Beispiel #1
0
        public static void OnReadyButtonClicked(int _fromClient, Packet _packet)
        {
            string hostname = _packet.ReadString();

            if (Server.playerDatabase.GetPlayerByName(hostname).isLoggedIn)
            {
                ServerSend.OnReadyButtonClicked(Server.playerDatabase.GetPlayerByName(hostname).id);
            }
            else
            {
                Match m2 = Server.matchDatabase.GetMatchByPlayer(Server.playerDatabase.GetPlayerById(_fromClient));
                if (m2 != null)
                {
                    foreach (Lobby l in m2.team1)
                    {
                        foreach (Player p in l.GetPlayers())
                        {
                            ServerSend.OnPlayerNotReady(p.id);
                        }
                    }

                    foreach (Lobby l in m2.team2)
                    {
                        foreach (Player p in l.GetPlayers())
                        {
                            ServerSend.OnPlayerNotReady(p.id);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public static void OnReadyButtonClicked1v1(int _fromClient, Packet _packet)
        {
            string hostname = _packet.ReadString();

            if (Server.playerDatabase.GetPlayerByName(hostname).isLoggedIn)
            {
                ServerSend.OnReadyButtonClicked1v1(Server.playerDatabase.GetPlayerByName(hostname).id);
            }
            else
            {
                Match1v1 m = Server.match1v1Database.GetMatchByPlayer(Server.playerDatabase.GetPlayerById(_fromClient));
                if (m != null)
                {
                    ServerSend.OnPlayerNotReady(m.player1.id);
                    ServerSend.OnPlayerNotReady(m.player2.id);
                }
            }
        }
Beispiel #3
0
        public static void OnPlayerNotReady(int _fromClient, Packet _packet)
        {
            Match1v1 m  = Server.match1v1Database.GetMatchByPlayer(Server.playerDatabase.GetPlayerById(_fromClient));
            Match    m2 = Server.matchDatabase.GetMatchByPlayer(Server.playerDatabase.GetPlayerById(_fromClient));

            if (m != null)
            {
                if (m.player1.isLoggedIn)
                {
                    ServerSend.OnPlayerNotReady(m.player1.id);
                }

                if (m.player2.isLoggedIn)
                {
                    ServerSend.OnPlayerNotReady(m.player2.id);
                }
            }
            else if (m2 != null)
            {
                foreach (Lobby l in m2.team1)
                {
                    foreach (Player p in l.GetPlayers())
                    {
                        if (p.isLoggedIn)
                        {
                            ServerSend.OnPlayerNotReady(p.id);
                        }
                    }
                }

                foreach (Lobby l in m2.team2)
                {
                    foreach (Player p in l.GetPlayers())
                    {
                        if (p.isLoggedIn)
                        {
                            ServerSend.OnPlayerNotReady(p.id);
                        }
                    }
                }
            }
        }