Esempio n. 1
0
        private async void SceneManager_sceneLoaded(Scene arg0, Scene arg1)
        {
            if (CountersController.settings.Enabled)
            {
                CountersController.OnLoad();
            }
            if (arg1.name == "GameCore" &&
                CountersController.settings.Enabled &&
                (!Resources.FindObjectsOfTypeAll <PlayerDataModelSO>()
                 .FirstOrDefault()?
                 .currentLocalPlayer.playerSpecificSettings.noTextsAndHuds ?? true)
                )
            {
                CountersController.LoadCounters();
            }
            if (reloadConfig)
            {
                await EnsureConfigSaves();

                if (saveOnReload)
                {
                    CountersController.settings.isSaving = true;
                    CountersController.settings.save();
                    await EnsureConfigSaves();
                }
                CountersController.settings = Config.Config.loadSettings();
                if (CountersController.Instance == null)
                {
                    CountersController.OnLoad();
                }
                reloadConfig = false;
                saveOnReload = false;
            }
        }
Esempio n. 2
0
        private void GameCoreLoaded()
        {
            PlayerDataModel dataModel = UnityEngine.Resources.FindObjectsOfTypeAll <PlayerDataModel>().FirstOrDefault();

            if (CountersController.settings.Enabled && !(dataModel?.playerData.playerSpecificSettings.noTextsAndHuds ?? false))
            {
                CountersController.LoadCounters();
            }
        }
Esempio n. 3
0
        internal static BS_Utils.Utilities.Config config = new BS_Utils.Utilities.Config("CountersPlus"); //Conflicts with CountersPlus.Config POG

        public void OnApplicationStart()
        {
            if (!File.Exists(Environment.CurrentDirectory.Replace('\\', '/') + "/UserData/CountersPlus.ini"))
            {
                File.Create(Environment.CurrentDirectory.Replace('\\', '/') + "/UserData/CountersPlus.ini");
            }
            SceneManager.activeSceneChanged += SceneManager_sceneLoaded;
            SceneManager.sceneLoaded        += addUI;
            CountersController.OnLoad();
        }
Esempio n. 4
0
 public void OnActiveSceneChanged(Scene arg0, Scene arg1)
 {
     //if (CountersController.settings.Enabled) CountersController.OnLoad();
     if (arg1.name == "GameCore" &&
         CountersController.settings.Enabled &&
         (!Resources.FindObjectsOfTypeAll <PlayerDataModelSO>()
          .FirstOrDefault()?
          .currentLocalPlayer.playerSpecificSettings.noTextsAndHuds ?? true)
         )
     {
         CountersController.LoadCounters();
     }
 }
Esempio n. 5
0
 public void OnActiveSceneChanged(Scene arg0, Scene arg1)
 {
     if (arg1.name == "GameCore" &&
         CountersController.settings.Enabled &&
         (!UnityEngine.Resources.FindObjectsOfTypeAll <PlayerDataModelSO>()
          .FirstOrDefault()?
          .playerData.playerSpecificSettings.noTextsAndHuds ?? true)
         )
     {
         CountersController.LoadCounters();
     }
     CountersController.LoadedCounters.Clear();
 }
Esempio n. 6
0
        public void OnApplicationStart()
        {
            try
            {
                harmonyInstance = HarmonyInstance.Create(harmonyId);
                harmonyInstance.PatchAll(System.Reflection.Assembly.GetExecutingAssembly());
            }
            catch (Exception ex)
            {
                Log($"{ex.Message}", LogInfo.Fatal, "Unable to apply Harmony patches. Did you even install BSIPA correctly?");
            }

            CountersController.OnLoad();
        }
Esempio n. 7
0
        public void OnApplicationStart()
        {
            Instance = this;

            try
            {
                harmonyInstance = HarmonyInstance.Create(harmonyId);
                harmonyInstance.PatchAll(System.Reflection.Assembly.GetExecutingAssembly());
            }
            catch (Exception ex)
            {
                Log($"{ex.Message}\n{ex.StackTrace}", LogInfo.Fatal, "Unable to apply Harmony patches. Are you missing a dependency?");
            }

            CountersController.OnLoad();

            Log($"{PluginName} v.{PluginVersion} has started.", LogInfo.Notice);
        }
Esempio n. 8
0
 public void OnApplicationStart()
 {
     if (File.Exists(Environment.CurrentDirectory.Replace('\\', '/') + "/BeatSaberVersion.txt"))
     {   //I wont be specific (0.12.0p1 VS 0.12.0b1) unless those updates cause issues
         string version = File.ReadAllText(Environment.CurrentDirectory.Replace('\\', '/') + "/BeatSaberVersion.txt");
         if (version.Contains("0.12.0"))
         {
             beatSaberVersion = "0.12.0";
         }
         if (version.Contains("0.12.1"))
         {
             beatSaberVersion = "0.12.1";
         }
         if (version.Contains("0.12.2"))
         {
             beatSaberVersion = "0.12.2";
         }
         Log("Found general Beat Saber version. Running: " + beatSaberVersion);
     }
     SceneManager.activeSceneChanged += SceneManager_sceneLoaded;
     SceneManager.sceneLoaded        += addUI;
     CountersController.OnLoad();
 }