示例#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);
        }