Exemple #1
0
        private void OnPlayerQuit(object sender, ClientEventArgs e)
        {
            var player = e.ClientData.info;

            Console.WriteLine(player.name + " has quit.");

            this.activePlayers.RemoveAll(x => x.name == player.name);
            this.pendingPlayers.RemoveAll(x => x.name == player.name);
        }
Exemple #2
0
        private void OnPlayerJoined(object sender, ClientEventArgs e)
        {
            if (activePlayers.Any(x => x.name == e.ClientData.id) || pendingPlayers.Any(x => x.name == e.ClientData.id))
            {
                Console.WriteLine("Player '{0}' already exists.", e.ClientData.id);
                return;
            }

            Console.WriteLine("New player joined: " + e.ClientData.id);

            var player = e.ClientData.info;
            player.type = "player";
            this.pendingPlayers.Add(e.ClientData.info);
        }