diff --git a/Assets/PerfectWorld/Scripts/UI/HUDPlayer.cs b/Assets/PerfectWorld/Scripts/UI/HUDPlayer.cs index a59ea3e51b..77b03ff6c6 100644 --- a/Assets/PerfectWorld/Scripts/UI/HUDPlayer.cs +++ b/Assets/PerfectWorld/Scripts/UI/HUDPlayer.cs @@ -1,4 +1,6 @@ using System; +using BrewMonster.Network; +using BrewMonster.UI; using CSNetwork.GPDataType; using TMPro; using UnityEngine; @@ -17,12 +19,17 @@ namespace BrewMonster public Image manaImage; public Image expImage; + [Tooltip("Optional. Assign to make this area open the character dialog on click. If unset, nothing opens.")] + [SerializeField] private Button m_btnOpenCharacter; + public float neededExp; private void Awake() { EventBus.Subscribe(UpdateHostPlayerInfoUI); EventBus.Subscribe(UpdateNameHostPlayer); EventBus.Subscribe(UpdateNeededExp); + if (m_btnOpenCharacter != null) + m_btnOpenCharacter.onClick.AddListener(OnOpenCharacterClick); } private void OnDestroy() @@ -52,5 +59,19 @@ namespace BrewMonster manaImage.fillAmount = (float)obj.iMP / (float)obj.iMaxMP; expImage.fillAmount = (float)obj.iExp / (float)neededExp; } + + private void OnOpenCharacterClick() + { + var gameUIMan = EC_Game.GetGameRun()?.GetUIManager()?.GetInGameUIMan(); + if (gameUIMan == null) return; + var dlg = gameUIMan.GetDialog("Win_Character"); + if (dlg == null) return; + if (!dlg.IsShow()) + { + UnityGameSession.c2s_SendCmdGetExtProps(); + dlg.ResetPoints(); + } + dlg.Show(!dlg.IsShow()); + } } } \ No newline at end of file