完善内存卸载
parent
d9b2a532ca
commit
fdbba9be9e
|
|
@ -161,6 +161,8 @@ namespace Framework.Wrapper
|
|||
|
||||
protected virtual void OnDispose()
|
||||
{
|
||||
RendererWrapper = null;
|
||||
Skeleton = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,10 +44,10 @@ namespace Gameplay.Buff
|
|||
return _instance;
|
||||
}
|
||||
|
||||
private readonly Dictionary<GameUnit, UnitBuffManager> _unitDict;
|
||||
private readonly List<UnitBuffManager> _unitList;
|
||||
private Dictionary<GameUnit, UnitBuffManager> _unitDict;
|
||||
private List<UnitBuffManager> _unitList;
|
||||
|
||||
private readonly Dictionary<int, SideBuffManager> _sideBuffManagerDict;
|
||||
private Dictionary<int, SideBuffManager> _sideBuffManagerDict;
|
||||
|
||||
private BuffManager()
|
||||
{
|
||||
|
|
@ -70,7 +70,15 @@ namespace Gameplay.Buff
|
|||
|
||||
EventManager.Instance.Unregister<GameUnit>(EventManager.EventName.INFIGHT_UNIT_READY, _OnUnitReady);
|
||||
EventManager.Instance.Unregister<GameUnit>(EventManager.EventName.INFIGHT_UNIT_REMOVE, _OnUnitRemove);
|
||||
|
||||
|
||||
_unitDict.Clear();
|
||||
_unitList.Clear();
|
||||
_sideBuffManagerDict.Clear();
|
||||
|
||||
_unitDict = null;
|
||||
_unitList = null;
|
||||
_sideBuffManagerDict = null;
|
||||
|
||||
_instance = null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -133,6 +133,6 @@ namespace Gameplay.Character
|
|||
// hp直接归0
|
||||
aliveData.currentHp = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,17 @@ namespace Gameplay.Character
|
|||
base.OnDispose();
|
||||
emojiManager.Dispose();
|
||||
SelecterView.Instance.UnSelect(Node);
|
||||
|
||||
_fullFSM = null;
|
||||
_upFSM = null;
|
||||
_downFSM = null;
|
||||
|
||||
weapon = null;
|
||||
|
||||
cAnim = null;
|
||||
fightData = null;
|
||||
aliveData = null;
|
||||
runtimeData = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@ namespace Gameplay.Character
|
|||
public partial class Character : GameUnit
|
||||
{
|
||||
|
||||
public readonly CharacterRuntimeData runtimeData;
|
||||
public CharacterRuntimeData runtimeData;
|
||||
public CharacterAnim cAnim;
|
||||
public ViewWeapon weapon;
|
||||
public UnitEmojiManager emojiManager;
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ namespace Gameplay.Effect
|
|||
|
||||
public async UniTask<LoadingResult> PreloadEffects(List<int> effectIds = null)
|
||||
{
|
||||
return LoadingResult.Success;
|
||||
if (effectIds == null)
|
||||
{
|
||||
// 从配表读取
|
||||
|
|
@ -282,6 +283,9 @@ namespace Gameplay.Effect
|
|||
}
|
||||
orderCacher.Clear();
|
||||
_objPools.Clear();
|
||||
_playingEffects.Clear();
|
||||
rootObj.transform.ClearChilds();
|
||||
_poolParent.ClearChilds();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
|||
|
|
@ -191,6 +191,7 @@ namespace Gameplay.Effect
|
|||
|
||||
public void RealDestroy()
|
||||
{
|
||||
_logic = null;
|
||||
_forceDestroy = true;
|
||||
if (rootObj != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using Gameplay.Buff;
|
|||
using Gameplay.Character;
|
||||
using Gameplay.Effect;
|
||||
using Gameplay.Emoji;
|
||||
using Gameplay.Pause;
|
||||
using Gameplay.Pool;
|
||||
using Gameplay.Skill;
|
||||
using Gameplay.SubSystems;
|
||||
|
|
@ -236,10 +237,16 @@ namespace Gameplay.Level
|
|||
|
||||
AIManager.Instance.Release();
|
||||
|
||||
EffectManager.instance.ClearPool();
|
||||
ObjPoolManager.instance.Clear();
|
||||
// 在这里释放所有单位
|
||||
GameUnitManager.instance.Dispose();
|
||||
|
||||
if (PauseManager.instance != null)
|
||||
{
|
||||
PauseManager.instance.Dispose();
|
||||
}
|
||||
|
||||
EffectManager.instance.ClearPool();
|
||||
ObjPoolManager.instance.Clear();
|
||||
//GameUnitManager.instance.Dispose();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ namespace Gameplay.Level
|
|||
{
|
||||
_level.isInBattle = false;
|
||||
|
||||
PauseManager.instance.Dispose();
|
||||
|
||||
|
||||
BulletManager.instance.Dispose();
|
||||
BoundsManager.instance.Dispose();
|
||||
|
|
|
|||
|
|
@ -74,6 +74,6 @@ namespace Gameplay.Pause
|
|||
{
|
||||
return rawPartical == null || rawPartical.isStopped;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -284,6 +284,13 @@ namespace Gameplay.Pause
|
|||
public void Dispose()
|
||||
{
|
||||
_UnRegistEvents();
|
||||
|
||||
_animList.Clear();
|
||||
_animList = null;
|
||||
|
||||
_paticalList.Clear();
|
||||
_paticalList = null;
|
||||
|
||||
_instance = null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,37 +35,37 @@ namespace Gameplay.Unit
|
|||
/// 公用数据,或者其他一些不知道放哪的数据
|
||||
/// </summary>
|
||||
[FightDebug]
|
||||
public readonly UnitCommonData commonData;
|
||||
public UnitCommonData commonData;
|
||||
|
||||
/// <summary>
|
||||
/// logic移动相关数据,view层主要与此进行同步
|
||||
/// </summary>
|
||||
[FightDebug]
|
||||
public readonly UnitTransData transData;
|
||||
public UnitTransData transData;
|
||||
|
||||
/// <summary>
|
||||
/// 生存相关数据,控制角色的死亡,复活等
|
||||
/// </summary>
|
||||
[FightDebug]
|
||||
public readonly UnitAliveData aliveData;
|
||||
public UnitAliveData aliveData;
|
||||
|
||||
/// <summary>
|
||||
/// 战斗相关数据,主要用于公式计算相关
|
||||
/// </summary>
|
||||
[FightDebug]
|
||||
public readonly UnitFightData fightData;
|
||||
public UnitFightData fightData;
|
||||
|
||||
/// <summary>
|
||||
/// 战斗内的控制数据,主要用于战斗内的逻辑控制
|
||||
/// </summary>
|
||||
[FightDebug]
|
||||
public readonly UnitControlData controlData;
|
||||
public UnitControlData controlData;
|
||||
|
||||
/// <summary>
|
||||
/// 状态数据,主要用于标识判定
|
||||
/// </summary>
|
||||
[FightDebug]
|
||||
public readonly UnitStatusData statusData;
|
||||
public UnitStatusData statusData;
|
||||
|
||||
public bool needRemove;
|
||||
|
||||
|
|
@ -98,6 +98,21 @@ namespace Gameplay.Unit
|
|||
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
base.OnDispose();
|
||||
commonData = null;
|
||||
transData = null;
|
||||
aliveData = null;
|
||||
fightData = null;
|
||||
controlData = null;
|
||||
statusData = null;
|
||||
aiManager = null;
|
||||
delayMoraleDamage = null;
|
||||
|
||||
buffManager = null;
|
||||
}
|
||||
|
||||
public async UniTask Prepare()
|
||||
{
|
||||
await _OnPrepare();
|
||||
|
|
|
|||
Loading…
Reference in New Issue