Esempio n. 1
0
        /// <summary>
        /// 卸载战场
        /// </summary>
        /// <param name="onDone"></param>
        /// <returns></returns>
        IEnumerator <float> _UnLoadBattle(Callback onDone)
        {
            //暂停一段时间
            SelfBaseGlobal.PauseGame(true);
            yield return(Timing.WaitForSeconds(0.1f));

            Callback_OnBattleUnLoad?.Invoke();
            yield return(Timing.WaitForSeconds(1.0f));

            string sceneName = CurData.GetSceneName();
            var    wait      = SceneManager.UnloadSceneAsync(sceneName);

            while (!wait.isDone)
            {
                yield return(Timing.WaitForOneFrame);

                Callback_OnLoadingProgressChanged?.Invoke("UnloadScene", wait.progress);
            }

            //卸载未使用的资源
            SelfBaseGlobal.DLCMgr.UnloadAsset(SceneAsset);
            SelfBaseGlobal.DLCMgr.UnLoadBattleAssetBundle();
            CurData.OnBeRemoved();
            CurData = null;

            Callback_OnLoadingProgressChanged?.Invoke("GC", 1.0f);
            BaseGlobalMonoMgr.RemoveAllNull();
            GC.Collect();
            yield return(Timing.WaitForSeconds(0.1f));

            Callback_OnBattleUnLoaded?.Invoke();
            SelfBaseGlobal.ResumeGame();
            onDone?.Invoke();
        }
Esempio n. 2
0
 public override void OnDestroy()
 {
     foreach (var value in componets)
     {
         value.OnDestroy();
     }
     BaseGlobalMonoMgr.RemoveMono(this);
 }
Esempio n. 3
0
 public override void Awake()
 {
     //如果LayerData没有被重载,则不会被设置
     if (LayerData != BaseConstMgr.Layer_Default)
     {
         SetLayer(LayerData, true);
     }
     OnSetNeedFlag();
     BaseGlobalMonoMgr.AddMono(this);
     AttachComponet();
 }
Esempio n. 4
0
 public override void OnEnable()
 {
     //如果LayerData和GameObject的Layer不相等,才会被设置
     if ((int)LayerData != GO.layer)
     {
         SetLayer(LayerData, false);
     }
     foreach (var value in componets)
     {
         value.OnEnable();
     }
     BaseGlobalMonoMgr.ActiveMono(this);
 }
Esempio n. 5
0
 private void _doPauseGame()
 {
     if (BoolPause.IsIn())
     {
         BaseGlobalMonoMgr.SetPauseType(MonoType.Unit);
         BattleCoroutine.Pause();
         KinematicCharacterSystem.AutoSimulation = false;
     }
     else
     {
         BaseGlobalMonoMgr.SetPauseType(MonoType.None);
         BattleCoroutine.Resume();
         KinematicCharacterSystem.AutoSimulation = true;
     }
 }
Esempio n. 6
0
 public override void OnDisable()
 {
     foreach (var value in componets)
     {
         value.OnDisable();
     }
     BaseGlobalMonoMgr.DeactiveMono(this);
     Callback_OnInit      = null;
     Callback_OnBirth     = null;
     Callback_OnRebirth   = null;
     Callback_OnDeath     = null;
     Callback_OnRealDeath = null;
     if (Rigidbody != null)
     {
         Rigidbody.Sleep();
     }
 }
 private void OnEnable()
 {
     BaseGlobalMonoMgr = (BaseGlobalMonoMgr)target;
 }