Beispiel #1
0
        private IEnumerator AsyncLoadOtherScene()
        {
            string         sceneName = GetSceneName(EnumSceneType.LoadingScene);
            AsyncOperation oper      = Application.LoadLevelAsync(sceneName);

            yield return(oper);

            // message send
            if (oper.isDone)
            {
                UIManager.Instance.OpenUI(EnumUIType.PanelLoading);
                LoadingBar loadingBar = UIManager.Instance.GetUI <LoadingBar>(EnumUIType.PanelLoading);
                if (!SceneManager.Instance.IsRegisterScene(ChangeSceneType))
                {
                    Debug.LogError("没有注册次场景! " + ChangeSceneType.ToString());
                }
                loadingBar.Load(ChangeSceneType);
                loadingBar.LoadingComplete += SceneLoadCompleted;
                //GameObject go = UIManager.Instance.GetUIObject
                //GameObject go = GameObject.Find("LoadingScenePanel");
                //LoadingSceneUI loadingSceneUI = go.GetComponent<LoadingSceneUI>();
                //BaseScene scene = CurrentScene;
                //if (null != scene)
                //{
                //    scene.CurrentScendId = ChangeSceneId;
                //}
                //// 检测是否注册该场景
                //if (!SceneManager.Instance.IsRegisterScene(ChangeSceneId))
                //{
                //    Debug.LogError("没有注册次场景! " + ChangeSceneId.ToString());
                //}
                //loadingSceneUI.Load(ChangeSceneId);
                //loadingSceneUI.LoadCompleted += SceneLoadCompleted;
            }
        }
Beispiel #2
0
        public void Show(ChangeSceneType changeType = ChangeSceneType.Open, Action onEnd = null)
        {
            if (go == null)
            {
                go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.UIWindow, "panChangeScene", true);
            }
            if (go == null)
            {
                return;
            }
            go.SetActive(true);
            Transform parent = UISceneCtrl.Instance.CurrentUIScene.ContainerCenter;

            go.transform.SetParent(parent);
            go.transform.localPosition = Vector3.zero;
            go.transform.localScale    = Vector3.one;
            go.GetComponent <RectTransform>().sizeDelta = Vector2.zero;

            UIChangeSceneView window = go.GetComponent <UIChangeSceneView>();

            window.Show(changeType, () =>
            {
                if (onEnd != null)
                {
                    onEnd();
                }
                if (changeType == ChangeSceneType.Open || changeType == ChangeSceneType.CloseAndOpen)
                {
                    go.SetActive(false);
                }
            });
        }
        public void Show(ChangeSceneType changeType, float time = 1, Action onEnd = null)
        {
            if (go == null)
            {
                go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.UIWindow, "panChangeScene", true);
            }
            if (go == null)
            {
                return;
            }
            UIChangeSceneView window = go.GetComponent <UIChangeSceneView>();

            window.SetEnable(true);
            Transform parent = UISceneCtrl.Instance.CurrentUIScene.ContainerCenter;

            go.transform.SetParent(parent);
            go.transform.localPosition = Vector3.zero;
            go.transform.localScale    = Vector3.one;
            go.GetComponent <RectTransform>().sizeDelta = Vector2.zero;
            window.Show(changeType, time, () => { if (onEnd != null)
                                                  {
                                                      onEnd();
                                                  }
                                                  ; window.SetEnable(false);; });
            //EditorApplication.isPaused = true;
        }
        public void Show(ChangeSceneType changeType, Action onEnd)
        {
            if (m_Mat == null)
            {
                m_Mat            = new Material(m_Image.material);
                m_Image.material = m_Mat;
            }
            float startValue = 0;
            float endValue   = 1;
            int   loopCount  = 0;

            switch (changeType)
            {
            case ChangeSceneType.Open:
            case ChangeSceneType.OpenAndClose:
                if (changeType == ChangeSceneType.OpenAndClose)
                {
                    loopCount = 1;
                }
                startValue = 1;
                endValue   = 0;
                break;

            case ChangeSceneType.Close:
            case ChangeSceneType.CloseAndOpen:
                if (changeType == ChangeSceneType.CloseAndOpen)
                {
                    loopCount = 1;
                }
                startValue = 0;
                endValue   = 1;
                break;

            default:
                break;
            }
            float number = 0;

            m_Mat.SetFloat("_Amount", startValue);
            TweenManager.To(() => number = startValue, (x) => number = x, endValue, m_Time).SetIsSpeed(false).SetUpdateAction((x) =>
            {
                m_Mat.SetFloat("_Amount", number);
            }).SetLoopCount(loopCount).SetLoopType(TweenLoopType.YoYo).SetEndAction(() => { if (onEnd != null)
                                                                                            {
                                                                                                onEnd();
                                                                                            }
                                                                                    });
        }
        private IEnumerator ShowIE(ChangeSceneType changeType = ChangeSceneType.Open, Action onEnd = null)
        {
            SetImage(true);
            float time = 0;

            if (changeType == ChangeSceneType.Close)
            {
                m_Animation1.RectTransformPositionTweener.IsFrom = false;
                m_Animation2.RectTransformPositionTweener.IsFrom = false;
            }
            else if (changeType == ChangeSceneType.Open)
            {
                m_Animation1.RectTransformPositionTweener.IsFrom = true;
                m_Animation2.RectTransformPositionTweener.IsFrom = true;
            }
            else
            {
                m_Animation1.RectTransformPositionTweener.IsFrom       = true;
                m_Animation1.RectTransformPositionTweener.LoopMaxCount = 1;
                m_Animation1.RectTransformPositionTweener.LoopType     = TweenLoopType.YoYo;

                m_Animation2.RectTransformPositionTweener.IsFrom       = false;
                m_Animation2.RectTransformPositionTweener.LoopMaxCount = 1;
                m_Animation2.RectTransformPositionTweener.LoopType     = TweenLoopType.YoYo;

                time = m_Animation1.RectTransformPositionTweener.Variable;
            }
            m_Animation1.Play();
            m_Animation2.Play();
            yield return(new WaitForSeconds(m_Animation1.RectTransformPositionTweener.Variable));

            if (onEnd != null)
            {
                onEnd();
            }
            yield return(new WaitForSeconds(time));

            SetImage(false);
        }
Beispiel #6
0
 public void Show(ChangeSceneType changeType, float time = 1, Action onEnd = null)
 {
     if (changeType == ChangeSceneType.Open)
     {
         m_Image.color = new Color(0, 0, 0, 1);
         m_Image.DoColor(new Color(0, 0, 0, 0), time).SetEndAction(() => { if (onEnd != null)
                                                                           {
                                                                               onEnd();
                                                                           }
                                                                   });
     }
     else if (changeType == ChangeSceneType.Close)
     {
         m_Image.color = new Color(0, 0, 0, 0);
         m_Image.DoColor(new Color(0, 0, 0, 1), time).SetEndAction(() => { if (onEnd != null)
                                                                           {
                                                                               onEnd();
                                                                           }
                                                                   });
     }
     else
     {
     }
 }
 public void Show(ChangeSceneType changeType = ChangeSceneType.Open, Action onEnd = null)
 {
     StartCoroutine(ShowIE(changeType, onEnd));
 }