修复Bug

This commit is contained in:
GL 2025-01-02 18:05:20 +08:00
parent c4d23e1398
commit 367b62b1c6
4 changed files with 18 additions and 7 deletions

@ -1 +1 @@
Subproject commit d198bb4790e69c80f7e7eb16e112fbf45d58243b
Subproject commit e828d3c14c03d86a77a12cf184c547257c08f849

View File

@ -92,10 +92,7 @@ public class CharacterClick : MonoBehaviour
ShowAttackRange(UIContorl.instance.NowAttackRange);
instantiatedPanel.GetComponent<charainfoPanel>().closeBtn.onClick.AddListener(() => {
UIContorl.instance.NowShowInfo.Id = -1;
Destroy(instantiatedPanel.GetComponent<charainfoPanel>()._closePanel);
HideAttackRange(UIContorl.instance.NowAttackRange);
Debug.Log("关闭攻击范围");
HideInfoPanel();
});
RectTransform panelRect = instantiatedPanel.GetComponent<RectTransform>();
// 确保生成的面板不会挡住父物体
@ -104,11 +101,12 @@ public class CharacterClick : MonoBehaviour
{
//string eveText,string name,string def,string speed,string shanghai,string info,int hp,int maxHp
panelRect.GetComponent<charainfoPanel>().UpDateShow("1", "Enemy_001", "0", "3", "1", "测试文档一", role.hp, role.maxHp);
panelRect.GetComponent<charainfoPanel>().role = role;
}
else
{
panelRect.GetComponent<charainfoPanel>().UpDateShow(role.Level.ToString(), role.Name, role.Info, role.MinAttack + "~" + role.MaxAttack, role.AttackRange.ToString(), role.AttackCD.ToString());
panelRect.GetComponent<charainfoPanel>().role = role;
}
@ -148,4 +146,17 @@ public class CharacterClick : MonoBehaviour
}
}
}
public void HideInfoPanel()
{
UIContorl.instance.NowShowInfo.Id = -1;
UIContorl.instance.NowShowInfo.role = null;
if (instantiatedPanel!=null&&instantiatedPanel.GetComponent<charainfoPanel>()._closePanel != null)
{
Destroy(instantiatedPanel.GetComponent<charainfoPanel>()._closePanel);
}
HideAttackRange(UIContorl.instance.NowAttackRange);
//Debug.Log("¹Ø±Õ¹¥»÷·¶Î§");
}
}

View File

@ -13,7 +13,6 @@ public class UIContorl : Base
[Header("ºìÉ«ÆÁÄ»")]
public GameObject redMaskPre;
public GameObject redMask;
[Header("指定的角色")] public Role role;
private int hp;
public int Hp
{

View File

@ -27,6 +27,7 @@ public class charainfoPanel : Base
public Image HpImage;
public int Id=-1;//信息id 0为当前为萌妖 1为敌人
public Role role;//当前显示的角色
public virtual void Start()
{