예제 #1
0
파일: BaseLobby.cs 프로젝트: jraicr/MST
        /// <summary>
        ///
        /// </summary>
        /// <param name="propertyData"></param>
        public void AddControl(LobbyPropertyData propertyData)
        {
            var defaultValue = "";

            if (propertyData.Options != null && propertyData.Options.Count > 0)
            {
                defaultValue = propertyData.Options.First();
            }

            SetProperty(propertyData.PropertyKey, defaultValue);
            controls.Add(propertyData);
        }
예제 #2
0
파일: BaseLobby.cs 프로젝트: jraicr/MST
 /// <summary>
 ///
 /// </summary>
 /// <param name="propertyData"></param>
 /// <param name="defaultValue"></param>
 public void AddControl(LobbyPropertyData propertyData, string defaultValue)
 {
     SetProperty(propertyData.PropertyKey, defaultValue);
     controls.Add(propertyData);
 }
예제 #3
0
        public override void FromBinaryReader(EndianBinaryReader reader)
        {
            LobbyState          = (LobbyState)reader.ReadInt32();
            LobbyType           = reader.ReadString();
            StatusText          = reader.ReadString();
            GameMaster          = reader.ReadString();
            CurrentUserUsername = reader.ReadString();

            LobbyId         = reader.ReadInt32();
            LobbyName       = reader.ReadString();
            LobbyProperties = reader.ReadDictionary();
            MaxPlayers      = reader.ReadInt32();

            // Read additional data
            var size = reader.ReadInt32();

            if (size > 0)
            {
                AdditionalData = reader.ReadBytes(size);
            }

            // Clear, in case we're reusing the object
            Players.Clear();

            // Read player properties
            var playerCount = reader.ReadInt32();

            for (var i = 0; i < playerCount; i++)
            {
                var data     = CreateLobbyMemberData();
                var username = reader.ReadString();
                data.FromBinaryReader(reader);

                Players.Add(username, data);
            }

            // Read teams
            Teams.Clear();
            var teamsCount = reader.ReadInt32();

            for (int i = 0; i < teamsCount; i++)
            {
                var teamKey  = reader.ReadString();
                var teamData = CreateTeamData();
                teamData.FromBinaryReader(reader);
                Teams.Add(teamKey, teamData);
            }

            // Read controls
            Controls = new List <LobbyPropertyData>();
            var controlsCount = reader.ReadInt32();

            for (int i = 0; i < controlsCount; i++)
            {
                var control = new LobbyPropertyData();
                control.FromBinaryReader(reader);
                Controls.Add(control);
            }

            // Other settings
            EnableManualStart   = reader.ReadBoolean();
            EnableReadySystem   = reader.ReadBoolean();
            EnableTeamSwitching = reader.ReadBoolean();
        }