fix lable rank
This commit is contained in:
@@ -202,10 +202,6 @@ namespace BrewMonster.Scripts.Skills
|
||||
|
||||
m_bInitialized = true;
|
||||
|
||||
// #region agent log
|
||||
BMLogger.LogError($"[SkillSubList][H-A] CECHostSkillModel.Initialize prof={professionOverride ?? (CECGameRun.Instance?.GetHostPlayer()?.GetProfession() ?? -1)} profSkills={m_allProfSkills.Count} rankBuckets={m_allRankProfSkills.Count} hostNull={CECGameRun.Instance?.GetHostPlayer() == null}");
|
||||
// #endregion
|
||||
|
||||
// ÖØÐ´¦ÀíNPCLIST
|
||||
ProcessServiceList();
|
||||
}
|
||||
@@ -565,9 +561,6 @@ namespace BrewMonster.Scripts.Skills
|
||||
|
||||
public void InitAllSkillsOfCurProf(int? professionOverride)
|
||||
{
|
||||
int npcSkillsCount = 0;
|
||||
int matchedSkillsCount = 0;
|
||||
int playerProfession = -1;
|
||||
// --- B1: Thu thập toàn bộ skill từ các NPC có cung cấp dịch vụ học skill ---
|
||||
HashSet<uint> npcSkills = new HashSet<uint>();
|
||||
{
|
||||
@@ -598,9 +591,8 @@ namespace BrewMonster.Scripts.Skills
|
||||
}
|
||||
}
|
||||
|
||||
npcSkillsCount = npcSkills.Count;
|
||||
var hostPlayer = CECGameRun.Instance?.GetHostPlayer();
|
||||
playerProfession = professionOverride ?? (hostPlayer != null ? hostPlayer.GetProfession() : -1);
|
||||
var hostPlayer = TryGetHostPlayer();
|
||||
int playerProfession = professionOverride ?? (hostPlayer != null ? hostPlayer.GetProfession() : -1);
|
||||
|
||||
// --- B2: Duyệt tất cả skill, lọc skill theo class hiện tại của người chơi ---
|
||||
uint curID = 0;
|
||||
@@ -615,7 +607,6 @@ namespace BrewMonster.Scripts.Skills
|
||||
|
||||
if (isSameClass && isProvidedByNPC)
|
||||
{
|
||||
matchedSkillsCount++;
|
||||
m_allProfSkills[(int)curID] = pSkill;
|
||||
if (!m_allRankProfSkills.ContainsKey(pSkill.GetRank()))
|
||||
m_allRankProfSkills[pSkill.GetRank()] = new List<int>();
|
||||
@@ -623,10 +614,6 @@ namespace BrewMonster.Scripts.Skills
|
||||
}
|
||||
}
|
||||
|
||||
// #region agent log
|
||||
BMLogger.LogError($"[SkillSubList][H-B] InitAllSkillsOfCurProf npcSkills={npcSkillsCount} matched={matchedSkillsCount} profSkills={m_allProfSkills.Count} rankBuckets={m_allRankProfSkills.Count} profession={playerProfession} hostNull={hostPlayer == null}");
|
||||
// #endregion
|
||||
|
||||
foreach (var kvp in m_allRankProfSkills)
|
||||
{
|
||||
kvp.Value.Sort((lhs, rhs) =>
|
||||
|
||||
@@ -44,8 +44,8 @@ namespace BrewMonster.UI
|
||||
ImportStringTable("Assets/Addressable/ingame.txt");
|
||||
ImportAuiDialogStringTable("Assets/Addressable/msgbox.txt");
|
||||
ImportStringBadWords("Assets/Addressable/badwords.txt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public string Translate(ushort[] str)
|
||||
{
|
||||
if (str == null || str.Length == 0)
|
||||
@@ -283,26 +283,23 @@ namespace BrewMonster.UI
|
||||
{
|
||||
try
|
||||
{
|
||||
// Wait for GameContentBootstrap gate + URL rewrite, then single shared init.
|
||||
AddressablesInitService.EnsureInitializedBlocking();
|
||||
|
||||
// Load using Addressables directly with WaitForCompletion (Unity-safe, won't deadlock)
|
||||
// This matches the pattern used in EC_Game.cs
|
||||
var handle = Addressables.LoadAssetAsync<TextAsset>(key);
|
||||
var textAsset = handle.WaitForCompletion();
|
||||
|
||||
|
||||
if (handle.Status == AsyncOperationStatus.Succeeded && textAsset != null)
|
||||
{
|
||||
// Keep the handle valid; string tables are used for the whole session
|
||||
// Note: We don't release the handle here to keep the asset loaded
|
||||
return textAsset;
|
||||
}
|
||||
|
||||
|
||||
if (handle.IsValid())
|
||||
{
|
||||
Addressables.Release(handle);
|
||||
}
|
||||
|
||||
|
||||
BMLogger.LogError($"[AUIManager] Failed to load TextAsset for key='{key}'");
|
||||
return null;
|
||||
}
|
||||
@@ -347,7 +344,7 @@ namespace BrewMonster.UI
|
||||
BMLogger.LogError($"[AUIManager] Không tìm thấy prefab dialog '{pszName}'. Add id+prefab to DialogScriptTableObject (Resources/UI/DialogScriptTableObject.asset).");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool IsDialogShow(string pszName)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BrewMonster;
|
||||
using BrewMonster.Scripts.Skills;
|
||||
using TMPro;
|
||||
@@ -29,7 +28,7 @@ namespace BrewMonster.UI
|
||||
|
||||
private readonly Dictionary<int, AUISubDialog> m_rankSubDialogs = new();
|
||||
private readonly List<CDlgSkillSubListItem> m_skillSubDialogs = new();
|
||||
private readonly Dictionary<int, CDlgSkillSubListItem> m_skillSubDialogsMap = new();
|
||||
private Dictionary<int, CDlgSkillSubListItem> m_skillSubDialogsMap = new();
|
||||
|
||||
private int m_skillSubCount; // 当前显示的技能数量 / Current shown skill count
|
||||
private float m_curBottom; // 当前底部位置 / Current bottom position
|
||||
@@ -88,14 +87,11 @@ namespace BrewMonster.UI
|
||||
|
||||
if (GetHostPlayer() == null)
|
||||
{
|
||||
BMLogger.LogError("[SkillSubList] ResetDialog skipped: host player still null");
|
||||
yield break;
|
||||
}
|
||||
|
||||
var uiMan = CECUIManager.Instance?.GetInGameUIMan();
|
||||
if (uiMan == null)
|
||||
if (CECUIManager.Instance?.GetInGameUIMan() == null)
|
||||
{
|
||||
BMLogger.LogError("[SkillSubList] ResetDialog skipped: InGameUIMan null");
|
||||
yield break;
|
||||
}
|
||||
|
||||
@@ -138,9 +134,6 @@ namespace BrewMonster.UI
|
||||
{
|
||||
if (m_bAllocRankDlgs || m_pSubRank == null || m_contentRoot == null)
|
||||
{
|
||||
// #region agent log
|
||||
BMLogger.LogError($"[SkillSubList][H-E] InitRankDlgs skipped reason={(m_bAllocRankDlgs ? "already_alloc" : (m_pSubRank == null ? "no_sub_rank" : "no_content_root"))} allocRank={m_bAllocRankDlgs} subSkill={m_pSubSkill != null} contentRoot={m_contentRoot != null}");
|
||||
// #endregion
|
||||
return;
|
||||
}
|
||||
m_bAllocRankDlgs = true;
|
||||
@@ -171,7 +164,6 @@ namespace BrewMonster.UI
|
||||
// ��ʼ�����������ڶԻ���һ���Է�����ڴ� / Initialize rank sub-dialogs once to avoid realloc
|
||||
private void CreateOneRankDlg(CECTaoistRank taoistRank)
|
||||
{
|
||||
BMLogger.LogError("HoangDev: CreateOneRankDlg");
|
||||
AUISubDialog pSubRank = Instantiate(m_pSubRank, m_contentRoot, transform);
|
||||
pSubRank.SetName($"{m_pSubRank.GetName()}{taoistRank.GetID()}");
|
||||
pSubRank.Show(false);
|
||||
@@ -197,14 +189,6 @@ namespace BrewMonster.UI
|
||||
skill.Show(false);
|
||||
}
|
||||
|
||||
var skillModel = CECHostSkillModel.Instance;
|
||||
IReadOnlyDictionary<int, List<int>> allRankProfSkills = skillModel?.GetAllRankProfSkills();
|
||||
|
||||
// #region agent log
|
||||
int totalCatalogSkills = allRankProfSkills != null ? allRankProfSkills.Values.Sum(l => l?.Count ?? 0) : -1;
|
||||
BMLogger.LogError($"[SkillSubList][H-A] ResetDialog start modelNull={skillModel == null} rankBuckets={allRankProfSkills?.Count ?? -1} catalogSkills={totalCatalogSkills} isEvil={IsEvil()} allocRank={m_bAllocRankDlgs} subSkillTpl={m_pSubSkill != null} contentRoot={m_contentRoot != null} hostNull={GetHostPlayer() == null}");
|
||||
// #endregion
|
||||
|
||||
for (CECTaoistRank taoistRank = CECTaoistRank.GetBaseRankBegin();
|
||||
taoistRank != CECTaoistRank.GetBaseRankEnd();
|
||||
taoistRank = taoistRank.GetNext())
|
||||
@@ -235,10 +219,6 @@ namespace BrewMonster.UI
|
||||
ShowLastSelectedSkill();
|
||||
}
|
||||
UpdateTotalSPText();
|
||||
|
||||
// #region agent log
|
||||
BMLogger.LogError($"[SkillSubList][H-E] ResetDialog end shownSkills={m_skillSubCount} rankBuckets={allRankProfSkills?.Count ?? -1} isEvil={IsEvil()} allocRank={m_bAllocRankDlgs}");
|
||||
// #endregion
|
||||
}
|
||||
|
||||
public void UpdateTotalSPText()
|
||||
@@ -263,23 +243,17 @@ namespace BrewMonster.UI
|
||||
{
|
||||
if (!m_skillSubDialogsMap.TryGetValue(skillID, out var pSub))
|
||||
{
|
||||
BMLogger.LogError($"[SkillSubList] UpdateOneSubDlg missing map entry skillId={skillID}");
|
||||
return;
|
||||
}
|
||||
|
||||
CDlgSkillSubListItem subListItem = pSub;
|
||||
if (subListItem == null)
|
||||
{
|
||||
BMLogger.LogError($"[SkillSubList] UpdateOneSubDlg subListItem null skillId={skillID} poolCount={m_skillSubDialogs.Count} shown={m_skillSubCount}");
|
||||
return;
|
||||
}
|
||||
BMLogger.LogError("HoangDEv subListItem before update ");
|
||||
|
||||
subListItem.UpdateSkill(skillID);
|
||||
BMLogger.LogError("HoangDEv subListItem after update ");
|
||||
|
||||
subListItem.Show(true);
|
||||
BMLogger.LogError("HoangDEv subListItem true");
|
||||
if (GetSelectedSkillID() == skillID)
|
||||
{
|
||||
//GetGameUIMan()->m_pDlgSkillAction->ShowSkillTree(skillID);
|
||||
@@ -307,7 +281,6 @@ namespace BrewMonster.UI
|
||||
{
|
||||
if (m_pSubSkill == null || m_contentRoot == null)
|
||||
{
|
||||
BMLogger.LogError($"[SkillSubList] AddSkillSubDlg aborted skillId={skillID} subSkillTpl={m_pSubSkill != null} contentRoot={m_contentRoot != null}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -338,7 +311,6 @@ namespace BrewMonster.UI
|
||||
|
||||
if (!m_rankSubDialogs.TryGetValue(rankID, out AUISubDialog rankSub) || rankSub == null)
|
||||
{
|
||||
BMLogger.LogError($"[SkillSubList] rank dialog missing rankId={rankID} allocRank={m_bAllocRankDlgs} rankDialogs={m_rankSubDialogs.Count}");
|
||||
if (!m_bAllocRankDlgs)
|
||||
{
|
||||
InitRankDlgs();
|
||||
@@ -346,7 +318,6 @@ namespace BrewMonster.UI
|
||||
|
||||
if (!m_rankSubDialogs.TryGetValue(rankID, out rankSub) || rankSub == null)
|
||||
{
|
||||
BMLogger.LogError($"[SkillSubList] cannot instantiate skill item skillId={skillID} rankId={rankID}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -354,7 +325,6 @@ namespace BrewMonster.UI
|
||||
CDlgSkillSubListItem created = Instantiate(m_pSubSkill, rankSub.transform);
|
||||
if (created == null)
|
||||
{
|
||||
BMLogger.LogError($"[SkillSubList] Instantiate returned null skillId={skillID} rankId={rankID} template={m_pSubSkill.name}");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -365,7 +335,6 @@ namespace BrewMonster.UI
|
||||
// ��ijһ�����漶���Ӧ�����м���������Ի��� / Add dialogs for one rank
|
||||
private void AddDlgsOfOneRank(CECTaoistRank taoistRank)
|
||||
{
|
||||
BMLogger.LogError("HoangDev: AddDlgsOfOneRank(CECTaoistRank taoistRank)");
|
||||
CECHostSkillModel model = CECHostSkillModel.Instance;
|
||||
IReadOnlyDictionary<int, List<int>> allRankProfSkills = model.GetAllRankProfSkills();
|
||||
|
||||
@@ -373,43 +342,27 @@ namespace BrewMonster.UI
|
||||
|
||||
if (allRankProfSkills == null)
|
||||
{
|
||||
// #region agent log
|
||||
BMLogger.LogError($"[SkillSubList][H-A] AddDlgsOfOneRank skip reason=allRankProfSkills_null rankId={rankID}");
|
||||
// #endregion
|
||||
return;
|
||||
}
|
||||
if (IsEvil() && taoistRank.IsGodRank())
|
||||
{
|
||||
// #region agent log
|
||||
BMLogger.LogError($"[SkillSubList][H-C] AddDlgsOfOneRank skip reason=evil_hides_god rankId={rankID}");
|
||||
// #endregion
|
||||
return;
|
||||
}
|
||||
else if (!IsEvil() && taoistRank.IsEvilRank())
|
||||
{
|
||||
// #region agent log
|
||||
BMLogger.LogError($"[SkillSubList][H-C] AddDlgsOfOneRank skip reason=non_evil_hides_evil rankId={rankID}");
|
||||
// #endregion
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!allRankProfSkills.TryGetValue(rankID, out var rankItr) || rankItr == null || rankItr.Count == 0)
|
||||
{
|
||||
// #region agent log
|
||||
BMLogger.LogError($"[SkillSubList][H-A] AddDlgsOfOneRank skip reason=rank_empty rankId={rankID}");
|
||||
// #endregion
|
||||
return;
|
||||
}
|
||||
|
||||
List<int> rankSkills = new List<int>();
|
||||
int overriddenSkipped = 0;
|
||||
foreach (var skillID in rankItr)
|
||||
{
|
||||
if (ElementSkill.IsOverridden((uint)skillID))
|
||||
{
|
||||
overriddenSkipped++;
|
||||
BMLogger.LogError($"[SkillSubList][H-D] skill overridden skillId={skillID} rankId={rankID}");
|
||||
continue;
|
||||
}
|
||||
/* bool bOnlyShowSkillCanLearn = GetGameUIMan()->m_pDlgSkillAction->IsOnlyShowSkillCanLearn();
|
||||
@@ -430,16 +383,9 @@ namespace BrewMonster.UI
|
||||
}
|
||||
if (rankSkills.Count == 0)
|
||||
{
|
||||
// #region agent log
|
||||
BMLogger.LogError($"[SkillSubList][H-D] AddDlgsOfOneRank skip reason=all_overridden rankId={rankID} raw={rankItr.Count} overriddenSkipped={overriddenSkipped}");
|
||||
// #endregion
|
||||
return;
|
||||
}
|
||||
|
||||
// #region agent log
|
||||
BMLogger.LogError($"[SkillSubList][H-E] AddDlgsOfOneRank adding rankId={rankID} raw={rankItr.Count} shown={rankSkills.Count} overriddenSkipped={overriddenSkipped} isEvil={IsEvil()}");
|
||||
// #endregion
|
||||
|
||||
AddRankSubDig(rankID);
|
||||
rankSkills.Sort();
|
||||
foreach (int skillID in rankSkills)
|
||||
|
||||
@@ -167,23 +167,19 @@ namespace BrewMonster
|
||||
|
||||
public void UpdateSkill(int skillID)
|
||||
{
|
||||
BMLogger.LogError("HoangDev: UpdateSkill skillID:" + skillID);
|
||||
if (m_skillIconImgPic == null || m_skillNameLbl == null || skillLevel == null)
|
||||
{
|
||||
BMLogger.LogError($"[SkillSubList] UpdateSkill missing refs skillId={skillID} icon={m_skillIconImgPic != null} nameLbl={m_skillNameLbl != null} levelLbl={skillLevel != null} go={name}");
|
||||
return;
|
||||
}
|
||||
|
||||
var uiMan = CECUIManager.Instance?.GetInGameUIMan();
|
||||
if (uiMan == null)
|
||||
{
|
||||
BMLogger.LogError($"[SkillSubList] UpdateSkill InGameUIMan null skillId={skillID}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetHostPlayer() == null)
|
||||
{
|
||||
BMLogger.LogError($"[SkillSubList] UpdateSkill host player null skillId={skillID}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -219,7 +215,6 @@ namespace BrewMonster
|
||||
|
||||
if (skillDsc == null)
|
||||
{
|
||||
BMLogger.LogError($"[SkillSubList] UpdateSkill skill description null skillId={skillID}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -269,7 +264,6 @@ namespace BrewMonster
|
||||
uiMan ??= CECUIManager.Instance?.GetInGameUIMan();
|
||||
if (m_upgradeBtn == null)
|
||||
{
|
||||
BMLogger.LogError($"[SkillSubList] UpdateUpgradeBtn m_upgradeBtn null skillId={m_skillID}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user