コード例 #1
0
        public static void SaveSettings()
        {
            ScriptSettings settings = ScriptSettings.Load("./scripts/BackToTheFutureV/settings.ini");
            CultureInfo    info     = CultureInfo.CreateSpecificCulture("en-US");

            settings.SetValue("tcd", "position_x", TCDPosition.X.ToString("G", info));
            settings.SetValue("tcd", "position_y", TCDPosition.Y.ToString("G", info));
            settings.SetValue("tcd", "scale", TCDScale.ToString("G", info));
            settings.SetValue("tcd", "background", TCDBackground.ToString());

            settings.SetValue("time_circuits", "PlayFluxCapacitorSound", PlayFluxCapacitorSound);

            settings.SetValue("time_circuits", "play_diode_sound", PlayDiodeBeep);
            settings.SetValue("time_circuits", "use_input_toggle", UseInputToggle);

            settings.SetValue("speedo", "play_speedo_beep", PlaySpeedoBeep);

            settings.SetValue("vehicle", "PlayEngineSounds", PlayEngineSounds);

            settings.SetValue("vehicle", "CinematicSpawn", CinematicSpawn);

            settings.SetValue("fly_mode", "force_fly_mode", ForceFlyMode);
            settings.SetValue("fly_mode", "LandingSystem", LandingSystem);

            settings.SetValue("time_circuits", "GlowingWormholeEmitter", GlowingWormholeEmitter);
            settings.SetValue("time_circuits", "GlowingPlutoniumReactor", GlowingPlutoniumReactor);

            settings.SetValue("events", "LightningStrikeEvent", LightningStrikeEvent);
            settings.SetValue("events", "EngineStallEvent", EngineStallEvent);
            settings.SetValue("events", "TurbulenceEvent", TurbulenceEvent);

            settings.Save();
        }
コード例 #2
0
        public static void LoadSettings()
        {
            string path = "./scripts/BackToTheFutureV/settings.ini";

            if (!File.Exists(path))
            {
                File.Create(path);
            }

            ScriptSettings settings = ScriptSettings.Load(path);
            CultureInfo    info     = CultureInfo.CreateSpecificCulture("en-US");

            TCDScale      = float.Parse(settings.GetValue("tcd", "scale", TCDScale.ToString("G", info)), info);
            TCDPosition   = new PointF(float.Parse(settings.GetValue("tcd", "position_x", TCDPosition.X.ToString("G", info)), info), float.Parse(settings.GetValue("tcd", "position_y", TCDPosition.Y.ToString("G", info)), info));
            TCDBackground = (TCDBackground)Enum.Parse(typeof(TCDBackground), settings.GetValue("tcd", "background", "Metal"));

            OnGUIChange?.Invoke();

            PlayFluxCapacitorSound = settings.GetValue("time_circuits", "PlayFluxCapacitorSound", true);

            PlayDiodeBeep  = settings.GetValue("time_circuits", "play_diode_sound", true);
            UseInputToggle = settings.GetValue("time_circuits", "use_input_toggle", true);

            PlayEngineSounds = settings.GetValue("vehicle", "PlayEngineSounds", true);

            CinematicSpawn = settings.GetValue("vehicle", "CinematicSpawn", true);

            PlaySpeedoBeep = settings.GetValue("speedo", "play_speedo_beep", true);

            ForceFlyMode = settings.GetValue("fly_mode", "force_fly_mode", true);

            LandingSystem = settings.GetValue("fly_mode", "LandingSystem", true);

            GlowingWormholeEmitter  = settings.GetValue("time_circuits", "GlowingWormholeEmitter", true);
            GlowingPlutoniumReactor = settings.GetValue("time_circuits", "GlowingPlutoniumReactor", true);

            LightningStrikeEvent = settings.GetValue("events", "LightningStrikeEvent", true);
            EngineStallEvent     = settings.GetValue("events", "EngineStallEvent", true);
            TurbulenceEvent      = settings.GetValue("events", "TurbulenceEvent", true);

            SaveSettings();
        }