diff --git a/Assets/PerfectWorld/Scripts/Common/DebugSessionLog.cs b/Assets/PerfectWorld/Scripts/Common/DebugSessionLog.cs
index d7b0eb0327..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, 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
+#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, 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/UI/Dialogs/CDlgSkillSubList.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillSubList.cs
index 241e45aa4c..fd773b0e31 100644
--- a/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillSubList.cs
+++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillSubList.cs
@@ -150,6 +150,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;
@@ -228,15 +229,16 @@ 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))
{
+ BMLogger.LogError($"[SkillSubList] UpdateOneSubDlg missing map entry skillId={skillID}");
return;
}
CDlgSkillSubListItem subListItem = pSub;
- if(subListItem == null )
+ if (subListItem == null)
{
+ BMLogger.LogError($"[SkillSubList] UpdateOneSubDlg subListItem null skillId={skillID} poolCount={m_skillSubDialogs.Count} shown={m_skillSubCount}");
return;
}
subListItem.UpdateSkill(skillID);
@@ -267,26 +269,63 @@ namespace BrewMonster.UI
// ����һ�����ܶԻ����øú����������UpdateOneSubDlg / Add a skill sub dialog then update it
private void AddSkillSubDlg(int skillID, int rankID)
{
- BMLogger.LogError("HoangDev: AddSkillSubDlg(int skillID, int rankID)");
if (m_pSubSkill == null || m_contentRoot == null)
+ {
+ BMLogger.LogError($"[SkillSubList] AddSkillSubDlg aborted skillId={skillID} subSkillTpl={m_pSubSkill != null} contentRoot={m_contentRoot != null}");
+ return;
+ }
+
+ CDlgSkillSubListItem curSubSkill = AcquireSkillSubDialog(skillID, rankID);
+ if (curSubSkill == null)
{
return;
}
- if (m_skillSubCount >= m_skillSubDialogs.Count)
- {
- CDlgSkillSubListItem pSubSkill = Instantiate(m_pSubSkill, m_rankSubDialogs[rankID].transform);
- m_skillSubDialogs.Add(pSubSkill);
- }
-
- 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)
+ {
+ BMLogger.LogError($"[SkillSubList] rank dialog missing rankId={rankID} allocRank={m_bAllocRankDlgs} rankDialogs={m_rankSubDialogs.Count}");
+ if (!m_bAllocRankDlgs)
+ {
+ InitRankDlgs();
+ }
+
+ if (!m_rankSubDialogs.TryGetValue(rankID, out rankSub) || rankSub == null)
+ {
+ BMLogger.LogError($"[SkillSubList] cannot instantiate skill item skillId={skillID} rankId={rankID}");
+ return null;
+ }
+ }
+
+ 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;
+ }
+
+ m_skillSubDialogs.Add(created);
+ return created;
+ }
+
// ��ijһ�����漶���Ӧ�����м���������Ի��� / Add dialogs for one rank
private void AddDlgsOfOneRank(CECTaoistRank taoistRank)
{
@@ -402,10 +441,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();
@@ -422,8 +465,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..8f6085fb2f 100644
--- a/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs
+++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs
@@ -167,13 +167,26 @@ namespace BrewMonster
public void UpdateSkill(int 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;
+ }
+
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);
@@ -229,14 +242,7 @@ namespace BrewMonster
{
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;
- }
+ name = "Item_" + m_skillID;
m_skillNameLbl.text = skillName;
UpdateUpgradeBtn();
diff --git a/Assets/PerfectWorld/Scripts/UI/MiniMap/CDlgMiniMap.cs b/Assets/PerfectWorld/Scripts/UI/MiniMap/CDlgMiniMap.cs
index eaa7ba6baa..377d1a5948 100644
--- a/Assets/PerfectWorld/Scripts/UI/MiniMap/CDlgMiniMap.cs
+++ b/Assets/PerfectWorld/Scripts/UI/MiniMap/CDlgMiniMap.cs
@@ -190,7 +190,7 @@ namespace PerfectWorld.UI.MiniMap
if (_txtSystemTime != null)
_txtSystemTime.text = strText;
- BMLogger.Log($"[Cuong] {strText}");
+ // BMLogger.Log($"[Cuong] {strText}");
}
///