Example #1
0
        private void CheckForUserDataFolder()
        {
            string userDataPath = Environment.CurrentDirectory + "/UserData";

            if (!Directory.Exists(userDataPath))
            {
                Directory.CreateDirectory(userDataPath);
            }
            if ("".Equals(ModPrefs.GetString(PluginName, KeyDarthMode, "")))
            {
                ModPrefs.SetBool(PluginName, KeyDarthMode, false);
            }
            if ("".Equals(ModPrefs.GetString(PluginName, KeyOneHanded, "")))
            {
                ModPrefs.SetBool(PluginName, KeyOneHanded, false);
            }
            if ("".Equals(ModPrefs.GetString(PluginName, KeyAutoDetect, "")))
            {
                ModPrefs.SetBool(PluginName, KeyAutoDetect, false);
            }
            if ("".Equals(ModPrefs.GetString(PluginName, KeySeparation, "")))
            {
                ModPrefs.SetInt(PluginName, KeySeparation, 15);
            }
        }
Example #2
0
        private void RunAction(string act)
        {
            if (act == "lock")
            {
                locked = !locked;

                Text = "Overlay (" + Size.Width + "x" + Size.Height + ") (Locked: " + locked + ")";
            }
            else if (act == "refresh")
            {
                ForeColor = System.Drawing.Color.FromName(ModPrefs.GetString("StreamInfo", "TextColor", "White", true));
                BackColor = System.Drawing.Color.FromName(ModPrefs.GetString("StreamInfo", "BackgroundColor", "Black", true));

                if (ModPrefs.GetBool("StreamInfo", "UseBackgroundImage", false, true) && File.Exists(Path.Combine(Plugin.dir, "image.png")))
                {
                    BackgroundImage = Image.FromFile(Path.Combine(Plugin.dir, "image.png"));
                }
                else
                {
                    BackgroundImage = null;
                }

                UpdateAlign();
                Refresh();
            }
        }
Example #3
0
        public void OnApplicationStart()
        {
            Directory.CreateDirectory(Path.Combine(Application.dataPath, "../UserData/BeFitUsers/"));
            userConfigs = new UserConfigs(ModPrefs.GetString(alias, "lastUserPath", Path.Combine(Application.dataPath, "../UserData/BeFitUsers/Player" + DateTime.Now.Minute + ".cfg"), true));
            Instance    = this;

            enabled = Instance.mainConfig.BeFitPluginEnabled;
            ModPrefs.SetString(alias, "version", Version.ToString());


            Console.WriteLine(modLog + "Current Date: " + DateTime.Now.ToString("MM.dd.yyyy HH:mm:ss tt"));
            Console.WriteLine(modLog + Name + " " + Version);


            var users = RetrieveUsers();

            if (users.Count == 0)
            {
                Console.WriteLine("No user profile found!"); return;
            }

            Plugin.Instance.mainConfig.sessionCalories = 0;
            userConfigs.sessionCalories = 0;

            SceneManager.activeSceneChanged += SceneManagerOnActiveSceneChanged;
            SceneManager.sceneLoaded        += SceneManager_sceneLoaded;
        }
        public void OnApplicationStart()
        {
            SceneManager.activeSceneChanged += OnSceneChanged;

            if (ModPrefs.GetString("PerfectionDisplay", "Position") == "")
            {
                ModPrefs.SetString("PerfectionDisplay", "Position", FormattableString.Invariant($"{PerfectDisplay.displayPosition.x:0.00},{PerfectDisplay.displayPosition.y:0.00},{PerfectDisplay.displayPosition.z:0.00}"));
            }
            else
            {
                var posString = ModPrefs.GetString("PerfectionDisplay", "Position");
                var posVals   = posString.Split(',').Select(f => float.Parse(f, CultureInfo.InvariantCulture)).ToArray();
                PerfectDisplay.displayPosition = new Vector3(posVals[0], posVals[1], posVals[2]);
            }
            if (ModPrefs.GetString("PerfectionDisplay", "Score Ranges") == "")
            {
                ModPrefs.SetString("PerfectionDisplay", "Score Ranges", string.Join(",", PerfectDisplay.scoreRanges));
            }
            else
            {
                var rangeString = ModPrefs.GetString("PerfectionDisplay", "Score Ranges");
                PerfectDisplay.scoreRanges = rangeString.Split(',').Select(f => int.Parse(f, CultureInfo.InvariantCulture)).ToArray();
            }
            if (ModPrefs.GetString("PerfectionDisplay", "Colors") == "")
            {
                ModPrefs.SetString("PerfectionDisplay", "Colors", string.Join(",", PerfectDisplay.colors));
            }
            else
            {
                var rangeString = ModPrefs.GetString("PerfectionDisplay", "Colors");
                PerfectDisplay.colors = rangeString.Split(',');
            }
            if (PerfectDisplay.scoreRanges.Length + 2 > PerfectDisplay.colors.Length)
            {
                Console.WriteLine("[PerfectionDisplay] Config error - colors should have 2 more colors than there are score ranges, filling the remaining colors with white");
                string[] colors = new string[PerfectDisplay.scoreRanges.Length + 2];
                for (int i = 0; i < colors.Length; i++)
                {
                    if (i < PerfectDisplay.colors.Length)
                    {
                        colors[i] = PerfectDisplay.colors[i];
                    }
                    else
                    {
                        colors[i] = "white";
                    }
                }
                PerfectDisplay.colors = colors;
            }
            for (int i = 0; i < PerfectDisplay.colors.Length; i++)
            {
                if (!PerfectDisplay.colors[i].StartsWith("#"))
                {
                    PerfectDisplay.colors[i] = "\"" + PerfectDisplay.colors[i] + "\"";
                }
            }
            PerfectDisplay.showNumbers    = ModPrefs.GetBool("PerfectionDisplay", "Show Count", PerfectDisplay.showNumbers, true);
            PerfectDisplay.showPercent    = ModPrefs.GetBool("PerfectionDisplay", "Show Percent", PerfectDisplay.showPercent, true);
            PerfectDisplay.shouldHitscore = ModPrefs.GetBool("PerfectionDisplay", "HitScoreVisualizer Integration", PerfectDisplay.shouldHitscore, true);
        }
Example #5
0
        public static Vector3 Position(VideoPlacement placement)
        {
            switch (placement)
            {
            case VideoPlacement.Background:
                return(new Vector3(0, 20, 50));

            case VideoPlacement.Center:
                return(new Vector3(0, 4.5f, 35));

            case VideoPlacement.Left:
                return(new Vector3(-8, 2, 11));

            case VideoPlacement.Right:
                return(new Vector3(8, 2, 11));

            case VideoPlacement.Bottom:
                return(new Vector3(0, -1.5f, 7.35f));

            case VideoPlacement.Top:
                return(new Vector3(0, 5, 10));

            default:     // Custom
                return(ModPrefs.GetString(Plugin.PluginName, "CustomPosition", new Vector3(0, 4, 15).ToString(), true).ToVector3());
            }
        }
Example #6
0
        public static Vector3 Rotation(VideoPlacement placement)
        {
            switch (placement)
            {
            case VideoPlacement.Background:
                return(new Vector3(0, 0, 0));

            case VideoPlacement.Center:
                return(new Vector3(0, 0, 0));

            case VideoPlacement.Left:
                return(new Vector3(0, -30, 0));

            case VideoPlacement.Right:
                return(new Vector3(0, 30, 0));

            case VideoPlacement.Bottom:
                return(new Vector3(15, 0, 0));

            case VideoPlacement.Top:
                return(new Vector3(-15, 0, 0));

            default:     // Custom
                return(ModPrefs.GetString(Plugin.PluginName, "CustomRotation", new Vector3(-10, 0, 0).ToString(), true).ToVector3());
            }
        }
Example #7
0
        private void Start()
        {
            platforms = new PlatformLoader().CreateAllPlatforms(transform);

            // Retrieve saved path from player prefs if it exists
            if (ModPrefs.HasKey(CustomFloorPlugin.PluginName, "CustomPlatformPath"))
            {
                string savedPath = ModPrefs.GetString(CustomFloorPlugin.PluginName, "CustomPlatformPath");
                // Check if this path was loaded and update our platform index
                for (int i = 0; i < platforms.Length; i++)
                {
                    if (savedPath == platforms[i].platName + platforms[i].platAuthor)
                    {
                        platformIndex = i;
                        break;
                    }
                }
            }

            EnvironmentArranger.arrangement        = (EnvironmentArranger.Arrangement)ModPrefs.GetInt(CustomFloorPlugin.PluginName, "EnvironmentArrangement", 0, true);
            EnvironmentSceneOverrider.overrideMode = (EnvironmentSceneOverrider.EnvOverrideMode)ModPrefs.GetInt(CustomFloorPlugin.PluginName, "EnvironmentOverrideMode", 0, true);
            EnvironmentSceneOverrider.GetSceneInfos();
            EnvironmentSceneOverrider.OverrideEnvironmentScene();

            envHider = new EnvironmentHider();
            envHider.showFeetOverride = ModPrefs.GetBool(CustomFloorPlugin.PluginName, "AlwaysShowFeet", false, true);
            envHider.FindEnvironment();
            envHider.HideObjectsForPlatform(currentPlatform);

            currentPlatform.gameObject.SetActive(true);

            BSSceneManager.activeSceneChanged += SceneManagerOnActiveSceneChanged;

            PlatformUI.OnLoad();
        }
Example #8
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);
        }
Example #9
0
        public static void LoadOrCreateConfig()
        {
            if (!Directory.Exists("UserData"))
            {
                Directory.CreateDirectory("UserData");
            }

            //EnablePlugin property
            if (!ModPrefs.HasKey("BeatSaverCustomExit", "EnablePlugin"))
            {
                ModPrefs.SetBool("BeatSaverCustomExit", "EnablePlugin", true);
                Console.WriteLine("Created config");
            }
            else
            {
                EnablePlugin = ModPrefs.GetBool("BeatSaverCustomExit", "EnablePlugin", true, true);
            }

            //TextContent property
            if (!ModPrefs.HasKey("BeatSaverCustomExit", "TextContent"))
            {
                ModPrefs.SetString("BeatSaverCustomExit", "TextContent", "Are you really sure to quit <b><color=#FF6060>Beat <color=#00B0FF>Saber</b><color=#FFFFFF> ?");
                Console.WriteLine("Created config");
            }
            else
            {
                TextContent = ModPrefs.GetString("BeatSaverCustomExit", "TextContent", "Are you really sure to quit <b><color=#FF6060>Beat <color=#00B0FF>Saber</b><color=#FFFFFF> ?", true);
            }
        }
Example #10
0
        public override void OnModSettingsApplied()
        {
            var cursorManager = VRCUiCursorManager.field_Private_Static_VRCUiCursorManager_0;

            if (cursorManager == null)
            {
                return;
            }

            var leftHand  = cursorManager.handLeftCursor;
            var rightHand = cursorManager.handRightCursor;

            if (myOriginalLaserTexture == null)
            {
                myOriginalLaserTexture            = leftHand.GetComponent <LineRenderer>().material.mainTexture.Cast <Texture2D>();
                myOriginalLaserTexture.hideFlags |= HideFlags.DontUnloadUnusedAsset;
            }

            var targetTexture = ModPrefs.GetBool(SettingsCategory, RecolorBeamsSetting) ? myWhiteLaserTexture : myOriginalLaserTexture;

            leftHand.GetComponent <LineRenderer>().material.mainTexture  = targetTexture;
            rightHand.GetComponent <LineRenderer>().material.mainTexture = targetTexture;

            AdjustParticleSystems(leftHand.gameObject);
            AdjustParticleSystems(rightHand.gameObject);

            var color = DecodeColor(ModPrefs.GetString(SettingsCategory, BeamColorSetting));

            ourBeamColor       = color;
            ourDoRecolorSparks = ModPrefs.GetBool(SettingsCategory, RecolorSparksSetting);
            ourDoRecolorBeams  = ModPrefs.GetBool(SettingsCategory, RecolorBeamsSetting);
        }
Example #11
0
        private void CheckForUserDataFolder()
        {
            string userDataPath = Environment.CurrentDirectory + "/UserData";

            if (!Directory.Exists(userDataPath))
            {
                Directory.CreateDirectory(userDataPath);
            }
            if ("".Equals(ModPrefs.GetString(Plugin.PluginName, Plugin.KeyTranparentWall, "")))
            {
                ModPrefs.SetBool(Plugin.PluginName, Plugin.KeyTranparentWall, true);
            }
            if ("".Equals(ModPrefs.GetString(Plugin.PluginName, Plugin.KeyHMD, "")))
            {
                ModPrefs.SetBool(Plugin.PluginName, Plugin.KeyHMD, true);
            }
            if ("".Equals(ModPrefs.GetString(Plugin.PluginName, Plugin.KeyCameraPlus, "")))
            {
                ModPrefs.SetBool(Plugin.PluginName, Plugin.KeyCameraPlus, true);
            }
            if ("".Equals(ModPrefs.GetString(Plugin.PluginName, Plugin.KeyMutiView, "")))
            {
                ModPrefs.SetBool(Plugin.PluginName, Plugin.KeyMutiView, true);
            }
            if ("".Equals(ModPrefs.GetString(Plugin.PluginName, Plugin.KeyDynamicCamera, "")))
            {
                ModPrefs.SetBool(Plugin.PluginName, Plugin.KeyDynamicCamera, true);
            }
            if ("".Equals(ModPrefs.GetString(Plugin.PluginName, Plugin.KeyLIV, "")))
            {
                ModPrefs.SetBool(Plugin.PluginName, Plugin.KeyLIV, true);
            }
        }
        public static void Load()
        {
            Length = ModPrefs.GetFloat(Plugin.Name, nameof(Length), 1f, true);
            Length = Math.Max(0.01f, Math.Min(2f, Length));

            IsTrailEnabled = ModPrefs.GetBool(Plugin.Name, nameof(IsTrailEnabled), true, true);

            TrailLength = ModPrefs.GetInt(Plugin.Name, nameof(TrailLength), 20, true);
            TrailLength = Math.Max(5, Math.Min(100, TrailLength));

            GripLeftPosition = ParseVector3(ModPrefs.GetString(Plugin.Name, nameof(GripLeftPosition), "0,0,0", true)) / 100f;
            GripLeftPosition = new Vector3
            {
                x = Mathf.Clamp(GripLeftPosition.x, -0.5f, 0.5f),
                y = Mathf.Clamp(GripLeftPosition.y, -0.5f, 0.5f),
                z = Mathf.Clamp(GripLeftPosition.z, -0.5f, 0.5f)
            };
            GripLeftRotation = Quaternion.Euler(ParseVector3(ModPrefs.GetString(Plugin.Name, nameof(GripLeftRotation), "0,0,0", true)));

            GripRightPosition = ParseVector3(ModPrefs.GetString(Plugin.Name, nameof(GripRightPosition), "0,0,0", true)) / 100f;
            GripRightPosition = new Vector3
            {
                x = Mathf.Clamp(GripRightPosition.x, -0.5f, 0.5f),
                y = Mathf.Clamp(GripRightPosition.y, -0.5f, 0.5f),
                z = Mathf.Clamp(GripRightPosition.z, -0.5f, 0.5f)
            };
            GripRightRotation = Quaternion.Euler(ParseVector3(ModPrefs.GetString(Plugin.Name, nameof(GripRightRotation), "0,0,0", true)));
        }
        /// <summary>
        /// ONLY USED FOR A SPECIFIC PURPOSE IN "Configuration.cs". DO NOT USE ELSEWHERE!
        /// </summary>
        internal static PluginConfig ImportSettingsFromModPrefs()
        {
            PluginConfig importedSettings = new PluginConfig(); // Initialize a new default configuration

            try
            {
#pragma warning disable CS0618 // ModPrefs is obsolete
                // Import trail configuration
                IsTrailEnabled = ModPrefs.GetBool(Plugin.PluginName, nameof(IsTrailEnabled), true, true);
                importedSettings.IsTrailEnabled = IsTrailEnabled;

                // Import grip position settings, convert old centimeter values to millimeter
                GripLeftPosition = ParseVector3(ModPrefs.GetString(Plugin.PluginName, nameof(GripLeftPosition), "0,0,0", true));
                importedSettings.GripLeftPosition = new Int3()
                {
                    x = (int)Math.Round(Mathf.Clamp(GripLeftPosition.x, -50f, 50f) * 10),
                    y = (int)Math.Round(Mathf.Clamp(GripLeftPosition.y, -50f, 50f) * 10),
                    z = (int)Math.Round(Mathf.Clamp(GripLeftPosition.z, -50f, 50f) * 10)
                };

                GripLeftRotation = ParseVector3(ModPrefs.GetString(Plugin.PluginName, nameof(GripLeftRotation), "0,0,0", true));
                importedSettings.GripLeftRotation = new Int3()
                {
                    x = (int)Math.Round(GripLeftRotation.x),
                    y = (int)Math.Round(GripLeftRotation.y),
                    z = (int)Math.Round(GripLeftRotation.z)
                };

                GripRightPosition = ParseVector3(ModPrefs.GetString(Plugin.PluginName, nameof(GripRightPosition), "0,0,0", true));
                importedSettings.GripRightPosition = new Int3()
                {
                    x = (int)Math.Round(Mathf.Clamp(GripRightPosition.x, -50f, 50f) * 10),
                    y = (int)Math.Round(Mathf.Clamp(GripRightPosition.y, -50f, 50f) * 10),
                    z = (int)Math.Round(Mathf.Clamp(GripRightPosition.z, -50f, 50f) * 10)
                };

                GripRightRotation = ParseVector3(ModPrefs.GetString(Plugin.PluginName, nameof(GripRightRotation), "0,0,0", true));
                importedSettings.GripRightRotation = new Int3()
                {
                    x = (int)Math.Round(GripRightRotation.x),
                    y = (int)Math.Round(GripRightRotation.y),
                    z = (int)Math.Round(GripRightRotation.z)
                };

                ModifyMenuHiltGrip = ModPrefs.GetBool(Plugin.PluginName, nameof(ModifyMenuHiltGrip), true, true);
                importedSettings.ModifyMenuHiltGrip = ModifyMenuHiltGrip;
#pragma warning restore CS0618 // ModPrefs is obsolete

                // Mark imported config as config version 1 so it will run through all steps of the config updater
                importedSettings.ConfigVersion = 1;

                MarkAsExported();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(importedSettings);
        }
        private void Init()
        {
            buttonData    = new List <MenuButton>();
            rows          = new List <RectTransform>();
            pinnedButtons = ModPrefs.GetString("CustomUI", "PinnedMenuButtons", "", true).Split(',').ToList();

            StartCoroutine(AddMenuButtonListButton());
        }
Example #15
0
        internal static void LoadSettings(LoadSettingsType type)
        {
            string iniName = ModPrefs.GetString("Chroma", "ConfigProfile", "default", true); //TODO get the thing

            IniProfile = new BS_Utils.Utilities.Config("Chroma/Preferences/" + iniName);

            LoadSettingsEvent?.Invoke(IniProfile, type);
        }
Example #16
0
        private void Init()
        {
            Plugin.Log("Initialized!", Plugin.LogLevel.DebugOnly);
            failedLevelsCountReplacementText = ModPrefs.GetString("MenuTweaks", "FailedCounterReplacementText", "HIDDEN", false);
            ModPrefs.SetString("MenuTweaks", "FailedLevelsReplacementText", failedLevelsCountReplacementText);

            showFailCounter = ModPrefs.GetBool("MenuTweaks", "FailCounterVisible", true, true);
        }
Example #17
0
 public static void Read()
 {
     AutoDownloadSongs  = ModPrefs.GetBool("SyncSaber", "AutoDownloadSongs", true);
     AutoUpdateSongs    = ModPrefs.GetBool("SyncSaber", "AutoUpdateSongs", true);
     BeastSaberUsername = ModPrefs.GetString("SyncSaber", "BeastSaberUsername", "");
     MaxBeastSaberPages = ModPrefs.GetInt("SyncSaber", "MaxBeastSaberPages", 0);
     DeleteOldVersions  = ModPrefs.GetBool("SyncSaber", "DeleteOldVersions", true);
 }
Example #18
0
        public void OnLateUpdate()
        {
            if (Input.GetKeyDown((KeyCode)System.Enum.Parse(typeof(KeyCode), ModPrefs.GetString("BodySliders", "enable|disable"))) && Manager.Scene.Instance.ActiveScene.name == "Studio")
            {
                Switch();
            }

            windowPosition = SlidersUI.windowMain.position;
            onlyBodyValues = SlidersUI.onlySliderValues;
        }
Example #19
0
        public void OnUpdate()
        {
            if (!Input.GetKeyDown(KeyCode.LeftAlt))
            {
                return;
            }

            var path = ModPrefs.GetString("injectLoader", "path", "C:\\Mod.dll", true);

            LoadDLL(path);
        }
Example #20
0
        public void OnApplicationStart()
        {
            SharedCoroutineStarter.instance.StartCoroutine(Patch());

            CutClip      = createHapticsClip(ModPrefs.GetString(Name, "CutClip", "0,0,0,0,255,255,255,0,255,255,255,0,255,255,0,255,255,0,200,200,0,200,200,0,120,120,0,90,90,0,90,90", true));
            MissCutClip  = createHapticsClip(ModPrefs.GetString(Name, "MissCutClip", "0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255", true));
            BombClip     = createHapticsClip(ModPrefs.GetString(Name, "BombClip", "0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255", true));
            UIClip       = createHapticsClip(ModPrefs.GetString(Name, "UIClip", "80,100,0,0,0,0", true));
            ClashClip    = createHapticsClip(ModPrefs.GetString(Name, "SaberClashClip", "45,90,135,180,0,0,0,0,0,0", true));
            ObstacleClip = createHapticsClip(ModPrefs.GetString(Name, "ObstacleClip", "255,255,255,0,255,255,255,0", true));
        }
Example #21
0
 Config()
 {
     _serverHubIPs             = new string[] { "127.0.0.1", "soupwhale.com", "hub.assistant.moe", "hub.n3s.co", "hub.auros.red", "beige.space", "treasurehunters.nz", "beatsaber.networkauditor.org", "hub.ligma.site", "hub.jogi-server.de", "beatsaberhub.freddi.xyz" };
     _serverHubPorts           = new int[] { 3700, 3700, 3700, 3700, 3700, 3700, 3700, 3700, 3700, 3700, 3700 };
     _showAvatarsInGame        = false;
     _showAvatarsInRoom        = true;
     _downloadAvatars          = true;
     _spectatorMode            = false;
     _maxSimultaneousDownloads = ModPrefs.GetInt("BeatSaverDownloader", "maxSimultaneousDownloads", 3);
     _beatSaverURL             = ModPrefs.GetString("BeatSaverDownloader", "beatsaverURL", "https://beatsaver.com");
     IsDirty = true;
 }
        public Config(string filePath)
        {
            FilePath = filePath;

            if (File.Exists(filePath))
            {
                Load();
            }
            else
            {
                // If their old config exists, rename it then load their settings
                if (File.Exists("UserData\\BetterTwitchChat.ini"))
                {
                    File.Move("UserData\\BetterTwitchChat.ini", "UserData\\EnhancedTwitchChat.ini");
                    Load();
                    Plugin.Log("Migrated settings from BetterTwitchChat.ini to EnhancedTwitchChat.ini");
                }
                else
                {
                    string configSectionName = "BetterTwitchChat";
                    if (ModPrefs.GetString(configSectionName, "ChannelToJoin") != String.Empty && !ModPrefs.GetBool(configSectionName, "Migrated", false))
                    {
                        //TwitchoAuthToken = ModPrefs.GetString(configSectionName, "oAuth_Token", string.Empty);
                        //TwitchUsername = ModPrefs.GetString(configSectionName, "Username", string.Empty);
                        TwitchChannel     = ModPrefs.GetString(configSectionName, "ChannelToJoin", String.Empty).ToLower().Replace(" ", "");
                        ChatPosition      = new Vector3(ModPrefs.GetFloat(configSectionName, "PositionX", 2.0244143f), ModPrefs.GetFloat(configSectionName, "PositionY", 0.373768f), ModPrefs.GetFloat(configSectionName, "PositionZ", 0.08235432f));
                        ChatRotation      = new Vector3(ModPrefs.GetFloat(configSectionName, "RotationX", 2.026023f), ModPrefs.GetFloat(configSectionName, "RotationY", 97.58616f), ModPrefs.GetFloat(configSectionName, "RotationZ", 1.190764f));
                        TextColor         = new Color(ModPrefs.GetFloat(configSectionName, "TextColorRed", 1), ModPrefs.GetFloat(configSectionName, "TextColorGreen", 1), ModPrefs.GetFloat(configSectionName, "TextColorBlue", 1), ModPrefs.GetFloat(configSectionName, "TextColorAlpha", 1));
                        BackgroundColor   = new Color(ModPrefs.GetFloat(configSectionName, "BackgroundRed", 0), ModPrefs.GetFloat(configSectionName, "BackgroundGreen", 0), ModPrefs.GetFloat(configSectionName, "BackgroundBlue", 0), ModPrefs.GetFloat(configSectionName, "BackgroundAlpha", 0.5f));
                        MaxMessages       = ModPrefs.GetInt(configSectionName, "MaxChatLines", 20);
                        ChatWidth         = ModPrefs.GetFloat(configSectionName, "ChatWidth", 160);
                        BackgroundPadding = ModPrefs.GetFloat(configSectionName, "BackgroundPadding", 4);
                        FontName          = ModPrefs.GetString(configSectionName, "SystemFontName", "Segoe UI");
                        ReverseChatOrder  = ModPrefs.GetBool(configSectionName, "ReverseChatOrder", false);
                        LockChatPosition  = ModPrefs.GetBool(configSectionName, "LockChatPosition", false);

                        ModPrefs.SetBool(configSectionName, "Migrated", true);

                        Plugin.Log("Migrated old config settings to EnhancedTwitchChat.ini!");
                    }
                    Save();
                }
            }

            _configWatcher = new FileSystemWatcher($"{Environment.CurrentDirectory}\\UserData")
            {
                NotifyFilter        = NotifyFilters.LastWrite,
                Filter              = "EnhancedTwitchChat.ini",
                EnableRaisingEvents = true
            };
            _configWatcher.Changed += ConfigWatcherOnChanged;
        }
Example #23
0
 public static void Read()
 {
     AutoDownloadSongs          = ModPrefs.GetBool(Plugin.Instance.Name, "AutoDownloadSongs", true);
     AutoUpdateSongs            = ModPrefs.GetBool(Plugin.Instance.Name, "AutoUpdateSongs", true);
     BeastSaberUsername         = ModPrefs.GetString(Plugin.Instance.Name, "BeastSaberUsername", "");
     DeleteOldVersions          = ModPrefs.GetBool(Plugin.Instance.Name, "DeleteOldVersions", true);
     SyncBookmarksFeed          = ModPrefs.GetBool(Plugin.Instance.Name, "SyncBookmarksFeed", true);
     SyncCuratorRecommendedFeed = ModPrefs.GetBool(Plugin.Instance.Name, "SyncCuratorRecommendedFeed", false);
     SyncFollowingsFeed         = ModPrefs.GetBool(Plugin.Instance.Name, "SyncFollowingsFeed", true);
     MaxFollowingsPages         = ModPrefs.GetInt(Plugin.Instance.Name, "MaxFollowingsPages", 0);
     MaxCuratorRecommendedPages = ModPrefs.GetInt(Plugin.Instance.Name, "MaxCuratorRecommendedPages", 0);
     MaxBookmarksPages          = ModPrefs.GetInt(Plugin.Instance.Name, "MaxBookmarksPages", 0);
 }
Example #24
0
        bool LoadSettings()
        {
            try
            {
                string keystring = ModPrefs.GetString("HideUI", "HideUIHotkey", 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);
        }
Example #25
0
        private void Start()
        {
            instance = Singleton <HSceneManager> .Instance;
            camera   = FindObjectOfType <CameraControl_Ver2>();
            defaultCameraMoveSpeed = camera.moveSpeed;

            lockOnHotkey              = new Hotkey(ModPrefs.GetString("LockOnPlugin", "LockOnHotkey", "M", true).ToLower()[0].ToString(), 0.5f);
            rotationHotkey            = new Hotkey(ModPrefs.GetString("LockOnPlugin", "RotationHotkey", "N", true).ToLower()[0].ToString(), 0.5f);
            lockedZoomSpeed           = ModPrefs.GetFloat("LockOnPlugin", "LockedZoomSpeed", 5.0f, true);
            lockedMinDistance         = Math.Abs(ModPrefs.GetFloat("LockOnPlugin", "LockedMinDistance", 0.2f, true));
            lockedTrackingSpeed1      = lockedTrackingSpeed2 = Math.Abs(ModPrefs.GetFloat("LockOnPlugin", "LockedTrackingSpeed", 0.1f, true));
            boneList                  = ModPrefs.GetString("LockOnPlugin", "BoneList", "J_Head|J_Mune00|J_Spine01|J_Kokan", true).Split('|');
            camera.isOutsideTargetTex = !Convert.ToBoolean(ModPrefs.GetString("LockOnPlugin", "HideCameraTarget", "True", true));
            manageCursorVisibility    = Convert.ToBoolean(ModPrefs.GetString("LockOnPlugin", "ManageCursorVisibility", "True", true));
        }
Example #26
0
        public override void OnApplicationStart()
        {
            ModPrefs.RegisterCategory(ModCategory, "Camera Resolution");
            ModPrefs.RegisterPrefString(ModCategory, Resolution1NamePref, "1080p", "Resolution 1 Name:");
            ModPrefs.RegisterPrefString(ModCategory, Resolution2NamePref, "4K", "Resolution 2 Name:");
            ModPrefs.RegisterPrefString(ModCategory, Resolution3NamePref, "8K", "Resolution 3 Name:");
            ModPrefs.RegisterPrefInt(ModCategory, Resolution1Pref, 1080, "Resolution 1: (Photo height, unstable > 4320)");
            ModPrefs.RegisterPrefInt(ModCategory, Resolution2Pref, 2160, "Resolution 2: (Photo height, unstable > 4320)");
            ModPrefs.RegisterPrefInt(ModCategory, Resolution3Pref, 4320, "Resolution 3: (Photo height, unstable > 4320)");
            ModPrefs.RegisterPrefInt(ModCategory, ResolutionPref, 2, "Default resolution setting (1-3)");

            ExpansionKitApi.RegisterSimpleMenuButton(ExpandedMenu.CameraQuickMenu, ModPrefs.GetString(ModCategory, Resolution1NamePref), Resolution1);
            ExpansionKitApi.RegisterSimpleMenuButton(ExpandedMenu.CameraQuickMenu, ModPrefs.GetString(ModCategory, Resolution2NamePref), Resolution2);
            ExpansionKitApi.RegisterSimpleMenuButton(ExpandedMenu.CameraQuickMenu, ModPrefs.GetString(ModCategory, Resolution3NamePref), Resolution3);
        }
Example #27
0
        public float getHeight()
        {
            String height = ModPrefs.GetString("MARUNEO", "height", "0.8");

            float ret = 0.8f;

            try
            {
                ret = float.Parse(height);
            }
            catch (Exception e)
            {
            }
            return(ret);
        }
Example #28
0
        public static KeyCode GetMirrorKeybind()
        {
            string modPrefKeybind = ModPrefs.GetString("PortableMirror", "MirrorKeybind").Trim();

            if (string.IsNullOrWhiteSpace(modPrefKeybind))
            {
                modPrefKeybind = "Alpha1";
            }
            if (modPrefKeybind.Length == 1)
            {
                char keybindChar = modPrefKeybind.ToLower()[0];
                return((KeyCode)keybindChar);
            }
            modPrefKeybind = char.ToUpper(modPrefKeybind[0]) + modPrefKeybind.Substring(1);
            return(Enum.TryParse(modPrefKeybind, out KeyCode keybind) ? keybind : KeyCode.Alpha1);
        }
Example #29
0
        public float getDistance()
        {
            // 設定ファイルから値を読みだすには、userdata/ModPerfs.iniに書いた上で下記を使用する。
            String distance = ModPrefs.GetString("MARU", "distance", "5");

            float ret = 5.0f;

            try
            {
                ret = float.Parse(distance);
            }
            catch (Exception e)
            {
            }
            return(ret);
        }
        public void OnApplicationStart()
        {
            if (_init)
            {
                return;
            }
            _init = true;

            scoreCounterPosition = ReadVector(ModPrefs.GetString("BeatSaberProgressCounter", "scorePosition",
                                                                 FormatVector(scoreCounterPosition), true));
            progressCounterPosition = ReadVector(ModPrefs.GetString("BeatSaberProgressCounter", "progressPosition",
                                                                    FormatVector(progressCounterPosition), true));

            progressTimeLeft = ModPrefs.GetBool("BeatSaberProgressCounter", "progressTimeLeft", false, true);
            progressCounterDecimalPrecision = ModPrefs.GetInt("BeatSaberProgressCounter", "progressCounterDecimalPrecision", 1, true);

            SceneManager.activeSceneChanged += OnSceneChanged;
        }