|
@@ -17,7 +17,8 @@ namespace Fort23.Mono
|
|
|
public int shieldSize = 50;
|
|
|
public bool isFollowTarget = true;
|
|
|
|
|
|
-
|
|
|
+ private BetterList<BuffWidget> buBetterList = new BetterList<BuffWidget>();
|
|
|
+
|
|
|
private void Init()
|
|
|
{
|
|
|
}
|
|
@@ -41,11 +42,29 @@ namespace Fort23.Mono
|
|
|
CombatEventManager.Instance.RemoveEventListener(CombatEventType.HeroDie, HeroDie);
|
|
|
CombatEventManager.Instance.RemoveEventListener(CombatEventType.AddBuff,
|
|
|
AddBuff);
|
|
|
-
|
|
|
+ CombatEventManager.Instance.RemoveEventListener(CombatEventType.RemoveBuff,
|
|
|
+ RemoveBuff);
|
|
|
StaticUpdater.Instance.RemoveRenderUpdateCallBack(Update);
|
|
|
base.DormancyObj();
|
|
|
}
|
|
|
|
|
|
+ private async void RemoveBuff(IEventData iEventData)
|
|
|
+ {
|
|
|
+ BuffEventData buffEventData = iEventData as BuffEventData;
|
|
|
+ if (buffEventData.target == combatHeroEntity)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < buBetterList.Count; i++)
|
|
|
+ {
|
|
|
+ BuffWidget buffWidget = buBetterList[i];
|
|
|
+ if (buffWidget.buffBasic == buffEventData.BuffBasic)
|
|
|
+ {
|
|
|
+ UIManager.Instance.DormancyGComponent(buffWidget);
|
|
|
+ buBetterList.RemoveAt(i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private async void AddBuff(IEventData iEventData)
|
|
|
{
|
|
|
BuffEventData buffEventData = iEventData as BuffEventData;
|
|
@@ -54,6 +73,7 @@ namespace Fort23.Mono
|
|
|
BuffBasic buffBasic = buffEventData.BuffBasic;
|
|
|
BuffWidget buffWidget = await UIManager.Instance.CreateGComponent<BuffWidget>(null, buffRoot);
|
|
|
buffWidget.InitBuff(buffBasic);
|
|
|
+ buBetterList.Add(buffWidget);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -103,12 +123,18 @@ namespace Fort23.Mono
|
|
|
private void HeroDie(IEventData iEventData)
|
|
|
{
|
|
|
HeroDieEventData heroHpUpdateEventData = iEventData as HeroDieEventData;
|
|
|
- if (heroHpUpdateEventData.combatHeroEntity == combatHeroEntity && combatHeroEntity.IsEnemy)
|
|
|
+ if (heroHpUpdateEventData.combatHeroEntity == combatHeroEntity)
|
|
|
{
|
|
|
+ for (int i = 0; i < buBetterList.Count; i++)
|
|
|
+ {
|
|
|
+ UIManager.Instance.DormancyGComponent(buBetterList[i]);
|
|
|
+ }
|
|
|
+ buBetterList.Clear();
|
|
|
if (string.IsNullOrEmpty(poolObjName))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
GObjectPool.Instance.Recycle(this);
|
|
|
}
|
|
|
}
|