Example #1
0
 public static bool SceneLoadedFinish()
 {
     if (wait4LoadQue_.Count > 0)
     {
         WaitLoadInfo wli = wait4LoadQue_.Dequeue();
         LoadingAsyncScene(wli.name_, wli.type_, wli.withUI_, wli.withDynRes_, wli.manualClose_, wli.resetLocker_);
         if (GlobalValue.isBattleScene(wli.name_))
         {
             return(true);
         }
     }
     else if (GameManager.Instance.nextBattle_ != null)
     {
         Battle.Instance.ComboBattle();
         GameManager.Instance.nextBattle_ = null;
         return(true);
     }
     else// if (!GamePlayer.Instance.isInBattle)
     {
         if (Prebattle.Instance.ExcuteNextScene() == false)
         {
             if (Scene_name.Equals(GlobalValue.StageName_piantoudonghuaf) || Scene_name.Equals("Village01"))
             {
                 ApplicationEntry.Instance.PlaceCinema();
             }
         }
     }
     return(false);
 }
Example #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;
    }