Ejemplo n.º 1
0
 public static void LoadingScene(string name)
 {
     GameManager.Instance.EnableDelayCheck(false);
     GuideManager.Instance.ClearMask();
     ApplicationEntry.Instance.switchSceneMask_.SetActive(true);
     UIManager.Instance.DoDeActive();
     Prebattle.Instance.ClearAssetLoadCount();
     GlobalInstanceFunction.LoadSceneUI(name, () =>
     {
         Application.LoadLevel(name);
     });
 }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        inst = this;
        if (GameManager.Instance != null)
        {
            GameManager.Instance.SetChatUIActive(false);
        }
        destroyed = false;
        if (OnBeginLoading != null)
        {
            OnBeginLoading();
        }
        SceneData sdata = SceneData.GetData(GameManager.SceneID);

        if (sdata == null)
        {
            scenenicon = "loding";
        }
        else
        {
            scenenicon = sdata.scene_icon;
        }
        HeadIconLoader.Instance.LoadIcon(scenenicon, back);
        ui_loaded_        = !StageMgr.withUI_;
        dynamicResLoaded_ = !StageMgr.withDynRes_;
        manualCloseUI_    = StageMgr.manualClose_;
        // 注册loading形式
        LoadingProgressbar progressbar = GetComponentInChildren <LoadingProgressbar>();

        progressbar.UseThisType();
        //加载场景模型
        SceneLoader.Instance.LoadScene(StageMgr.Scene_name, () =>
        {
            StartCoroutine(loading());
        });
        //加载UI资源
        GlobalInstanceFunction.LoadSceneUI(StageMgr.Scene_name, UILoadFinish);

        Resources.UnloadUnusedAssets();
    }
Ejemplo n.º 3
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;
    }