diff --git a/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs b/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs index 1da0d8f674..f9975427fe 100644 --- a/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs +++ b/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs @@ -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 npcSkills = new HashSet(); { @@ -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(); @@ -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) => diff --git a/Assets/PerfectWorld/Scripts/UI/AUIManager.cs b/Assets/PerfectWorld/Scripts/UI/AUIManager.cs index 9bdf1fbf89..05d8d10d6b 100644 --- a/Assets/PerfectWorld/Scripts/UI/AUIManager.cs +++ b/Assets/PerfectWorld/Scripts/UI/AUIManager.cs @@ -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(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) diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillSubList.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillSubList.cs index b69a271e71..eb9a205d9e 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillSubList.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillSubList.cs @@ -1,7 +1,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Linq; using BrewMonster; using BrewMonster.Scripts.Skills; using TMPro; @@ -91,14 +90,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; } @@ -141,9 +137,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; @@ -174,7 +167,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); @@ -200,14 +192,6 @@ namespace BrewMonster.UI skill.Show(false); } - var skillModel = CECHostSkillModel.Instance; - IReadOnlyDictionary> 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()) @@ -238,10 +222,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() @@ -266,24 +246,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 "); - BMLogger.LogError("HoangDEv subListItem before2 update "+ subListItem); subListItem.UpdateSkill(skillID); - BMLogger.LogError("HoangDEv subListItem after update " + subListItem); - subListItem.Show(true); - BMLogger.LogError("HoangDEv subListItem true"); if (GetSelectedSkillID() == skillID) { //GetGameUIMan()->m_pDlgSkillAction->ShowSkillTree(skillID); @@ -311,7 +284,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; } @@ -342,7 +314,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(); @@ -350,7 +321,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; } } @@ -358,7 +328,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; } @@ -369,7 +338,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> allRankProfSkills = model.GetAllRankProfSkills(); @@ -377,43 +345,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 rankSkills = new List(); - 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(); @@ -434,16 +386,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) diff --git a/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs b/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs index d36188ffc4..ce99534d93 100644 --- a/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs +++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs @@ -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; }