Пример #1
0
        void TonemappingModule()
        {
            GUILayout.Label(GUIStrings.Tonemapping, titlestyle2);
            GUILayout.Space(space);
            var SelectedToneMapper = (int)PPCtrl.colorGrading.tonemapping.tonemapper;

            SelectedToneMapper = GUILayout.SelectionGrid(SelectedToneMapper, new GUIContent[]
            {
                GUIStrings.Tonemapping_none,
                GUIStrings.Tonemapping_ACES,
                GUIStrings.Tonemapping_neutral
            }, 3, selectstyle);
            PPCtrl.colorGrading.tonemapping.tonemapper = (ColorGradingModel.Tonemapper)SelectedToneMapper;
            GUILayout.Space(space);
            if (SelectedToneMapper == 2)
            {
                SliderGUI(ref PPCtrl.colorGrading.tonemapping.neutralBlackIn, -0.1f, 0.1f, GUIStrings.Tonemapping_neutralBlackIn);
                SliderGUI(ref PPCtrl.colorGrading.tonemapping.neutralWhiteIn, 1f, 20f, GUIStrings.Tonemapping_neutralWhiteIn);
                SliderGUI(ref PPCtrl.colorGrading.tonemapping.neutralBlackOut, -0.09f, 0.1f, GUIStrings.Tonemapping_neutralBlackOut);
                SliderGUI(ref PPCtrl.colorGrading.tonemapping.neutralWhiteOut, 1f, 19f, GUIStrings.Tonemapping_neutralWhiteOut);
                SliderGUI(ref PPCtrl.colorGrading.tonemapping.neutralWhiteLevel, 0.1f, 20f, GUIStrings.Tonemapping_neutralWhiteLevel);
                SliderGUI(ref PPCtrl.colorGrading.tonemapping.neutralWhiteClip, 1f, 10f, GUIStrings.Tonemapping_neutralWhiteClip);
            }
            SliderGUI(PPCtrl.colorGrading.basic.postExposure, min: -5f, max: 5f, reset: 0f, guiContent: GUIStrings.Exposure_Value,
                      SetOutput: x => { PPCtrl.colorGrading.basic.postExposure = x; ModPrefs.SetFloat("PHIBL", "EV", x); });
            GUILayout.Space(space);
        }
Пример #2
0
        protected bool LoadSettings()
        {
            if (ModPrefs.GetString("TogglePOV", "Version", TogglePOVPlugin.PLUGIN_VERSION, true) != TogglePOVPlugin.PLUGIN_VERSION)
            {
                ModPrefs.SetString("TogglePOV", "Version", TogglePOVPlugin.PLUGIN_VERSION);
                ModPrefs.SetFloat("TogglePOV", "fFOV", DEFAULT_FOV);
                ModPrefs.SetBool("TogglePOV", "bShowHair", SHOW_HAIR);
                ModPrefs.SetFloat("TogglePOV", "fMaleOffset", MALE_OFFSET);
                ModPrefs.SetFloat("TogglePOV", "fFemaleOffset", FEMALE_OFFSET);
            }
            else
            {
                currentfov    = DEFAULT_FOV = Mathf.Clamp(ModPrefs.GetFloat("TogglePOV", "fFOV", DEFAULT_FOV, true), 1f, MAXFOV);
                SHOW_HAIR     = ModPrefs.GetBool("TogglePOV", "bShowHair", SHOW_HAIR, true);
                MALE_OFFSET   = ModPrefs.GetFloat("TogglePOV", "fMaleOffset", MALE_OFFSET, true);
                FEMALE_OFFSET = ModPrefs.GetFloat("TogglePOV", "fFemaleOffset", FEMALE_OFFSET, true);
            }

            try
            {
                string keystring = ModPrefs.GetString("TogglePOV", "POVHotkey", hotkey.ToString(), true);
                hotkey = (KeyCode)Enum.Parse(typeof(KeyCode), keystring, true);
            }
            catch (Exception)
            {
                Console.WriteLine("Using default hotkey ({0})", hotkey.ToString());
                return(false);
            }

            return(true);
        }
Пример #3
0
        private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
        {
            if (arg0.name == "Menu")
            {
                modEnable = false;
                var settingsSubmenu = SettingsUI.CreateSubMenu("AutoPause");
                var en = settingsSubmenu.AddBool("AutoPause Enabled");
                en.GetValue += delegate { return(ModPrefs.GetBool("Auros's AutoPause", "Enabled", true, true)); };
                en.SetValue += delegate(bool value) { ModPrefs.SetBool("Auros's AutoPause", "Enabled", value); };

                var pq = settingsSubmenu.AddBool("FPS Pause");
                pq.GetValue += delegate { return(ModPrefs.GetBool("Auros's AutoPause", "FPSCheckerOn", false, true)); };
                pq.SetValue += delegate(bool value) { ModPrefs.SetBool("Auros's AutoPause", "FPSCheckerOn", value); };

                float[] fpsValues    = { 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90 };
                var     fpsThreshold = settingsSubmenu.AddList("FPS Threshold", fpsValues);
                fpsThreshold.GetValue    += delegate { return(ModPrefs.GetFloat("Auros's AutoPause", "FPSThreshold", 40, true)); };
                fpsThreshold.SetValue    += delegate(float value) { ModPrefs.SetFloat("Auros's AutoPause", "FPSThreshold", value); };
                fpsThreshold.FormatValue += delegate(float value) { return(string.Format("{0:0}", value)); };
                System.Console.WriteLine("[AutoPause] Settings Created");
                //System.Console.Read();

                //SharedCoroutineStarter.instance.StartCoroutine(DelayedEnable());
            }
        }
Пример #4
0
        public static void Write()
        {
            // Write the updated values to the config file in case we haven't already
            ModPrefs.SetBool(Plugin.Instance.Name, "Enabled", EnableHiddenBlocks);
            ModPrefs.SetFloat(Plugin.Instance.Name, "BlockHideDistance", BlockHideDistance);

            WritePending = false;
        }
Пример #5
0
 public void Reset(string cameraName, Params resetParams)
 {
     ModPrefs.SetFloat(SECTIONBASE + "!" + cameraName, "BaseColorBoost", resetParams.baseColorBoost);
     ModPrefs.SetFloat(SECTIONBASE + "!" + cameraName, "BaseColorBoostThreshold", resetParams.baseColorBoostThreshold);
     ModPrefs.SetFloat(SECTIONBASE + "!" + cameraName, "BloomIntensity", resetParams.bloomIntensity);
     ModPrefs.SetInt(SECTIONBASE + "!" + cameraName, "BloomIterations", resetParams.bloomIterations);
     ModPrefs.SetFloat(SECTIONBASE + "!" + cameraName, "TextureWidth", resetParams.textureWidth);
 }
Пример #6
0
        private void ScreenWasMoved(Vector3 pos, Quaternion rot, float scale)
        {
            placement = VideoPlacement.Custom;
            screen.transform.position   = pos;
            screen.transform.rotation   = rot;
            screen.transform.localScale = scale * Vector3.one;

            ModPrefs.SetString(Plugin.PluginName, "CustomPosition", pos.ToString());
            ModPrefs.SetString(Plugin.PluginName, "CustomRotation", rot.eulerAngles.ToString());
            ModPrefs.SetFloat(Plugin.PluginName, "CustomScale", scale);
        }
Пример #7
0
        public static void Save()
        {
            ModPrefs.SetBool(PrefsSection, "Enabled", DisplayLyrics);
            ModPrefs.SetInt(PrefsSection, nameof(ToggleKeyCode), ToggleKeyCode);
            ModPrefs.SetFloat(PrefsSection, nameof(DisplayDelay), DisplayDelay);
            ModPrefs.SetFloat(PrefsSection, nameof(HideDelay), HideDelay);

            if (VerboseLogging)
            {
                ModPrefs.SetBool(PrefsSection, nameof(VerboseLogging), true);
            }
        }
Пример #8
0
        private void UserCustomModule()
        {
            GUILayout.Label(GUIStrings.Global_Settings, titlestyle2);
            SliderGUI(QualitySettings.shadowDistance, 20f, 150f, 30f, x => QualitySettings.shadowDistance = x, " Shadow Distance ");
            SliderGUI(Camera.main.nearClipPlane, 0.01f, 1f, 0.06f, x => Camera.main.nearClipPlane         = x, new GUIContent(" Camra near clip plane "));
            ToggleGUI(Camera.main.useOcclusionCulling, new GUIContent(" Occlusion Culling "), x => Camera.main.useOcclusionCulling = x);
            //ToggleGUI(Camera.main.useJitteredProjectionMatrixForTransparentRendering, new GUIContent(" Use Jittered Projection Matrix For Transparent Rendering "), x => Camera.main.useJitteredProjectionMatrixForTransparentRendering = x);
            SelectGUI(ref vSyncCount, GUIStrings.Vsync, GUIStrings.Disable_vs_Enable, count => ModPrefs.SetInt("PHIBL", "VSync", count));
            ToggleGUI(ref asyncLoad, GUIStrings.Async_Load, enable => ModPrefs.SetBool("PHIBL", "AsyncLoad", enable));
            //ToggleGUI(ref forceDeferred, GUIStrings.Force_Deferred, enable => ModPrefs.SetBool("PHIBL", "ForceDeferred", enable));
            ToggleGUI(ref autoSetting, GUIStrings.Auto_Setting, enable => ModPrefs.SetBool("PHIBL", "AutoSetting", enable));
            ToggleGUI(ref disableLightMap, GUIStrings.DisableLightMap, disablelightmap => ModPrefs.SetBool("PHIBL", "DisableLightMap", disablelightmap));
            GUILayout.BeginHorizontal();
            GUILayout.Label(GUIStrings.Custom_Window, labelstyle);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(GUIStrings.Custom_Window_Remember, buttonstyleNoStretch, GUILayout.ExpandWidth(false)))
            {
                ModPrefs.SetFloat("PHIBL", "Window.width", windowRect.width);
                ModPrefs.SetFloat("PHIBL", "Window.height", windowRect.height);
                ModPrefs.SetFloat("PHIBL", "Window.x", windowRect.x);
                ModPrefs.SetFloat("PHIBL", "Window.y", windowRect.y);
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(space);
            float widthtemp;

            widthtemp = SliderGUI(
                value: windowRect.width,
                min: minwidth,
                max: UIUtils.Screen.width * 0.5f,
                reset: () => ModPrefs.GetFloat("PHIBL", "Window.width"),
                labeltext: GUIStrings.Window_Width,
                valuedecimals: "N0");
            if (widthtemp != windowRect.width)
            {
                windowRect.x    += (windowRect.width - widthtemp) * (windowRect.x) / (UIUtils.Screen.width - windowRect.width);
                windowRect.width = widthtemp;
            }
            windowRect.height = SliderGUI(
                value: windowRect.height,
                min: UIUtils.Screen.height * 0.2f,
                max: UIUtils.Screen.height - 10f,
                reset: () => ModPrefs.GetFloat("PHIBL", "Window.height"),
                labeltext: GUIStrings.Window_Height,
                valuedecimals: "N0");
            SelectGUI(ref screenShotSize, new GUIContent(" Screen Shot Size: "), 0);
        }
Пример #9
0
 private void TessellationModule()
 {
     GUILayout.BeginHorizontal();
     GUILayout.Label(GUIStrings.Tessellation, titlestyle2);
     GUILayout.FlexibleSpace();
     if (GUILayout.Button(GUIStrings.Save, buttonstyleNoStretch))
     {
         ModPrefs.SetFloat("PHIBL", "Tessellation.Phong", phong);
         ModPrefs.SetFloat("PHIBL", "Tessellation.EdgeLength", edgelength);
     }
     GUILayout.EndHorizontal();
     SliderExGUI(value: phong, guiContent: GUIStrings.Tessellation_phong,
                 reset: () => ModPrefs.GetFloat("PHIBL", "Tessellation.Phong", 0.5f),
                 SetOutput: x => { phong = x; Shader.SetGlobalFloat(_Phong, x); });
     SliderGUI(value: edgelength, min: 2f, max: 50f, label: GUIStrings.Tessellation_edgelength,
               reset: () => ModPrefs.GetFloat("PHIBL", "Tessellation.EdgeLength", 15f),
               SetOutput: x => { edgelength = x; Shader.SetGlobalFloat(_EdgeLength, x); });
 }
Пример #10
0
        public static void CreateSettingsUI()
        {
            var subMenu = SettingsUI.CreateSubMenu("AutoPause");

            var en = subMenu.AddBool("AutoPause Enabled");

            en.GetValue += delegate { return(ModPrefs.GetBool("Auros's AutoPause", "Enabled", true, true)); };
            en.SetValue += delegate(bool value) { ModPrefs.SetBool("Auros's AutoPause", "Enabled", value); };

            var pq = subMenu.AddBool("FPS Pause");

            pq.GetValue += delegate { return(ModPrefs.GetBool("Auros's AutoPause", "FPSCheckerOn", false, true)); };
            pq.SetValue += delegate(bool value) { ModPrefs.SetBool("Auros's AutoPause", "FPSCheckerOn", value); };

            float[] fpsValues    = { 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90 };
            var     fpsThreshold = subMenu.AddList("FPS Threshold", fpsValues);

            fpsThreshold.GetValue    += delegate { return(ModPrefs.GetFloat("Auros's AutoPause", "FPSThreshold", 40, true)); };
            fpsThreshold.SetValue    += delegate(float value) { ModPrefs.SetFloat("Auros's AutoPause", "FPSThreshold", value); };
            fpsThreshold.FormatValue += delegate(float value) { return(string.Format("{0:0}", value)); };
        }
Пример #11
0
        private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
        {
            if (arg0.name == "MenuCore")
            {
                Gamemode.Init();
                modEnable = false;
                var settingsSubmenu = SettingsUI.CreateSubMenu("AutoPause");
                var modenabled      = settingsSubmenu.AddBool("AutoPause Enabled");
                modenabled.GetValue += delegate { return(ModPrefs.GetBool("AutoPause | Main", "Enabled", true, true)); };
                modenabled.SetValue += delegate(bool value) { ModPrefs.SetBool("AutoPause | Main", "Enabled", value); };

                var pausebool = settingsSubmenu.AddBool("FPS Pause");
                pausebool.GetValue += delegate { return(ModPrefs.GetBool("AutoPause | Main", "FPSCheckerOn", false, true)); };
                pausebool.SetValue += delegate(bool value) { ModPrefs.SetBool("AutoPause | Main", "FPSCheckerOn", value); };

                var voices = settingsSubmenu.AddBool("Voices");
                voices.GetValue += delegate { return(ModPrefs.GetBool("AutoPause | Main", "Voices", true, true)); };
                voices.SetValue += delegate(bool value) { ModPrefs.SetBool("AutoPause | Main", "Voices", value); };

                float[] fpsValues    = { 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90 };
                var     fpsThreshold = settingsSubmenu.AddList("FPS Threshold", fpsValues);
                fpsThreshold.GetValue    += delegate { return(ModPrefs.GetFloat("AutoPause | Main", "FPSThreshold", 40, true)); };
                fpsThreshold.SetValue    += delegate(float value) { ModPrefs.SetFloat("AutoPause | Main", "FPSThreshold", value); };
                fpsThreshold.FormatValue += delegate(float value) { return(string.Format("{0:0}", value)); };

                var reaction = settingsSubmenu.AddList("Reaction Time", numnums);
                reaction.GetValue    += delegate { return(ModPrefs.GetFloat("AutoPause | Main", "ResponseTime", .2f, true)); };
                reaction.SetValue    += delegate(float value) { ModPrefs.SetFloat("AutoPause | Main", "ResponseTime", value); };
                reaction.FormatValue += delegate(float value) { return(string.Format("{0:0.00}", value)); };

                Log.AutoPause("Settings Created");
            }

            if (arg0.name == "MenuCore" && firstTime == true)
            {
                firstTime = false;
                TextObject.OnLoad();
                ///Despacito 2
            }
        }
Пример #12
0
        private void InstallNearClipPlaneSlider()
        {
            Transform sliderParentObject = studio.transform.Find("Canvas Main Menu/04_System/02_Option/Slider Camera Speed");

            if (sliderParentObject && !GameObject.Find("Slider NearClipPlane"))
            {
                GameObject nearClipSlider = Instantiate(sliderParentObject.gameObject);
                nearClipSlider.name = "Slider NearClipPlane";
                nearClipSlider.transform.SetParent(sliderParentObject.parent);
                nearClipSlider.transform.localPosition = new Vector3(114f, -16f, 0f);
                nearClipSlider.transform.localScale    = new Vector3(0.65f, 0.65f, 0.65f);

                Slider nearClipSliderComponent = nearClipSlider.GetComponent <Slider>();
                nearClipSliderComponent.maxValue       = 0.06f;
                nearClipSliderComponent.minValue       = 0.001f;
                nearClipSliderComponent.value          = ModPrefs.GetFloat("LockOnPlugin.Misc", "NearClipPlane", Camera.main.nearClipPlane, true);
                nearClipSliderComponent.onValueChanged = new Slider.SliderEvent();
                nearClipSliderComponent.onValueChanged.AddListener((value) =>
                {
                    Camera.main.nearClipPlane = value;
                    ModPrefs.SetFloat("LockOnPlugin.Misc", "NearClipPlane", value);
                });

                Console.WriteLine("NearClipPlane slider installed");
            }

            Transform textParentObject = studio.transform.Find("Canvas Main Menu/04_System/02_Option/Text Camera Speed");

            if (sliderParentObject && textParentObject && !GameObject.Find("Text NearClipPlane"))
            {
                GameObject nearClipText = Instantiate(textParentObject.gameObject);
                nearClipText.name = "Text NearClipPlane";
                nearClipText.transform.SetParent(sliderParentObject.parent);
                nearClipText.transform.localPosition = new Vector3(83f, -16f, 0f);
                nearClipText.transform.localScale    = new Vector3(0.65f, 0.65f, 0.65f);
                Text nearClipTextComponent = nearClipText.GetComponent <Text>();
                nearClipTextComponent.text = "NearClip";
                Console.WriteLine("NearClipPlane text installed");
            }
        }
        public static void CreateSettingsUI()
        {
            var subMenuCC = SettingsUI.CreateSubMenu("Custom Colors");

            //Saber Override Setting for Left menu
            var disableOption = subMenuCC.AddBool("Disable the Plugin");

            disableOption.GetValue += delegate { return(ModPrefs.GetBool(Plugin.Name, "disablePlugin", false, true)); };
            disableOption.SetValue += delegate(bool value)
            {
                if (value == true)
                {
                    ModPrefs.SetBool(Plugin.Name, "disablePlugin", value);
                    Plugin.disablePlugin = value;
                    Plugin.queuedDisable = true;
                }
                if (value == false)
                {
                    ModPrefs.SetBool(Plugin.Name, "disablePlugin", value);
                    Plugin.disablePlugin = value;
                    Plugin.queuedDisable = false;
                }
            };
            var environmentColorsOption = subMenuCC.AddBool("Allow Color Overrides");

            environmentColorsOption.GetValue += delegate { return(ModPrefs.GetBool(Plugin.Name, "allowEnvironmentColors", true, true)); };
            environmentColorsOption.SetValue += delegate(bool value) { ModPrefs.SetBool(Plugin.Name, "allowEnvironmentColors", value); };

            var saberOverrideL = subMenuCC.AddBool("Override Custom Saber Color");

            saberOverrideL.GetValue += delegate { return(ModPrefs.GetBool(Plugin.Name, "OverrideCustomSabers", true, true)); };
            saberOverrideL.SetValue += delegate(bool value) { ModPrefs.SetBool(Plugin.Name, "OverrideCustomSabers", value); };

            bool saberTailorInstalled = CheckSaberTailor();

            if (saberTailorInstalled == true)
            {
                //Trail adjustment if Saber Tailor is installed
                var SaberTrails = subMenuCC.AddInt("Trail Length", 0, 100, 1);
                SaberTrails.GetValue += delegate { return(ModPrefs.GetInt("SaberTailor", "TrailLength", 20, true)); };
                SaberTrails.SetValue += delegate(int value) { ModPrefs.SetInt("SaberTailor", "TrailLength", (int)value); };
            }
            //Light brightness
            float[] brightnessValues = new float[11] {
                0, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f
            };
            var Brightness = subMenuCC.AddList("Light Brightness", brightnessValues);

            Brightness.GetValue    += delegate { return(ModPrefs.GetFloat(Plugin.Name, "Brightness", 1, true)); };
            Brightness.SetValue    += delegate(float value) { ModPrefs.SetFloat(Plugin.Name, "Brightness", value); };
            Brightness.FormatValue += delegate(float value) { return(value.ToString()); };

            var subMenuPresets = SettingsUI.CreateSubMenu("Color Settings");

            float[] presetValues = new float[ColorPresets.Count];
            for (int i = 0; i < ColorPresets.Count; i++)
            {
                presetValues[i] = i;
            }

            //Left Color Preset
            var leftPreset = subMenuPresets.AddList("Left Color Preset", presetValues);

            leftPreset.GetValue    += delegate { return(ModPrefs.GetInt(Plugin.Name, "leftColorPreset", 0, true)); };
            leftPreset.SetValue    += delegate(float value) { ModPrefs.SetInt(Plugin.Name, "leftColorPreset", (int)value); };
            leftPreset.FormatValue += delegate(float value) { return(ColorPresets[(int)value].Item2); };

            //Right Color Preset
            var rightPreset = subMenuPresets.AddList("Right Color Preset", presetValues);

            rightPreset.GetValue    += delegate { return(ModPrefs.GetInt(Plugin.Name, "rightColorPreset", 0, true)); };
            rightPreset.SetValue    += delegate(float value) { ModPrefs.SetInt(Plugin.Name, "rightColorPreset", (int)value); };
            rightPreset.FormatValue += delegate(float value) { return(ColorPresets[(int)value].Item2); };

            float[] otherPresetValues = new float[OtherPresets.Count];
            for (int i = 0; i < OtherPresets.Count; i++)
            {
                otherPresetValues[i] = i;
            }
            // Wall Color Preset
            var customColoredWalls = subMenuPresets.AddList("Wall Color", otherPresetValues);

            customColoredWalls.GetValue    += delegate { return(ModPrefs.GetInt(Plugin.Name, "wallColorPreset", 0, true)); };
            customColoredWalls.SetValue    += delegate(float value) { ModPrefs.SetInt(Plugin.Name, "wallColorPreset", (int)value); };
            customColoredWalls.FormatValue += delegate(float value) { return(OtherPresets[(int)value].Item2); };

            //Left Light Preset
            var leftLightPreset = subMenuPresets.AddList("Left Light Preset", otherPresetValues);

            leftLightPreset.GetValue    += delegate { return(ModPrefs.GetInt(Plugin.Name, "leftLightPreset", 0, true)); };
            leftLightPreset.SetValue    += delegate(float value) { ModPrefs.SetInt(Plugin.Name, "leftLightPreset", (int)value); };
            leftLightPreset.FormatValue += delegate(float value) { return(OtherPresets[(int)value].Item2); };
            //Right Light Preset
            var rightLightPreset = subMenuPresets.AddList("Right Light Preset", otherPresetValues);

            rightLightPreset.GetValue    += delegate { return(ModPrefs.GetInt(Plugin.Name, "rightLightPreset", 0, true)); };
            rightLightPreset.SetValue    += delegate(float value) { ModPrefs.SetInt(Plugin.Name, "rightLightPreset", (int)value); };
            rightLightPreset.FormatValue += delegate(float value) { return(OtherPresets[(int)value].Item2); };

            //Rainbow Walls
            var rainbowWallOverride = subMenuPresets.AddBool("Rainbow Wall Override");

            rainbowWallOverride.GetValue += delegate { return(ModPrefs.GetBool(Plugin.Name, "rainbowWalls", false, true)); };
            rainbowWallOverride.SetValue += delegate(bool value) { ModPrefs.SetBool(Plugin.Name, "rainbowWalls", value); };


            var subMenuUser = SettingsUI.CreateSubMenu("User Colors");

            //Left Red
            var LeftR = subMenuUser.AddInt("User Left Red", Plugin.Min, Plugin.Max, Plugin.userIncrement);

            LeftR.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "LeftRed", 255, true)); };
            LeftR.SetValue += delegate(int value) { ModPrefs.SetInt(Plugin.Name, "LeftRed", value); };

            //Left Green
            var LeftG = subMenuUser.AddInt("User Left Green", Plugin.Min, Plugin.Max, Plugin.userIncrement);

            LeftG.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "LeftGreen", 255, true)); };
            LeftG.SetValue += delegate(int value) { ModPrefs.SetInt(Plugin.Name, "LeftGreen", value); };

            //Left Blue
            var LeftB = subMenuUser.AddInt("User Left Blue", Plugin.Min, Plugin.Max, Plugin.userIncrement);

            LeftB.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "LeftBlue", 255, true)); };
            LeftB.SetValue += delegate(int value) { ModPrefs.SetInt(Plugin.Name, "LeftBlue", value); };

            //Right Red
            var RightR = subMenuUser.AddInt("User Right Red", Plugin.Min, Plugin.Max, Plugin.userIncrement);

            RightR.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "RightRed", 255, true)); };
            RightR.SetValue += delegate(int value) { ModPrefs.SetInt(Plugin.Name, "RightRed", value); };

            //Right Green
            var RightG = subMenuUser.AddInt("User Right Green", Plugin.Min, Plugin.Max, Plugin.userIncrement);

            RightG.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "RightGreen", 255, true)); };
            RightG.SetValue += delegate(int value) { ModPrefs.SetInt(Plugin.Name, "RightGreen", value); };

            //Right Blue
            var RightB = subMenuUser.AddInt("User Right Blue", Plugin.Min, Plugin.Max, Plugin.userIncrement);

            RightB.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "RightBlue", 255, true)); };
            RightB.SetValue += delegate(int value) { ModPrefs.SetInt(Plugin.Name, "RightBlue", value); };

            // Increment Modifier
            var incrementValue = subMenuCC.AddList("User Color Increment", new float[] { 1, 5, 10, 25, 50, 100 });

            incrementValue.GetValue += delegate { return(ModPrefs.GetInt(Plugin.Name, "userIncrement", 0, true)); };
            incrementValue.SetValue += delegate(float value)
            {
                ModPrefs.SetInt(Plugin.Name, "userIncrement", (int)value);
                new IntViewController[] { LeftR, LeftG, LeftB, RightR, RightG, RightB }.ToList().ForEach((controller) => { controller.UpdateIncrement((int)value); });
            };
            incrementValue.FormatValue += delegate(float value) { return(((int)value).ToString()); };
        }
Пример #14
0
        public static void CreateSettingsUI()
        {
            var subMenu = SettingsUI.CreateSubMenu("Progress Counter");

            //Time Left Bool
            {
                var timeLeft = subMenu.AddBool("Time Left");

                timeLeft.GetValue = () => Plugin.progressTimeLeft;

                timeLeft.SetValue = (bool value) =>
                {
                    Plugin.progressTimeLeft = value;
                    ModPrefs.SetBool("BeatSaberProgressCounter", "progressTimeLeft", Plugin.progressTimeLeft);
                };
            }


            //Decimal Precision
            {
                int[] precisionValues = { 1, 2, 3, 4 };
                var   precisionMenu   = subMenu.AddListSetting <DecimalSettingsViewController>("Decimal Precision");
                precisionMenu.values = precisionValues.ToList();

                precisionMenu.GetValue = () => Plugin.progressCounterDecimalPrecision;

                precisionMenu.SetValue = (int value) =>
                {
                    Plugin.progressCounterDecimalPrecision = (int)value;

                    ModPrefs.SetFloat("BeatSaberProgressCounter", "progressCounterDecimalPrecision", value);
                };

                precisionMenu.GetTextForValue = (int value) => value + " Place" + ((value == 1) ? "" : "s");
            }


            //Timer Position Preset
            {
                var timerPositions = new List <Tuple <Vector3, string> >
                {
                    { Plugin.progressCounterPosition, "Current" },
                    { new Vector3(.25f, -2.0f, 7.5f), "Default" },
                    { new Vector3(.25f, 3.4f, 7.5f), "Top" },
                    { new Vector3(-3.0f, 3.4f, 7f), "Top Left" },
                    { new Vector3(3.5f, 3.4f, 7f), "Top Right" },
                    { new Vector3(-3.0f, -1.75f, 7f), "Bottom Left" },
                    { new Vector3(3.5f, -1.6f, 7f), "Bottom Right" },
                };

                var timerPositionMenu = subMenu.AddListSetting <PositionSettingsViewController>("Timer Position");
                timerPositionMenu.values = timerPositions;

                timerPositionMenu.GetValue        = () => timerPositions[0];
                timerPositionMenu.GetTextForValue = (value) => value.Item2;
                timerPositionMenu.SetValue        = (v) =>
                {
                    Plugin.progressCounterPosition = v.Item1;
                    ModPrefs.SetString("BeatSaberProgressCounter", "progressPosition",
                                       FormattableString.Invariant(
                                           $"{Plugin.progressCounterPosition.x:0.00},{Plugin.progressCounterPosition.y:0.00},{Plugin.progressCounterPosition.z:0.00}"));
                };
            }


            // Score Counter Position Preset
            {
                var scorePositions = new List <Tuple <Vector3, string> >
                {
                    { Plugin.scoreCounterPosition, "Current" },
                    { new Vector3(3.25f, 0.5f, 7.0f), "Default" },
                    { new Vector3(-3.25f, -0.3f, 7.0f), "Left" },
                };

                var scorePositionPresetMenu = subMenu.AddListSetting <PositionSettingsViewController>("Score Counter Position");
                scorePositionPresetMenu.values = scorePositions;

                scorePositionPresetMenu.GetValue        = () => scorePositions[0];
                scorePositionPresetMenu.GetTextForValue = (value) => value.Item2;
                scorePositionPresetMenu.SetValue        = (v) =>
                {
                    Plugin.scoreCounterPosition = v.Item1;
                    ModPrefs.SetString("BeatSaberProgressCounter", "scorePosition",
                                       FormattableString.Invariant(
                                           $"{Plugin.scoreCounterPosition.x:0.00},{Plugin.scoreCounterPosition.y:0.00},{Plugin.scoreCounterPosition.z:0.00}"));
                };
            }


            //Score Counter Toggle
            {
                var scoreCounterToggle = subMenu.AddBool("Enable Score Counter");

                scoreCounterToggle.GetValue = () => Plugin.scoreCounterEnabled;

                scoreCounterToggle.SetValue = (bool value) =>
                {
                    Plugin.scoreCounterEnabled = value;
                    ModPrefs.SetBool("BeatSaberProgressCounter", "scoreCounterEnabled", Plugin.scoreCounterEnabled);
                };
            }


            //Personal Best Tracker Toggle
            {
                var pbTrackerToggle = subMenu.AddBool("Enable Personal Best Tracker");

                pbTrackerToggle.GetValue = () => Plugin.pbTrackerEnabled;

                pbTrackerToggle.SetValue = (bool value) =>
                {
                    Plugin.pbTrackerEnabled = value;
                    ModPrefs.SetBool("BeatSaberProgressCounter", "scoreCounterEnabled", Plugin.pbTrackerEnabled);
                };
            }
        }
Пример #15
0
 void DeferredSkinModule()
 {
     GUILayout.BeginHorizontal();
     GUILayout.Label(GUIStrings.Skin_Scattering, titlestyle2);
     GUILayout.FlexibleSpace();
     if (GUILayout.Button(GUIStrings.Save, buttonstyleNoStretch, GUILayout.ExpandWidth(false)))
     {
         JSON.Utilities.SaveSettings(deferredShading.SSSSS.SkinSettings, JSON.Utilities.SkinSettings);
     }
     GUILayout.EndHorizontal();
     GUILayout.Space(space);
     SliderGUI(deferredShading.SSSSS.SkinSettings.Weight, min: 0f, max: 1f, reset: 1f,
               SetOutput: x => { deferredShading.SSSSS.SkinSettings.Weight = x; deferredShading.SSSSS.Refresh(); },
               labeltext: GUIStrings.Skin_Scattering_Weight, tooltip: GUIStrings.Skin_Scattering_Weight_Tooltips);
     SliderGUI(deferredShading.SSSSS.SkinSettings.MaskCutoff, min: 0.01f, max: 1f, reset: 0.1f,
               SetOutput: x => { deferredShading.SSSSS.SkinSettings.MaskCutoff = x; deferredShading.SSSSS.Refresh(); },
               labeltext: GUIStrings.Skin_Scattering_Mask_Cutoff, tooltip: GUIStrings.Skin_Scattering_Mask_Cutoff_Tooltips);
     SliderExGUI(deferredShading.SSSSS.SkinSettings.Bias, reset: 0.01f, power: 0.4f,
                 SetOutput: x => { deferredShading.SSSSS.SkinSettings.Bias = x; deferredShading.SSSSS.Refresh(); },
                 labeltext: GUIStrings.Skin_scattering_bias, tooltip: GUIStrings.Skin_scattering_bias_tooltips);
     SliderExGUI(deferredShading.SSSSS.SkinSettings.Scale, reset: 1f, power: 0.4f,
                 SetOutput: x => { deferredShading.SSSSS.SkinSettings.Scale = x; deferredShading.SSSSS.Refresh(); },
                 labeltext: GUIStrings.Skin_Scattering_Scale, tooltip: GUIStrings.Skin_Scattering_Scale_Tooltips);
     SliderGUI(deferredShading.SSSSS.SkinSettings.BumpBlur, min: 0f, max: 1f, reset: 0.7f,
               SetOutput: x => { deferredShading.SSSSS.SkinSettings.BumpBlur = x; deferredShading.SSSSS.Refresh(); },
               labeltext: GUIStrings.Skin_bump_blur, tooltip: GUIStrings.Skin_bump_blur_tooltips);
     GUILayout.Space(space);
     GUILayout.BeginHorizontal();
     GUILayout.Label(GUIStrings.Skin_Transmission, titlestyle2);
     GUILayout.FlexibleSpace();
     if (GUILayout.Button(GUIStrings.Save, buttonstyleNoStretch, GUILayout.ExpandWidth(false)))
     {
         JSON.Utilities.SaveSettings(deferredShading.SSSSS.TransmissionSettings, JSON.Utilities.TransmissionSettings);
     }
     GUILayout.EndHorizontal();
     SliderGUI(deferredShading.SSSSS.TransmissionSettings.Weight, min: 0f, max: 1f, reset: 1f,
               SetOutput: x => { deferredShading.SSSSS.TransmissionSettings.Weight = x; deferredShading.SSSSS.Refresh(); },
               labeltext: GUIStrings.Skin_transmission_weight, tooltip: GUIStrings.Skin_transmission_weight_tooltips);
     SliderGUI(deferredShading.SSSSS.TransmissionSettings.ShadowWeight, min: 0f, max: 1f, reset: 0.5f,
               SetOutput: x => { deferredShading.SSSSS.TransmissionSettings.ShadowWeight = x; deferredShading.SSSSS.Refresh(); },
               labeltext: GUIStrings.Skin_transmission_shadow_weight, tooltip: GUIStrings.Skin_transmission_shadow_weight_tooltips);
     SliderGUI(deferredShading.SSSSS.TransmissionSettings.BumpDistortion, min: 0f, max: 1f, reset: 0.05f,
               SetOutput: x => { deferredShading.SSSSS.TransmissionSettings.BumpDistortion = x; deferredShading.SSSSS.Refresh(); },
               labeltext: GUIStrings.Skin_bump_distortion, tooltip: GUIStrings.Skin_bump_distortion_tooltips);
     SliderGUI(deferredShading.SSSSS.TransmissionSettings.Falloff, min: 1f, max: 10f, reset: 1f,
               SetOutput: x => { deferredShading.SSSSS.TransmissionSettings.Falloff = x; deferredShading.SSSSS.Refresh(); },
               labeltext: GUIStrings.Skin_transmission_falloff, tooltip: GUIStrings.Skin_transmission_falloff_tooltips);
     GUILayout.Space(space);
     GUILayout.BeginHorizontal();
     GUILayout.Label("Nipples", titlestyle2);
     GUILayout.FlexibleSpace();
     if (GUILayout.Button(GUIStrings.Save, buttonstyleNoStretch, GUILayout.ExpandWidth(false)))
     {
         ModPrefs.SetFloat("PHIBL", "NippleSSS", nippleSSS);
     }
     GUILayout.EndHorizontal();
     SliderGUI(nippleSSS, min: 0f, max: 1f,
               reset: () => ModPrefs.GetFloat("PHIBL", "NippleSSS", 0.5f),
               SetOutput: x => { nippleSSS = x; Shader.SetGlobalFloat(_AlphaSSS, x); },
               label: new GUIContent(" Scattering and Transmission Weight: "));
 }
Пример #16
0
        private void MirrorHelperwindow(int id)
        {
            if (Event.current.type == EventType.MouseDown)
            {
                GUI.FocusWindow(windowID);
                windowdragflag = true;
            }
            else if (Event.current.type == EventType.MouseUp)
            {
                windowdragflag = false;
            }

            GUILayout.BeginVertical();
            if (Mirror == null)
            {
                window = false;
                return;
            }
            texturesize = Mirror.m_TextureSize;
            int selected;

            if (texturesize <= 1024)
            {
                selected = 0;
            }
            else if (texturesize <= 2048)
            {
                selected = 1;
            }
            else
            {
                selected = 2;
            }
            GUILayout.Label("Mirror Resolution", UIUtils.labelstyle);
            GUILayout.Space(UIUtils.space);
            selected = GUILayout.SelectionGrid(selected, new string[] { "1024", "2048", "4096" }, 3, UIUtils.selectstyle);
            switch (selected)
            {
            default:
            case 0:
                texturesize = 1024;
                break;

            case 1:
                texturesize = 2048;
                break;

            case 2:
                texturesize = 4096;
                break;
            }
            Mirror.m_TextureSize     = texturesize;
            clipplaneoffset          = UIUtils.SliderGUI(clipplaneoffset, 0f, 1f, 0.01f, "Clip plane offset", "N3");
            Mirror.m_ClipPlaneOffset = clipplaneoffset;
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Close Window", UIUtils.buttonstyle))
            {
                window = false;
            }
            if (GUILayout.Button("Save", UIUtils.buttonstyle))
            {
                ModPrefs.SetInt("MirrorHelper", "Resolution", texturesize);
                ModPrefs.SetFloat("MirrorHelper", "ClipPlaneOffset", clipplaneoffset);
            }
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            GUI.DragWindow();
        }
Пример #17
0
        void LensModule()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label(GUIStrings.Field_Of_View, titlestyle2);
            GUILayout.FlexibleSpace();
            if (!StudioMode)
            {
                dollyZoom = UIUtils.ToggleButton(dollyZoom, new GUIContent(GUIStrings.Dolly_zoom), enable => ModPrefs.SetBool("PHIBL", "DollyZoom", enable));
            }
            else
            {
                if (GUILayout.Button(GUIStrings.Save, buttonstyleNoStretch))
                {
                    ModPrefs.SetFloat("PHIBL", "StudioFOV", Camera.main.fieldOfView);
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.Label(Camera.main.fieldOfView.ToString("N1"), labelstyle2);
            if (StudioMode)
            {
                GetComponent <CamCtrlStudio>().StudioCameraControl.fieldOfView = GUILayout.HorizontalSlider(GetComponent <CamCtrlStudio>().StudioCameraControl.fieldOfView, leftValue: 10f, rightValue: 120f, slider: sliderstyle, thumb: thumbstyle);
            }
            else
            {
                if (dollyZoom)
                {
                    GetComponent <CamCtrl>().Illcam.SetParse(GUILayout.HorizontalSlider(Camera.main.fieldOfView, leftValue: 10f, rightValue: 120f, slider: sliderstyle, thumb: thumbstyle), true);
                }
                else
                {
                    Camera.main.fieldOfView = GUILayout.HorizontalSlider(Camera.main.fieldOfView, leftValue: 10f, rightValue: 120f, slider: sliderstyle, thumb: thumbstyle);
                }
            }
            GUILayout.Space(space);

            ToggleGUITitle(ref PPCtrl.enableDepthOfField, new GUIContent(GUIStrings.Depth_Of_View), new Action <bool>(DoFAction));

            if (PPCtrl.enableDepthOfField)
            {
                if (StudioMode)
                {
                    Singleton <Studio.Studio> .Instance.sceneInfo.enableDepth = false;
                }
                GUILayout.Space(space);
                GUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent(GUIStrings.Dof_focal_distance + PPCtrl.depthOfField.focusDistance.ToString("N3"), GUIStrings.Dof_focal_distance_tooltips), labelstyle);
                GUILayout.FlexibleSpace();
                autoFocus = UIUtils.ToggleButton(autoFocus, GUIStrings.Dof_auto_focus, new Action <bool>(AutoFocusAction));
                GUILayout.EndHorizontal();
                if (!autoFocus)
                {
                    GUILayout.Space(space);
                    PPCtrl.depthOfField.focusDistance = GUILayout.HorizontalSlider(PPCtrl.depthOfField.focusDistance,
                                                                                   leftValue: 0.1f,
                                                                                   rightValue: 20f,
                                                                                   slider: sliderstyle,
                                                                                   thumb: thumbstyle);
                }
                else
                {
                    FocusPuller.speed = SliderGUI(FocusPuller.speed, 1f, 20f, 6f, GUIStrings.Focus_Speed);
                }
                GUILayout.Space(space);
                GUILayout.Label(new GUIContent(GUIStrings.Dof_aperture + PPCtrl.depthOfField.aperture.ToString("N3"), GUIStrings.Dof_aperture_tooltips), labelstyle);
                PPCtrl.depthOfField.aperture = GUILayout.HorizontalSlider(PPCtrl.depthOfField.aperture, leftValue: 0.05f, rightValue: 32f, slider: sliderstyle, thumb: thumbstyle);
                //GUILayout.Space(UIUtils.space);
                GUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent(GUIStrings.Dof_focallength, GUIStrings.Dof_focallength_tooltips), labelstyle);
                GUILayout.FlexibleSpace();
                PPCtrl.depthOfField.useCameraFov = UIUtils.ToggleButton(PPCtrl.depthOfField.useCameraFov, GUIStrings.Dof_auto_calc);
                GUILayout.EndHorizontal();

                if (!PPCtrl.depthOfField.useCameraFov)
                {
                    GUILayout.Label(PPCtrl.depthOfField.focalLength.ToString("N3"), labelstyle2);
                    PPCtrl.depthOfField.focalLength = GUILayout.HorizontalSlider(PPCtrl.depthOfField.focalLength, 0.1f, 100f, sliderstyle, thumbstyle);
                }
                SelectGUI(ref PPCtrl.depthOfField.kernelSize, new GUIContent(GUIStrings.Dof_kernel, GUIStrings.Dof_kernel_tooltips), 0);
                GUILayout.Space(space);
            }
            ToggleGUITitle(ref PPCtrl.enableVignette, new GUIContent(GUIStrings.Vignette), enable => ModPrefs.SetBool("PHIBL", "Vignette", enable));

            if (PPCtrl.enableVignette)
            {
                ToggleGUI(ref PPCtrl.vignette.rounded, GUIStrings.Vignette_mode, GUIStrings.Vignette_mode_selection);
                SliderGUI(ref PPCtrl.vignette.intensity, 0f, 1f, GUIStrings.Vignette_intensity);
                if (!PPCtrl.vignette.rounded)
                {
                    SliderGUI(ref PPCtrl.vignette.roundness, 0f, 1f, GUIStrings.Vignette_roundness);
                }
                SliderGUI(ref PPCtrl.vignette.smoothness, 0f, 1f, GUIStrings.Vignette_smoothness);

                PPCtrl.vignette.color = SliderGUI(PPCtrl.vignette.color, Color.black, GUIStrings.Vignette_color);
            }

            ToggleGUITitle(ref PPCtrl.enableChromaticAberration, new GUIContent(GUIStrings.Chromatic_Aberration), enable => ModPrefs.SetBool("PHIBL", "ChromaticAberration", enable));
            if (PPCtrl.enableChromaticAberration)
            {
                GUILayout.Label(GUIStrings.Chromatic_aberration_intensity + PPCtrl.chromaticAberration.intensity.ToString("N3"), labelstyle);
                PPCtrl.chromaticAberration.intensity = GUILayout.HorizontalSlider(PPCtrl.chromaticAberration.intensity, 0f, 1f, sliderstyle, thumbstyle);
            }
            GUILayout.Space(space);
            //GUILayout.Label(" Lens Dirt ", UIUtils.titlestyle2);
            //GUILayout.Label(" Intensity: " + postprofile.bloom.lensDirt.intensity.ToString("N3"), UIUtils.labelstyle);
            //postprofile.bloom.lensDirt.intensity = GUILayout.HorizontalSlider(postprofile.bloom.lensDirt.intensity, 0f, 10f, UIUtils.sliderstyle, UIUtils.thumbstyle);
            //GUILayout.Space(UIUtils.space);
        }
Пример #18
0
        //Initialize GUI style
        internal static void InitStyle()
        {
            scale.y = UnityEngine.Screen.height / Screen.height;
            scale.x = scale.y;
            scale.z = 1f;

            customscale = ModPrefs.GetFloat("BoneManager", "Window.customScale", 1f, true);
            customscale = Mathf.Clamp(customscale, 0.5f / scale.y, 2f);
            ModPrefs.SetFloat("BoneManager", "Window.customScale", customscale);
            screenBound = new Vector2(UnityEngine.Screen.width / scale.x / customscale, Screen.height / customscale);

            myfont      = Font.CreateDynamicFontFromOSFont(new string[] { "Segeo UI", "Microsoft YaHei UI", "Microsoft YaHei" }, 20);
            windowtitle = new GUIStyle(GUI.skin.label)
            {
                //border = new RectOffset(1,1,1,1),
                fontSize  = 24,
                padding   = new RectOffset(10, 10, 6, 12),
                fontStyle = FontStyle.Bold,
                alignment = TextAnchor.MiddleCenter,
                font      = myfont
            };
            toggleButtonOn = new GUIStyle(GUI.skin.button)
            {
                fontStyle     = FontStyle.Bold,
                stretchHeight = false,
                stretchWidth  = false,
                alignment     = TextAnchor.MiddleCenter,
                wordWrap      = false,
                font          = myfont,
                margin        = new RectOffset(4, 4, 4, 4),
                padding       = new RectOffset(6, 6, 6, 12),
                fontSize      = 22
            };
            toggleButtonOff = new GUIStyle(GUI.skin.button)
            {
                fontStyle     = FontStyle.Bold,
                stretchHeight = false,
                stretchWidth  = false,
                alignment     = TextAnchor.MiddleCenter,
                wordWrap      = false,
                font          = myfont,
                margin        = new RectOffset(4, 4, 4, 4),
                padding       = new RectOffset(6, 6, 6, 12),
                fontSize      = 22
            };
            toggleButtonOn.onNormal.textColor = selected;
            toggleButtonOn.onHover.textColor  = selectedOnHover;
            toggleButtonOn.normal             = toggleButtonOn.onNormal;
            toggleButtonOn.hover = toggleButtonOn.onHover;
            boxstyle             = new GUIStyle(GUI.skin.box)
            {
                stretchHeight = false,
                stretchWidth  = true,
                alignment     = TextAnchor.MiddleLeft,
                wordWrap      = true,
                font          = myfont,
                fontSize      = 22,
                padding       = new RectOffset(6, 6, 6, 12)
            };
            windowstyle = new GUIStyle(GUI.skin.window);
            selectstyle = new GUIStyle(GUI.skin.button)
            {
                fontStyle = FontStyle.Bold,
                alignment = TextAnchor.MiddleCenter,
                fontSize  = 22,
                padding   = new RectOffset(6, 6, 6, 12),
                margin    = new RectOffset(4, 4, 4, 4),
                font      = myfont
            };
            selectstyle.onNormal.textColor = selected;
            selectstyle.onHover.textColor  = selectedOnHover;
            buttonstyleNoStretch           = new GUIStyle(GUI.skin.button)
            {
                fontStyle     = FontStyle.Bold,
                stretchHeight = false,
                stretchWidth  = false,
                alignment     = TextAnchor.MiddleCenter,
                wordWrap      = false,
                font          = myfont,
                padding       = new RectOffset(6, 6, 6, 12),
                margin        = new RectOffset(4, 4, 4, 4),
                fontSize      = 22
            };

            sliderstyle = new GUIStyle(GUI.skin.horizontalSlider)
            {
                padding     = new RectOffset(-10, -10, -4, -4),
                fixedHeight = 16f,
                margin      = new RectOffset(22, 22, 22, 22)
            };
            thumbstyle = new GUIStyle(GUI.skin.horizontalSliderThumb)
            {
                fixedHeight = 24f,
                padding     = new RectOffset(14, 14, 12, 12)
            };
            labelstyle2 = new GUIStyle(GUI.skin.label)
            {
                font     = myfont,
                fontSize = 20,
                margin   = new RectOffset(16, 16, 8, 8)
            };
            titlestyle = new GUIStyle(GUI.skin.button)
            {
                fontStyle = FontStyle.Bold,
                font      = myfont,
                fontSize  = 30,
                padding   = new RectOffset(6, 6, 6, 12),
                margin    = new RectOffset(4, 4, 4, 4),
                alignment = TextAnchor.MiddleCenter
            };
            titlestyle.onNormal.textColor = selected;
            titlestyle.onHover.textColor  = selectedOnHover;
            titlestyle2 = new GUIStyle(GUI.skin.label)
            {
                fontStyle = FontStyle.Bold,
                font      = myfont,
                fontSize  = 30,
                padding   = new RectOffset(6, 6, 6, 12),
            };
            labelstyle = new GUIStyle(GUI.skin.label)
            {
                font      = myfont,
                fontSize  = 24,
                padding   = new RectOffset(6, 6, 6, 12),
                alignment = TextAnchor.MiddleLeft
            };
            buttonstyleStrechWidth = new GUIStyle(GUI.skin.button)
            {
                stretchHeight = false,
                stretchWidth  = true,
                wordWrap      = true,
                fontStyle     = FontStyle.Bold,
                font          = myfont,
                fontSize      = 22,
                margin        = new RectOffset(10, 10, 5, 5),
                padding       = new RectOffset(6, 6, 6, 12)
            };
            buttonstyleStrechWidth.onNormal.textColor = selected;
            buttonstyleStrechWidth.onHover.textColor  = selectedOnHover;
            labelstyle3 = new GUIStyle(GUI.skin.label)
            {
                wordWrap = true,
                fontSize = 22
            };

            space            = 12f;
            minwidth         = Mathf.Round(0.333f * Screen.width);
            styleInitialized = true;

            windowRect.x      = ModPrefs.GetFloat("BoneManager", "Window.x", windowRect.x, true);
            windowRect.y      = ModPrefs.GetFloat("BoneManager", "Window.y", windowRect.y, true);
            windowRect.width  = Mathf.Min(Screen.width - 10f, ModPrefs.GetFloat("BoneManager", "Window.width", windowRect.width, true));
            windowRect.height = Mathf.Min(Screen.height - 10f, ModPrefs.GetFloat("BoneManager", "Window.height", windowRect.height, true));
        }
Пример #19
0
        private static void CreateSoundEffectSettingsUI()
        {
            float[] volArray  = new float[21];
            float[] distArray = new float[51];

            for (int i = 0; i <= 20; i++)
            {
                volArray[i] = (float)i * 0.05f;
            }
            for (int i = 0; i <= 50; i++)
            {
                distArray[i] = (float)i * 0.01f;
            }

            var subMenu    = SettingsUI.CreateSubMenu("Sound Effects");
            var subMenuVol = SettingsUI.CreateSubMenu("Sound Effects Values");

            // Distortion
            // Enable/disable
            var distMenuB = subMenu.AddBool("Distortion");

            distMenuB.GetValue += delegate
            {
                return(ModPrefs.GetBool(SoundEffectPlugin.PluginName, "Distortion", SoundEffect._dist));
            };
            distMenuB.SetValue += delegate(bool value)
            {
                SoundEffect._dist = value;
                ModPrefs.SetBool(SoundEffectPlugin.PluginName, "Distortion", SoundEffect._dist);
            };
            // Length
            var distMenuV = subMenuVol.AddList("Distortion Length", distArray);

            distMenuV.GetValue += delegate
            {
                return(ModPrefs.GetFloat(SoundEffectPlugin.PluginName, "DistortionLength", SoundEffect._distLen));
            };
            distMenuV.SetValue += delegate(float value)
            {
                SoundEffect._distLen = value;
                ModPrefs.SetFloat(SoundEffectPlugin.PluginName, "DistortionLength", SoundEffect._distLen);
            };
            distMenuV.FormatValue += delegate(float value) { return(value.ToString()); };



            // Miss
            // Enable/disable
            var missMenuB = subMenu.AddBool("Miss");

            missMenuB.GetValue += delegate
            {
                return(ModPrefs.GetBool(SoundEffectPlugin.PluginName, "Miss", SoundEffect._miss));
            };
            missMenuB.SetValue += delegate(bool value)
            {
                SoundEffect._miss = value;
                ModPrefs.SetBool(SoundEffectPlugin.PluginName, "Miss", SoundEffect._miss);
            };
            // Value
            var missMenuV = subMenuVol.AddList("Miss Volume", volArray);

            missMenuV.GetValue += delegate
            {
                return(ModPrefs.GetFloat(SoundEffectPlugin.PluginName, "MissVolume", SoundEffect._missVol));
            };
            missMenuV.SetValue += delegate(float value)
            {
                SoundEffect._missVol = value;
                ModPrefs.SetFloat(SoundEffectPlugin.PluginName, "MissVolume", SoundEffect._missVol);
            };
            missMenuV.FormatValue += delegate(float value) { return(value.ToString()); };



            // Bomb
            // Enable/disable
            var bombMenuB = subMenu.AddBool("Bomb");

            bombMenuB.GetValue += delegate
            {
                return(ModPrefs.GetBool(SoundEffectPlugin.PluginName, "Bomb", SoundEffect._bomb));
            };
            bombMenuB.SetValue += delegate(bool value)
            {
                SoundEffect._bomb = value;
                ModPrefs.SetBool(SoundEffectPlugin.PluginName, "Bomb", SoundEffect._bomb);
            };
            // Value
            var bombMenuV = subMenuVol.AddList("Bomb Volume", volArray);

            bombMenuV.GetValue += delegate
            {
                return(ModPrefs.GetFloat(SoundEffectPlugin.PluginName, "BombVolume", SoundEffect._bombVol));
            };
            bombMenuV.SetValue += delegate(float value)
            {
                SoundEffect._bombVol = value;
                ModPrefs.SetFloat(SoundEffectPlugin.PluginName, "BombVolume", SoundEffect._bombVol);
            };
            bombMenuV.FormatValue += delegate(float value) { return(value.ToString()); };



            // Hit
            // Enable/disable
            var hitMenuB = subMenu.AddBool("Hit");

            hitMenuB.GetValue += delegate
            {
                return(ModPrefs.GetBool(SoundEffectPlugin.PluginName, "Hit", SoundEffect._hit));
            };
            hitMenuB.SetValue += delegate(bool value)
            {
                SoundEffect._hit = value;
                ModPrefs.SetBool(SoundEffectPlugin.PluginName, "Hit", SoundEffect._hit);
            };
            // Value
            var hitMenuV = subMenuVol.AddList("Hit Volume", volArray);

            hitMenuV.GetValue += delegate
            {
                return(ModPrefs.GetFloat(SoundEffectPlugin.PluginName, "HitVolume", SoundEffect._hitVol));
            };
            hitMenuV.SetValue += delegate(float value)
            {
                SoundEffect._hitVol = value;
                ModPrefs.SetFloat(SoundEffectPlugin.PluginName, "HitVolume", SoundEffect._hitVol);
            };
            hitMenuV.FormatValue += delegate(float value) { return(value.ToString()); };



            // Hit
            // Enable/disable
            var badMenuB = subMenu.AddBool("BadHit");

            badMenuB.GetValue += delegate
            {
                return(ModPrefs.GetBool(SoundEffectPlugin.PluginName, "BadHit", SoundEffect._bad));
            };
            badMenuB.SetValue += delegate(bool value)
            {
                SoundEffect._bad = value;
                ModPrefs.SetBool(SoundEffectPlugin.PluginName, "BadHit", SoundEffect._bad);
            };
            // Value
            var badMenuV = subMenuVol.AddList("Bad Hit Volume", volArray);

            badMenuV.GetValue += delegate
            {
                return(ModPrefs.GetFloat(SoundEffectPlugin.PluginName, "BadHitVolume", SoundEffect._badVol));
            };
            badMenuV.SetValue += delegate(float value)
            {
                SoundEffect._badVol = value;
                ModPrefs.SetFloat(SoundEffectPlugin.PluginName, "BadHitVolume", SoundEffect._badVol);
            };
            badMenuV.FormatValue += delegate(float value) { return(value.ToString()); };



            // Fail
            // Enable/disable
            var failMenuB = subMenu.AddBool("Fail");

            failMenuB.GetValue += delegate
            {
                return(ModPrefs.GetBool(SoundEffectPlugin.PluginName, "Fail", SoundEffect._fail));
            };
            failMenuB.SetValue += delegate(bool value)
            {
                SoundEffect._fail = value;
                ModPrefs.SetBool(SoundEffectPlugin.PluginName, "Fail", SoundEffect._fail);
            };
            // Value
            var failMenuV = subMenuVol.AddList("Fail Volume", volArray);

            failMenuV.GetValue += delegate
            {
                return(ModPrefs.GetFloat(SoundEffectPlugin.PluginName, "FailVolume", SoundEffect._failVol));
            };
            failMenuV.SetValue += delegate(float value)
            {
                SoundEffect._failVol = value;
                ModPrefs.SetFloat(SoundEffectPlugin.PluginName, "FailVolume", SoundEffect._failVol);
            };
            failMenuV.FormatValue += delegate(float value) { return(value.ToString()); };
        }
Пример #20
0
 public void SetFloat(string key, float value)
 {
     ModPrefs.SetFloat(this._name, key, value);
 }
        public static void CreateSettingsUI()
        {
            var subMenu = SettingsUI.CreateSubMenu("Particle Overdrive");

            BoolViewController noiseEnabled = subMenu.AddBool("Camera Noise");

            noiseEnabled.GetValue += (() => Plugin._noiseController.Enabled);
            noiseEnabled.SetValue += delegate(bool value)
            {
                Plugin._noiseController.Enabled = value;
                ModPrefs.SetBool(Plugin.ModPrefsKey, "cameraNoise", value);
            };

            BoolViewController dustEnabled = subMenu.AddBool("Global Dust Particles");

            dustEnabled.GetValue += (() => Plugin._particleController.Enabled);
            dustEnabled.SetValue += delegate(bool value)
            {
                Plugin._particleController.Enabled = value;
                ModPrefs.SetBool(Plugin.ModPrefsKey, "dustParticles", value);
            };

            float[] values = new float[]
            {
                0f,
                //0.1f,
                //0.2f,
                //0.3f,
                //0.4f,
                //0.5f,
                //0.6f,
                //0.7f,
                //0.8f,
                //0.9f,
                1f,
                1.1f,
                1.2f,
                1.3f,
                1.4f,
                1.5f,
                1.6f,
                1.7f,
                1.8f,
                1.9f,
                2f,
                2.25f,
                2.5f,
                2.75f,
                3f,
                3.25f,
                3.5f,
                3.75f,
                4f,
                4.25f,
                4.5f,
                4.75f,
                5f,
                5.5f,
                6f,
                6.5f,
                7f,
                7.5f,
                8f,
                8.5f,
                9f,
                9.5f,
                10f,
                11f,
                12f,
                13f,
                14f,
                15f,
                16f,
                17f,
                18f,
                19f,
                20f,
                22.5f,
                25f,
                27.5f,
                30f,
                32.5f,
                35f,
                37.5f,
                40f,
                42.5f,
                45f,
                47.5f,
                50f,
                55f,
                60f,
                65f,
                70f,
                75f,
                80f,
                85f,
                90f,
                100f,
                110f,
                120f,
                130f,
                140f,
                150f,
                160f,
                170f,
                180f,
                190f,
                200f
            };

            ListViewController slashParticleCount = subMenu.AddList("Slash Particles", values);

            slashParticleCount.FormatValue += ((float value) => $"{value * 100f}%");
            slashParticleCount.GetValue    += (() => Plugin.SlashParticleMultiplier);
            slashParticleCount.SetValue    += delegate(float value)
            {
                Plugin.SlashParticleMultiplier = value;
                ModPrefs.SetFloat(Plugin.ModPrefsKey, "slashParticleMultiplier", value);
            };

            ListViewController exploParticleCount = subMenu.AddList("Explosion Particles", values);

            exploParticleCount.FormatValue += ((float value) => $"{value * 100f}%");
            exploParticleCount.GetValue    += (() => Plugin.ExplosionParticleMultiplier);
            exploParticleCount.SetValue    += delegate(float value)
            {
                Plugin.ExplosionParticleMultiplier = value;
                ModPrefs.SetFloat(Plugin.ModPrefsKey, "explosionParticleMultiplier", value);
            };
        }