Exemplo n.º 1
0
 public void Update()
 {
     if (OptionsWrapper <Options> .Options.noUi)
     {
         _label.Hide();
     }
     if (OptionsWrapper <Options> .Options.anarchyAlwaysOn)
     {
         DetoursManager.Deploy(true);
         SetupText();
         return;
     }
     if (!OptionsWrapper <Options> .Options.noUi)
     {
         _label.Show();
         SetupText();
     }
     if (!InputUtil.IsComboPressed())
     {
         return;
     }
     if (DetoursManager.IsDeployed())
     {
         DetoursManager.Revert(true);
     }
     else
     {
         DetoursManager.Deploy(true);
     }
 }
Exemplo n.º 2
0
 //performed each frame
 public void SetupText()
 {
     if (_label == null || !_label.isVisible)
     {
         return;
     }
     _label.text = DetoursManager.IsDeployed()? On : Off;
 }
Exemplo n.º 3
0
        public override void OnLevelUnloading()
        {
            DetoursManager.Revert(true);
            DetoursManager.Deploy(false); //to save the trees on reloading
            var go = GameObject.Find("PropAnarchy");

            if (go != null)
            {
                Object.Destroy(go);
            }
        }
Exemplo n.º 4
0
 public override void OnLevelLoaded(LoadMode mode)
 {
     base.OnLevelLoaded(mode);
     if (OptionsWrapper <Options> .Options.anarchyAlwaysOn || OptionsWrapper <Options> .Options.anarchyOnByDefault)
     {
         DetoursManager.Deploy(true);
     }
     else
     {
         DetoursManager.Revert(true);
     }
     new GameObject("PropAnarchy").AddComponent <PropAnarchyUI>();
 }
Exemplo n.º 5
0
 public static void ImUpToNoGood(string modName)
 {
     UnityEngine.Debug.Log($"Prop Anarchy - enable prevent props & trees from disappearing ({modName})");
     lock (ClassLock)
     {
         if (_currentThread != -1)
         {
             UnityEngine.Debug.LogError("Prop Anarchy - PropAnarchyHook::ImUpToNoGood() - _currentThread wasn't null");
             throw new Exception("Some other code is already using prop anarchy hook. Make sure all calls happen in the simulation thread");
         }
         _currentThread = Thread.CurrentThread.ManagedThreadId;
         DetoursManager.Deploy(false);
     }
 }
Exemplo n.º 6
0
 public static void MischiefManaged(string modName)
 {
     UnityEngine.Debug.Log($"Prop Anarchy - disable prevent props & trees from disappearing ({modName})");
     lock (ClassLock)
     {
         if (_currentThread != Thread.CurrentThread.ManagedThreadId)
         {
             UnityEngine.Debug.LogError("Prop Anarchy - PropAnarchyHook::MischiefManaged() - current thread no equal to _currentThread");
             throw new Exception("Some other code is already using prop anarchy hook. Make sure all calls happen in the simulation thread");
         }
         if (!DetoursManager.GetCachedDeployedState())
         {
             DetoursManager.Revert(false);
         }
         _currentThread = -1;
     }
 }
Exemplo n.º 7
0
 public override void OnCreated(ILoading loading)
 {
     base.OnCreated(loading);
     DetoursManager.Deploy(false);
 }
Exemplo n.º 8
0
 public override void OnReleased()
 {
     base.OnReleased();
     DetoursManager.Revert(true);
 }