Update - 1.9.0.103
EN: 1.9.0.103 CN: 1.9.0.104 JP: 1.9.0.106 KR: 1.9.0.108
This commit is contained in:
@@ -76,7 +76,7 @@ function EquipmentAttrPreviewCtrl:RefreshByEquipment()
|
||||
for i = 1, 4 do
|
||||
local goAttr = goItemObj.transform:Find("rtBg/goProperty" .. i).gameObject
|
||||
local ctrlAttr = self:BindCtrlByNode(goAttr, "Game.UI.TemplateEx.TemplateRandomPropertyCtrl")
|
||||
ctrlAttr:SetProperty(v.tbAffix[i], self.nCharId)
|
||||
ctrlAttr:SetProperty(v.tbAffix[i], self.nCharId, false, v.tbUpgradeCount[i])
|
||||
end
|
||||
end
|
||||
self.bInitedByEquipment = true
|
||||
@@ -90,8 +90,13 @@ function EquipmentAttrPreviewCtrl:RefreshByAll()
|
||||
end
|
||||
local tbAllAffix = {}
|
||||
for _, v in ipairs(self.tbEquipment) do
|
||||
for _, nId in ipairs(v.tbAffix) do
|
||||
table.insert(tbAllAffix, nId)
|
||||
for k, nId in ipairs(v.tbAffix) do
|
||||
local nAddId = nId
|
||||
local mapCfg = ConfigTable.GetData("CharGemAttrValue", nId)
|
||||
if v.tbUpgradeCount[k] > 0 and mapCfg then
|
||||
nAddId = mapCfg.TypeId * 100 + v.tbUpgradeCount[k] + mapCfg.Level
|
||||
end
|
||||
table.insert(tbAllAffix, nAddId)
|
||||
end
|
||||
end
|
||||
local mapAttr_ATTR_FIX = {}
|
||||
@@ -162,10 +167,10 @@ function EquipmentAttrPreviewCtrl:RefreshByAll()
|
||||
local create = function(mapAttributeDesc, nValue, nTag)
|
||||
local goItemObj = instantiate(self._mapNode.goPropertyP, self._mapNode.rtAll)
|
||||
goItemObj:SetActive(true)
|
||||
local txtTag = goItemObj.transform:Find("txtTag"):GetComponent("TMP_Text")
|
||||
local txtProperty = goItemObj.transform:Find("txtProperty"):GetComponent("TMP_Text")
|
||||
local txtPropertyValue = goItemObj.transform:Find("txtPropertyValue"):GetComponent("TMP_Text")
|
||||
local link = goItemObj.transform:Find("txtProperty"):GetComponent("TMPHyperLink")
|
||||
local txtTag = goItemObj.transform:Find("AnimRoot/txtTag"):GetComponent("TMP_Text")
|
||||
local txtProperty = goItemObj.transform:Find("AnimRoot/txtProperty"):GetComponent("TMP_Text")
|
||||
local txtPropertyValue = goItemObj.transform:Find("AnimRoot/txtPropertyValue"):GetComponent("TMP_Text")
|
||||
local link = goItemObj.transform:Find("AnimRoot/txtProperty"):GetComponent("TMPHyperLink")
|
||||
NovaAPI.SetTMPText(txtTag, ConfigTable.GetUIText("Equipment_AttrTag_" .. nTag))
|
||||
local sValue = ""
|
||||
sValue = self:_TransValueFormat(nValue, mapAttributeDesc.isPercent, mapAttributeDesc.Format, nTag ~= GameEnum.CharGemAttrTag.ATTR)
|
||||
|
||||
@@ -70,8 +70,8 @@ end
|
||||
function EquipmentAttrReplaceCtrl:Refresh(sName)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtReplaceName, sName)
|
||||
for i = 1, 4 do
|
||||
self._mapNode.goPropertyBefore[i]:SetProperty(self.mapEquipment.tbAffix[i], self.nCharId)
|
||||
self._mapNode.goPropertyAfter[i]:SetProperty(self.mapEquipment.tbAlterAffix[i], self.nCharId)
|
||||
self._mapNode.goPropertyBefore[i]:SetProperty(self.mapEquipment.tbAffix[i], self.nCharId, false, self.mapEquipment.tbUpgradeCount[i])
|
||||
self._mapNode.goPropertyAfter[i]:SetProperty(self.mapEquipment.tbAlterAffix[i], self.nCharId, false, self.mapEquipment.tbAlterUpgradeCount[i])
|
||||
end
|
||||
end
|
||||
function EquipmentAttrReplaceCtrl:PlayInAni()
|
||||
@@ -102,12 +102,37 @@ function EquipmentAttrReplaceCtrl:OnBtnClick_Close()
|
||||
self:PlayOutAni()
|
||||
end
|
||||
function EquipmentAttrReplaceCtrl:OnBtnClick_Replace()
|
||||
local callback = function()
|
||||
self:PlayOutAni()
|
||||
if self.callback then
|
||||
self.callback()
|
||||
local replace = function()
|
||||
local callback = function()
|
||||
self:PlayOutAni()
|
||||
if self.callback then
|
||||
self.callback()
|
||||
end
|
||||
end
|
||||
PlayerData.Equipment:SendCharGemReplaceAttributeReq(self.nCharId, self.nSlotId, self.nSelectGemIndex, callback)
|
||||
end
|
||||
local nAll = 0
|
||||
if self.mapEquipment.tbUpgradeCount then
|
||||
for _, v in ipairs(self.mapEquipment.tbUpgradeCount) do
|
||||
nAll = nAll + v
|
||||
end
|
||||
end
|
||||
PlayerData.Equipment:SendCharGemReplaceAttributeReq(self.nCharId, self.nSlotId, self.nSelectGemIndex, callback)
|
||||
local nAlterAll = 0
|
||||
if self.mapEquipment.tbAlterUpgradeCount then
|
||||
for _, v in ipairs(self.mapEquipment.tbAlterUpgradeCount) do
|
||||
nAlterAll = nAlterAll + v
|
||||
end
|
||||
end
|
||||
if nAlterAll == nAll then
|
||||
replace()
|
||||
else
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = ConfigTable.GetUIText("Equipment_ReplaceWarning_HasUpgrade"),
|
||||
callbackConfirmAfterClose = replace,
|
||||
bBlur = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
end
|
||||
return EquipmentAttrReplaceCtrl
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
local EquipmentInfoCtrl = class("EquipmentInfoCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
EquipmentInfoCtrl._mapNodeConfig = {
|
||||
blur = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
@@ -37,15 +38,26 @@ EquipmentInfoCtrl._mapNodeConfig = {
|
||||
callback = "OnBtnClick_PreLock"
|
||||
},
|
||||
txtEquipmentName = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
imgEquipmentUp = {nCount = 2},
|
||||
goPoint = {},
|
||||
trPoint = {sComponentName = "Transform"},
|
||||
imgIcon = {nCount = 2, sComponentName = "Image"},
|
||||
imgIcon = {nCount = 2, sComponentName = "Transform"},
|
||||
txtEquiped = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Equipped"
|
||||
},
|
||||
imgEquiped = {},
|
||||
txtLockSwitch = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Roll_LockRoll"
|
||||
},
|
||||
btnSwitch = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Switch"
|
||||
},
|
||||
aniIconMask = {sNodeName = "IconMask", sComponentName = "Animator"},
|
||||
goSwitch = {},
|
||||
Info = {sNodeName = "--Info--"},
|
||||
aniInfo = {sNodeName = "--Info--", sComponentName = "Animator"},
|
||||
goProperty = {
|
||||
@@ -64,6 +76,10 @@ EquipmentInfoCtrl._mapNodeConfig = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Unload"
|
||||
},
|
||||
btnUpgrade = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Upgrade"
|
||||
},
|
||||
txtBtnEquip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Btn_Equip"
|
||||
@@ -76,6 +92,10 @@ EquipmentInfoCtrl._mapNodeConfig = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Btn_Unload"
|
||||
},
|
||||
txtBtnUpgrade = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Btn_Upgrade"
|
||||
},
|
||||
Active = {sNodeName = "--Active--"},
|
||||
txtTitleMat = {
|
||||
sComponentName = "TMP_Text",
|
||||
@@ -115,8 +135,17 @@ function EquipmentInfoCtrl:Init()
|
||||
self.mapGemCfg = ConfigTable.GetData("CharGem", nGemId)
|
||||
self.mapSlotCfg = ConfigTable.GetData("CharGemSlotControl", self.nSlotId)
|
||||
self.nSubSelectIndex = 1
|
||||
self.tbEquipmentIcon = {}
|
||||
for i = 1, 2 do
|
||||
self:SetPngSprite(self._mapNode.imgIcon[i], self.mapGemCfg.Icon)
|
||||
local equipPrefab
|
||||
local sPrefab = self.mapGemCfg.Icon .. ".prefab"
|
||||
if GameResourceLoader.ExistsAsset(Settings.AB_ROOT_PATH .. sPrefab) == true then
|
||||
equipPrefab = self:LoadAsset(sPrefab)
|
||||
end
|
||||
if equipPrefab then
|
||||
delChildren(self._mapNode.imgIcon[i])
|
||||
self.tbEquipmentIcon[i] = instantiate(equipPrefab, self._mapNode.imgIcon[i])
|
||||
end
|
||||
end
|
||||
self.tbPoint = {}
|
||||
delChildren(self._mapNode.trPoint)
|
||||
@@ -184,6 +213,14 @@ function EquipmentInfoCtrl:RefreshTop()
|
||||
local sSuf = orderedFormat(ConfigTable.GetUIText("Equipment_NameIndexSuffix"), sRoman)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEquipmentName[self.nSubSelectIndex], self.mapGemCfg.Title .. sSuf)
|
||||
self._mapNode.imgEquiped:SetActive(self.nEquipedGemIndex == self.nSelectGemIndex)
|
||||
local tbEquipment = PlayerData.Equipment:GetEquipmentBySlot(self.nCharId, self.nSlotId)
|
||||
local mapEquipment = tbEquipment[self.nSelectGemIndex]
|
||||
local bUpgrade = mapEquipment and mapEquipment:GetUpgradeCount() > 0
|
||||
self._mapNode.imgEquipmentUp[self.nSubSelectIndex]:SetActive(bUpgrade)
|
||||
if self.tbEquipmentIcon[self.nSubSelectIndex] then
|
||||
self.tbEquipmentIcon[self.nSubSelectIndex].transform:Find("goFx").gameObject:SetActive(bUpgrade)
|
||||
end
|
||||
self:RefreshLock()
|
||||
end
|
||||
function EquipmentInfoCtrl:RefreshInfo(mapEquipment)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtWindowTitle, ConfigTable.GetUIText("Equipment_Title_Info"))
|
||||
@@ -195,7 +232,7 @@ function EquipmentInfoCtrl:RefreshInfo(mapEquipment)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBtnEquip, ConfigTable.GetUIText("Equipment_Btn_Replace"))
|
||||
end
|
||||
for i = 1, 4 do
|
||||
self._mapNode.goProperty[i]:SetProperty(mapEquipment.tbAffix[i], self.nCharId)
|
||||
self._mapNode.goProperty[i]:SetProperty(mapEquipment.tbAffix[i], self.nCharId, false, mapEquipment.tbUpgradeCount[i])
|
||||
end
|
||||
end
|
||||
function EquipmentInfoCtrl:RefreshActive()
|
||||
@@ -229,6 +266,16 @@ function EquipmentInfoCtrl:RefreshSelectPoint(nBefore, nAfter)
|
||||
goCur.transform:Find("imgPointOn").gameObject:SetActive(true)
|
||||
goCur.transform:Find("imgPointOff").gameObject:SetActive(false)
|
||||
end
|
||||
function EquipmentInfoCtrl:RefreshLock()
|
||||
local tbEquipment = PlayerData.Equipment:GetEquipmentBySlot(self.nCharId, self.nSlotId)
|
||||
local mapEquipment = tbEquipment[self.nSelectGemIndex]
|
||||
local bEmpty = mapEquipment == nil
|
||||
self._mapNode.goSwitch:SetActive(not bEmpty)
|
||||
if not bEmpty then
|
||||
self._mapNode.btnSwitch[1].gameObject:SetActive(not mapEquipment.bLock)
|
||||
self._mapNode.btnSwitch[2].gameObject:SetActive(mapEquipment.bLock)
|
||||
end
|
||||
end
|
||||
function EquipmentInfoCtrl:PlayInAni()
|
||||
self._mapNode.window:SetActive(true)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_in")
|
||||
@@ -347,6 +394,22 @@ function EquipmentInfoCtrl:OnBtnClick_Unload()
|
||||
end
|
||||
PlayerData.Equipment:SendCharGemEquipGemReq(self.nCharId, self.nSlotId, 0, nSelectPreset, callback)
|
||||
end
|
||||
function EquipmentInfoCtrl:OnBtnClick_Upgrade()
|
||||
local tbEquipment = PlayerData.Equipment:GetEquipmentBySlot(self.nCharId, self.nSlotId)
|
||||
local mapEquipment = tbEquipment[self.nSelectGemIndex]
|
||||
if mapEquipment and mapEquipment.bLock then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_UpgradeAfterUnlock"))
|
||||
return
|
||||
end
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_out")
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
PlayerData.Equipment:GetEquipmentSelect()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.EquipmentInfo)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EquipmentUpgrade, self.nCharId, self.nSlotId, self.nSelectGemIndex)
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
end
|
||||
function EquipmentInfoCtrl:OnBtnClick_MatTip(btn)
|
||||
if self.mapGemCfg.GenerateCostTid > 0 then
|
||||
local mapData = {
|
||||
@@ -373,4 +436,11 @@ function EquipmentInfoCtrl:OnBtnClick_Active()
|
||||
end
|
||||
PlayerData.Equipment:SendCharGemGenerateReq(self.nCharId, self.nSlotId, callback)
|
||||
end
|
||||
function EquipmentInfoCtrl:OnBtnClick_Switch(btn, nIndex)
|
||||
local bLock = nIndex == 1
|
||||
local callback = function()
|
||||
self:RefreshLock()
|
||||
end
|
||||
PlayerData.Equipment:SendCharGemUpdateGemLockStatusReq(self.nCharId, self.nSlotId, self.nSelectGemIndex, bLock, callback)
|
||||
end
|
||||
return EquipmentInfoCtrl
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
local EquipmentRollCtrl = class("EquipmentRollCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
EquipmentRollCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
@@ -15,7 +16,7 @@ EquipmentRollCtrl._mapNodeConfig = {
|
||||
txtLockDesc = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
imgLockType = {nCount = 3, sComponentName = "Image"},
|
||||
imgChoose = {nCount = 3},
|
||||
imgSlotIcon = {nCount = 3, sComponentName = "Image"},
|
||||
imgSlotIcon = {nCount = 3, sComponentName = "Transform"},
|
||||
imgCharHead = {sComponentName = "Image"},
|
||||
tab = {
|
||||
nCount = 4,
|
||||
@@ -37,8 +38,9 @@ EquipmentRollCtrl._mapNodeConfig = {
|
||||
sNodeName = "imgTabMask",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgEquipmentIcon = {nCount = 2, sComponentName = "Image"},
|
||||
imgEquipmentIcon = {nCount = 2, sComponentName = "Transform"},
|
||||
txtEquipmentName = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
imgEquipmentUp = {nCount = 2},
|
||||
txtEquipmentDesc = {sComponentName = "TMP_Text"},
|
||||
ScrollView = {sComponentName = "ScrollRect"},
|
||||
txtLockSwitch = {
|
||||
@@ -149,14 +151,18 @@ function EquipmentRollCtrl:Refresh()
|
||||
self:RefreshSlot()
|
||||
end
|
||||
function EquipmentRollCtrl:RefreshSlot()
|
||||
for i = 1, 2 do
|
||||
delChildren(self._mapNode.imgEquipmentIcon[i])
|
||||
end
|
||||
self.tbEquipmentIcon = {}
|
||||
self:RefreshSlotData()
|
||||
self:RefreshTab()
|
||||
self:RefreshIndexGem()
|
||||
end
|
||||
function EquipmentRollCtrl:RefreshIndexGem(bAfterActive)
|
||||
self:RefreshSelectData()
|
||||
self:RefreshEquipmentTop()
|
||||
self:RefreshEquipmentInfo()
|
||||
self:RefreshEquipmentTop()
|
||||
self:RefreshEquipmentState(bAfterActive)
|
||||
self:RefreshAttr()
|
||||
self:RefreshAlterAttr()
|
||||
@@ -181,7 +187,16 @@ function EquipmentRollCtrl:RefreshPresetSlot()
|
||||
self:SetPngSprite(self._mapNode.imgLockType[i], mapGemCfg.IconBg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLockDesc[i], orderedFormat(ConfigTable.GetUIText("Equipment_SlotActiveLevel"), mapSlot.nLevel))
|
||||
else
|
||||
self:SetPngSprite(self._mapNode.imgSlotIcon[i], mapGemCfg.Icon)
|
||||
delChildren(self._mapNode.imgSlotIcon[i])
|
||||
local equipPrefab
|
||||
local sPrefab = mapGemCfg.Icon .. ".prefab"
|
||||
if GameResourceLoader.ExistsAsset(Settings.AB_ROOT_PATH .. sPrefab) == true then
|
||||
equipPrefab = self:LoadAsset(sPrefab)
|
||||
end
|
||||
if equipPrefab then
|
||||
local goEquip = instantiate(equipPrefab, self._mapNode.imgSlotIcon[i])
|
||||
goEquip.transform:Find("goFx").gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -256,10 +271,24 @@ function EquipmentRollCtrl:RefreshEquipmentTop()
|
||||
local sRoman = ConfigTable.GetUIText("RomanNumeral_" .. self._panel.nSelectGemIndex)
|
||||
local sSuf = orderedFormat(ConfigTable.GetUIText("Equipment_NameIndexSuffix"), sRoman)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEquipmentName[self.nSubSelectIndex], self.mapGemCfg.Title .. sSuf)
|
||||
local bUpgrade = self.mapEquipment and self.mapEquipment:GetUpgradeCount() > 0
|
||||
self._mapNode.imgEquipmentUp[self.nSubSelectIndex]:SetActive(bUpgrade)
|
||||
if self.tbEquipmentIcon[self.nSubSelectIndex] then
|
||||
self.tbEquipmentIcon[self.nSubSelectIndex].transform:Find("goFx").gameObject:SetActive(bUpgrade)
|
||||
end
|
||||
end
|
||||
function EquipmentRollCtrl:RefreshEquipmentInfo()
|
||||
for i = 1, 2 do
|
||||
self:SetPngSprite(self._mapNode.imgEquipmentIcon[i], self.mapGemCfg.Icon)
|
||||
if self.tbEquipmentIcon[i] == nil then
|
||||
local equipPrefab
|
||||
local sPrefab = self.mapGemCfg.Icon .. ".prefab"
|
||||
if GameResourceLoader.ExistsAsset(Settings.AB_ROOT_PATH .. sPrefab) == true then
|
||||
equipPrefab = self:LoadAsset(sPrefab)
|
||||
end
|
||||
if equipPrefab then
|
||||
self.tbEquipmentIcon[i] = instantiate(equipPrefab, self._mapNode.imgEquipmentIcon[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEquipmentDesc, self.mapGemCfg.Desc)
|
||||
NovaAPI.SetVerticalNormalizedPosition(self._mapNode.ScrollView, 1)
|
||||
@@ -310,7 +339,7 @@ function EquipmentRollCtrl:RefreshAttr()
|
||||
return
|
||||
end
|
||||
for i = 1, 4 do
|
||||
self._mapNode.goProperty[i]:SetProperty(self.mapEquipment.tbAffix[i], self._panel.nCharId)
|
||||
self._mapNode.goProperty[i]:SetProperty(self.mapEquipment.tbAffix[i], self._panel.nCharId, false, self.mapEquipment.tbUpgradeCount[i])
|
||||
self:RefreshAttrLock(i)
|
||||
end
|
||||
end
|
||||
@@ -328,7 +357,7 @@ function EquipmentRollCtrl:RefreshAlterAttr(bRoll)
|
||||
self._mapNode.goAlter.gameObject:SetActive(not bEmpty)
|
||||
if not bEmpty then
|
||||
for i = 1, 4 do
|
||||
self._mapNode.goPropertyAlter[i]:SetProperty(self.mapEquipment.tbAlterAffix[i], self._panel.nCharId, self.tbLockAttr[i])
|
||||
self._mapNode.goPropertyAlter[i]:SetProperty(self.mapEquipment.tbAlterAffix[i], self._panel.nCharId, self.tbLockAttr[i], self.mapEquipment.tbAlterUpgradeCount[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -438,79 +467,112 @@ function EquipmentRollCtrl:OnBtnClick_Roll(btn)
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_Roll_EquipmentLock"))
|
||||
return
|
||||
end
|
||||
local bHasUpgrade = false
|
||||
for k, v in pairs(self.mapEquipment.tbUpgradeCount) do
|
||||
if 0 < v and not self.tbLockAttr[k] then
|
||||
bHasUpgrade = true
|
||||
break
|
||||
end
|
||||
end
|
||||
local tbLockAttrId = {}
|
||||
for k, v in pairs(self.tbLockAttr) do
|
||||
if v == true then
|
||||
table.insert(tbLockAttrId, self.mapEquipment.tbAffix[k])
|
||||
end
|
||||
end
|
||||
local roll = function()
|
||||
local bEnough = false
|
||||
local nHasRefresh = PlayerData.Item:GetItemCountByID(self.mapGemCfg.RefreshCostTid)
|
||||
local nLockAttr = self:GetAttrLockCount()
|
||||
local bUseLock = 0 < nLockAttr
|
||||
if bUseLock then
|
||||
local nHasLock = PlayerData.Item:GetItemCountByID(self.mapSlotCfg.LockItemTid)
|
||||
bEnough = nHasLock >= self.mapSlotCfg.LockItemQty * nLockAttr and nHasRefresh >= self.mapSlotCfg.RefreshCostQty
|
||||
else
|
||||
bEnough = nHasRefresh >= self.mapSlotCfg.RefreshCostQty
|
||||
end
|
||||
if not bEnough then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_MatNotEnough_Roll"))
|
||||
if nHasRefresh < self.mapSlotCfg.RefreshCostQty then
|
||||
self._mapNode.TopBar:OnBtnClick_CoinFirstTips(self._mapNode.goCoinOther)
|
||||
end
|
||||
return
|
||||
end
|
||||
local callback = function()
|
||||
self:RefreshAlterAttr(true)
|
||||
self:RefreshCoin()
|
||||
self:RefreshConfirm()
|
||||
WwiseAudioMgr:PostEvent("ui_charInfo_equipment_reforge_ani")
|
||||
end
|
||||
PlayerData.Equipment:SendCharGemRefreshReq(self._panel.nCharId, self._panel.nSlotId, self._panel.nSelectGemIndex, tbLockAttrId, callback)
|
||||
local bEnough = false
|
||||
local nHasRefresh = PlayerData.Item:GetItemCountByID(self.mapGemCfg.RefreshCostTid)
|
||||
local nLockAttr = self:GetAttrLockCount()
|
||||
local bUseLock = 0 < nLockAttr
|
||||
if bUseLock then
|
||||
local nHasLock = PlayerData.Item:GetItemCountByID(self.mapSlotCfg.LockItemTid)
|
||||
bEnough = nHasLock >= self.mapSlotCfg.LockItemQty * nLockAttr and nHasRefresh >= self.mapSlotCfg.RefreshCostQty
|
||||
else
|
||||
bEnough = nHasRefresh >= self.mapSlotCfg.RefreshCostQty
|
||||
end
|
||||
local warning = function()
|
||||
if not bEnough then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_MatNotEnough_Roll"))
|
||||
if nHasRefresh < self.mapSlotCfg.RefreshCostQty then
|
||||
self._mapNode.TopBar:OnBtnClick_CoinFirstTips(self._mapNode.goCoinOther)
|
||||
end
|
||||
return
|
||||
end
|
||||
local step1 = function(next)
|
||||
local isSelectAgain = false
|
||||
local confirmCallback = function()
|
||||
PlayerData.Equipment:SetRollWarning(not isSelectAgain)
|
||||
roll()
|
||||
PlayerData.Equipment:SetRollUpgradeWarning(not isSelectAgain)
|
||||
next()
|
||||
end
|
||||
local againCallback = function(isSelect)
|
||||
isSelectAgain = isSelect
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = ConfigTable.GetUIText("Equipment_RollWarning_HighQuality"),
|
||||
sContent = ConfigTable.GetUIText("Equipment_RollWarning_HasUpgrade"),
|
||||
callbackConfirm = confirmCallback,
|
||||
callbackAgain = againCallback,
|
||||
sAgain = ConfigTable.GetUIText("MessageBox_LoginWarning")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
local bWarn = PlayerData.Equipment:GetRollWarning()
|
||||
if self.mapEquipment.tbAlterAffix and bWarn then
|
||||
local nRareCount = self:GetRareCount(self.mapEquipment.tbAffix)
|
||||
local nAlterRareCount = self:GetRareCount(self.mapEquipment.tbAlterAffix)
|
||||
local bLock = false
|
||||
for k, v in pairs(self.tbLockAttr) do
|
||||
if v == true then
|
||||
bLock = true
|
||||
break
|
||||
local step2 = function()
|
||||
local roll = function()
|
||||
local callback = function()
|
||||
self:RefreshAlterAttr(true)
|
||||
self:RefreshCoin()
|
||||
self:RefreshConfirm()
|
||||
WwiseAudioMgr:PostEvent("ui_charInfo_equipment_reforge_ani")
|
||||
end
|
||||
PlayerData.Equipment:SendCharGemRefreshReq(self._panel.nCharId, self._panel.nSlotId, self._panel.nSelectGemIndex, tbLockAttrId, callback)
|
||||
end
|
||||
local bHasHQ = PlayerData.Equipment:CheckAlterHighQualityAffix(self.mapEquipment.tbAlterAffix, tbLockAttrId)
|
||||
if not bLock and nAlterRareCount >= ConfigTable.GetConfigNumber("CharGemHighQualityNum") then
|
||||
warning()
|
||||
elseif bLock and nRareCount < nAlterRareCount then
|
||||
warning()
|
||||
elseif bHasHQ then
|
||||
warning()
|
||||
local warning = function()
|
||||
local isSelectAgain = false
|
||||
local confirmCallback = function()
|
||||
PlayerData.Equipment:SetRollWarning(not isSelectAgain)
|
||||
roll()
|
||||
end
|
||||
local againCallback = function(isSelect)
|
||||
isSelectAgain = isSelect
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = ConfigTable.GetUIText("Equipment_RollWarning_HighQuality"),
|
||||
callbackConfirm = confirmCallback,
|
||||
callbackAgain = againCallback,
|
||||
sAgain = ConfigTable.GetUIText("MessageBox_LoginWarning")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
local bWarn = PlayerData.Equipment:GetRollWarning()
|
||||
if self.mapEquipment.tbAlterAffix and bWarn then
|
||||
local nRareCount = self:GetRareCount(self.mapEquipment.tbAffix)
|
||||
local nAlterRareCount = self:GetRareCount(self.mapEquipment.tbAlterAffix)
|
||||
local bLock = false
|
||||
for k, v in pairs(self.tbLockAttr) do
|
||||
if v == true then
|
||||
bLock = true
|
||||
break
|
||||
end
|
||||
end
|
||||
local bHasHQ = PlayerData.Equipment:CheckAlterHighQualityAffix(self.mapEquipment.tbAlterAffix, tbLockAttrId)
|
||||
if not bLock and nAlterRareCount >= ConfigTable.GetConfigNumber("CharGemHighQualityNum") then
|
||||
warning()
|
||||
elseif bLock and nRareCount < nAlterRareCount then
|
||||
warning()
|
||||
elseif bHasHQ then
|
||||
warning()
|
||||
else
|
||||
roll()
|
||||
end
|
||||
else
|
||||
roll()
|
||||
end
|
||||
end
|
||||
local bWarn = PlayerData.Equipment:GetRollUpgradeWarning()
|
||||
if bHasUpgrade and bWarn then
|
||||
step1(step2)
|
||||
else
|
||||
roll()
|
||||
step2()
|
||||
end
|
||||
end
|
||||
function EquipmentRollCtrl:OnBtnClick_EquipmentSlot(_, nIndex)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
local EquipmentSlotItemCtrl = class("EquipmentSlotItemCtrl", BaseCtrl)
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
EquipmentSlotItemCtrl._mapNodeConfig = {
|
||||
goEmpty = {},
|
||||
imgAbleBg = {sComponentName = "Image"},
|
||||
@@ -11,7 +12,7 @@ EquipmentSlotItemCtrl._mapNodeConfig = {
|
||||
imgLockType = {sComponentName = "Image"},
|
||||
imgChoose = {},
|
||||
goEquip = {},
|
||||
imgEquipmentIcon = {sComponentName = "Image"}
|
||||
imgEquipmentIcon = {sComponentName = "Transform"}
|
||||
}
|
||||
EquipmentSlotItemCtrl._mapEventConfig = {}
|
||||
EquipmentSlotItemCtrl._mapRedDotConfig = {}
|
||||
@@ -32,7 +33,21 @@ function EquipmentSlotItemCtrl:Init(mapSlot, nCharId)
|
||||
self:SetPngSprite(self._mapNode.imgLockType, mapGemCfg.IconBg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLockDesc, orderedFormat(ConfigTable.GetUIText("Equipment_SlotActiveLevel"), mapSlot.nLevel))
|
||||
elseif bUnlock and not bEmpty then
|
||||
self:SetPngSprite(self._mapNode.imgEquipmentIcon, mapGemCfg.Icon)
|
||||
local mapEquipment = PlayerData.Equipment:GetEquipmentByGemIndex(nCharId, mapSlot.nSlotId, mapSlot.nGemIndex)
|
||||
local bUpgrade = 0 < mapEquipment:GetUpgradeCount()
|
||||
if not self.goEquipment then
|
||||
local equipPrefab
|
||||
local sPrefab = mapEquipment.sIcon .. ".prefab"
|
||||
if GameResourceLoader.ExistsAsset(Settings.AB_ROOT_PATH .. sPrefab) == true then
|
||||
equipPrefab = self:LoadAsset(sPrefab)
|
||||
end
|
||||
if equipPrefab then
|
||||
self.goEquipment = instantiate(equipPrefab, self._mapNode.imgEquipmentIcon)
|
||||
end
|
||||
end
|
||||
if self.goEquipment then
|
||||
self.goEquipment.transform:Find("goFx").gameObject:SetActive(bUpgrade)
|
||||
end
|
||||
end
|
||||
if mapSlot.nSlotId == 1 and bEmpty and bUnlock then
|
||||
local mapSlotCfg = ConfigTable.GetData("CharGemSlotControl", mapSlot.nSlotId)
|
||||
@@ -53,5 +68,10 @@ function EquipmentSlotItemCtrl:PlayAnim()
|
||||
end
|
||||
function EquipmentSlotItemCtrl:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
self.goEquipment = nil
|
||||
end
|
||||
function EquipmentSlotItemCtrl:Disable()
|
||||
delChildren(self._mapNode.imgEquipmentIcon)
|
||||
self.goEquipment = nil
|
||||
end
|
||||
return EquipmentSlotItemCtrl
|
||||
|
||||
@@ -0,0 +1,471 @@
|
||||
local EquipmentUpgradeCtrl = class("EquipmentUpgradeCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
EquipmentUpgradeCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
blur = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_blur_blue",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnCloseBg = {
|
||||
sNodeName = "snapshot1",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Upgrade_WindowTitle"
|
||||
},
|
||||
window = {},
|
||||
aniWindow = {sNodeName = "window", sComponentName = "Animator"},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtEquipmentName = {sComponentName = "TMP_Text"},
|
||||
btnProperty = {
|
||||
nCount = 4,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Property"
|
||||
},
|
||||
goProperty = {
|
||||
nCount = 4,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateRandomPropertyCtrl"
|
||||
},
|
||||
imgOff = {nCount = 4},
|
||||
imgOn = {nCount = 4},
|
||||
imgMax = {nCount = 4},
|
||||
txtTitleMat = {sComponentName = "TMP_Text"},
|
||||
goTip = {},
|
||||
goRevert = {},
|
||||
goUpgrade = {},
|
||||
goPropertyRevert = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateRandomPropertyCtrl"
|
||||
},
|
||||
txtUpgradeTip = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
goMat = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateMatCtrl"
|
||||
},
|
||||
btnMat = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_MatTip"
|
||||
},
|
||||
btnUpgrade = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Upgrade"
|
||||
},
|
||||
btnRevert = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Revert"
|
||||
},
|
||||
txtBtnUpgrade = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Btn_Upgrade"
|
||||
},
|
||||
txtBtnRevert = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Btn_Revert"
|
||||
},
|
||||
imgCostIcon = {sComponentName = "Image"},
|
||||
txtCostCount = {sComponentName = "TMP_Text"},
|
||||
goCostCoin = {},
|
||||
goMaxUpgrade = {},
|
||||
animPopUpBlur = {
|
||||
sNodeName = "goMaxUpgradeBlur",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
animPopUpWindow = {
|
||||
sNodeName = "goMaxUpgradeWindow",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
txtPopUpTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Title"
|
||||
},
|
||||
txtMaxUpgradeTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Upgrade_MaxUpgradeTip"
|
||||
},
|
||||
goPropertyPopUp = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateRandomPropertyCtrl"
|
||||
},
|
||||
btnOK = {sComponentName = "UIButton"},
|
||||
txtBtnOK = {sComponentName = "TMP_Text", sLanguageId = "BtnConfirm"},
|
||||
btnNG = {sComponentName = "UIButton"},
|
||||
txtBtnNG = {sComponentName = "TMP_Text", sLanguageId = "BtnCancel"},
|
||||
btnPopUpClose = {sComponentName = "UIButton", callback = "ClosePopUp"},
|
||||
btnPopUpCloseBig = {sComponentName = "UIButton", callback = "ClosePopUp"}
|
||||
}
|
||||
EquipmentUpgradeCtrl._mapEventConfig = {}
|
||||
function EquipmentUpgradeCtrl:Open()
|
||||
self._mapNode.blur:SetActive(true)
|
||||
self:PlayInAni()
|
||||
self:Refresh()
|
||||
end
|
||||
function EquipmentUpgradeCtrl:Refresh()
|
||||
self:RefreshData()
|
||||
self:RefreshProperty()
|
||||
self:RefreshInfo()
|
||||
self:RefreshDesc()
|
||||
end
|
||||
function EquipmentUpgradeCtrl:RefreshData()
|
||||
local nGemId = PlayerData.Equipment:GetGemIdBySlot(self.nCharId, self.nSlotId)
|
||||
self.mapGemCfg = ConfigTable.GetData("CharGem", nGemId)
|
||||
self.mapSlotCfg = ConfigTable.GetData("CharGemSlotControl", self.nSlotId)
|
||||
local tbEquipment = PlayerData.Equipment:GetEquipmentBySlot(self.nCharId, self.nSlotId)
|
||||
self.mapEquipment = tbEquipment[self.nSelectGemIndex]
|
||||
end
|
||||
function EquipmentUpgradeCtrl:RefreshInfo()
|
||||
local sRoman = ConfigTable.GetUIText("RomanNumeral_" .. self.nSelectGemIndex)
|
||||
local sSuf = orderedFormat(ConfigTable.GetUIText("Equipment_NameIndexSuffix"), sRoman)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEquipmentName, self.mapGemCfg.Title .. sSuf)
|
||||
end
|
||||
function EquipmentUpgradeCtrl:RefreshProperty()
|
||||
for i = 1, 4 do
|
||||
if self.nSelectUpgradeIndex == i then
|
||||
local bSelectChanged = false
|
||||
local nId = self.mapEquipment.tbAffix[self.nSelectUpgradeIndex]
|
||||
local mapCfg = ConfigTable.GetData("CharGemAttrValue", nId)
|
||||
if mapCfg then
|
||||
local nLeft = mapCfg.OverlockCount - self.mapEquipment.tbUpgradeCount[self.nSelectUpgradeIndex]
|
||||
if 0 < nLeft then
|
||||
bSelectChanged = true
|
||||
end
|
||||
end
|
||||
if bSelectChanged then
|
||||
self._mapNode.goProperty[i]:SetProperty(self.mapEquipment.tbAffix[i], self.nCharId, false, self.mapEquipment.tbUpgradeCount[i] + 1)
|
||||
else
|
||||
self._mapNode.goProperty[i]:SetProperty(self.mapEquipment.tbAffix[i], self.nCharId, false, self.mapEquipment.tbUpgradeCount[i])
|
||||
end
|
||||
else
|
||||
self._mapNode.goProperty[i]:SetProperty(self.mapEquipment.tbAffix[i], self.nCharId, false, self.mapEquipment.tbUpgradeCount[i])
|
||||
end
|
||||
self._mapNode.imgMax[i]:SetActive(false)
|
||||
self._mapNode.imgOff[i]:SetActive(self.nSelectUpgradeIndex ~= i)
|
||||
self._mapNode.imgOn[i]:SetActive(self.nSelectUpgradeIndex == i)
|
||||
end
|
||||
end
|
||||
function EquipmentUpgradeCtrl:RefreshDesc()
|
||||
self._mapNode.goRevert:SetActive(false)
|
||||
self._mapNode.goUpgrade:SetActive(false)
|
||||
self._mapNode.goTip:SetActive(false)
|
||||
self._mapNode.goCostCoin:SetActive(false)
|
||||
local nUpgradeCount = self.mapEquipment:GetUpgradeCount()
|
||||
local nLimit = ConfigTable.GetConfigNumber("CharGemOverlockCount")
|
||||
local bAble = nUpgradeCount < nLimit
|
||||
if bAble then
|
||||
if self.nSelectUpgradeIndex == 0 then
|
||||
self._mapNode.goTip:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtUpgradeTip[1], orderedFormat(ConfigTable.GetUIText("Equipment_Upgrade_NeedSelect"), nLimit - nUpgradeCount))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitleMat, ConfigTable.GetUIText("Equipment_Upgrade_OptionTitle"))
|
||||
elseif self.nSelectUpgradeIndex ~= 0 then
|
||||
local nId = self.mapEquipment.tbAffix[self.nSelectUpgradeIndex]
|
||||
local mapCfg = ConfigTable.GetData("CharGemAttrValue", nId)
|
||||
if mapCfg then
|
||||
local nLeft = mapCfg.OverlockCount - self.mapEquipment.tbUpgradeCount[self.nSelectUpgradeIndex]
|
||||
if 0 < nLeft then
|
||||
self._mapNode.goUpgrade:SetActive(true)
|
||||
self._mapNode.goMat[1]:SetMat(self.mapGemCfg.OverlockCostTid, self.mapSlotCfg.OverlockCostQty)
|
||||
self._mapNode.goMat[2]:SetMat(AllEnum.CoinItemId.Gold, self.mapSlotCfg.OverlockDoraCostQty)
|
||||
self:RefreshCoin()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitleMat, ConfigTable.GetUIText("Equipment_Upgrade_CostTitle"))
|
||||
else
|
||||
self._mapNode.goTip:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtUpgradeTip[1], ConfigTable.GetUIText("Equipment_Upgrade_MaxLevel"))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitleMat, ConfigTable.GetUIText("Equipment_Upgrade_OptionTitle"))
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif self.nSelectUpgradeIndex == 0 then
|
||||
self._mapNode.goTip:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtUpgradeTip[1], orderedFormat(ConfigTable.GetUIText("Equipment_Upgrade_NeedSelect"), nLimit - nUpgradeCount))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitleMat, ConfigTable.GetUIText("Equipment_Upgrade_OptionTitle"))
|
||||
elseif self.nSelectUpgradeIndex ~= 0 then
|
||||
if 0 < self.mapEquipment.tbUpgradeCount[self.nSelectUpgradeIndex] then
|
||||
self._mapNode.goRevert:SetActive(true)
|
||||
self._mapNode.goPropertyRevert:SetProperty(self.mapEquipment.tbAffix[self.nSelectUpgradeIndex], self.nCharId, false, self.mapEquipment.tbUpgradeCount[self.nSelectUpgradeIndex] - 1)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtUpgradeTip[2], orderedFormat(ConfigTable.GetUIText("Equipment_Upgrade_RevertDesc"), nLimit - nUpgradeCount + 1))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitleMat, ConfigTable.GetUIText("Equipment_Upgrade_RevertTitle"))
|
||||
else
|
||||
self._mapNode.goTip:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtUpgradeTip[1], ConfigTable.GetUIText("Equipment_Upgrade_MaxLimit"))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitleMat, ConfigTable.GetUIText("Equipment_Upgrade_OptionTitle"))
|
||||
end
|
||||
end
|
||||
end
|
||||
function EquipmentUpgradeCtrl:RefreshCoin()
|
||||
self._mapNode.goCostCoin:SetActive(true)
|
||||
self:SetSprite_Coin(self._mapNode.imgCostIcon, AllEnum.CoinItemId.Gold)
|
||||
local nHasCoin = PlayerData.Coin:GetCoinCount(AllEnum.CoinItemId.Gold)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCostCount, self.mapSlotCfg.OverlockDoraCostQty)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtCostCount, nHasCoin < self.mapSlotCfg.OverlockDoraCostQty and Red_Unable or Blue_Normal)
|
||||
end
|
||||
function EquipmentUpgradeCtrl:PlayInAni()
|
||||
self._mapNode.window:SetActive(true)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function EquipmentUpgradeCtrl:PlayOutAni()
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_out")
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
self:AddTimer(1, 0.2, "Close", true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
end
|
||||
function EquipmentUpgradeCtrl:Close()
|
||||
self._mapNode.window:SetActive(false)
|
||||
self.bManualClose = true
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.EquipmentUpgrade)
|
||||
end
|
||||
function EquipmentUpgradeCtrl:CheckMaxUpgrade(nId, nIdx)
|
||||
local nIndex = 0
|
||||
if nIdx ~= nil then
|
||||
nIndex = nIdx
|
||||
else
|
||||
nIndex = self.nSelectUpgradeIndex
|
||||
end
|
||||
local nCurId = nId + self.mapEquipment.tbUpgradeCount[nIndex]
|
||||
local nNextId = nCurId + 1
|
||||
local mapNextLevel = ConfigTable.GetData("CharGemAttrValue", nNextId)
|
||||
return mapNextLevel ~= nil and mapNextLevel.OverlockCount == 0
|
||||
end
|
||||
function EquipmentUpgradeCtrl:Awake()
|
||||
self._mapNode.window:SetActive(false)
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.nCharId = tbParam[1]
|
||||
self.nSlotId = tbParam[2]
|
||||
self.nSelectGemIndex = tbParam[3]
|
||||
self.nSelectUpgradeIndex = tbParam[4] or 0
|
||||
end
|
||||
end
|
||||
function EquipmentUpgradeCtrl:OnEnable()
|
||||
self:Open()
|
||||
end
|
||||
function EquipmentUpgradeCtrl:OnDisable()
|
||||
if not self.bManualClose then
|
||||
PlayerData.Equipment:CacheEquipmentUpgrade(self.nSlotId, self.nSelectGemIndex, self.nCharId, self.nSelectUpgradeIndex)
|
||||
end
|
||||
end
|
||||
function EquipmentUpgradeCtrl:OnDestroy()
|
||||
end
|
||||
function EquipmentUpgradeCtrl:OnBtnClick_Close()
|
||||
self:PlayOutAni()
|
||||
end
|
||||
function EquipmentUpgradeCtrl:OnBtnClick_Property(_, nIndex)
|
||||
local nBefore = self.nSelectUpgradeIndex
|
||||
if self.nSelectUpgradeIndex == nIndex then
|
||||
self.nSelectUpgradeIndex = 0
|
||||
else
|
||||
self.nSelectUpgradeIndex = nIndex
|
||||
end
|
||||
self:RefreshDesc()
|
||||
for i = 1, 4 do
|
||||
self._mapNode.imgMax[i]:SetActive(false)
|
||||
self._mapNode.imgOff[i]:SetActive(self.nSelectUpgradeIndex ~= i)
|
||||
self._mapNode.imgOn[i]:SetActive(self.nSelectUpgradeIndex == i)
|
||||
end
|
||||
if nBefore ~= 0 then
|
||||
self._mapNode.goProperty[nBefore]:SetProperty(self.mapEquipment.tbAffix[nBefore], self.nCharId, false, self.mapEquipment.tbUpgradeCount[nBefore])
|
||||
end
|
||||
if self.nSelectUpgradeIndex ~= 0 then
|
||||
local nUpgradeCount = self.mapEquipment:GetUpgradeCount()
|
||||
local nLimit = ConfigTable.GetConfigNumber("CharGemOverlockCount")
|
||||
local bAble = nUpgradeCount < nLimit
|
||||
local bSelectChanged = false
|
||||
local nId = self.mapEquipment.tbAffix[self.nSelectUpgradeIndex]
|
||||
local mapCfg = ConfigTable.GetData("CharGemAttrValue", nId)
|
||||
if mapCfg then
|
||||
local nLeft = mapCfg.OverlockCount - self.mapEquipment.tbUpgradeCount[self.nSelectUpgradeIndex]
|
||||
if 0 < nLeft then
|
||||
bSelectChanged = true
|
||||
end
|
||||
end
|
||||
if bSelectChanged and bAble then
|
||||
local nCurId = self.mapEquipment.tbAffix[nIndex]
|
||||
local bMaxUpgrade = self:CheckMaxUpgrade(nCurId, nIndex)
|
||||
self._mapNode.imgMax[nIndex]:SetActive(bMaxUpgrade)
|
||||
self._mapNode.goProperty[self.nSelectUpgradeIndex]:PlayUpgradeAni(self.mapEquipment.tbAffix[self.nSelectUpgradeIndex], self.nCharId, false, self.mapEquipment.tbUpgradeCount[self.nSelectUpgradeIndex] + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
function EquipmentUpgradeCtrl:OnBtnClick_Upgrade()
|
||||
if self.nSelectUpgradeIndex == 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_NeedToSelectAffix"))
|
||||
return
|
||||
end
|
||||
local bAble = self.mapEquipment:CheckUpgradeAble()
|
||||
if not bAble then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_UpgradeCountEmpty"))
|
||||
return
|
||||
end
|
||||
local nId = self.mapEquipment.tbAffix[self.nSelectUpgradeIndex]
|
||||
local mapCfg = ConfigTable.GetData("CharGemAttrValue", nId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
local nLeft = mapCfg.OverlockCount - self.mapEquipment.tbUpgradeCount[self.nSelectUpgradeIndex]
|
||||
if nLeft <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_SelectAffixMax"))
|
||||
return
|
||||
end
|
||||
local nHas = PlayerData.Item:GetItemCountByID(self.mapGemCfg.OverlockCostTid)
|
||||
local nHasCoin = PlayerData.Item:GetItemCountByID(AllEnum.CoinItemId.Gold)
|
||||
local bEnough = nHas >= self.mapSlotCfg.OverlockCostQty and nHasCoin >= self.mapSlotCfg.OverlockDoraCostQty
|
||||
if not bEnough then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_MatNotEnough_Upgrade"))
|
||||
return
|
||||
end
|
||||
local upgrade = function()
|
||||
local sCost = ""
|
||||
local mapItemCfg = ConfigTable.GetData_Item(self.mapGemCfg.OverlockCostTid)
|
||||
if mapItemCfg then
|
||||
sCost = mapItemCfg.Title
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = orderedFormat(ConfigTable.GetUIText("Equipment_Upgrade_MainTips"), self.mapSlotCfg.OverlockCostQty, sCost),
|
||||
sContentSub = ConfigTable.GetUIText("Equipment_Upgrade_SubTips"),
|
||||
callbackConfirmAfterClose = function()
|
||||
local callback = function()
|
||||
local mapData = {
|
||||
nAffixId = nId,
|
||||
nCharId = self.nCharId,
|
||||
nUpgradeCount = self.mapEquipment.tbUpgradeCount[self.nSelectUpgradeIndex]
|
||||
}
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_out")
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self._mapNode.blur:SetActive(false)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EquipmentSucBar, mapData, function()
|
||||
self._mapNode.blur:SetActive(true)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_in")
|
||||
WwiseAudioMgr:PostEvent("ui_common_menu2")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
self.nSelectUpgradeIndex = 0
|
||||
self:Refresh()
|
||||
end)
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
end
|
||||
PlayerData.Equipment:SendCharGemOverlockReq(self.nCharId, self.nSlotId, self.nSelectGemIndex, self.nSelectUpgradeIndex, callback)
|
||||
end,
|
||||
bBlur = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
local confirm = function()
|
||||
self:ClosePopUp()
|
||||
local bSame = self.mapEquipment:CheckUpgradeAlterSame(self.nSelectUpgradeIndex)
|
||||
if not bSame then
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = ConfigTable.GetUIText("Equipment_Upgrade_AlterHasNotSameAffix"),
|
||||
callbackConfirmAfterClose = upgrade,
|
||||
bBlur = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
else
|
||||
upgrade()
|
||||
end
|
||||
end
|
||||
local nCurId = nId + self.mapEquipment.tbUpgradeCount[self.nSelectUpgradeIndex]
|
||||
local nNextId = nCurId + 1
|
||||
local mapNextLevel = ConfigTable.GetData("CharGemAttrValue", nNextId)
|
||||
local bMaxUpgrade = mapNextLevel ~= nil and mapNextLevel.OverlockCount == 0
|
||||
if bMaxUpgrade then
|
||||
self:OpenPopUp()
|
||||
self._mapNode.goPropertyPopUp[1]:SetProperty(nCurId, self.nCharId)
|
||||
self._mapNode.goPropertyPopUp[2]:SetProperty(nNextId, self.nCharId)
|
||||
self._mapNode.btnOK.onClick:RemoveAllListeners()
|
||||
self._mapNode.btnOK.onClick:AddListener(confirm)
|
||||
self._mapNode.btnNG.onClick:RemoveAllListeners()
|
||||
self._mapNode.btnNG.onClick:AddListener(function()
|
||||
self:ClosePopUp()
|
||||
end)
|
||||
else
|
||||
confirm()
|
||||
end
|
||||
end
|
||||
function EquipmentUpgradeCtrl:OpenPopUp()
|
||||
self._mapNode.goMaxUpgrade:SetActive(true)
|
||||
self._mapNode.animPopUpWindow:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function EquipmentUpgradeCtrl:ClosePopUp()
|
||||
if self._mapNode.goMaxUpgrade.activeSelf == false then
|
||||
return
|
||||
end
|
||||
self._mapNode.animPopUpWindow:Play("t_window_04_t_out")
|
||||
self._mapNode.animPopUpBlur:SetTrigger("tOut")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self._mapNode.goMaxUpgrade:SetActive(false)
|
||||
end, true, true, true)
|
||||
end
|
||||
function EquipmentUpgradeCtrl:OnBtnClick_Revert()
|
||||
if self.nSelectUpgradeIndex == 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_NeedToSelectAffix"))
|
||||
return
|
||||
end
|
||||
if self.mapEquipment.tbUpgradeCount[self.nSelectUpgradeIndex] == 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_CanNotRevert"))
|
||||
return
|
||||
end
|
||||
local sCost = ""
|
||||
local mapItemCfg = ConfigTable.GetData_Item(self.mapGemCfg.OverlockCostTid)
|
||||
if mapItemCfg then
|
||||
sCost = mapItemCfg.Title
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = ConfigTable.GetUIText("Equipment_Revert_MainTips"),
|
||||
sContentSub = orderedFormat(ConfigTable.GetUIText("Equipment_Revert_SubTips"), sCost),
|
||||
callbackConfirmAfterClose = function()
|
||||
local callback = function()
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_out")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_in")
|
||||
WwiseAudioMgr:PostEvent("ui_common_menu2")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
self.nSelectUpgradeIndex = 0
|
||||
self:Refresh()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_RevertSuccess"))
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
end
|
||||
PlayerData.Equipment:SendCharGemOverlockRevertReq(self.nCharId, self.nSlotId, self.nSelectGemIndex, self.nSelectUpgradeIndex, callback)
|
||||
end,
|
||||
bBlur = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function EquipmentUpgradeCtrl:OnBtnClick_MatTip(btn, index)
|
||||
if index == 1 then
|
||||
if self.mapGemCfg.OverlockCostTid > 0 then
|
||||
local mapData = {
|
||||
nTid = self.mapGemCfg.OverlockCostTid,
|
||||
nNeedCount = self.mapSlotCfg.OverlockCostQty,
|
||||
bShowDepot = true,
|
||||
bShowJumpto = true
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ItemTips, btn.transform, mapData)
|
||||
end
|
||||
else
|
||||
local mapData = {
|
||||
nTid = AllEnum.CoinItemId.Gold,
|
||||
nNeedCount = self.mapSlotCfg.OverlockDoraCostQty,
|
||||
bShowDepot = true,
|
||||
bShowJumpto = true
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ItemTips, btn.transform, mapData)
|
||||
end
|
||||
end
|
||||
return EquipmentUpgradeCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local EquipmentUpgradePanel = class("EquipmentUpgradePanel", BasePanel)
|
||||
EquipmentUpgradePanel._bIsMainPanel = false
|
||||
EquipmentUpgradePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Equipment/EquipmentUpgradePanel.prefab",
|
||||
sCtrlName = "Game.UI.Equipment.EquipmentUpgradeCtrl"
|
||||
}
|
||||
}
|
||||
function EquipmentUpgradePanel:Awake()
|
||||
end
|
||||
function EquipmentUpgradePanel:OnEnable()
|
||||
end
|
||||
function EquipmentUpgradePanel:OnAfterEnter()
|
||||
end
|
||||
function EquipmentUpgradePanel:OnDisable()
|
||||
end
|
||||
function EquipmentUpgradePanel:OnDestroy()
|
||||
end
|
||||
function EquipmentUpgradePanel:OnRelease()
|
||||
end
|
||||
return EquipmentUpgradePanel
|
||||
Reference in New Issue
Block a user