public static IGamePlayer Login(IGamePlayer gamePlayerProxy, string userName) { if (gamePlayerProxy == null) { throw new ArgumentNullException(nameof(gamePlayerProxy), "代理不能为null"); } var gamePlayer = new NormalGamePlayer2(userName); Console.WriteLine($"{userName} 登录游戏成功!"); return(gamePlayer); }
public NormalGamePlayerProxy2(string userName) { _gamePlayer = NormalGamePlayer2.Login(this, userName); }