Пример #1
0
        private void OnClientConnected(ClientData client, string name, string team)
        {
            Console.WriteLine("OnClientConnected: {0} {1} {2}", client == null ? Guid.Empty : client.Id, name, team);

            DisplayClientList();
        }
Пример #2
0
        private void OnClientGameCreated(ClientData client, GameData game)
        {
            Console.WriteLine("OnClientGameCreated: {0} {1} {2} {3}", client == null ? Guid.Empty : client.Id, game.Id, game.Name, game.Rule);
            if (game.Clients != null)
            {
                Console.WriteLine("\tClients: {0}", game.Clients.Count);
                foreach (ClientData gameClient in game.Clients)
                    Console.WriteLine("\tClient: {0} {1} {2} {3} {4} {5}", gameClient.Id, gameClient.Name, gameClient.GameId, gameClient.IsGameMaster, gameClient.IsPlayer, gameClient.IsSpectator);
            }

            DisplayGameList();
        }
Пример #3
0
        private void OnClientDisconnected(ClientData client, LeaveReasons reason)
        {
            Console.WriteLine("OnClientDisconnected: {0} {1}", client == null ? Guid.Empty : client.Id, reason);

            DisplayClientList();
        }
Пример #4
0
 private void OnTeamChanged(ClientData client, string team)
 {
     Console.WriteLine("OnTeamChanged: {0} {1}", client == null ? Guid.Empty : client.Id, team);
 }
Пример #5
0
 private void OnBroadcastMessageReceived(ClientData client, string message)
 {
     Console.WriteLine("OnBroadcastMessageReceived: {0} {1}", client == null ? Guid.Empty : client.Id, message);
 }
Пример #6
0
 private void OnGridModified(ClientData client, byte[] grid)
 {
     Console.WriteLine("OnGridModified: {0}", client == null ? Guid.Empty : client.Id);
 }
Пример #7
0
        public void OnClientConnected(Guid clientId, string name, string team)
        {
            Log.Default.WriteLine(LogLevels.Info, "Client connected {0} {1} {2}", clientId, name, team);

            ResetTimeout();

            ClientData client = _clients.FirstOrDefault(x => x.Id == clientId);
            if (client == null)
               client = new ClientData
                {
                    Id = clientId,
                    Name = name,
                    Team = team
                };
            else
            {
                client.Id = clientId;
                client.Name = name;
                client.Team = team;
            }

            ClientConnected.Do(x => x(client, name, team));
        }
Пример #8
0
 private void OnVoteKickAsked(ClientData sourceClient, ClientData targetClient, string reason)
 {
     Console.WriteLine("OnVoteKickAsked: {0} {1} {2}", sourceClient == null ? Guid.Empty : sourceClient.Id, targetClient == null ? Guid.Empty : targetClient.Id, reason);
 }
Пример #9
0
 private void OnGameMasterModified(ClientData client)
 {
     Console.WriteLine("OnGameMasterModified: {0}", client == null ? Guid.Empty : client.Id);
 }
Пример #10
0
 private void OnPlayerWon(ClientData client)
 {
     Console.WriteLine("OnPlayerWon: {0}", client == null ? Guid.Empty : client.Id);
 }
Пример #11
0
 private void OnAchievementEarned(ClientData client, int achievementId, string achievementTitle)
 {
     Console.WriteLine("OnAchievementEarned: {0} {1} {2}", client == null ? Guid.Empty : client.Id, achievementId, achievementTitle);
 }
Пример #12
0
 private void OnPlayerLinesAdded(ClientData client, int specialId, int count)
 {
     Console.WriteLine("OnPlayerLinesAdded: {0} {1} {2}", client == null ? Guid.Empty : client.Id, specialId, count);
 }
Пример #13
0
        public bool VoteKick(ClientData target, string reason)
        {
            if (target == null || _clients.All(x => x != target))
                return false;

            _proxy.Do(x => x.ClientVoteKick(target.Id, reason));
            return true;
        }
Пример #14
0
        public bool SendPrivateMessage(ClientData target, string message)
        {
            if (target == null || _clients.All(x => x != target))
                return false;

            _proxy.Do(x => x.ClientSendPrivateMessage(target.Id, message));
            return true;
        }
Пример #15
0
 private void OnConnected(ConnectResults result, Versioning serverVersion, ClientData client, List<GameData> games)
 {
     Console.WriteLine("OnConnected: {0} {1}.{2} {3}", result, serverVersion == null ? -1 : serverVersion.Major, serverVersion == null ? -1 : serverVersion.Minor, client.Id);
     Console.WriteLine("Game list: {0}", games == null ? 0 : games.Count);
     if (games != null)
         foreach (GameData game in games)
         {
             Console.WriteLine("Game: {0} {1} {2}", game.Id, game.Name, game.Rule);
             Console.WriteLine("\tClients: {0}", game.Clients == null ? 0 : game.Clients.Count);
             if (game.Clients != null)
                 foreach (ClientData gameClient in game.Clients)
                     Console.WriteLine("\tClient: {0} {1} {2} {3} {4} {5}", gameClient.Id, gameClient.Name, gameClient.GameId, gameClient.IsGameMaster, gameClient.IsPlayer, gameClient.IsSpectator);
         }
 }
Пример #16
0
 private void OnClientGameLeft(ClientData client)
 {
     Console.WriteLine("OnClientGameLeft: {0}", client == null ? Guid.Empty : client.Id);
 }
Пример #17
0
 private void OnContinuousSpecialFinished(ClientData client, Specials special)
 {
     Console.WriteLine("OnContinuousSpecialFinished: {0} {1}", client == null ? Guid.Empty : client.Id, special);
 }
Пример #18
0
 private void OnClientGameJoined(ClientData client, bool asSpectator)
 {
     Console.WriteLine("OnClientGameJoined: {0} {1}", client == null ? Guid.Empty : client.Id, asSpectator);
 }
Пример #19
0
 private void OnSpecialUsed(ClientData client, ClientData target, int specialId, Specials special)
 {
     Console.WriteLine("OnSpecialUsed: {0} {1} {2} {3}", client == null ? Guid.Empty : client.Id, target == null ? Guid.Empty : target.Id, specialId, special);
 }
Пример #20
0
        public void OnConnected(ConnectResults result, Versioning serverVersion, Guid clientId, List<GameData> games)
        {
            ClientData client = null;
            if (result == ConnectResults.Successfull)
            {
                Log.Default.WriteLine(LogLevels.Info, "Connected as player {0}", clientId);

                _clients.Clear();
                _gameClients.Clear();
                _games.Clear();

                _games.AddRange(games);

                _clientId = clientId;

                client = new ClientData
                    {
                        Id = clientId,
                        Name = Name,
                        Team = Team,
                    };
                _clients.Add(client);

                _state = States.Connected;
            }
            else
            {
                Log.Default.WriteLine(LogLevels.Warning, "Wrong id {0}", clientId);

                _state = States.Created;
            }

            Connected.Do(x => x(result, serverVersion, client, games));
        }