Example #1
0
        private void Awake()
        {
            bepinex = gameObject;
            Logger  = base.Logger;

            TargetData.LoadData();

            TrackingSpeedNormal = Config.Bind(SECTION_GENERAL, "Tracking speed", 0.1f, new ConfigDescription(DESCRIPTION_TRACKSPEED, new AcceptableValueRange <float>(0.01f, 0.3f), new ConfigurationManagerAttributes {
                Order = 10
            }));
            ScrollThroughMalesToo = Config.Bind(SECTION_GENERAL, "Scroll through males too", true, new ConfigDescription(DESCRIPTION_SCROLLMALES, null, new ConfigurationManagerAttributes {
                Order = 8
            }));
            ShowInfoMsg = Config.Bind(SECTION_GENERAL, "Show info messages", false, new ConfigDescription(DESCRIPTION_SHOWINFOMSG, null, new ConfigurationManagerAttributes {
                Order = 6
            }));
            LockLeashLength = Config.Bind(SECTION_GENERAL, "Leash length", 0f, new ConfigDescription(DESCRIPTION_LEASHLENGTH, new AcceptableValueRange <float>(0f, 0.5f), new ConfigurationManagerAttributes {
                Order = 9
            }));
            AutoSwitchLock = Config.Bind(SECTION_GENERAL, "Auto switch lock", false, new ConfigDescription(DESCRIPTION_AUTOLOCK, null, new ConfigurationManagerAttributes {
                Order = 7
            }));

            LockOnKey = Config.Bind(SECTION_HOTKEYS, "Lock on", new KeyboardShortcut(KeyCode.Mouse4), new ConfigDescription("", null, new ConfigurationManagerAttributes {
                Order = 10
            }));
            PrevCharaKey = Config.Bind(SECTION_HOTKEYS, "Select previous character", new KeyboardShortcut(KeyCode.None), new ConfigDescription("", null, new ConfigurationManagerAttributes {
                Order = 8
            }));
            NextCharaKey = Config.Bind(SECTION_HOTKEYS, "Select next character", new KeyboardShortcut(KeyCode.None), new ConfigDescription("", null, new ConfigurationManagerAttributes {
                Order = 9
            }));

            harmony = HarmonyWrapper.PatchAll();
        }
Example #2
0
        private static void LoadResourceData()
        {
            var ass          = typeof(LockOnPluginCore).Assembly;
            var resourceName = $"{ass.GetName().Name}.{dataFileName}";

            using (var stream = ass.GetManifestResourceStream(resourceName))
            {
                using (var reader = new StreamReader(stream))
                {
                    string json = reader.ReadToEnd();
                    data = JSONSerializer.Deserialize <TargetData>(json);
                }
            }
        }
Example #3
0
        public static void LoadData()
        {
            var dataPath = Path.Combine(Paths.ConfigPath, dataFileName);

            if (File.Exists(dataPath))
            {
                try
                {
                    var json = File.ReadAllText(dataPath);
                    data = JSONSerializer.Deserialize <TargetData>(json);
                    LockOnPluginCore.Logger.Log(LogLevel.Info, "Loading custom target data.");
                }
                catch (Exception)
                {
                    LockOnPluginCore.Logger.Log(LogLevel.Info, "Failed to deserialize custom target data. Loading default target data.");
                    LoadResourceData();
                }
            }
            else
            {
                LockOnPluginCore.Logger.Log(LogLevel.Debug, "Loading default target data.");
                LoadResourceData();
            }
        }