public void Awake() { instance = this; thisObj = gameObject; canvasGroup = thisObj.GetComponent <CanvasGroup>(); if (canvasGroup == null) { canvasGroup = thisObj.AddComponent <CanvasGroup>(); } canvasGroup.alpha = 0; thisObj.SetActive(false); thisObj.GetComponent <RectTransform>().anchoredPosition = new Vector3(0, 0, 0); fpsItem.Init(); recticleSpreadDefaultSize = recticleSpreadRectT.sizeDelta; reloadProgressObj = imgReloadProgress.transform.parent.gameObject; reloadProgressObj.SetActive(false); UIItemCallback itemCallback = buttonFireObj.AddComponent <UIItemCallback>(); itemCallback.SetDownCallback(this.OnFireButtonDown); itemCallback.SetUpCallback(this.OnFireButtonUp); buttonExit.Init(); }
public void SetCallback(Callback enter = null, Callback exit = null, CallbackInputDependent down = null, CallbackInputDependent up = null) { itemCallback = rootObj.AddComponent <UIItemCallback>(); itemCallback.SetEnterCallback(enter); itemCallback.SetExitCallback(exit); itemCallback.SetDownCallback(down); itemCallback.SetUpCallback(up); }