Example #1
0
        protected override void OnWrite()
        {
            foreach (MultiplayerOptions.MultiplayerOption option in this._optionList)
            {
                MultiplayerOptions.OptionType optionType     = option.OptionType;
                MultiplayerOptionsProperty    optionProperty = optionType.GetOptionProperty();
                switch (optionProperty.OptionValueType)
                {
                case MultiplayerOptions.OptionValueType.Bool:
                    GameNetworkMessage.WriteBoolToPacket(optionType.GetBoolValue());
                    continue;

                case MultiplayerOptions.OptionValueType.Integer:
                case MultiplayerOptions.OptionValueType.Enum:
                    GameNetworkMessage.WriteIntToPacket(optionType.GetIntValue(), new CompressionInfo.Integer(optionProperty.BoundsMin, optionProperty.BoundsMax, true));
                    continue;

                case MultiplayerOptions.OptionValueType.String:
                    GameNetworkMessage.WriteStringToPacket(optionType.GetStrValue());
                    continue;

                default:
                    continue;
                }
            }
        }
Example #2
0
        public static string GetValueText(
            this MultiplayerOptions.OptionType optionType,
            MultiplayerOptions.MultiplayerOptionsAccessMode mode = MultiplayerOptions.MultiplayerOptionsAccessMode.CurrentMapOptions)
        {
            switch (optionType.GetOptionProperty().OptionValueType)
            {
            case MultiplayerOptions.OptionValueType.Bool:
                return(optionType.GetBoolValue(mode).ToString());

            case MultiplayerOptions.OptionValueType.Integer:
            case MultiplayerOptions.OptionValueType.Enum:
                return(optionType.GetIntValue(mode).ToString());

            case MultiplayerOptions.OptionValueType.String:
                return(optionType.GetStrValue(mode));

            default:
                return((string)null);
            }
        }