尝试修改丢text的情况
This commit is contained in:
@@ -122,7 +122,7 @@ namespace Continentis.MainGame
|
||||
|
||||
public void Remove()
|
||||
{
|
||||
buffIcon?.RemoveIcon();
|
||||
//buffIcon?.RemoveIcon();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,6 +105,13 @@ namespace Continentis.MainGame.Character
|
||||
public override void Remove()
|
||||
{
|
||||
OnBuffRemove();
|
||||
|
||||
if (iconSubmodule != null)
|
||||
{
|
||||
(attachedCharacter.characterView.hudContainer.enablingHUDs["CharacterBuffCollection"] as HUD_CharacterBuffCollection)
|
||||
?.RemoveBuffIcon(this);
|
||||
}
|
||||
|
||||
this.attachedCharacter.combatBuffSubmodule.buffList.Remove(this);
|
||||
attachedCharacter.deckSubmodule.GetAllCards().ForEach(card => card.RefreshCardAttributes());
|
||||
attachedCharacter.combatBuffSubmodule.buffList.Exclude(this).For(buff => buff.eventSubmodule?.onOtherBuffRemoved.Invoke(this));
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Continentis.MainGame.UI
|
||||
card.user = CombatMainManager.Instance.currentCharacter;
|
||||
card.RefreshCardAttributes();
|
||||
buttonText.text = "Team";
|
||||
teamPileText.gameObject.SetActive(true);
|
||||
UpdateTeamPileText(card.user.team);
|
||||
});
|
||||
}));
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Continentis.MainGame.UI
|
||||
CombatUIManager.Instance.combatMainPage.ClearAllCardViews();
|
||||
playerHero.deckSubmodule.SetUpHandCardViews();
|
||||
buttonText.text = "Hero";
|
||||
teamPileText.gameObject.SetActive(false);
|
||||
UpdateTeamPileText(playerHero.team);
|
||||
}));
|
||||
seq.AppendInterval(0.1f);
|
||||
seq.Append(CombatUIManager.Instance.combatMainPage.handPile.rectTransform.DOAnchorPosY(80f, 0.2f));
|
||||
@@ -87,13 +87,17 @@ namespace Continentis.MainGame.UI
|
||||
public void UpdateTeamPileText(CombatTeam team)
|
||||
{
|
||||
int currentCardCount = team.deckSubmodule.HandPile.Count;
|
||||
|
||||
Debug.Log($"Current team hand pile count: {currentCardCount}");
|
||||
|
||||
gameObject.SetActive(currentCardCount != 0);
|
||||
|
||||
if (isTeam)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObject.SetActive(currentCardCount != 0);
|
||||
}
|
||||
|
||||
teamPileText.text = $"{currentCardCount}/10";
|
||||
Debug.Log($"Updated team pile text: {teamPileText.text}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,8 +34,18 @@ namespace Continentis.MainGame.UI
|
||||
HUD_CharacterBuffIcon buffIcon = buffIcons.Find(x => x.buff == buff);
|
||||
if (buffIcon != null)
|
||||
{
|
||||
LeanPool.Despawn(buffIcon.gameObject);
|
||||
buffIcons.Remove(buffIcon);
|
||||
buff.iconSubmodule.buffIcon = null;
|
||||
LeanPool.Despawn(buffIcon.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果逻辑上要移除 Buff,但在 UI 列表里找不到对应的 Icon,说明出事了。
|
||||
// 这可能是导致你看到“Buff图标没有正常显示”的另一个原因(状态不同步)。
|
||||
Debug.LogWarning($"[HUD] 尝试移除 Buff {buff.contentSubmodule.displayName} 的图标,但在 buffIcons 列表中未找到匹配项!可能存在状态脱节。");
|
||||
|
||||
// 可选:强制清理一遍列表中的空引用(自我修复)
|
||||
// CleanUpInvalidIcons();
|
||||
}
|
||||
UpdateHud();
|
||||
}
|
||||
|
||||
@@ -40,6 +40,14 @@ namespace Continentis.MainGame.UI
|
||||
}
|
||||
|
||||
TMP_Text text = textList[textIndex];
|
||||
|
||||
if (text == null)
|
||||
{
|
||||
Debug.LogWarning($"Text component at index {textIndex} is null.");
|
||||
// 如果这里触发了,说明上层逻辑在尝试操作一个已经死亡的 UI 对象
|
||||
return;
|
||||
}
|
||||
|
||||
if (getText != null)
|
||||
{
|
||||
text.gameObject.SetActive(true);
|
||||
|
||||
Reference in New Issue
Block a user