private GameSettings currentSettings; //被挑战的临时游戏设置与此变量无关 public PokemonLobbyClient(IPAddress serverAddress, int serverPort) : base(new TcpMessageClient(serverAddress, serverPort)) { roomLock = new object(); LobbyService.Register(this); EnterSucceed = (user) => { user.Quited += () => { lock (roomLock) { battleClient = null; battleHost = null; challengingPms = null; if (User.State == UserState.Battling || User.State == UserState.Watching) ChangeState(UserState.Normal); }; }; switch (user.Role) { case Room.UserRole.Player: User.State = UserState.Aggressive; break; case Room.UserRole.Spectator: User.State = UserState.Watching; break; } }; }
private void OnChallengeAccepted(int userId) { lock (roomLock) { ChallengeAccepted(GetUser(userId)); SingleHost s = new SingleHost(User.Id, currentSettings);/////////// battleHost = s; battleClient = s; StartGame(challengingPms); challengingPms = null; } }