void PressedButton(EntityHUD.Button btn, string arg = null) { if (btn.currentWindow != null && btn.currentWindow.IsActive && btn.toggle) { EntityOverlayWindow currentWindow = btn.currentWindow; btn.currentWindow = null; currentWindow.Hide(); } else if (btn.currentWindow == null && btn.action.CanShow(this._entity)) { if (btn.action.Exclusive) { List <GameObject> list = new List <GameObject>(); for (int i = this.ownedObjects.Count - 1; i >= 0; i--) { GameObject gameObject = this.ownedObjects[i]; if (gameObject.activeInHierarchy) { gameObject.SetActive(false); list.Add(gameObject); } } btn.hiddenObjects = list; } btn.currentWindow = btn.action.DoShow(this._entity, delegate { this.WindowDone(btn); }, arg); } }
public void PressedAction(EntityHUDAction action, string arg = null) { EntityHUD.Button btn = new EntityHUD.Button(new EntityHUDData.Button { buttonAction = action }); this.PressedButton(btn, arg); }
void SetupButtons() { if (this.buttons == null) { EntityHUDData.Button[] array = this._data.GetButtons(); this.buttons = new List <EntityHUD.Button>(array.Length); this.buttonListeners = new List <MappedInput.ButtonEventListener>(array.Length); for (int i = 0; i < array.Length; i++) { EntityHUDData.Button button = array[i]; EntityHUD.Button nBtn = new EntityHUD.Button(button); this.buttons.Add(nBtn); if (nBtn.button != null) { this.ownedObjects.Add(nBtn.button.gameObject); GuiClickable componentInChildren = nBtn.button.gameObject.GetComponentInChildren <GuiClickable>(); if (componentInChildren != null) { GuiClickableWheel guiClickableWheel = componentInChildren as GuiClickableWheel; if (guiClickableWheel != null) { guiClickableWheel.onclick = delegate(object b) { this.PressedWheel(); }; guiClickableWheel.ondir = delegate(Vector2 d) { this.UpdateWheel(d); }; guiClickableWheel.onrelease = delegate(object b) { this.ReleasedWheel(); }; } else { componentInChildren.onclick = delegate(object b) { this.PressedButton(nBtn, null); }; } } } if (button.hotkey != null) { this.buttonListeners.Add(this._input.RegisterButtonDown(button.hotkey, delegate(InputButton b) { this.PressedButton(nBtn, null); }, -1)); } } } if (this.mouseTag == null && PlatformInfo.Current.AllowMouseInput) { this.mouseTag = PrioMouseHandler.GetHandler(this._input).GetListener(2, new PrioMouseHandler.MouseDownFunc(this.MouseDown), new PrioMouseHandler.MouseMoveFunc(this.MouseMove), new PrioMouseHandler.MouseUpFunc(this.MouseUp)); } }
void WindowDone(EntityHUD.Button btn) { btn.currentWindow = null; List <GameObject> hiddenObjects = btn.hiddenObjects; btn.hiddenObjects = null; if (hiddenObjects != null) { for (int i = hiddenObjects.Count - 1; i >= 0; i--) { hiddenObjects[i].SetActive(true); } } this.UpdateSaveVarWindows(); }