예제 #1
0
파일: Game.cs 프로젝트: MrLeebo/Hackathon
        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);
        }
예제 #2
0
파일: Game.cs 프로젝트: MrLeebo/Hackathon
        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);
        }