From 026286ac46295dd3be578864b3fbd020256b20e6 Mon Sep 17 00:00:00 2001 From: VuNgocHaiC7 Date: Wed, 22 Apr 2026 16:57:25 +0700 Subject: [PATCH] fix conflig --- .../GamePlay/SkillUI/CDlgSkillSubListItem.cs | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs b/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs index 016d9227fe..5fd18450fc 100644 --- a/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs +++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs @@ -106,6 +106,7 @@ namespace BrewMonster int needMoney = CECHostSkillModel.Instance.GetSkillMoney(m_skillID, m_curLevel + 1); int needSp = CECHostSkillModel.Instance.GetSkillSp(m_skillID, m_curLevel + 1); + string str = GPDataTypeHelper.ReplacePercentD(GetStringFromTable(11326), needMoney, needSp); // var messagebox = uiManager.ShowMessageBox(new MessageBoxData() // { @@ -115,16 +116,38 @@ namespace BrewMonster // }); var messagebox = uiManager.ShowMessageBoxYes("Game_LearnSkill", str, this, () => { - UnityGameSession.c2s_SendCmdNPCSevLearnSkill(m_skillID); - int skillID = (int)GetData(); - int nCondition = EC_Game.GetGameRun().GetHostPlayer().CheckSkillLearnCondition(skillID, true); - // BMLogger.LogError("HoangDev: CDlgSkillSubListItem OnCommand_Upgrade clicked yes for nCondition " + nCondition); + CECHostPlayer hostPlayer = GetHostPlayer(); + if (hostPlayer == null) + return; - if (0 == nCondition) + int skillID = m_skillID; + int recheck = hostPlayer.CheckSkillLearnCondition(skillID, true); + + if (recheck != 0) { - UnityGameSession.c2s_SendCmdNPCSevLearnSkill(skillID); + UpdateUpgradeBtn(); + if (!string.IsNullOrEmpty(m_upgradeDisabledReason)) + { + uiManager.ShowMessageBoxGeneral("MessageBox", m_upgradeDisabledReason, this); + } + return; } + int costMoney = CECHostSkillModel.Instance.GetSkillMoney(skillID, m_curLevel + 1); + int costSp = CECHostSkillModel.Instance.GetSkillSp(skillID, m_curLevel + 1); + + if(!hostPlayer.TryConsumeSkillLearnCost(costMoney, costSp)) + { + UpdateUpgradeBtn(); + if(!string.IsNullOrEmpty(m_upgradeDisabledReason)) + { + uiManager.ShowMessageBoxGeneral("MessageBox", m_upgradeDisabledReason, this); + } + return; + } + + UnityGameSession.c2s_SendCmdNPCSevLearnSkill(skillID); + UpdateUpgradeBtn(); }); messagebox.SetData((uint)m_skillID); //GetGameUIMan()->MessageBox("Game_LearnSkill", str, //GetGameUIMan()->GetStringFromTable(231),