Fix get character name logic

This commit is contained in:
HungDK
2026-01-27 17:41:33 +07:00
parent af13bd5c47
commit 312edda4aa
2 changed files with 19 additions and 6 deletions
@@ -26,11 +26,14 @@ namespace BrewMonster.UI
}
public bool SetName(string pszName)
{
m_szName = pszName;
if (m_pAUIManager == null)
return false; // Will be registered when SetAUIManager is called
if (m_pAUIManager.m_DlgName.ContainsKey(pszName))
return false;
//m_pAUIManager.m_DlgName.Remove(m_szName);
m_szName = pszName;
m_pAUIManager.m_DlgName[m_szName] = this;
return true;
@@ -94,6 +97,11 @@ namespace BrewMonster.UI
public void SetAUIManager(AUIManager pAUIManager)
{
m_pAUIManager = pAUIManager;
// Register dialog name if it was set before manager was assigned
if (m_pAUIManager != null && !string.IsNullOrEmpty(m_szName) && !m_pAUIManager.m_DlgName.ContainsKey(m_szName))
{
m_pAUIManager.m_DlgName[m_szName] = this;
}
}
public virtual void OnEnable()
@@ -129,5 +137,8 @@ namespace BrewMonster.UI
{
return false;
}
/// <summary>Override in dialogs that support attribute-point reset (e.g. DlgCharacter). No-op by default.</summary>
public virtual void ResetPoints() { }
}
}
@@ -1,4 +1,4 @@
using BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay;
using BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay;
using BrewMonster.Network;
using BrewMonster.Scripts;
using BrewMonster.Scripts.Skills;
@@ -43,6 +43,9 @@ namespace BrewMonster
var a_pszPanel = new List<string>();
GetQuickBarNameAndSC(pHost, a_pszPanel, a_pSCS, nCurPanel9, nCurPanel8);
if (a_pSCS == null || a_pSCS.Count < 2)
return false;
for (int i = 0; i <= 1/*(int)a_pSCS.Count*/; i++)
{
if (a_pSCS[i] == null)
@@ -50,10 +53,10 @@ namespace BrewMonster
/*CDlgQuickBar* pQuickBar = dynamic_cast<CDlgQuickBar*>(GetGameUIMan()->GetDialog(a_pszPanel[i]));
if (!pQuickBar || !pQuickBar->IsShow()) continue;*/
int slotIndex = 0;
for (int j = 0; j < a_pSCS.Count; j++)
int nSlots = Mathf.Min(a_pSCS[i].GetShortcutNum(), AUIImagePictureList.Count);
for (int j = 0; j < nSlots; j++)
{
pCell = AUIImagePictureList[slotIndex];
pCell = AUIImagePictureList[j];
pSC = a_pSCS[i].GetShortcut(j);
pClock = pCell.GetClockIcon();
pClock.SetProgressRange(0, 1);
@@ -207,7 +210,6 @@ namespace BrewMonster
{
if (pSkill != null)
{
slotIndex++;
//BMLogger.Log("HoangDev: QuickBar Set Skill Icon: " + (uint)pSkill.GetSkillID() + " : " + ElementSkill.GetIcon((uint)pSkill.GetSkillID()));
var nameskill = ElementSkill.GetIcon((uint)pSkill.GetSkillID());
GetGameUIMan().SetCover(pCell, nameskill, EC_GAMEUI_ICONS.ICONS_SKILL);