public void GameCreated(GameModel model) { game.Log("Player " + this.ConnectUserId + " started playing."); this.model = model; model.OnGameEnded += GameEnded; this.Send("Game started"); }
/// <summary> /// Вызывает другого игрока на игру. /// </summary> /// <param name="other">Вызванный игрок.</param> public void ChallengePlayer(Player other) { game.Log("Player " + this.ConnectUserId + " challenged player " + other.ConnectUserId + "."); if (other == this) { this.Send("Denied", "You can't challenge yourself."); return; } if (challenged != null) { challenged.Send("Challenge revoked", this.ConnectUserId); } challenged = other; other.Send("Challenged", this.ConnectUserId); if (other.Challenged == this) { GameModel model = new GameModel(this, other); this.GameCreated(model); other.GameCreated(model); } }
private void GameEnded() { game.Log("Player " + this.ConnectUserId + " stopped playing."); model = null; this.Send("Game ended"); }