add more log
This commit is contained in:
@@ -147,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())
|
||||
@@ -314,9 +324,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);
|
||||
}
|
||||
@@ -329,7 +345,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;
|
||||
@@ -364,7 +380,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)
|
||||
{
|
||||
@@ -401,15 +418,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)
|
||||
{
|
||||
@@ -525,7 +540,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;
|
||||
@@ -666,7 +682,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)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BrewMonster;
|
||||
@@ -40,6 +41,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()
|
||||
{
|
||||
@@ -60,9 +62,12 @@ namespace BrewMonster.UI
|
||||
|
||||
private void OnShowDialog()
|
||||
{
|
||||
BMLogger.LogError("HoangDev: 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);
|
||||
@@ -71,6 +76,33 @@ 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)
|
||||
{
|
||||
BMLogger.LogError("[SkillSubList] ResetDialog skipped: host player still null");
|
||||
yield break;
|
||||
}
|
||||
|
||||
var uiMan = CECUIManager.Instance?.GetInGameUIMan();
|
||||
if (uiMan == null)
|
||||
{
|
||||
BMLogger.LogError("[SkillSubList] ResetDialog skipped: InGameUIMan null");
|
||||
yield break;
|
||||
}
|
||||
|
||||
ResetDialog();
|
||||
m_resetDialogCoroutine = null;
|
||||
}
|
||||
|
||||
// 初始化模板尺寸 / Cache template sizing info
|
||||
private void CacheTemplateInfo()
|
||||
{
|
||||
@@ -241,7 +273,11 @@ namespace BrewMonster.UI
|
||||
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)
|
||||
|
||||
@@ -167,6 +167,7 @@ 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}");
|
||||
@@ -180,6 +181,12 @@ namespace BrewMonster
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetHostPlayer() == null)
|
||||
{
|
||||
BMLogger.LogError($"[SkillSubList] UpdateSkill host player null skillId={skillID}");
|
||||
return;
|
||||
}
|
||||
|
||||
CECHostSkillModel model = CECHostSkillModel.Instance;
|
||||
m_skillID = skillID;
|
||||
m_curLevel = model.GetSkillCurrentLevel(m_skillID);
|
||||
@@ -192,19 +199,6 @@ namespace BrewMonster
|
||||
picture.SetSkillId(skillID);
|
||||
}
|
||||
|
||||
/* var sprites = Resources.LoadAll<Sprite>("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;
|
||||
@@ -222,30 +216,32 @@ namespace BrewMonster
|
||||
reqLevel = ElementSkill.GetRequiredLevel((uint)m_skillID, m_curLevel);
|
||||
reqRealmLevel = ElementSkill.GetRequiredRealmLevel((uint)m_skillID, m_curLevel);
|
||||
}
|
||||
|
||||
if (skillDsc == null)
|
||||
{
|
||||
BMLogger.LogError($"[SkillSubList] UpdateSkill skill description null skillId={skillID}");
|
||||
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));
|
||||
}*/
|
||||
name = "Item_" + m_skillID;
|
||||
m_skillNameLbl.text = skillName;
|
||||
m_skillNameLbl.text = skillName ?? string.Empty;
|
||||
|
||||
UpdateUpgradeBtn();
|
||||
UpdateUpgradeBtn(uiMan);
|
||||
|
||||
if (enumSkillLearnedState.SKILL_NOT_LEARNED == learnedState)
|
||||
{
|
||||
@@ -254,12 +250,29 @@ 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)
|
||||
{
|
||||
BMLogger.LogError($"[SkillSubList] UpdateUpgradeBtn m_upgradeBtn null skillId={m_skillID}");
|
||||
return;
|
||||
}
|
||||
|
||||
CECHostSkillModel model = CECHostSkillModel.Instance;
|
||||
enumSkillFitLevelState fitLevel = model.GetSkillFitLevel(m_skillID);
|
||||
enumSkillLearnedState learnedState = model.GetSkillLearnedState(m_skillID);
|
||||
@@ -270,14 +283,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;
|
||||
@@ -295,7 +314,7 @@ namespace BrewMonster
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (m_skillID == 234)
|
||||
|
||||
if (spOK && moneyOK && preSkillOK)
|
||||
{
|
||||
m_upgradeDisabledReason = null;
|
||||
@@ -306,25 +325,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
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"threadedArchiving": true,
|
||||
"logCacheMiss": false,
|
||||
"logAssetWarnings": true,
|
||||
"slimWriteResults": true,
|
||||
"slimWriteResults": false,
|
||||
"maximumCacheSize": 20,
|
||||
"useDetailedBuildLog": false,
|
||||
"useV2Hasher": true,
|
||||
|
||||
@@ -14,7 +14,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
_data:
|
||||
_json: '{"dictionary":{"aotSafeMode":{"$content":true,"$type":"System.Boolean"},"favoriteMembers":{"$content":[],"$type":"System.Collections.Generic.HashSet`1[[Unity.VisualScripting.Member,
|
||||
Unity.VisualScripting.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"LinkerPropertyProviderSettings":{"$content":[true,true,true],"$type":"System.Collections.Generic.List`1[[System.Boolean,
|
||||
Unity.VisualScripting.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"LinkerPropertyProviderSettings":{"$content":[false,false,false],"$type":"System.Collections.Generic.List`1[[System.Boolean,
|
||||
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"assemblyOptions":{"$content":["mscorlib","Assembly-CSharp-firstpass","Assembly-CSharp","UnityEngine","UnityEngine.CoreModule","UnityEngine.InputModule","UnityEngine.ClusterInputModule","UnityEngine.InputLegacyModule","UnityEngine.PhysicsModule","UnityEngine.Physics2DModule","UnityEngine.TerrainPhysicsModule","UnityEngine.VehiclesModule","UnityEngine.AudioModule","UnityEngine.AnimationModule","UnityEngine.VideoModule","UnityEngine.DirectorModule","UnityEngine.Timeline","UnityEngine.ParticleSystemModule","UnityEngine.ParticlesLegacyModule","UnityEngine.WindModule","UnityEngine.ClothModule","UnityEngine.TilemapModule","UnityEngine.SpriteMaskModule","UnityEngine.TerrainModule","UnityEngine.ImageConversionModule","UnityEngine.TextRenderingModule","UnityEngine.ClusterRendererModule","UnityEngine.ScreenCaptureModule","UnityEngine.AIModule","UnityEngine.UI","UnityEngine.UIModule","UnityEngine.IMGUIModule","UnityEngine.UIElementsModule","UnityEngine.StyleSheetsModule","UnityEngine.VR","UnityEngine.VRModule","UnityEngine.ARModule","UnityEngine.HoloLens","UnityEngine.SpatialTracking","UnityEngine.GoogleAudioSpatializer","UnityEngine.Networking","UnityEngine.Analytics","UnityEngine.Advertisements","UnityEngine.Purchasing","UnityEngine.UnityConnectModule","UnityEngine.UnityAnalyticsModule","UnityEngine.GameCenterModule","UnityEngine.AccessibilityModule","UnityEngine.AndroidJNIModule","UnityEngine.AssetBundleModule","UnityEngine.FileSystemHttpModule","UnityEngine.JSONSerializeModule","UnityEngine.UmbraModule","Unity.Timeline","Unity.Timeline.Editor","Cinemachine","com.unity.cinemachine.editor","Unity.InputSystem","Unity.TextMeshPro","Unity.VisualScripting.Core","Unity.VisualScripting.Flow","Unity.VisualScripting.State"],"$type":"System.Collections.Generic.List`1[[Unity.VisualScripting.LooseAssemblyName,
|
||||
Unity.VisualScripting.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"typeOptions":{"$content":["System.Object","System.Boolean","System.Int32","System.Single","System.String","UnityEngine.Vector2","UnityEngine.Vector3","UnityEngine.Vector4","UnityEngine.Quaternion","UnityEngine.Matrix4x4","UnityEngine.Rect","UnityEngine.Bounds","UnityEngine.Color","UnityEngine.AnimationCurve","UnityEngine.LayerMask","UnityEngine.Ray","UnityEngine.Ray2D","UnityEngine.RaycastHit","UnityEngine.RaycastHit2D","UnityEngine.ContactPoint","UnityEngine.ContactPoint2D","UnityEngine.ParticleCollisionEvent","UnityEngine.SceneManagement.Scene","UnityEngine.Application","UnityEngine.Resources","UnityEngine.Mathf","UnityEngine.Debug","UnityEngine.Input","UnityEngine.Touch","UnityEngine.Screen","UnityEngine.Cursor","UnityEngine.Time","UnityEngine.Random","UnityEngine.Physics","UnityEngine.Physics2D","UnityEngine.SceneManagement.SceneManager","UnityEngine.GUI","UnityEngine.GUILayout","UnityEngine.GUIUtility","UnityEngine.Audio.AudioMixerGroup","UnityEngine.AI.NavMesh","UnityEngine.Gizmos","UnityEngine.AnimatorStateInfo","UnityEngine.EventSystems.BaseEventData","UnityEngine.EventSystems.PointerEventData","UnityEngine.EventSystems.AxisEventData","System.Collections.IList","System.Collections.IDictionary","Unity.VisualScripting.AotList","Unity.VisualScripting.AotDictionary","System.Exception"],"$type":"System.Collections.Generic.List`1[[System.Type,
|
||||
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"projectSetupCompleted":{"$content":false,"$type":"System.Boolean"},"savedVersion":{"major":1,"minor":9,"patch":8,"label":null,"increment":0,"$type":"Unity.VisualScripting.SemanticVersion"}}}'
|
||||
|
||||
Reference in New Issue
Block a user