示例#1
0
        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();
        }
示例#2
0
 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);
 }