protected override void OnEnd(AbstractPanel panelBefore, AbstractPanel newPanel) { newPanel.m_TransFrom.position = GlobalVar.GCanvasObj.transform.position; if (panelBefore != null && panelBefore.IsVisable()) { panelBefore.Disable(); } }
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; }); }
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(); }); } }