Beispiel #1
0
 public void ShowScenEffect(SwitchScenEffect ScenEffect)
 {
     SceneLoader.Instance.LoadScene(StageMgr.Scene_name, () =>
     {
         string transitionPrefab  = "Transitions/" + ScenEffect.ToString();
         GameObject prefab        = (GameObject)Resources.Load(transitionPrefab);
         GameObject instance      = (GameObject)GameObject.Instantiate(prefab);
         SMTransition transition  = instance.GetComponent <SMTransition>();
         transition.screenId      = StageMgr.Scene_name;
         transition.loadAsync     = true;
         transition.prefetchLevel = true;
     });
 }
Beispiel #2
0
    public static void LoadingAsyncScene(string name, SwitchScenEffect type = SwitchScenEffect.LoadingBar, bool withUI = true, bool withDynRes = false, bool manualClose = false, bool resetLocker = false)
    {
        if (GlobalValue.isBattleScene(name))
        {
            GamePlayer.Instance.isInBattle = true;
        }
        else
        {
            GamePlayer.Instance.isInBattle = false;
        }

        GameManager.Instance.EnableDelayCheck(false);
        GuideManager.Instance.ClearMask();
        GlobalInstanceFunction.Instance.ClearInvokeRepeat();

        PlayerAsseMgr.ClearAll();
        EffectAssetMgr.ClearAll();
        Resources.UnloadUnusedAssets();
        if (Loading || ScenePreloader.Instance.DiffSceneLoad(name))
        {
            wait4LoadQue_.Clear();
            WaitLoadInfo wli = new WaitLoadInfo();
            wli.name_        = name;
            wli.type_        = type;
            wli.withUI_      = withUI;
            wli.withDynRes_  = withDynRes;
            wli.manualClose_ = manualClose;
            wli.resetLocker_ = resetLocker;
            wait4LoadQue_.Enqueue(wli);
            return;
        }

        Loading = true;

        if (resetLocker)
        {
            GameManager.Instance.reconnectionLocker_ = false;
        }
        ApplicationEntry.Instance.switchSceneMask_.SetActive(true);

        if (OnSceneBeginLoad != null)
        {
            OnSceneBeginLoad();
        }

        UIManager.Instance.DoDeActive();
        withUI_      = withUI;
        withDynRes_  = withDynRes;
        manualClose_ = manualClose;
        preScene_    = Scene_name;
        Scene_name   = name;
        Loadtype     = type;

        if (Scene_name.Equals(GlobalValue.StageName_ReLoginScene))
        {
            GameManager.Instance.ClearCurrentState();
        }

        if (type == SwitchScenEffect.LoadingBar)
        {
            UIFactory.Instance.LoadUIPanel(UIASSETS_ID.UIASSETS_LoadingPanel, () => {
                UIFactory.Instance.CloseCurrentUI();
                UIFactory.Instance.OpenUI(UIASSETS_ID.UIASSETS_LoadingPanel, menuTypes.Popup);
                ApplicationEntry.Instance.switchSceneMask_.SetActive(false);
            });
        }
        else
        {
            GlobalInstanceFunction.LoadSceneUI(Scene_name, () => {
                ShowGame.Instance.ShowScenEffect(type);
            });
        }
        Prebattle.Instance.ClearAssetLoadCount();
        sendSceneLoaded_ = false;
    }