Пример #1
0
 public void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         SceneManager.activeSceneChanged += SceneManagerOnActiveSceneChanged;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(this);
     }
 }
Пример #2
0
        private void OnActiveSceneChanged(Scene arg0, Scene arg1)
        {
            if (env.Contains(arg1.name) && (ModPrefs.GetBool("ImmersiveMode", "HMDEnabled", false, true) || ModPrefs.GetBool("ImmersiveMode", "MirrorEnabled", false, true)))
            {
                new GameObject("HUDHider").AddComponent <HUDHider>();
                new GameObject("WaitForFailText").AddComponent <WaitForFailText>();
            }
            else if (SettingsUI.isMenuScene(arg1))
            {
                var subMenu = SettingsUI.CreateSubMenu("Immersive Mode");

                var hmd    = subMenu.AddBool("Hide in HMD");
                var mirror = subMenu.AddBool("Hide in MIRROR");

                hmd.GetValue += delegate { return(ModPrefs.GetBool("ImmersiveMode", "HMDEnabled", false, true)); };
                hmd.SetValue += delegate(bool value) { ModPrefs.SetBool("ImmersiveMode", "HMDEnabled", value); };

                mirror.GetValue += delegate { return(ModPrefs.GetBool("ImmersiveMode", "MirrorEnabled", false, true)); };
                mirror.SetValue += delegate(bool value) { ModPrefs.SetBool("ImmersiveMode", "MirrorEnabled", value); };
            }
        }