Exemplo n.º 1
0
        /// <summary>
        /// Reads settings data from files before implementing
        /// <see cref="ISerializableGameObject"/>.
        /// </summary>
        public void ReadLegacy(BinaryReader reader)
        {
            int              zoom;
            bool             fullscreen        = false;
            int              stereoscopicLevel = 0;
            bool             anaglyph          = true;
            Metrics_Settings metrics           = Metrics_Settings.Not_Set;
            bool             updatesActive     = false;
            bool             rumble            = true;

            Keys[] keyConfig;

            if (Global.LOADED_VERSION.older_than(0, 4, 2, 0))
            {
                zoom = reader.ReadInt32();
                bool unused = reader.ReadBoolean();
            }
            else if (Global.LOADED_VERSION.older_than(0, 4, 6, 3))
            {
                zoom              = reader.ReadInt32();
                fullscreen        = reader.ReadBoolean();
                stereoscopicLevel = reader.ReadInt32();
                anaglyph          = reader.ReadBoolean();
            }
            else if (Global.LOADED_VERSION.older_than(0, 5, 0, 6))
            {
                zoom              = reader.ReadInt32();
                fullscreen        = reader.ReadBoolean();
                stereoscopicLevel = reader.ReadInt32();
                anaglyph          = reader.ReadBoolean();
                metrics           = (Metrics_Settings)reader.ReadInt32();
            }
            else
            {
                zoom              = reader.ReadInt32();
                fullscreen        = reader.ReadBoolean();
                stereoscopicLevel = reader.ReadInt32();
                anaglyph          = reader.ReadBoolean();
                metrics           = (Metrics_Settings)reader.ReadInt32();
                updatesActive     = reader.ReadBoolean();
                rumble            = reader.ReadBoolean();
            }
            keyConfig = ReadLegacyInputs(reader);

            // Apply the read values to the settings
            RestoreDefaults();
            Graphics.SetValue(GraphicsSetting.Zoom, 0, zoom);
            Graphics.SetValue(GraphicsSetting.Fullscreen, 0,
                              fullscreen ? (int)WindowMode.Fullscreen : (int)WindowMode.Windowed);
            Graphics.SetValue(GraphicsSetting.Stereoscopic, 0, stereoscopicLevel);
            Graphics.SetValue(GraphicsSetting.Anaglyph, 0, anaglyph);
            if (metrics != Metrics_Settings.Not_Set)
            {
                General.ConfirmSetting(GeneralSetting.Metrics, 0, metrics == Metrics_Settings.On);
            }
            General.SetValue(GeneralSetting.CheckForUpdates, 0, updatesActive);
            Controls.SetValue(ControlsSetting.Rumble, 0, rumble);
            Controls.SetLegacyKeyboardConfig(keyConfig);
        }
Exemplo n.º 2
0
        public override void ConfirmSetting(int index, object value)
        {
            var entry = GetEntryIndex(index);

            switch (entry.Item1)
            {
            // If confirming a value, force removing not set
            case (int)GeneralSetting.Metrics:
                if (_Metrics == Metrics_Settings.Not_Set)
                {
                    _Metrics = Metrics_Settings.Off;
                }
                break;
            }

            base.ConfirmSetting(index, value);
        }
Exemplo n.º 3
0
        public override void SetValue(Tuple <int, int> entry, object value)
        {
            switch (entry.Item1)
            {
            // bool
            case (int)GeneralSetting.Metrics:
                if (_Metrics != Metrics_Settings.Not_Set)
                {
                    bool metrics = _Metrics == Metrics_Settings.On;
                    SetValue(entry, ref metrics, value);
                    _Metrics = metrics ? Metrics_Settings.On : Metrics_Settings.Off;
                }
                break;

            case (int)GeneralSetting.CheckForUpdates:
                SetValue(entry, ref _CheckForUpdates, value);
                break;
            }
        }