diff --git a/Assets/AddressableAssetsData/AddressableAssetSettings.asset b/Assets/AddressableAssetsData/AddressableAssetSettings.asset index bd80e9cca7..049dac9a74 100644 --- a/Assets/AddressableAssetsData/AddressableAssetSettings.asset +++ b/Assets/AddressableAssetsData/AddressableAssetSettings.asset @@ -58,7 +58,7 @@ MonoBehaviour: m_ContentStateBuildPathProfileVariableName: m_CustomContentStateBuildPath: m_ContentStateBuildPath: - m_BuildAddressablesWithPlayerBuild: 0 + m_BuildAddressablesWithPlayerBuild: 2 m_overridePlayerVersion: '[UnityEditor.PlayerSettings.bundleVersion]' m_GroupAssets: - {fileID: 11400000, guid: c99cbfd356e4d487b8da3554688ea241, type: 2} diff --git a/Assets/AddressableAssetsData/AssetGroups/gfx.asset b/Assets/AddressableAssetsData/AssetGroups/gfx.asset index 3c3ca35f47..b04be0329a 100644 --- a/Assets/AddressableAssetsData/AssetGroups/gfx.asset +++ b/Assets/AddressableAssetsData/AssetGroups/gfx.asset @@ -1241,12 +1241,6 @@ MonoBehaviour: m_SerializedLabels: - RemoteContent FlaggedDuringContentUpdateRestriction: 0 - - m_GUID: 96405357221afa34990f1c8b0ad64755 - m_Address: "gfx/\u7B56\u5212\u8054\u5165/\u4EBA\u7269\u6280\u80FD/\u51FB\u4E2D/\u517D\u738B\u9524\u51FB\u4E2D.gfx" - m_ReadOnly: 0 - m_SerializedLabels: - - RemoteContent - FlaggedDuringContentUpdateRestriction: 0 - m_GUID: 97bb43aeae9345e4ea58bd33e8257cb0 m_Address: "gfx/\u7B56\u5212\u8054\u5165/\u4EBA\u7269\u6280\u80FD/\u98DE\u884C/\u9F99\u73B0\u98DE\u884C.gfx" m_ReadOnly: 0 diff --git a/Assets/PerfectWorld/Scripts/Common/DebugSessionLog.cs b/Assets/PerfectWorld/Scripts/Common/DebugSessionLog.cs index f18fbd16bc..b1e677e059 100644 --- a/Assets/PerfectWorld/Scripts/Common/DebugSessionLog.cs +++ b/Assets/PerfectWorld/Scripts/Common/DebugSessionLog.cs @@ -1,59 +1,118 @@ #if UNITY_EDITOR || DEVELOPMENT_BUILD + using System; + using System.IO; + using System.Text; + using UnityEngine; + + namespace BrewMonster + { + /// NDJSON debug session logger (agent instrumentation). + public static class DebugSessionLog + { + const string LogPath = @"c:\Hoang\PW\debug-a9c674.log"; + const string SessionId = "a9c674"; - public static void Write(string location, string message, string hypothesisId, object data, string runId = "pre-fix") + + + public static void Write(string location, string message, string hypothesisId, DebugSessionPayload data, string runId = "pre-fix") + { + try + { + var ts = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); + var dataJson = data != null ? JsonUtility.ToJson(data) : "{}"; + var line = $"{{\"sessionId\":\"{SessionId}\",\"runId\":\"{runId}\",\"hypothesisId\":\"{hypothesisId}\",\"location\":\"{Escape(location)}\",\"message\":\"{Escape(message)}\",\"data\":{dataJson},\"timestamp\":{ts}}}\n"; + File.AppendAllText(LogPath, line, Encoding.UTF8); + } + catch { /* ignore */ } + } + + static string Escape(string s) => (s ?? "").Replace("\\", "\\\\").Replace("\"", "\\\""); + } + + [Serializable] + public class DebugSessionPayload + { + public int skillId; + public int hostId; + public int castTargetId; + public int targetId; + public int targetCount; + public bool castInTargets; + public bool alreadyFired; + public int flyClusterCount; + public int flyDelayMs; + public int eventId; + public string flyGfx; + public string prevState; + public string newState; + public int frame; + public float spawnX; + public float spawnY; + public float spawnZ; + public float targetX; + public float targetY; + public float targetZ; + public float radius; + public float offsetMag; + public bool isCluster; + public bool isArea; + } + } + #endif + diff --git a/Assets/PerfectWorld/Scripts/Managers/CECAttacksMan.cs b/Assets/PerfectWorld/Scripts/Managers/CECAttacksMan.cs index f410a75352..3c59eeeed7 100644 --- a/Assets/PerfectWorld/Scripts/Managers/CECAttacksMan.cs +++ b/Assets/PerfectWorld/Scripts/Managers/CECAttacksMan.cs @@ -401,7 +401,6 @@ namespace BrewMonster 200, // timeToBeFired 1000 // timeToDoDamage ); - BMLogger.LogError("HoangDev: idTarget:" + idTarget); m_targets.AddLast(newEvent); #if UNITY_EDITOR if (m_AttackList.Count == 0) diff --git a/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs b/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs index fc16307e4c..bf766aac63 100644 --- a/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs +++ b/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs @@ -957,7 +957,6 @@ namespace BrewMonster continue; string strGFXFile = szBasePath + strEffect; - BMLogger.LogError("HoangDevGFXSTATE: strGFXFile: " +strGFXFile); // [中文] TestProcessPetCureGFX — 宠愈 GFX 系统尚未移植,跳过(等价于始终返回 false) // [English] TestProcessPetCureGFX — pet-cure GFX system not ported yet; skip (equivalent to always false) // if (TestProcessPetCureGFX(strGFXFile, dwFlag2 != 0, i + idState * bitSize)) continue; @@ -2607,9 +2606,7 @@ namespace BrewMonster if (GetMoveEnv() == (int)MoveEnvironment.MOVEENV_GROUND) { riseName = EC_Utility.BuildActionName(data, weapon_type, "_施放起_"); - Debug.Log("HoangDev: riseName: " + riseName); fallName = EC_Utility.BuildActionName(data, weapon_type, "_施放落_"); - Debug.Log("HoangDev: fallName: " + fallName); } else { diff --git a/Assets/PerfectWorld/Scripts/Players/CECPlayerActionController.cs b/Assets/PerfectWorld/Scripts/Players/CECPlayerActionController.cs index ab0281b1db..a8e8ea8c59 100644 --- a/Assets/PerfectWorld/Scripts/Players/CECPlayerActionController.cs +++ b/Assets/PerfectWorld/Scripts/Players/CECPlayerActionController.cs @@ -115,7 +115,6 @@ namespace BrewMonster public bool PlaySkillAttackActionWithName(int idSkill, string szActName, bool bNoFX = false, CECAttackEvent attackEvent = null, uint dwFlagMode = 0) { - BMLogger.LogError("HoangDev PlaySkillAttackActionWithName:"+szActName); bool? pActFlag = null; if (m_actionPlayPolicy != null && m_actionPlayPolicy.PlaySkillAttackActionWithName(idSkill, szActName, bNoFX, attackEvent, dwFlagMode)) diff --git a/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs b/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs index 97be7203c8..f9975427fe 100644 --- a/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs +++ b/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs @@ -98,6 +98,7 @@ namespace BrewMonster.Scripts.Skills public CECHostSkillModel() { + m_allProfSkills = new Dictionary(); m_skillLearnNPCNID = 0; m_bReceivedNPCGreeting = false; m_bInitialized = false; @@ -146,9 +147,19 @@ namespace BrewMonster.Scripts.Skills return enumEvilGod.SKILL_BASE; } } + static CECHostPlayer TryGetHostPlayer() => CECGameRun.Instance?.GetHostPlayer(); + public enumSkillLearnedState GetSkillLearnedState(int skillID) { - CECSkill pSkill = CECGameRun.Instance.GetHostPlayer().GetNormalSkill(skillID); + CECHostPlayer host = TryGetHostPlayer(); + if (host == null) + { + return ElementSkill.IsOverridden((uint)skillID) + ? enumSkillLearnedState.SKILL_OVERRIDDEN + : enumSkillLearnedState.SKILL_NOT_LEARNED; + } + + CECSkill pSkill = host.GetNormalSkill(skillID); if (pSkill != null) { if (pSkill.GetSkillLevel() < pSkill.GetMaxLevel()) @@ -309,9 +320,15 @@ namespace BrewMonster.Scripts.Skills BMLogger.LogError("skillID not exist in m_allProfSkills"); return default; } - int maxLevel = CECGameRun.Instance.GetHostPlayer().GetMaxLevelSofar(); - int rank = CECGameRun.Instance.GetHostPlayer().GetBasicProps().iLevel2; - int realmLevel = CECGameRun.Instance.GetHostPlayer().GetRealmLevel(); + CECHostPlayer host = TryGetHostPlayer(); + if (host == null) + { + return enumSkillFitLevelState.SKILL_NOT_FIT_LEVEL; + } + + int maxLevel = host.GetMaxLevelSofar(); + int rank = host.GetBasicProps().iLevel2; + int realmLevel = host.GetRealmLevel(); return GetSkillFitLevel(skillID, maxLevel, rank, realmLevel); } @@ -324,7 +341,7 @@ namespace BrewMonster.Scripts.Skills } int skillLevel = 1; //½«ÒªÑ§Ï°µÄ¼¼Äܼ¶±ð - CECSkill pSkill = CECGameRun.Instance.GetHostPlayer().GetNormalSkill(skillID); + CECSkill pSkill = TryGetHostPlayer()?.GetNormalSkill(skillID); if (pSkill != null) { skillLevel = pSkill.GetSkillLevel() + 1; @@ -359,7 +376,8 @@ namespace BrewMonster.Scripts.Skills } public int CheckLearnCondition(int skillID) { - return CECGameRun.Instance.GetHostPlayer().CheckSkillLearnCondition(skillID, true); + CECHostPlayer host = TryGetHostPlayer(); + return host != null ? host.CheckSkillLearnCondition(skillID, true) : 0; } public StringBuilder GetSkillDescription(int skillID, int level) { @@ -396,15 +414,13 @@ namespace BrewMonster.Scripts.Skills return 0; } - CECSkill pSkill = CECGameRun.Instance.GetHostPlayer().GetNormalSkill(skillID); + CECSkill pSkill = TryGetHostPlayer()?.GetNormalSkill(skillID); if (pSkill != null) { return pSkill.GetSkillLevel(); } - else - { - return 0; - } + + return 0; } private void InitializeRootOfSkillTree(int rootSkillID) { @@ -520,7 +536,8 @@ namespace BrewMonster.Scripts.Skills } - if (pSkill.GetCls() == CECGameRun.Instance.GetHostPlayer().GetProfession()) + CECHostPlayer host = TryGetHostPlayer(); + if (host != null && pSkill.GetCls() == host.GetProfession()) { // ��NPC������ǰְҵ���ܣ���Ҫ��¼��NPC��ID profCorrect = true; @@ -574,14 +591,16 @@ namespace BrewMonster.Scripts.Skills } } + 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; while ((curID = ElementSkill.NextSkill(curID)) != 0) { ElementSkill pSkill = ElementSkill.Create(curID, 1); int cls = pSkill.GetCls(); - int playerCls = professionOverride ?? - CECGameRun.Instance.GetHostPlayer().GetProfession(); + int playerCls = playerProfession; bool isSameClass = (cls == playerCls || cls == 255); bool isProvidedByNPC = npcSkills.Contains(curID); @@ -650,7 +669,8 @@ namespace BrewMonster.Scripts.Skills } public bool CheckPreItem(int itemID) { - return CECGameRun.Instance.GetHostPlayer().GetPack().FindItem(itemID) != -1; + CECHostPlayer host = TryGetHostPlayer(); + return host != null && host.GetPack().FindItem(itemID) != -1; } public bool IsSkillServedByNPC(int skillID) { 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 bd749400e9..eb9a205d9e 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillSubList.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillSubList.cs @@ -1,6 +1,6 @@ using System; +using System.Collections; using System.Collections.Generic; -using System.Linq; using BrewMonster; using BrewMonster.Scripts.Skills; using TMPro; @@ -26,9 +26,9 @@ namespace BrewMonster.UI [Header("State")] [SerializeField] private bool m_isEvil; - private readonly Dictionary m_rankSubDialogs = new(); - private readonly List m_skillSubDialogs = new(); - private readonly Dictionary m_skillSubDialogsMap = new(); + private Dictionary m_rankSubDialogs ; + private List m_skillSubDialogs ; + private Dictionary m_skillSubDialogsMap ; private int m_skillSubCount; // 当前显示的技能数量 / Current shown skill count private float m_curBottom; // 当前底部位置 / Current bottom position @@ -40,6 +40,7 @@ namespace BrewMonster.UI private bool m_bAllocRankDlgs; // 是否已创建阶位子对话 / Whether rank sub dialogs are allocated private int m_selectedSkillId; + private Coroutine m_resetDialogCoroutine; private void Awake() { @@ -47,6 +48,9 @@ namespace BrewMonster.UI { m_contentRoot = transform as RectTransform; } + m_skillSubDialogsMap = new Dictionary(); + m_skillSubDialogs = new List(); + m_rankSubDialogs = new Dictionary(); EventBus.Subscribe(OnModelChange); CacheTemplateInfo(); HideTemplates(); @@ -61,7 +65,11 @@ namespace BrewMonster.UI private void OnShowDialog() { InitRankDlgs(); - ResetDialog(); + if (m_resetDialogCoroutine != null) + { + StopCoroutine(m_resetDialogCoroutine); + } + m_resetDialogCoroutine = StartCoroutine(ResetDialogWhenReady()); // 保留原始隐藏新图标逻辑 / Keep original "hide new" logic (pending port) // GetGameUIMan()->m_pDlgSystem->ShowNewImg(false); @@ -70,6 +78,30 @@ namespace BrewMonster.UI // GetGameUIMan()->m_pDlgSystem5b->ShowNewImg(false); } + private IEnumerator ResetDialogWhenReady() + { + const float timeoutSecs = 15f; + float elapsed = 0f; + while (GetHostPlayer() == null && elapsed < timeoutSecs) + { + elapsed += Time.unscaledDeltaTime; + yield return null; + } + + if (GetHostPlayer() == null) + { + yield break; + } + + if (CECUIManager.Instance?.GetInGameUIMan() == null) + { + yield break; + } + + ResetDialog(); + m_resetDialogCoroutine = null; + } + // 初始化模板尺寸 / Cache template sizing info private void CacheTemplateInfo() { @@ -145,6 +177,7 @@ namespace BrewMonster.UI // ���¶������Ի�����в��� / Reset dialog with all rank/skill sub dialogs public void ResetDialog() { + m_skillSubDialogs.RemoveAll(item => item == null); m_skillSubDialogsMap.Clear(); m_skillSubCount = 0; m_curBottom = m_originBottom; @@ -159,8 +192,6 @@ namespace BrewMonster.UI skill.Show(false); } - IReadOnlyDictionary> allRankProfSkills = CECHostSkillModel.Instance?.GetAllRankProfSkills(); - for (CECTaoistRank taoistRank = CECTaoistRank.GetBaseRankBegin(); taoistRank != CECTaoistRank.GetBaseRankEnd(); taoistRank = taoistRank.GetNext()) @@ -213,17 +244,17 @@ namespace BrewMonster.UI // �޸�ijһ����������״̬ / Refresh a single skill sub dialog private void UpdateOneSubDlg(int skillID) { - //BMLogger.LogError("UpdateOneSubDlg"); if (!m_skillSubDialogsMap.TryGetValue(skillID, out var pSub)) { return; } CDlgSkillSubListItem subListItem = pSub; - if(subListItem == null ) + if (subListItem == null) { return; } + subListItem.UpdateSkill(skillID); subListItem.Show(true); if (GetSelectedSkillID() == skillID) @@ -256,20 +287,54 @@ namespace BrewMonster.UI return; } - if (m_skillSubCount >= m_skillSubDialogs.Count) + CDlgSkillSubListItem curSubSkill = AcquireSkillSubDialog(skillID, rankID); + if (curSubSkill == null) { - CDlgSkillSubListItem pSubSkill = Instantiate(m_pSubSkill, m_rankSubDialogs[rankID].transform); - m_skillSubDialogs.Add(pSubSkill); + return; } - CDlgSkillSubListItem curSubSkill = m_skillSubDialogs[m_skillSubCount]; - curSubSkill?.SetHighlight(false); - + curSubSkill.SetHighlight(false); m_skillSubDialogsMap[skillID] = curSubSkill; m_skillSubCount++; UpdateOneSubDlg(skillID); } + private CDlgSkillSubListItem AcquireSkillSubDialog(int skillID, int rankID) + { + while (m_skillSubCount < m_skillSubDialogs.Count) + { + CDlgSkillSubListItem pooled = m_skillSubDialogs[m_skillSubCount]; + if (pooled != null) + { + return pooled; + } + + m_skillSubDialogs.RemoveAt(m_skillSubCount); + } + + if (!m_rankSubDialogs.TryGetValue(rankID, out AUISubDialog rankSub) || rankSub == null) + { + if (!m_bAllocRankDlgs) + { + InitRankDlgs(); + } + + if (!m_rankSubDialogs.TryGetValue(rankID, out rankSub) || rankSub == null) + { + return null; + } + } + + CDlgSkillSubListItem created = Instantiate(m_pSubSkill, rankSub.transform); + if (created == null) + { + return null; + } + + m_skillSubDialogs.Add(created); + return created; + } + // ��ijһ�����漶���Ӧ�����м���������Ի��� / Add dialogs for one rank private void AddDlgsOfOneRank(CECTaoistRank taoistRank) { @@ -291,7 +356,6 @@ namespace BrewMonster.UI return; } - if (!allRankProfSkills.TryGetValue(rankID, out var rankItr) || rankItr == null || rankItr.Count == 0) { return; @@ -302,7 +366,6 @@ namespace BrewMonster.UI { if (ElementSkill.IsOverridden((uint)skillID)) { - BMLogger.LogError("HoangDev: AddDlgsOfOneRank ElementSkill.IsOverridden for skillID " + skillID); continue; } /* bool bOnlyShowSkillCanLearn = GetGameUIMan()->m_pDlgSkillAction->IsOnlyShowSkillCanLearn(); @@ -323,7 +386,6 @@ namespace BrewMonster.UI } if (rankSkills.Count == 0) { - BMLogger.LogError("HoangDev: AddDlgsOfOneRank rankSkills.Count == 0"); return; } @@ -364,10 +426,14 @@ namespace BrewMonster.UI Destroy(kv.Value.gameObject); } m_rankSubDialogs.Clear(); + m_bAllocRankDlgs = false; foreach (var dlg in m_skillSubDialogs) { - Destroy(dlg.gameObject); + if (dlg != null) + { + Destroy(dlg.gameObject); + } } m_skillSubDialogs.Clear(); @@ -384,8 +450,7 @@ namespace BrewMonster.UI if (isActiveAndEnabled) { InitRankDlgs(); - FitSize(); - ShowLastSelectedSkill(); + ResetDialog(); } } diff --git a/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs b/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs index 1da346a909..ce99534d93 100644 --- a/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs +++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs @@ -167,31 +167,34 @@ namespace BrewMonster public void UpdateSkill(int skillID) { + if (m_skillIconImgPic == null || m_skillNameLbl == null || skillLevel == null) + { + return; + } + + var uiMan = CECUIManager.Instance?.GetInGameUIMan(); + if (uiMan == null) + { + return; + } + + if (GetHostPlayer() == null) + { + return; + } + CECHostSkillModel model = CECHostSkillModel.Instance; m_skillID = skillID; m_curLevel = model.GetSkillCurrentLevel(m_skillID); enumSkillLearnedState learnedState = model.GetSkillLearnedState(m_skillID); var spriteName = model.GetSkillIcon(skillID); - var slot = CECUIManager.Instance.GetInGameUIMan().SetCover(m_skillIconImgPic, spriteName, EC_GAMEUI_ICONS.ICONS_SKILL); + var slot = uiMan.SetCover(m_skillIconImgPic, spriteName, EC_GAMEUI_ICONS.ICONS_SKILL); if (slot is AUIImagePicture picture) { picture.SetSkillId(skillID); } - /* var sprites = Resources.LoadAll("iconlist_skill_multisprite"); - if (sprites == null || sprites.Length == 0) - return; - - for (int i = 0; i < sprites.Length; i++) - { - if (sprites[i].name == spriteName) - { - skillIcon.sprite = sprites[i]; - break; - } - }*/ - StringBuilder skillDsc; int reqLevel; int reqRealmLevel; @@ -209,37 +212,31 @@ namespace BrewMonster reqLevel = ElementSkill.GetRequiredLevel((uint)m_skillID, m_curLevel); reqRealmLevel = ElementSkill.GetRequiredRealmLevel((uint)m_skillID, m_curLevel); } + + if (skillDsc == null) + { + return; + } + if (reqLevel == 0) { reqLevel = 1; } - skillDsc.AppendLine(GPDataTypeHelper.ReplacePercentD(GetStringFromTable(11328), reqLevel)); + skillDsc.AppendLine(GPDataTypeHelper.ReplacePercentD(GetTableString(uiMan, 11328), reqLevel)); if (reqRealmLevel != 0) { - skillDsc.AppendLine(GetStringFromTable(11401)); - skillDsc.AppendLine(GetGameUIMan().GetRealmName(reqRealmLevel)); + skillDsc.AppendLine(GetTableString(uiMan, 11401)); + skillDsc.AppendLine(uiMan.GetRealmName(reqRealmLevel)); } var str = EC_Utility.FormatForTextMeshPro(skillDsc.ToString()); - // Store hint for tooltip display when clicking skill icon m_skillIconImgPic.SetHint(str); string skillName = model.GetSkillName(m_skillID); - /* if (model.IsPassiveSkill(m_skillID)) - { - skillName += ACString(GetStringFromTable(11322)); - }*/ - if (m_skillNameLbl == null) - { - BMLogger.LogError("HoangDev: CDlgSkillSubListItem m_skillNameLbl is null for skillID " + skillID); - } - else - { - this.name = "Item_"+m_skillID; - } - m_skillNameLbl.text = skillName; + name = "Item_" + m_skillID; + m_skillNameLbl.text = skillName ?? string.Empty; - UpdateUpgradeBtn(); + UpdateUpgradeBtn(uiMan); if (enumSkillLearnedState.SKILL_NOT_LEARNED == learnedState) { @@ -248,12 +245,28 @@ namespace BrewMonster else { skillLevel.gameObject.SetActive(true); - skillLevel.text = GetStringFromTable(11323).Replace("%d", m_curLevel.ToString()); + skillLevel.text = GetTableString(uiMan, 11323).Replace("%d", m_curLevel.ToString()); } } - private void UpdateUpgradeBtn() + static string GetTableString(CECGameUIMan uiMan, int id) { + if (uiMan == null) + { + return string.Empty; + } + + return uiMan.GetStringFromAuiDialogTable(id) ?? uiMan.GetStringFromTable(id) ?? string.Empty; + } + + private void UpdateUpgradeBtn(CECGameUIMan uiMan = null) + { + uiMan ??= CECUIManager.Instance?.GetInGameUIMan(); + if (m_upgradeBtn == null) + { + return; + } + CECHostSkillModel model = CECHostSkillModel.Instance; enumSkillFitLevelState fitLevel = model.GetSkillFitLevel(m_skillID); enumSkillLearnedState learnedState = model.GetSkillLearnedState(m_skillID); @@ -264,14 +277,20 @@ namespace BrewMonster (requiredItem == 0 || model.CheckPreItem(requiredItem))) { m_upgradeBtn.gameObject.SetActive(true); - string str; if (model.IsSkillServedByNPC(m_skillID)) { int needSp = model.GetSkillSp(m_skillID, m_curLevel + 1); int needMoney = model.GetSkillMoney(m_skillID, m_curLevel + 1); - int curSp = GetHostPlayer().GetBasicProps().iSP; - uint curMoney = GetHostPlayer().GetMoneyAmount(); + CECHostPlayer host = GetHostPlayer(); + if (host == null) + { + m_upgradeBtn.gameObject.SetActive(false); + return; + } + + int curSp = host.GetBasicProps().iSP; + uint curMoney = host.GetMoneyAmount(); bool spOK = curSp >= needSp; bool moneyOK = curMoney >= needMoney; @@ -289,7 +308,7 @@ namespace BrewMonster } } } - //if (m_skillID == 234) + if (spOK && moneyOK && preSkillOK) { m_upgradeDisabledReason = null; @@ -300,25 +319,27 @@ namespace BrewMonster if (!spOK) { - string strSp = GPDataTypeHelper.ReplacePercentD(GetStringFromTable(11402), needSp); + string strSp = GPDataTypeHelper.ReplacePercentD(GetTableString(uiMan, 11402), needSp); sb.AppendLine(l_colorRed + strSp + l_colorClose); } if (!moneyOK) { - string strMoney = GPDataTypeHelper.ReplacePercentD(GetStringFromTable(11403), needMoney); + string strMoney = GPDataTypeHelper.ReplacePercentD(GetTableString(uiMan, 11403), needMoney); sb.AppendLine(l_colorRed + strMoney + l_colorClose); } if (!preSkillOK) - sb.AppendLine(GetStringFromTable(11404)); + { + sb.AppendLine(GetTableString(uiMan, 11404)); + } m_upgradeDisabledReason = sb.ToString().TrimEnd(); } } else { - m_upgradeDisabledReason = GetStringFromTable(11321); + m_upgradeDisabledReason = GetTableString(uiMan, 11321); } } else diff --git a/ProjectSettings/ScriptableBuildPipeline.json b/ProjectSettings/ScriptableBuildPipeline.json index dfa4f083cf..551b978e8e 100644 --- a/ProjectSettings/ScriptableBuildPipeline.json +++ b/ProjectSettings/ScriptableBuildPipeline.json @@ -5,7 +5,7 @@ "threadedArchiving": true, "logCacheMiss": false, "logAssetWarnings": true, - "slimWriteResults": true, + "slimWriteResults": false, "maximumCacheSize": 20, "useDetailedBuildLog": false, "useV2Hasher": true,