Ejemplo n.º 1
0
        public override void FromBinaryReader(EndianBinaryReader reader)
        {
            Address = reader.ReadString();
            Id      = reader.ReadInt32();
            Type    = (GameInfoType)reader.ReadInt32();
            Name    = reader.ReadString();

            IsPasswordProtected = reader.ReadBoolean();
            MaxPlayers          = reader.ReadInt32();
            OnlinePlayers       = reader.ReadInt32();
            Properties          = reader.ReadDictionary();
        }
Ejemplo n.º 2
0
        private PreGameJoinRequest getJoinRequest(GameInfoType roomType, string roomID)
        {
            AccountInfoPacket ac = ClientUIOverlord.getCurrentAcountInfo();

            return(new PreGameJoinRequest()
            {
                roomID = roomID,
                joiningPlayer = new PlayerInfo {
                    username = ac.Username,
                    iconNumber = int.Parse(ac.Properties[AlbotDictKeys.icon])
                }
            });
        }
Ejemplo n.º 3
0
        public void joinPreGame(GameInfoType roomType, string roomID)
        {
            PreGameJoinRequest joinRequest = getJoinRequest(roomType, roomID);

            if (roomType == GameInfoType.PreGame)
            {
                Msf.Connection.SendMessage((short)ServerCommProtocl.RequestJoinPreGame, joinRequest, handleJoinPreGameMsg);
            }
            else if (roomType == GameInfoType.PreTournament)
            {
                Msf.Connection.SendMessage((short)CustomMasterServerMSG.joinTournament, joinRequest, CurrentTournament.handleJoinedTournament);
            }
        }
Ejemplo n.º 4
0
        private void initBackgroundColor(GameInfoType type)
        {
            if (type == GameInfoType.PreTournament)
            {
                currentColor = tournamentColor;
            }
            else
            {
                currentColor = defaultColor;
            }

            SetIsSelected(false);
        }
Ejemplo n.º 5
0
            public GameInfoPacket createGameInfoPacket(GameInfoType infoType, string roomID, string hostName, int maxPlayers, int playerAmount, Game.GameType type)
            {
                return(new GameInfoPacket()
                {
                    infoType = infoType,
                    Name = hostName,
                    OnlinePlayers = playerAmount,
                    MaxPlayers = maxPlayers,
                    IsPasswordProtected = false,
                    Properties = new Dictionary <string, string>()
                    {
                        { MsfDictKeys.MapName, type.ToString() },
                        { MsfDictKeys.IsPreGame, true.ToString() },
                        { MsfDictKeys.GameType, type.ToString() }
                    },

                    Id = roomID,
                    Address = "MasterIP"
                });
            }
Ejemplo n.º 6
0
        public void Setup(GameInfoPacket data, Action doubleClickAction = null)
        {
            RawData   = data;
            IsLobby   = data.infoType == GameInfoType.Lobby;
            roomType  = data.infoType;
            Name.text = data.Name;
            GameId    = data.Id;
            initBackgroundColor(data.infoType);
            this.doubleClickAction = doubleClickAction;


            if (data.MaxPlayers > 0)
            {
                Online.text = string.Format("{0}/{1}", data.OnlinePlayers, data.MaxPlayers);
            }
            else
            {
                Online.text = data.OnlinePlayers.ToString();
            }

            MapName.text = data.Properties.ContainsKey(MsfDictKeys.MapName)
                ? data.Properties[MsfDictKeys.MapName] : UnknownMapName;
        }
Ejemplo n.º 7
0
 public static void handleJoinPreGame(GameInfoType roomType, string roomID)
 {
     singleton.joinPreGame(roomType, roomID);
 }
 internal void Write(GameInfoType type)
 {
     throw new NotImplementedException();
 }