예제 #1
0
 new public void RemoveItem(CButtonToggle tog)
 {
     tweenState.Remove(tog);
     tweenTargetPos.Remove(tog);
     EventUtil.RemoveHover(tog.gameObject, OnTogHover);
     base.RemoveItem(tog);
 }
예제 #2
0
 public void ResetState(CButtonToggle tog)
 {
     if (side == TabBarTweenSide.LEFT || side == TabBarTweenSide.RIGHT)
     {
         if ((int)tog.transform.localPosition.x != tweenTargetPos[tog])
         {
             iTween.MoveTo(tog.gameObject,
                           iTween.Hash("x", tweenTargetPos[tog], "time", 0.2f, "islocal", true, "easeType", iTween.EaseType.easeInOutCirc,
                                       "oncompletetarget", this, "oncomplete", "ResetState", "oncompleteparams", new object[] { tog }));
         }
         else
         {
             tweenState[tog] = false;
         }
     }
     else
     {
         if ((int)tog.transform.localPosition.y != tweenTargetPos[tog])
         {
             iTween.MoveTo(tog.gameObject,
                           iTween.Hash("y", tweenTargetPos[tog], "time", 0.2f, "islocal", true, "easeType", iTween.EaseType.easeInOutCirc,
                                       "oncompletetarget", this, "oncomplete", "ResetState", "oncompleteparams", new object[] { tog }));
         }
         else
         {
             tweenState[tog] = false;
         }
     }
 }
예제 #3
0
 new public void AddItem(CButtonToggle tog)
 {
     base.AddItem(tog);
     tweenState[tog]     = false;
     tweenTargetPos[tog] = 0;
     if (moveOnOver)
     {
         EventUtil.AddHover(tog.gameObject, OnTogHover, tog.gameObject);
     }
 }
예제 #4
0
        public static CButtonToggle CreateTabBarBtn(int x, int y, Transform parent, string name, int w, int h, int depth)
        {
            GameObject obj = UnityEngine.Object.Instantiate(FuncUtil.GetUIAssetByPath(TAB_BUTTON_PATH)) as GameObject;

            if (obj == null)
            {
                return(null);
            }
            obj.transform.parent        = parent;
            obj.transform.localScale    = Vector3.one;
            obj.transform.localPosition = new Vector3(x, y, 0);
            CButtonToggle box = obj.GetComponent <CButtonToggle>();

            box.width  = w;
            box.height = h;
            box.Text   = name;
            return(box);
        }