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 Awake() { if (this._player == null) { this._player = base.GetComponent <Entity>(); } if (this._mainCam == null) { GameObject gameObject = GameObject.Find("Main Camera"); if (gameObject != null) { this._mainCam = gameObject.GetComponent <Camera>(); } } if (PlatformInfo.Current.AllowMouseInput) { this.mouseTag = PrioMouseHandler.GetHandler(this._input).GetListener(0, new PrioMouseHandler.MouseDownFunc(this.MouseDown), null, new PrioMouseHandler.MouseUpFunc(this.MouseUp)); } }