(client) feat:状态UI
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using Base;
|
||||
using Map;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
@ -8,7 +10,13 @@ namespace UI
|
||||
{
|
||||
[SerializeField] private BarUI focusedEntityHP;
|
||||
[SerializeField] private BarUI lastEntityHP;
|
||||
|
||||
[SerializeField] private BarUI BaseBuildingHP;
|
||||
[SerializeField] private MiniMap miniMap;
|
||||
[SerializeField] private EquipmentUI equipmentUI;
|
||||
[SerializeField] private CoinCountUI coinCountUI;
|
||||
[SerializeField] private BuffIconListUI focuseEntityBuffIconList;
|
||||
[SerializeField] private BuffIconListUI lastEntityBuffIconList;
|
||||
[SerializeField] private AttackModeUI attackMode;
|
||||
|
||||
public void Tick()
|
||||
{
|
||||
@ -19,6 +27,53 @@ namespace UI
|
||||
(float)focusedEntity.attributes.health / focusedEntity.entityDef.attributes.health;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Show()
|
||||
{
|
||||
focusedEntityHP.gameObject.SetActive(true);
|
||||
lastEntityHP.gameObject.SetActive(true);
|
||||
BaseBuildingHP.gameObject.SetActive(true);
|
||||
miniMap.gameObject.SetActive(true);
|
||||
equipmentUI.gameObject.SetActive(true);
|
||||
coinCountUI.gameObject.SetActive(true);
|
||||
focuseEntityBuffIconList.gameObject.SetActive(true);
|
||||
lastEntityBuffIconList.gameObject.SetActive(true);
|
||||
attackMode.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
focusedEntityHP.gameObject.SetActive(false);
|
||||
lastEntityHP.gameObject.SetActive(false);
|
||||
BaseBuildingHP.gameObject.SetActive(false);
|
||||
miniMap.gameObject.SetActive(false);
|
||||
equipmentUI.gameObject.SetActive(false);
|
||||
coinCountUI.gameObject.SetActive(false);
|
||||
focuseEntityBuffIconList.gameObject.SetActive(false);
|
||||
lastEntityBuffIconList.gameObject.SetActive(false);
|
||||
attackMode.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
UIInputControl.Instance.OnWindowVisibilityChanged += UIChange;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
UIInputControl.Instance.OnWindowVisibilityChanged -= UIChange;
|
||||
}
|
||||
|
||||
private void UIChange(UIBase ui, bool open)
|
||||
{
|
||||
if (ui.exclusive && open)
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user