打字猴:1.70046042e+09
1700460420
1700460421 代码清单12-14 强制代理的真实角色
1700460422
1700460423 public class GamePlayer implements IGamePlayer{
1700460424
1700460425 private String name=””;
1700460426
1700460427 //我的代理是谁
1700460428
1700460429 private IGamePlayer proxy=null;
1700460430
1700460431 public GamePlayer(String_name){
1700460432
1700460433 this.name=_name;
1700460434
1700460435 }
1700460436
1700460437 //找到自己的代理
1700460438
1700460439 public IGamePlayer getProxy(){
1700460440
1700460441 this.proxy=new GamePlayerProxy(this.name);
1700460442
1700460443 return this.proxy;
1700460444
1700460445 }
1700460446
1700460447 //打怪,最期望的就是杀老怪
1700460448
1700460449 public void killBoss(){
1700460450
1700460451 if(this.isProxy()){
1700460452
1700460453 System.out.println(this.name+“在打怪!”);
1700460454
1700460455 }else{
1700460456
1700460457 System.out.println(“请使用指定的代理访问”);
1700460458
1700460459 }
1700460460
1700460461 }
1700460462
1700460463 //进游戏之前你肯定要登录吧,这是一个必要条件
1700460464
1700460465 public void login(String user,String password){
1700460466
1700460467 if(this.isProxy()){
1700460468
1700460469 System.out.println(“登录名为”+user+“的用户”+this.name+“登录成功!”);
[ 上一页 ]  [ :1.70046042e+09 ]  [ 下一页 ]