show why can't learn skill or upgrade
This commit is contained in:
@@ -24,6 +24,7 @@ namespace BrewMonster
|
||||
|
||||
private int m_skillID;
|
||||
private int m_curLevel;
|
||||
private string m_upgradeDisabledReason = null;
|
||||
|
||||
private const string l_colorWhite = "<color=#ffffff>";
|
||||
private const string l_colorRed = "<color=#ff0000>";
|
||||
@@ -45,6 +46,13 @@ namespace BrewMonster
|
||||
}
|
||||
var uiManager = CECUIManager.Instance;
|
||||
var gameUIMan = uiManager.GetInGameUIMan();
|
||||
|
||||
if (!string.IsNullOrEmpty(m_upgradeDisabledReason))
|
||||
{
|
||||
uiManager.ShowMessageBoxGeneral("MessageBox", m_upgradeDisabledReason, this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.IsDead() ||
|
||||
player.IsSitting() ||
|
||||
player.IsChangingFace() ||
|
||||
@@ -56,6 +64,7 @@ namespace BrewMonster
|
||||
player.IsFighting())
|
||||
{
|
||||
uiManager.ShowMessageBoxGeneral("MessageBox", gameUIMan.GetStringFromTable(11327), this);
|
||||
return;
|
||||
}
|
||||
|
||||
int nCondition = CECHostSkillModel.Instance.CheckLearnCondition(m_skillID);
|
||||
@@ -129,9 +138,7 @@ namespace BrewMonster
|
||||
}
|
||||
else
|
||||
{
|
||||
/* GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(nCheckCode), MB_OK,
|
||||
A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
|
||||
pMsgBox->SetLife(3);*/
|
||||
uiManager.ShowMessageBoxGeneral("MessageBox", gameUIMan.GetStringFromTable(nCheckCode), this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,54 +269,38 @@ namespace BrewMonster
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_skillID == 234)
|
||||
BMLogger.LogError($"HoangDev: UpdateUpgradeBtn m_skillID:{m_skillID} spOK=" + spOK + ", moneyOK=" + moneyOK + ", preSkillOK=" + preSkillOK);
|
||||
//if (m_skillID == 234)
|
||||
// BMLogger.LogError($"HoangDev: UpdateUpgradeBtn m_skillID:{m_skillID} spOK=" + spOK + ", moneyOK=" + moneyOK + ", preSkillOK=" + preSkillOK);
|
||||
if (spOK && moneyOK && preSkillOK)
|
||||
{
|
||||
m_upgradeBtn.interactable = true;
|
||||
m_upgradeDisabledReason = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_upgradeBtn.interactable = (false);
|
||||
}
|
||||
var sb = new StringBuilder();
|
||||
|
||||
/*string strSp;
|
||||
string strMoney;
|
||||
string strPreSkill = "";
|
||||
strSp = string.Format(GetStringFromTable(11402), needSp);
|
||||
strMoney = string.Format(GetStringFromTable(11403), needMoney);
|
||||
if (!spOK)
|
||||
{
|
||||
string strSp = GPDataTypeHelper.ReplacePercentD(GetStringFromTable(11402), needSp);
|
||||
sb.AppendLine(l_colorRed + strSp + l_colorClose);
|
||||
}
|
||||
|
||||
if (spOK)
|
||||
{
|
||||
strSp = l_colorWhite + strSp + l_colorClose;
|
||||
}
|
||||
else
|
||||
{
|
||||
strSp = l_colorRed + strSp + l_colorClose;
|
||||
}
|
||||
if (moneyOK)
|
||||
{
|
||||
strMoney = l_colorWhite + strMoney + l_colorClose;
|
||||
}
|
||||
else
|
||||
{
|
||||
strMoney = l_colorRed + strMoney + l_colorClose;
|
||||
}
|
||||
if (!preSkillOK)
|
||||
{
|
||||
strPreSkill = GetStringFromTable(11404);
|
||||
}*/
|
||||
if (!moneyOK)
|
||||
{
|
||||
string strMoney = GPDataTypeHelper.ReplacePercentD(GetStringFromTable(11403), needMoney);
|
||||
sb.AppendLine(l_colorRed + strMoney + l_colorClose);
|
||||
}
|
||||
|
||||
// Set tooltip/hint for the button
|
||||
// m_upgradeBtn.SetHint(strSp + strMoney + strPreSkill);
|
||||
// Note: Unity doesn't have SetHint, you may need to implement tooltip system
|
||||
if (!preSkillOK)
|
||||
sb.AppendLine(GetStringFromTable(11404));
|
||||
|
||||
m_upgradeDisabledReason = sb.ToString().TrimEnd();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BMLogger.LogError("HoangDev: UpdateUpgradeBtn Skill is not served by NPC m_skillID:" + m_skillID);
|
||||
str = string.Format(GetStringFromTable(11321));
|
||||
// m_upgradeBtn.SetHint(str);
|
||||
m_upgradeBtn.interactable = false;
|
||||
m_upgradeDisabledReason = GetStringFromTable(11321);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user