示例#1
0
 public void Init(OnClickFunc func, System.Object param = null)
 {
     if (CdImageTrans == null)
     {
         CdImageTrans = transform.Find("CDImage").GetComponent <RectTransform>();
     }
     if (TimeText == null)
     {
         TimeText = transform.Find("Text").GetComponent <Text>();
     }
     if (LockObj == null)
     {
         LockObj = transform.Find("LockImage").gameObject;
     }
     if (ItemButton == null)
     {
         ItemButton = gameObject.GetComponent <Button>();
         if (ItemButton != null)
         {
             ItemButton.onClick.RemoveAllListeners();
             ItemButton.onClick.AddListener(OnClickGoodsBtn);
         }
     }
     gameObject.SetActive(false);
     Is_CD  = false;
     mFunc  = func;
     State  = LockState.Open;
     mParam = param;
 }
示例#2
0
        public void Dispose()
        {
            mFunc  = null;
            mParam = null;

            ClientEventMgr.GetInstance().UnsubscribeClientEvent((int)ClientEvent.CE_SERVER_TIME_CHANGED, OnServerTimeUpdate);
        }
示例#3
0
        private void CheckRef()
        {
            var empty_node_trans = transform.Find("EmptyNode");

            if (empty_node_trans == null)// 兼容之前的旧UI
            {
                empty_node_trans = transform;
            }

            Transform child_trans = null;

            if (CdImageTrans == null)
            {
                child_trans = empty_node_trans.Find("CDImage");
                if (child_trans != null)
                {
                    CdImageTrans = child_trans.GetComponent <RectTransform>();
                }
            }

            if (mLockImage == null)
            {
                child_trans = empty_node_trans.Find("LockImage");
                if (child_trans != null)
                {
                    mLockImage = child_trans.GetComponent <Image>();
                }
            }

            if (TimeText == null)
            {
                child_trans = empty_node_trans.Find("Text");
                if (child_trans != null)
                {
                    TimeText = child_trans.GetComponent <Text>();
                }
            }

            if (ItemButton == null)
            {
                ItemButton = transform.GetComponent <Button>();
                if (ItemButton == null)
                {
                    var lock_trans = empty_node_trans.Find("LockPanel");
                    if (lock_trans != null)
                    {
                        ItemButton = lock_trans.GetComponent <Button>();
                    }
                }

                if (ItemButton != null)
                {
                    ItemButton.onClick.RemoveAllListeners();
                    ItemButton.onClick.AddListener(OnClickGoodsBtn);
                }
            }

            Is_CD  = false;
            mFunc  = null;
            State  = LockState.Open;
            mParam = null;
        }
示例#4
0
 public void SetClickCallback(OnClickFunc func, System.Object param = null)
 {
     this.mFunc  = func;
     this.mParam = param;
 }
示例#5
0
 public PkButton(string Text, PkButtonStyle Style, OnClickFunc Func) : this(Text, Style)
 {
     OnClick += Func;
 }