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); } }
//performed each frame public void SetupText() { if (_label == null || !_label.isVisible) { return; } _label.text = DetoursManager.IsDeployed()? On : Off; }
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); } }
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>(); }
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); } }
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; } }
public override void OnCreated(ILoading loading) { base.OnCreated(loading); DetoursManager.Deploy(false); }
public override void OnReleased() { base.OnReleased(); DetoursManager.Revert(true); }