Add open dlgcharacter event
This commit is contained in:
@@ -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<cmd_self_info_00>(UpdateHostPlayerInfoUI);
|
||||
EventBus.Subscribe<CECHostPlayer.InfoHostPlayer>(UpdateNameHostPlayer);
|
||||
EventBus.Subscribe<CECHostPlayer.EXPToUpLevel>(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());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user