public override void OnUpdate(float realTimeDelta, float simulationTimeDelta) { //if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) && Input.GetKey(KeyCode.P)) if (ModInfo.ModShortcut.IsPressed()) { if (_processed) { return; } _processed = true; if (UIWindow.Instance != null && LoadingExt.patched) { //UIWindow.Instance.enabled = !UIWindow.Instance.enabled; AdjustPathfindingTool.Instance.enabled = !AdjustPathfindingTool.Instance.enabled; } } else { _processed = false; } if (UIWindow.Instance && !UIPanelButton.instance && ModInfo.ShowUIButton.value) // If UIPanel has been already initialized && button missing { UIPanelButton.CreateButton(); } }
public override void OnUpdate(float realTimeDelta, float simulationTimeDelta) { if (RoundAboutBuilder.ModShortcut.IsPressed()) { // cancel if they key input was already processed in a previous frame if (_processed) { return; } _processed = true; if (UIWindow.instance == null) { return; } //Activating/deactivating tool & UI UIWindow.instance.Toggle(); } else if (UIWindow.instance.enabled) { _processed = KeysPressed(); } else { _processed = false; } // Mouse wheel /*if (Input.GetAxis("Mouse ScrollWheel") > 0f) // forward * { * UIWindow2.instance.toolOnUI?.IncreaseButton(); * } * else if (Input.GetAxis("Mouse ScrollWheel") < 0f) // backwards * { * UIWindow2.instance.toolOnUI?.DecreaseButton(); * }*/ /* Check for UI panel button */ if (UIWindow.instance && !UIPanelButton.Instance && RoundAboutBuilder.ShowUIButton.value) // If UIPanel has been already initialized && button missing { UIPanelButton.CreateButton(); } /* Delayed setup */ if (timeUp) { timeUp = false; try { m_TMPEaction.Do(); } catch (Exception e) { Debug.LogWarning(e); } } }
private bool FindButton(string buttonName, out UIPanelButton button) { for (int i = 0; i < buttons.Length; i++) { if (buttonName == buttons[i].name) { button = buttons[i]; return(true); } } button = new UIPanelButton(); return(false); }
public override void OnUpdate(float realTimeDelta, float simulationTimeDelta) { if (RoundAboutBuilder.ModShortcut.IsPressed()) { // cancel if they key input was already processed in a previous frame if (_processed) { return; } _processed = true; if (UIWindow2.instance == null) { return; } //Activating/deactivating tool & UI //UIWindow.Instance.enabled = !UIWindow.Instance.enabled; UIWindow2.instance.enabled = !UIWindow2.instance.enabled; //NodeSelection.instance.enabled = UIWindow.Instance.enabled; } else if (UIWindow2.instance.enabled) { _processed = KeysPressed(); } else { _processed = false; } /* Check for UI panel button */ if (UIWindow2.instance && !UIPanelButton.Instance && RoundAboutBuilder.ShowUIButton.value) // If UIPanel has been already initialized && button missing { UIPanelButton.CreateButton(); } /* Delayed setup */ if (timeUp) { timeUp = false; try { m_TMPEaction.Do(); } catch (Exception e) { Debug.LogWarning(e); } } }