Esempio n. 1
0
        /// <summary>
        /// 加载新面板,带效果
        /// </summary>
        /// <param name="panelName"></param>
        /// <param name="abstractScreenEffect"></param>
        public static void PushPanel(string panelName, AbstractScreenEffect abstractScreenEffect)
        {
            var panel = AbstractPanel.GetPanel(panelName);

            abstractScreenEffect.OnBegin(CurrentPanel as AbstractPanel, panel);
            panelStack.Push(panel);
        }
 protected override void OnEnd(AbstractPanel panelBefore, AbstractPanel newPanel)
 {
     newPanel.m_TransFrom.position = GlobalVar.G_Canvas.transform.position;
     if (panelBefore != null && panelBefore.IsVisable())
     {
         panelBefore.Disable();
     }
 }
Esempio n. 3
0
 public override void OnBegin(AbstractPanel panelBefore, AbstractPanel newPanel)
 {
     if (panelBefore != null)
     {
         this.time *= 0.5f;
     }
     PanelFadeOut(panelBefore, this.time, () => PanelFadeIn(newPanel, this.time));
 }
Esempio n. 4
0
        /// <summary>
        /// 加载新面板,都带
        /// </summary>
        /// <param name="panelName"></param>
        /// <param name="transition"></param>
        /// <param name="abstractScreenEffect"></param>
        public static void PushPanel(string panelName, AbstractTransition transition,
                                     AbstractScreenEffect abstractScreenEffect)
        {
            var panel = AbstractPanel.GetPanel(panelName);

            transition.onBegin += abstractScreenEffect.OnBegin;
            transition.PushPanel(panel);
            panelStack.Push(panel);
        }
Esempio n. 5
0
        /// <summary>
        /// 加载新面板,带动画
        /// </summary>
        /// <param name="panelName"></param>
        /// <param name="transition"></param>
        public static void PushPanel(string panelName, AbstractTransition transition)
        {
            var panel = AbstractPanel.GetPanel(panelName);

            transition.PushPanel(panel);
            panelStack.Push(panel);

//            Debug.Log("入栈:" + panelStack.Count + " name:" + panelName);
        }
Esempio n. 6
0
        public void PushPanel(string name)
        {
            if (panelStack.Count != 0)
            {
                panelStack.Peek().Disable();
            }

            var panel = AbstractPanel.GetPanel(name);

            panel.Enable();
            panelStack.Push(panel);
            Debug.Log("入栈:" + this.panelStack.Count + " name:" + name);
        }
Esempio n. 7
0
        public void PushPanel(AbstractPanel newPanel)
        {
            var panelBefore = PanelMgr.CurrentPanel as AbstractPanel;

            MainLoop.Instance.ExecuteLater(() =>
            {
                OnBegin(panelBefore, newPanel);
                if (onBegin != null)
                {
                    onBegin(panelBefore, newPanel);
                }
                MainLoop.Instance.ExecuteLater(() =>
                {
                    OnEnd(panelBefore, newPanel);
                    if (onEnd != null)
                    {
                        onEnd(panelBefore, newPanel);
                    }
                }, this.time);
            }, this.delay);
        }
Esempio n. 8
0
        private void PanelFadeOut(AbstractPanel panelBefore, float time, Action endCall)
        {
            CanvasGroup cg;

            if (panelBefore != null)
            {
                cg = panelBefore.m_TransFrom.GetComponent <CanvasGroup>();
                if (cg == null)
                {
                    cg = panelBefore.m_TransFrom.gameObject.AddComponent <CanvasGroup>();
                }
                MainLoop.Instance.UpdateForSeconds(() => { cg.alpha -= Time.deltaTime / time; }, time,
                                                   () =>
                {
                    cg.alpha = 1;
                    if (panelBefore.IsVisable())
                    {
                        panelBefore.Disable();
                    }
                    endCall();
                });
            }
        }
Esempio n. 9
0
        private void PanelFadeIn(AbstractPanel newPanel, float time)
        {
            Assert.IsTrue(newPanel != null);

            if (newPanel.IsVisable() == false)
            {
                newPanel.Enable();
            }

            CanvasGroup cg;

            cg = newPanel.m_TransFrom.GetComponent <CanvasGroup>();

            if (cg == null)
            {
                cg = newPanel.m_TransFrom.gameObject.AddComponent <CanvasGroup>();
            }
            cg.alpha = 0;
            MainLoop.Instance.UpdateForSeconds(() =>
            {
                if (!newPanel.IsVisable())
                {
                    return;
                }
                cg.alpha += Time.deltaTime / time;
            },
                                               time,
                                               () =>
            {
                if (!newPanel.IsVisable())
                {
                    return;
                }
                newPanel.m_TransFrom.position = GlobalVar.G_Canvas.transform.position;
            });
        }
        protected override void OnBegin(AbstractPanel panelBefore, AbstractPanel newPanel)
        {
            var speedX = Screen.width / this.time;
            var speedY = Screen.height / this.time;

            newPanel.Enable();

            switch (type)
            {
            case TransionType.PageDown:
                newPanel.m_TransFrom.position = GlobalVar.GCanvasButton;
                MainLoop.Instance.UpdateForSeconds(
                    () =>
                {
                    if (panelBefore != null)
                    {
                        panelBefore.m_TransFrom.Translate(Vector3.up * speedY * Time.deltaTime, Space.World);
                    }
                    newPanel.m_TransFrom.Translate(Vector3.up * speedY * Time.deltaTime, Space.World);
                },
                    this.time);
                break;

            case TransionType.PageRight:
                newPanel.m_TransFrom.position = GlobalVar.GCanvasRight;
                MainLoop.Instance.UpdateForSeconds(
                    () =>
                {
                    if (panelBefore != null)
                    {
                        panelBefore.m_TransFrom.Translate(Vector3.left * speedX * Time.deltaTime, Space.World);
                    }
                    newPanel.m_TransFrom.Translate(Vector3.left * speedX * Time.deltaTime, Space.World);
                },
                    this.time);
                break;

            case TransionType.PageUp:
                newPanel.m_TransFrom.position = GlobalVar.GCanvasTop;
                MainLoop.Instance.UpdateForSeconds(
                    () =>
                {
                    if (panelBefore != null)
                    {
                        panelBefore.m_TransFrom.Translate(Vector3.down * speedY * Time.deltaTime, Space.World);
                    }
                    newPanel.m_TransFrom.Translate(Vector3.down * speedY * Time.deltaTime, Space.World);
                },
                    this.time);
                break;

            case TransionType.PageLeft:
                newPanel.m_TransFrom.position = GlobalVar.GCanvasLeft;
                MainLoop.Instance.UpdateForSeconds(
                    () =>
                {
                    if (panelBefore != null)
                    {
                        panelBefore.m_TransFrom.Translate(Vector3.right * speedX * Time.deltaTime, Space.World);
                    }
                    newPanel.m_TransFrom.Translate(Vector3.right * speedX * Time.deltaTime, Space.World);
                },
                    this.time);
                break;
            }
        }
Esempio n. 11
0
 public static bool CanNext(this AbstractPanel ap)
 {
     return(Input.GetAxis("Mouse ScrollWheel") < 0);
 }
Esempio n. 12
0
 protected abstract void OnEnd(AbstractPanel panelBefore, AbstractPanel newPanel);
Esempio n. 13
0
 protected abstract void OnBegin(AbstractPanel panelBefore, AbstractPanel newPanel);
 public abstract void OnEnd(AbstractPanel panelbefore, AbstractPanel newPanel);
 public abstract void OnBegin(AbstractPanel panelBefore, AbstractPanel newPanel);
Esempio n. 16
0
 public override void OnEnd(AbstractPanel panelbefore, AbstractPanel newPanel)
 {
 }