Esempio n. 1
0
 public Lobby_Match(ushort matchID, ushort maxPlayersInMatch, Lobby_Player matchOwner)
 {
     this.matchID           = matchID;
     this.maxPlayersInMatch = maxPlayersInMatch;
     this.matchOwner        = matchOwner;
     this.AddPlayerToMatch(matchOwner);
 }
Esempio n. 2
0
 public void ChangeLobbyReadyStatus(Lobby_Player lobby_Player)
 {
     this.matchPlayers[lobby_Player] = !this.matchPlayers[lobby_Player];
     foreach (Lobby_Player lp in this.matchPlayers.Keys)
     {
         Lobby_Match.SendLobbyReadyStatusToPlayer(this.matchPlayers[lobby_Player], lp);
     }
 }
Esempio n. 3
0
 public void FinishMatch(Lobby_Player matchWinner)
 {
     foreach (Lobby_Player player in matchPlayers.Keys)
     {
         RemovePlayerFromMatch(player, true);
     }
     //TODO: Set Match Winner
 }
Esempio n. 4
0
 public static void SendLobbyReadyStatusToPlayer(bool readyStatus, Lobby_Player playerToSend)
 {
     using (DarkRiftWriter w = DarkRiftWriter.Create())
     {
         w.Write(readyStatus);
         using (Message mes = Message.Create(UDRMS_Tags.connectLobbyMatch, w))
             playerToSend.client.SendMessage(mes, SendMode.Reliable);
     }
 }
Esempio n. 5
0
        public bool AddPlayerToMatch(Lobby_Player playerToAdd)
        {
            if (matchPlayers.Count >= maxPlayersInMatch)
            {
                return(false);
            }
            else
            {
                matchPlayers.Add(playerToAdd, false);
            }

            playerToAdd.AssignMatch(this);
            return(true);
        }
Esempio n. 6
0
        public void RemovePlayerFromMatch(Lobby_Player playerToRemove, bool finishedMatch = false)
        {
            this.matchPlayers.Remove(playerToRemove);

            //TODO: Dont overflow with change host

            if (matchOwner == playerToRemove)
            {
                //TODO: Destroy Match or Change Owner
            }
            if (matchPlayers.Count <= 0)
            {
                //TODO: Destroy Match
            }
        }
Esempio n. 7
0
        public static void SendToPlayerLobbyMatchInformation(Lobby_Player lobby_Player)
        {
            Lobby_Match match = lobby_Player.getCurrentMatch();

            using (DarkRiftWriter w = DarkRiftWriter.Create())
            {
                foreach (var item in match.matchPlayers.Keys)
                {
                    w.Write(item.client.ID);            //ID do Player
                    //w.Write(item)
                    w.Write(match.matchPlayers[item]);  //Status (Ready)
                }
                using (Message m = Message.Create(UDRMS_Tags.getLobbyMatchInfo, w))
                    lobby_Player.client.SendMessage(m, SendMode.Reliable);
            }
        }