Esempio n. 1
0
        public void Push(UIType _type)
        {
            // if pagestack.count > 0, make peek onPause
            if (pageStack.Count != 0)
            {
                UIType   pagePeek = pageStack.Peek();
                BaseView view     = SingleTon <T> .Instance.GetByUIType(pagePeek).gameObject.GetComponent <AnimaView>();

                view.OnPause(pagePeek);
            }

            pageStack.Push(_type);
            GameObject pushObj = SingleTon <T> .Instance.GetPageGameObj(_type);

            BaseView pushView = pushObj.GetComponent <AnimaView>();

            pushView.OnEnter(_type);
        }
Esempio n. 2
0
        public void Pop()
        {
            if (pageStack.Count > 0)
            {
                UIType     popType = pageStack.Pop();
                GameObject popObj  = SingleTon <T> .Instance.GetByUIType(popType);

                BaseView popview = popObj.GetComponent <AnimaView>();
                popview.OnExit(popType);
                // GameObject.Destroy(popObj);
            }

            if (pageStack.Count > 0)
            {
                UIType   peek     = pageStack.Peek();
                BaseView peekview = SingleTon <T> .Instance.GetByUIType(peek).GetComponent <AnimaView>();

                peekview.OnWake(peek);
            }
        }
Esempio n. 3
0
        // 预设体的中心要放好 -- 可以通过动画调节位置
        protected GameObject Instantiate(UIType _type)
        {
            //Debug.Log(_type.Path);
            Transform  trans = canves.Find(_type.name);
            GameObject gameobj;

            if (trans != null)
            {
                gameobj = trans.gameObject;
                PagesDic.Add(_type, gameobj);
                return(trans.gameObject);
            }
            //Debug.Log(gameobj);
            gameobj = Resources.Load <GameObject>(_type.Path) as GameObject;
            GameObject obj = GameObject.Instantiate(gameobj);

            obj.transform.SetParent(canves);
            obj.transform.localPosition = Vector2.zero;
            obj.name = gameobj.name; // 可以不加
            // 生成时这一句必须加 -- 防止跑偏
            obj.GetComponent <RectTransform>().sizeDelta = gameobj.GetComponent <RectTransform>().sizeDelta;
            PagesDic.Add(_type, obj);
            return(obj);
        }
Esempio n. 4
0
        }                                            // 退出

        public virtual void OnPause(UIType _type)
        {
        }                                             // 暂停
Esempio n. 5
0
        }                                             // 进入

        public virtual void OnExit(UIType _type)
        {
        }                                            // 退出
Esempio n. 6
0
 public override void OnEnter(UIType _type)
 {
     base.OnEnter(_type);
     animator.SetBool("Exit", false);
     animator.SetBool("Enter", true);
 }
Esempio n. 7
0
 public override void OnWake(UIType _type)
 {
     animator.SetBool("Exit", false);
     animator.SetBool("Enter", true);
 }
Esempio n. 8
0
 // 不使用接口的原因是因为getcomponet<> 函数不能获取到接口函数
 public abstract void Notify(UIType uIType);
Esempio n. 9
0
 public override void OnExit(UIType _type)
 {
     base.OnExit(_type);
     animator.SetBool(onEnter, false);
     animator.SetBool(onExit, true);
 }
Esempio n. 10
0
 public bool Delete(UIType _type)
 {
     GameObject.Destroy(GetByUIType(_type));
     return(PagesDic.Remove(_type));
 }
Esempio n. 11
0
 public bool Exist(UIType _type)
 {
     return(PagesDic.ContainsKey(_type));
 }
Esempio n. 12
0
 public bool Add(UIType _type, GameObject _game)
 {
     return(PagesDic.AddKeyValues(_type, _game));
 }
Esempio n. 13
0
 public GameObject GetByUIType(UIType _type)
 {
     return(PagesDic.GetValue(_type));
 }
Esempio n. 14
0
        }                                             // 暂停

        public virtual void OnWake(UIType _type)
        {
        }                                            // 暂停后唤醒
Esempio n. 15
0
 public override void OnWake(UIType _type)
 {
     base.OnWake(_type);
     animator.SetBool(onPause, false);
     animator.SetBool(onWake, true);
 }
Esempio n. 16
0
 public virtual void OnEnter(UIType _type)
 {
 }                                             // 进入
Esempio n. 17
0
 public override void OnEnter(UIType _type)
 {
     base.OnEnter(_type);
 }