Initial version - 1.2.0.60
EN: 1.2.0.60 CN: 1.2.0.61 JP: 1.2.0.63 KR: 1.2.0.67
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
local EquipmentAttrPreviewCtrl = class("EquipmentAttrPreviewCtrl", BaseCtrl)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
EquipmentAttrPreviewCtrl._mapNodeConfig = {
|
||||
blur = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_blur_blue",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnCloseBg = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Title_AttrPreview"
|
||||
},
|
||||
window = {},
|
||||
aniWindow = {sNodeName = "window", sComponentName = "Animator"},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
Content = {sComponentName = "Transform"},
|
||||
goAttr = {},
|
||||
ActionBar = {
|
||||
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
|
||||
},
|
||||
btnShortcutClose = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
}
|
||||
}
|
||||
EquipmentAttrPreviewCtrl._mapEventConfig = {}
|
||||
function EquipmentAttrPreviewCtrl:Open()
|
||||
self._mapNode.blur:SetActive(true)
|
||||
self:PlayInAni()
|
||||
self:Refresh()
|
||||
end
|
||||
function EquipmentAttrPreviewCtrl:Refresh()
|
||||
local mapSlotData
|
||||
if self.tbEquipment == nil then
|
||||
self.tbEquipment, mapSlotData = PlayerData.Equipment:GetEquipedGem(self.nCharId)
|
||||
end
|
||||
for k, v in ipairs(self.tbEquipment) do
|
||||
local goItemObj = instantiate(self._mapNode.goAttr, self._mapNode.Content)
|
||||
goItemObj:SetActive(true)
|
||||
local txtName = goItemObj.transform:Find("t_common_04/imgBg/txtName"):GetComponent("TMP_Text")
|
||||
local sRoman = mapSlotData and ConfigTable.GetUIText("RomanNumeral_" .. mapSlotData[k].nGemIndex) or ""
|
||||
local sName = orderedFormat(ConfigTable.GetUIText("Equipment_AttrPreviewName_" .. k), v.sName, sRoman)
|
||||
NovaAPI.SetTMPText(txtName, sName)
|
||||
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)
|
||||
end
|
||||
end
|
||||
end
|
||||
function EquipmentAttrPreviewCtrl:PlayInAni()
|
||||
self._mapNode.window:SetActive(true)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function EquipmentAttrPreviewCtrl: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 EquipmentAttrPreviewCtrl:Close()
|
||||
self._mapNode.window:SetActive(false)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.EquipmentAttrPreview)
|
||||
end
|
||||
function EquipmentAttrPreviewCtrl:Awake()
|
||||
self._mapNode.window:SetActive(false)
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.nCharId = tbParam[1]
|
||||
self.tbEquipment = tbParam[2]
|
||||
end
|
||||
self._mapNode.btnShortcutClose.gameObject:SetActive(GamepadUIManager.GetInputState())
|
||||
if GamepadUIManager.GetInputState() then
|
||||
local tbConfig = {
|
||||
{
|
||||
sAction = "Back",
|
||||
sLang = "ActionBar_Back"
|
||||
}
|
||||
}
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
end
|
||||
end
|
||||
function EquipmentAttrPreviewCtrl:OnEnable()
|
||||
if GamepadUIManager.GetInputState() then
|
||||
GamepadUIManager.EnableGamepadUI("EquipmentAttrPreviewCtrl", self:GetGamepadUINode(), nil, true)
|
||||
end
|
||||
self:Open()
|
||||
end
|
||||
function EquipmentAttrPreviewCtrl:OnDisable()
|
||||
if GamepadUIManager.GetInputState() then
|
||||
GamepadUIManager.DisableGamepadUI("EquipmentAttrPreviewCtrl")
|
||||
end
|
||||
end
|
||||
function EquipmentAttrPreviewCtrl:OnDestroy()
|
||||
end
|
||||
function EquipmentAttrPreviewCtrl:OnBtnClick_Close()
|
||||
self:PlayOutAni()
|
||||
end
|
||||
return EquipmentAttrPreviewCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local EquipmentAttrPreviewPanel = class("EquipmentAttrPreviewPanel", BasePanel)
|
||||
EquipmentAttrPreviewPanel._bIsMainPanel = false
|
||||
EquipmentAttrPreviewPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Equipment/EquipmentAttrPreviewPanel.prefab",
|
||||
sCtrlName = "Game.UI.Equipment.EquipmentAttrPreviewCtrl"
|
||||
}
|
||||
}
|
||||
function EquipmentAttrPreviewPanel:Awake()
|
||||
end
|
||||
function EquipmentAttrPreviewPanel:OnEnable()
|
||||
end
|
||||
function EquipmentAttrPreviewPanel:OnAfterEnter()
|
||||
end
|
||||
function EquipmentAttrPreviewPanel:OnDisable()
|
||||
end
|
||||
function EquipmentAttrPreviewPanel:OnDestroy()
|
||||
end
|
||||
function EquipmentAttrPreviewPanel:OnRelease()
|
||||
end
|
||||
return EquipmentAttrPreviewPanel
|
||||
@@ -0,0 +1,113 @@
|
||||
local EquipmentAttrReplaceCtrl = class("EquipmentAttrReplaceCtrl", BaseCtrl)
|
||||
EquipmentAttrReplaceCtrl._mapNodeConfig = {
|
||||
blur = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_blur_blue",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnCloseBg = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Title_RollConfirm"
|
||||
},
|
||||
window = {},
|
||||
aniWindow = {sNodeName = "window", sComponentName = "Animator"},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtReplaceName = {sComponentName = "TMP_Text"},
|
||||
txtPropertyBefore = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_AttrBefore"
|
||||
},
|
||||
goPropertyBefore = {
|
||||
nCount = 4,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateRandomPropertyCtrl"
|
||||
},
|
||||
txtPropertyAfter = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_AttrAfter"
|
||||
},
|
||||
goPropertyAfter = {
|
||||
nCount = 4,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateRandomPropertyCtrl"
|
||||
},
|
||||
btnReplace = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Replace"
|
||||
},
|
||||
btnCancel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtBtnReplace = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Btn_ConfirmRollResult"
|
||||
},
|
||||
txtBtnCancel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Cancel"
|
||||
}
|
||||
}
|
||||
EquipmentAttrReplaceCtrl._mapEventConfig = {}
|
||||
function EquipmentAttrReplaceCtrl:Open(sName, mapEquipment, nCharId, nSlotId, nSelectGemIndex, callback)
|
||||
self.mapEquipment = mapEquipment
|
||||
self.nCharId = nCharId
|
||||
self.nSlotId = nSlotId
|
||||
self.nSelectGemIndex = nSelectGemIndex
|
||||
self.callback = callback
|
||||
self._mapNode.blur:SetActive(true)
|
||||
self:PlayInAni()
|
||||
self:Refresh(sName)
|
||||
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)
|
||||
end
|
||||
end
|
||||
function EquipmentAttrReplaceCtrl:PlayInAni()
|
||||
self._mapNode.window:SetActive(true)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function EquipmentAttrReplaceCtrl: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 EquipmentAttrReplaceCtrl:Close()
|
||||
self._mapNode.window:SetActive(false)
|
||||
self._mapNode.blur:SetActive(false)
|
||||
end
|
||||
function EquipmentAttrReplaceCtrl:Awake()
|
||||
self._mapNode.window:SetActive(false)
|
||||
end
|
||||
function EquipmentAttrReplaceCtrl:OnEnable()
|
||||
end
|
||||
function EquipmentAttrReplaceCtrl:OnDisable()
|
||||
end
|
||||
function EquipmentAttrReplaceCtrl:OnDestroy()
|
||||
end
|
||||
function EquipmentAttrReplaceCtrl:OnBtnClick_Close()
|
||||
self:PlayOutAni()
|
||||
end
|
||||
function EquipmentAttrReplaceCtrl:OnBtnClick_Replace()
|
||||
local callback = function()
|
||||
self:PlayOutAni()
|
||||
if self.callback then
|
||||
self.callback()
|
||||
end
|
||||
end
|
||||
PlayerData.Equipment:SendCharGemReplaceAttributeReq(self.nCharId, self.nSlotId, self.nSelectGemIndex, callback)
|
||||
end
|
||||
return EquipmentAttrReplaceCtrl
|
||||
@@ -0,0 +1,368 @@
|
||||
local EquipmentInfoCtrl = class("EquipmentInfoCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
EquipmentInfoCtrl._mapNodeConfig = {
|
||||
blur = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_blur_blue",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnCloseBg = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtWindowTitle = {sComponentName = "TMP_Text"},
|
||||
window = {},
|
||||
aniWindow = {sNodeName = "window", sComponentName = "Animator"},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnNext = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Next"
|
||||
},
|
||||
btnPre = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Pre"
|
||||
},
|
||||
btnNextLock = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_NextLock"
|
||||
},
|
||||
btnPreLock = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_PreLock"
|
||||
},
|
||||
txtEquipmentName = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
goPoint = {},
|
||||
trPoint = {sComponentName = "Transform"},
|
||||
imgIcon = {nCount = 2, sComponentName = "Image"},
|
||||
txtEquiped = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Equipped"
|
||||
},
|
||||
imgEquiped = {},
|
||||
aniIconMask = {sNodeName = "IconMask", sComponentName = "Animator"},
|
||||
Info = {sNodeName = "--Info--"},
|
||||
aniInfo = {sNodeName = "--Info--", sComponentName = "Animator"},
|
||||
goProperty = {
|
||||
nCount = 4,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateRandomPropertyCtrl"
|
||||
},
|
||||
btnEquip = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Equip"
|
||||
},
|
||||
btnRoll = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Roll"
|
||||
},
|
||||
btnUnload = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Unload"
|
||||
},
|
||||
txtBtnEquip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Btn_Equip"
|
||||
},
|
||||
txtBtnRoll = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Btn_GotoRoll"
|
||||
},
|
||||
txtBtnUnload = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Btn_Unload"
|
||||
},
|
||||
Active = {sNodeName = "--Active--"},
|
||||
txtTitleMat = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Active_Material"
|
||||
},
|
||||
goMat = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateMatCtrl"
|
||||
},
|
||||
btnAdd = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_MatTip"
|
||||
},
|
||||
txtActiveTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Active_AttrTip"
|
||||
},
|
||||
btnActive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Active"
|
||||
},
|
||||
txtBtnActive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Btn_Active"
|
||||
},
|
||||
FX = {sNodeName = "--FX--"}
|
||||
}
|
||||
EquipmentInfoCtrl._mapEventConfig = {}
|
||||
function EquipmentInfoCtrl:Open()
|
||||
self._mapNode.blur:SetActive(true)
|
||||
self:PlayInAni()
|
||||
self:Init()
|
||||
self:Refresh()
|
||||
self:RefreshPoint()
|
||||
end
|
||||
function EquipmentInfoCtrl:Init()
|
||||
local nGemId = PlayerData.Equipment:GetGemIdBySlot(self.nCharId, self.nSlotId)
|
||||
self.mapGemCfg = ConfigTable.GetData("CharGem", nGemId)
|
||||
self.mapSlotCfg = ConfigTable.GetData("CharGemSlotControl", self.nSlotId)
|
||||
self.nSubSelectIndex = 1
|
||||
for i = 1, 2 do
|
||||
self:SetPngSprite(self._mapNode.imgIcon[i], self.mapGemCfg.Icon)
|
||||
end
|
||||
self.tbPoint = {}
|
||||
delChildren(self._mapNode.trPoint)
|
||||
for i = 1, self.mapSlotCfg.MaxAlterNum do
|
||||
local obj = instantiate(self._mapNode.goPoint, self._mapNode.trPoint)
|
||||
obj:SetActive(true)
|
||||
table.insert(self.tbPoint, obj)
|
||||
end
|
||||
end
|
||||
function EquipmentInfoCtrl:Refresh(bAfterActive)
|
||||
local tbEquipment = PlayerData.Equipment:GetEquipmentBySlot(self.nCharId, self.nSlotId)
|
||||
local mapEquipment = tbEquipment[self.nSelectGemIndex]
|
||||
local bEmpty = mapEquipment == nil
|
||||
self:RefreshTop()
|
||||
self:RefreshSwitch(tbEquipment)
|
||||
if bAfterActive then
|
||||
self._mapNode.FX:SetActive(false)
|
||||
self._mapNode.FX:SetActive(true)
|
||||
local callback = function()
|
||||
self._mapNode.Info:SetActive(not bEmpty)
|
||||
self._mapNode.Active:SetActive(bEmpty)
|
||||
self._mapNode.aniInfo:Play("EquipmentInfoPanel_Info")
|
||||
WwiseAudioMgr:PostEvent("ui_charInfo_equipment_coagulate_ani")
|
||||
end
|
||||
self:AddTimer(1, 0.07, callback, true, true, true)
|
||||
else
|
||||
self._mapNode.Info:SetActive(not bEmpty)
|
||||
self._mapNode.Active:SetActive(bEmpty)
|
||||
end
|
||||
if not bEmpty then
|
||||
self:RefreshInfo(mapEquipment)
|
||||
else
|
||||
self:RefreshActive()
|
||||
end
|
||||
end
|
||||
function EquipmentInfoCtrl:RefreshSwitch(tbEquipment)
|
||||
local nCount = 0
|
||||
for i = 1, self.mapSlotCfg.MaxAlterNum do
|
||||
if tbEquipment[i] ~= nil then
|
||||
nCount = nCount + 1
|
||||
end
|
||||
end
|
||||
if nCount >= self.mapSlotCfg.MaxAlterNum - 1 then
|
||||
self._mapNode.btnPre.gameObject:SetActive(true)
|
||||
self._mapNode.btnPreLock.gameObject:SetActive(false)
|
||||
self._mapNode.btnNext.gameObject:SetActive(true)
|
||||
self._mapNode.btnNextLock.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
local bCurEmpty = tbEquipment[self.nSelectGemIndex] == nil
|
||||
local nNext = 0
|
||||
if self.mapSlotCfg.MaxAlterNum == self.nSelectGemIndex then
|
||||
nNext = 1
|
||||
else
|
||||
nNext = self.nSelectGemIndex + 1
|
||||
end
|
||||
local bNextEmpty = tbEquipment[nNext] == nil
|
||||
self._mapNode.btnNext.gameObject:SetActive(not bCurEmpty or not bNextEmpty)
|
||||
self._mapNode.btnNextLock.gameObject:SetActive(bCurEmpty and bNextEmpty)
|
||||
self._mapNode.btnPre.gameObject:SetActive(1 < self.nSelectGemIndex)
|
||||
self._mapNode.btnPreLock.gameObject:SetActive(self.nSelectGemIndex == 1)
|
||||
end
|
||||
function EquipmentInfoCtrl:RefreshTop()
|
||||
local sRoman = ConfigTable.GetUIText("RomanNumeral_" .. self.nSelectGemIndex)
|
||||
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)
|
||||
end
|
||||
function EquipmentInfoCtrl:RefreshInfo(mapEquipment)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtWindowTitle, ConfigTable.GetUIText("Equipment_Title_Info"))
|
||||
self._mapNode.btnEquip.gameObject:SetActive(self.nEquipedGemIndex ~= self.nSelectGemIndex)
|
||||
self._mapNode.btnUnload.gameObject:SetActive(self.nEquipedGemIndex == self.nSelectGemIndex)
|
||||
if self.nEquipedGemIndex == 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBtnEquip, ConfigTable.GetUIText("Equipment_Btn_Equip"))
|
||||
else
|
||||
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)
|
||||
end
|
||||
end
|
||||
function EquipmentInfoCtrl:RefreshActive()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtWindowTitle, ConfigTable.GetUIText("Equipment_Title_Active"))
|
||||
self._mapNode.goMat:SetMat(self.mapGemCfg.GenerateCostTid, self.mapSlotCfg.GeneratenCostQty)
|
||||
end
|
||||
function EquipmentInfoCtrl:RefreshPoint()
|
||||
local tbEquipment = PlayerData.Equipment:GetEquipmentBySlot(self.nCharId, self.nSlotId)
|
||||
local bFirstEmpty = true
|
||||
for i = 1, self.mapSlotCfg.MaxAlterNum do
|
||||
local obj = self.tbPoint[i]
|
||||
local on = obj.transform:Find("imgPointOn").gameObject
|
||||
local off = obj.transform:Find("imgPointOff").gameObject
|
||||
local lock = obj.transform:Find("imgPointLock").gameObject
|
||||
local mapEquipment = tbEquipment[i]
|
||||
local bEmpty = mapEquipment == nil
|
||||
local bLock = not bFirstEmpty and bEmpty
|
||||
if bFirstEmpty and bEmpty then
|
||||
bFirstEmpty = false
|
||||
end
|
||||
on:SetActive(self.nSelectGemIndex == i)
|
||||
off:SetActive(self.nSelectGemIndex ~= i and not bLock)
|
||||
lock:SetActive(bLock)
|
||||
end
|
||||
end
|
||||
function EquipmentInfoCtrl:RefreshSelectPoint(nBefore, nAfter)
|
||||
local goBefore = self.tbPoint[nBefore]
|
||||
goBefore.transform:Find("imgPointOn").gameObject:SetActive(false)
|
||||
goBefore.transform:Find("imgPointOff").gameObject:SetActive(true)
|
||||
local goCur = self.tbPoint[nAfter]
|
||||
goCur.transform:Find("imgPointOn").gameObject:SetActive(true)
|
||||
goCur.transform:Find("imgPointOff").gameObject:SetActive(false)
|
||||
end
|
||||
function EquipmentInfoCtrl:PlayInAni()
|
||||
self._mapNode.window:SetActive(true)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function EquipmentInfoCtrl: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 EquipmentInfoCtrl:Close()
|
||||
self._mapNode.window:SetActive(false)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.EquipmentInfo)
|
||||
end
|
||||
function EquipmentInfoCtrl:Awake()
|
||||
self._mapNode.window:SetActive(false)
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.nCharId = tbParam[1]
|
||||
self.nSlotId = tbParam[2]
|
||||
self.nEquipedGemIndex = tbParam[3]
|
||||
self.nSelectGemIndex = self.nEquipedGemIndex == 0 and 1 or self.nEquipedGemIndex
|
||||
end
|
||||
end
|
||||
function EquipmentInfoCtrl:OnEnable()
|
||||
self:Open()
|
||||
end
|
||||
function EquipmentInfoCtrl:OnDisable()
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
end
|
||||
end
|
||||
function EquipmentInfoCtrl:OnDestroy()
|
||||
end
|
||||
function EquipmentInfoCtrl:OnBtnClick_Close()
|
||||
self:PlayOutAni()
|
||||
end
|
||||
function EquipmentInfoCtrl:OnBtnClick_Next()
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
end
|
||||
local nBefore = self.nSelectGemIndex
|
||||
if self.mapSlotCfg.MaxAlterNum == self.nSelectGemIndex then
|
||||
self.nSelectGemIndex = 1
|
||||
else
|
||||
self.nSelectGemIndex = self.nSelectGemIndex + 1
|
||||
end
|
||||
self.nSubSelectIndex = 2
|
||||
self._mapNode.aniIconMask:Play("IconMaskSwitch_R")
|
||||
self:RefreshSelectPoint(nBefore, self.nSelectGemIndex)
|
||||
self:Refresh()
|
||||
local callback = function()
|
||||
self.nSubSelectIndex = 1
|
||||
self:RefreshTop()
|
||||
end
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.aniIconMask, {
|
||||
"IconMaskSwitch_R"
|
||||
})
|
||||
self.timer = self:AddTimer(1, nAnimTime, callback, true, true, true)
|
||||
end
|
||||
function EquipmentInfoCtrl:OnBtnClick_Pre()
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
end
|
||||
local nBefore = self.nSelectGemIndex
|
||||
if 1 == self.nSelectGemIndex then
|
||||
self.nSelectGemIndex = self.mapSlotCfg.MaxAlterNum
|
||||
else
|
||||
self.nSelectGemIndex = self.nSelectGemIndex - 1
|
||||
end
|
||||
self.nSubSelectIndex = 2
|
||||
self._mapNode.aniIconMask:Play("IconMaskSwitch_L")
|
||||
self:RefreshSelectPoint(nBefore, self.nSelectGemIndex)
|
||||
self:Refresh()
|
||||
local callback = function()
|
||||
self.nSubSelectIndex = 1
|
||||
self:RefreshTop()
|
||||
end
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.aniIconMask, {
|
||||
"IconMaskSwitch_L"
|
||||
})
|
||||
self.timer = self:AddTimer(1, nAnimTime, callback, true, true, true)
|
||||
end
|
||||
function EquipmentInfoCtrl:OnBtnClick_NextLock()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_SlotGemEmpty"))
|
||||
end
|
||||
function EquipmentInfoCtrl:OnBtnClick_PreLock()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_SlotGemEmpty"))
|
||||
end
|
||||
function EquipmentInfoCtrl:OnBtnClick_Equip()
|
||||
local nSelectPreset = PlayerData.Equipment:GetSelectPreset(self.nCharId)
|
||||
local callback = function()
|
||||
self.nEquipedGemIndex = self.nSelectGemIndex
|
||||
self:Refresh()
|
||||
EventManager.Hit("EquipmentSlotChanged")
|
||||
end
|
||||
PlayerData.Equipment:SendCharGemEquipGemReq(self.nCharId, self.nSlotId, self.nSelectGemIndex, nSelectPreset, callback)
|
||||
end
|
||||
function EquipmentInfoCtrl:OnBtnClick_Roll()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.EquipmentInfo)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EquipmentRoll, self.nCharId, self.nSlotId, self.nSelectGemIndex)
|
||||
end
|
||||
function EquipmentInfoCtrl:OnBtnClick_Unload()
|
||||
local nSelectPreset = PlayerData.Equipment:GetSelectPreset(self.nCharId)
|
||||
local callback = function()
|
||||
self.nEquipedGemIndex = 0
|
||||
self:Refresh()
|
||||
EventManager.Hit("EquipmentSlotChanged")
|
||||
end
|
||||
PlayerData.Equipment:SendCharGemEquipGemReq(self.nCharId, self.nSlotId, 0, nSelectPreset, callback)
|
||||
end
|
||||
function EquipmentInfoCtrl:OnBtnClick_MatTip(btn)
|
||||
if self.mapGemCfg.GenerateCostTid > 0 then
|
||||
local mapData = {
|
||||
nTid = self.mapGemCfg.GenerateCostTid,
|
||||
nNeedCount = self.mapSlotCfg.GeneratenCostQty,
|
||||
bShowDepot = true,
|
||||
bShowJumpto = true
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ItemTips, btn.transform, mapData)
|
||||
end
|
||||
end
|
||||
function EquipmentInfoCtrl:OnBtnClick_Active()
|
||||
local nHas = PlayerData.Item:GetItemCountByID(self.mapGemCfg.GenerateCostTid)
|
||||
if nHas < self.mapSlotCfg.GeneratenCostQty then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_MatNotEnough_Active"))
|
||||
return
|
||||
end
|
||||
local callback = function(nNewIndex)
|
||||
self:RefreshPoint()
|
||||
self.nSelectGemIndex = nNewIndex
|
||||
self:Refresh(true)
|
||||
end
|
||||
PlayerData.Equipment:SendCharGemGenerateReq(self.nCharId, self.nSlotId, callback)
|
||||
end
|
||||
return EquipmentInfoCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local EquipmentSelectPanel = class("EquipmentSelectPanel", BasePanel)
|
||||
EquipmentSelectPanel._bIsMainPanel = false
|
||||
EquipmentSelectPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Equipment/EquipmentInfoPanel.prefab",
|
||||
sCtrlName = "Game.UI.Equipment.EquipmentInfoCtrl"
|
||||
}
|
||||
}
|
||||
function EquipmentSelectPanel:Awake()
|
||||
end
|
||||
function EquipmentSelectPanel:OnEnable()
|
||||
end
|
||||
function EquipmentSelectPanel:OnAfterEnter()
|
||||
end
|
||||
function EquipmentSelectPanel:OnDisable()
|
||||
end
|
||||
function EquipmentSelectPanel:OnDestroy()
|
||||
end
|
||||
function EquipmentSelectPanel:OnRelease()
|
||||
end
|
||||
return EquipmentSelectPanel
|
||||
@@ -0,0 +1,126 @@
|
||||
local EquipmentRenameCtrl = class("EquipmentRenameCtrl", BaseCtrl)
|
||||
EquipmentRenameCtrl._mapNodeConfig = {
|
||||
blur = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_blur_blue",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
aniWindow = {
|
||||
sNodeName = "---Rename---",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
goWindow = {
|
||||
sNodeName = "---Rename---"
|
||||
},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Title_PresetRename"
|
||||
},
|
||||
txtOldName = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_OldPresetName"
|
||||
},
|
||||
txtNameDesc = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_NameDesc"
|
||||
},
|
||||
txtCurName = {sComponentName = "TMP_Text"},
|
||||
inputRename = {
|
||||
sComponentName = "TMP_InputField"
|
||||
},
|
||||
btnBlur = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Cancel"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Cancel"
|
||||
},
|
||||
btnCancel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Cancel"
|
||||
},
|
||||
btnConfirm1 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Confirm"
|
||||
},
|
||||
txtBtnConfirm = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Confirm"
|
||||
},
|
||||
txtBtnCancel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Cancel"
|
||||
}
|
||||
}
|
||||
EquipmentRenameCtrl._mapEventConfig = {}
|
||||
function EquipmentRenameCtrl:Open()
|
||||
self:Refresh()
|
||||
self:PlayInAni()
|
||||
end
|
||||
function EquipmentRenameCtrl:Refresh()
|
||||
local bInit = NovaAPI.IsDirtyWordsInit()
|
||||
if not bInit then
|
||||
NovaAPI.InitDirtyWords()
|
||||
end
|
||||
NovaAPI.SetTMPInputFieldText(self._mapNode.inputRename, "")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCurName, self.sCurName)
|
||||
end
|
||||
function EquipmentRenameCtrl:PlayInAni()
|
||||
self._mapNode.goWindow:SetActive(true)
|
||||
self._mapNode.blur:SetActive(true)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function EquipmentRenameCtrl:PlayOutAni()
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_out")
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
self:AddTimer(1, 0.2, "Close", true, true, true)
|
||||
end
|
||||
function EquipmentRenameCtrl:Close()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.EquipmentRename)
|
||||
end
|
||||
function EquipmentRenameCtrl:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.nCharId = tbParam[1]
|
||||
self.sCurName = tbParam[2]
|
||||
self.callback = tbParam[3]
|
||||
end
|
||||
end
|
||||
function EquipmentRenameCtrl:OnEnable()
|
||||
self:Open()
|
||||
end
|
||||
function EquipmentRenameCtrl:OnDisable()
|
||||
end
|
||||
function EquipmentRenameCtrl:OnDestroy()
|
||||
end
|
||||
function EquipmentRenameCtrl:OnBtnClick_Cancel(btn)
|
||||
self:PlayOutAni()
|
||||
end
|
||||
function EquipmentRenameCtrl:OnBtnClick_Confirm(btn)
|
||||
local sNewName = NovaAPI.GetTMPInputFieldText(self._mapNode.inputRename)
|
||||
if sNewName == "" then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_RenameEmptyTip"))
|
||||
return
|
||||
end
|
||||
local bInit = NovaAPI.IsDirtyWordsInit()
|
||||
if not bInit then
|
||||
NovaAPI.InitDirtyWords()
|
||||
end
|
||||
if NovaAPI.IsDirtyString(sNewName) then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PLAYER_01"))
|
||||
return
|
||||
end
|
||||
local nSelect = PlayerData.Equipment:GetSelectPreset(self.nCharId)
|
||||
local callback = function()
|
||||
self:PlayOutAni()
|
||||
self.callback(sNewName)
|
||||
end
|
||||
PlayerData.Equipment:SendCharGemRenamePresetReq(self.nCharId, nSelect, sNewName, callback)
|
||||
end
|
||||
return EquipmentRenameCtrl
|
||||
@@ -0,0 +1,17 @@
|
||||
local EquipmentRenamePanel = class("EquipmentRenamePanel", BasePanel)
|
||||
EquipmentRenamePanel._bIsMainPanel = false
|
||||
EquipmentRenamePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Equipment/EquipmentRenamePanel.prefab",
|
||||
sCtrlName = "Game.UI.Equipment.EquipmentRenameCtrl"
|
||||
}
|
||||
}
|
||||
function EquipmentRenamePanel:Awake()
|
||||
end
|
||||
function EquipmentRenamePanel:OnEnable()
|
||||
end
|
||||
function EquipmentRenamePanel:OnDisable()
|
||||
end
|
||||
function EquipmentRenamePanel:OnDestroy()
|
||||
end
|
||||
return EquipmentRenamePanel
|
||||
@@ -0,0 +1,318 @@
|
||||
local EquipmentRollCtrl = class("EquipmentRollCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
EquipmentRollCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
imgEquipmentIcon = {sComponentName = "Image"},
|
||||
txtEquipmentName = {sComponentName = "TMP_Text"},
|
||||
txtEquipmentDesc = {sComponentName = "TMP_Text"},
|
||||
txtLockSwitch = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Roll_LockRoll"
|
||||
},
|
||||
btnSwitch = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Switch"
|
||||
},
|
||||
txtLockLimit = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Roll_LockAttrTitle"
|
||||
},
|
||||
txtLockLimitCount = {sComponentName = "TMP_Text"},
|
||||
txtTitleCurAttr = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Roll_CurAttr"
|
||||
},
|
||||
goProperty = {
|
||||
nCount = 4,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateRandomPropertyCtrl"
|
||||
},
|
||||
btnUnlock = {
|
||||
nCount = 4,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Unlock"
|
||||
},
|
||||
btnLock = {
|
||||
nCount = 4,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Lock"
|
||||
},
|
||||
txtAlterEmpty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Roll_NoneRolled"
|
||||
},
|
||||
goAlter = {},
|
||||
goPropertyAlter = {
|
||||
nCount = 4,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateRandomPropertyCtrl"
|
||||
},
|
||||
btnConfirm = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Confirm"
|
||||
},
|
||||
btnRoll = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Roll"
|
||||
},
|
||||
txtBtnConfirm = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Btn_ConfirmRollResult"
|
||||
},
|
||||
txtBtnRoll = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Btn_Reroll"
|
||||
},
|
||||
imgConfirmMask = {},
|
||||
imgCostIcon = {nCount = 2, sComponentName = "Image"},
|
||||
txtCostCount = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
goCost2 = {},
|
||||
Replace = {
|
||||
sNodeName = "----Replace----",
|
||||
sCtrlName = "Game.UI.Equipment.EquipmentAttrReplaceCtrl"
|
||||
}
|
||||
}
|
||||
EquipmentRollCtrl._mapEventConfig = {}
|
||||
function EquipmentRollCtrl: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]
|
||||
self.tbLockAttr = {}
|
||||
self._mapNode.TopBar:CreateCoin({
|
||||
self.mapGemCfg.RefreshCostTid,
|
||||
self.mapSlotCfg.LockItemTid
|
||||
})
|
||||
end
|
||||
function EquipmentRollCtrl:Refresh()
|
||||
self:RefreshData()
|
||||
self:RefreshEquipmentInfo()
|
||||
self:RefreshAttr()
|
||||
self:RefreshAlterAttr()
|
||||
self:RefreshCoin()
|
||||
self:RefreshConfirm()
|
||||
end
|
||||
function EquipmentRollCtrl:RefreshEquipmentInfo()
|
||||
self:SetPngSprite(self._mapNode.imgEquipmentIcon, self.mapGemCfg.Icon)
|
||||
local sRoman = ConfigTable.GetUIText("RomanNumeral_" .. self.nSelectGemIndex)
|
||||
local sSuf = orderedFormat(ConfigTable.GetUIText("Equipment_NameIndexSuffix"), sRoman)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEquipmentName, self.mapGemCfg.Title .. sSuf)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEquipmentDesc, self.mapGemCfg.Desc)
|
||||
local nLockAttr = self:GetAttrLockCount()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLockLimitCount, orderedFormat(ConfigTable.GetUIText("Equipment_Roll_LockAttrCount"), nLockAttr, self.mapSlotCfg.LockableNum))
|
||||
self:RefreshLock()
|
||||
end
|
||||
function EquipmentRollCtrl:GetAttrLockCount()
|
||||
local nLockAttr = 0
|
||||
for _, v in pairs(self.tbLockAttr) do
|
||||
if v == true then
|
||||
nLockAttr = nLockAttr + 1
|
||||
end
|
||||
end
|
||||
return nLockAttr
|
||||
end
|
||||
function EquipmentRollCtrl:RefreshLock()
|
||||
self._mapNode.btnSwitch[1].gameObject:SetActive(not self.mapEquipment.bLock)
|
||||
self._mapNode.btnSwitch[2].gameObject:SetActive(self.mapEquipment.bLock)
|
||||
end
|
||||
function EquipmentRollCtrl:RefreshAttr()
|
||||
for i = 1, 4 do
|
||||
self._mapNode.goProperty[i]:SetProperty(self.mapEquipment.tbAffix[i], self.nCharId)
|
||||
self:RefreshAttrLock(i)
|
||||
end
|
||||
end
|
||||
function EquipmentRollCtrl:RefreshAttrLock(nIndex)
|
||||
local bAttrLock = self.tbLockAttr[nIndex] == true
|
||||
self._mapNode.btnUnlock[nIndex].gameObject:SetActive(bAttrLock)
|
||||
self._mapNode.btnLock[nIndex].gameObject:SetActive(not bAttrLock)
|
||||
end
|
||||
function EquipmentRollCtrl:RefreshAlterAttr(bRoll)
|
||||
if bRoll then
|
||||
self._mapNode.goAlter.gameObject:SetActive(false)
|
||||
end
|
||||
local bEmpty = self.mapEquipment:CheckAlterEmpty()
|
||||
self._mapNode.txtAlterEmpty.gameObject:SetActive(bEmpty)
|
||||
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.nCharId, self.tbLockAttr[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
function EquipmentRollCtrl:RefreshCoin()
|
||||
local nLockAttr = self:GetAttrLockCount()
|
||||
local bUseLock = 0 < nLockAttr
|
||||
self._mapNode.goCost2.gameObject:SetActive(bUseLock)
|
||||
self._mapNode.imgCostIcon[2].gameObject:SetActive(bUseLock)
|
||||
self._mapNode.txtCostCount[2].gameObject:SetActive(bUseLock)
|
||||
if bUseLock then
|
||||
self:SetSprite_Coin(self._mapNode.imgCostIcon[2], self.mapSlotCfg.LockItemTid)
|
||||
local nHas = PlayerData.Item:GetItemCountByID(self.mapSlotCfg.LockItemTid)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCostCount[2], self.mapSlotCfg.LockItemQty * nLockAttr)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtCostCount[2], nHas < self.mapSlotCfg.LockItemQty * nLockAttr and Red_Unable or Blue_Normal)
|
||||
end
|
||||
self:SetSprite_Coin(self._mapNode.imgCostIcon[1], self.mapGemCfg.RefreshCostTid)
|
||||
local nHas = PlayerData.Item:GetItemCountByID(self.mapGemCfg.RefreshCostTid)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCostCount[1], self.mapSlotCfg.RefreshCostQty)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtCostCount[1], nHas < self.mapSlotCfg.RefreshCostQty and Red_Unable or Blue_Normal)
|
||||
end
|
||||
function EquipmentRollCtrl:RefreshConfirm()
|
||||
local bEmpty = self.mapEquipment:CheckAlterEmpty()
|
||||
self._mapNode.imgConfirmMask:SetActive(bEmpty)
|
||||
end
|
||||
function EquipmentRollCtrl:GetRareCount(tbAffix)
|
||||
local nRareCount = 0
|
||||
for _, v in ipairs(tbAffix) do
|
||||
if v ~= 0 then
|
||||
local mapCfg = ConfigTable.GetData("CharGemAttrValue", v)
|
||||
if mapCfg and mapCfg.Rarity == GameEnum.itemRarity.SSR then
|
||||
nRareCount = nRareCount + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
return nRareCount
|
||||
end
|
||||
function EquipmentRollCtrl:FadeIn()
|
||||
self.animator = self.gameObject.transform:GetComponent("Animator")
|
||||
self.animator:Play("EquipmentSelectPanel_in1")
|
||||
end
|
||||
function EquipmentRollCtrl:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.nCharId = tbParam[1]
|
||||
self.nSlotId = tbParam[2]
|
||||
self.nSelectGemIndex = tbParam[3]
|
||||
end
|
||||
end
|
||||
function EquipmentRollCtrl:OnEnable()
|
||||
self:Refresh()
|
||||
end
|
||||
function EquipmentRollCtrl:OnDisable()
|
||||
end
|
||||
function EquipmentRollCtrl:OnDestroy()
|
||||
end
|
||||
function EquipmentRollCtrl: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
|
||||
function EquipmentRollCtrl:OnBtnClick_Unlock(btn, nIndex)
|
||||
self.tbLockAttr[nIndex] = false
|
||||
self:RefreshAttrLock(nIndex)
|
||||
local nLockAttr = self:GetAttrLockCount()
|
||||
self:RefreshCoin()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLockLimitCount, orderedFormat(ConfigTable.GetUIText("Equipment_Roll_LockAttrCount"), nLockAttr, self.mapSlotCfg.LockableNum))
|
||||
end
|
||||
function EquipmentRollCtrl:OnBtnClick_Lock(btn, nIndex)
|
||||
local nLockAttr = self:GetAttrLockCount()
|
||||
if nLockAttr >= self.mapSlotCfg.LockableNum then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_LockAttrMax"))
|
||||
return
|
||||
end
|
||||
self.tbLockAttr[nIndex] = true
|
||||
self:RefreshAttrLock(nIndex)
|
||||
self:RefreshCoin()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLockLimitCount, orderedFormat(ConfigTable.GetUIText("Equipment_Roll_LockAttrCount"), nLockAttr + 1, self.mapSlotCfg.LockableNum))
|
||||
end
|
||||
function EquipmentRollCtrl:OnBtnClick_Confirm(btn)
|
||||
local bEmpty = self.mapEquipment:CheckAlterEmpty()
|
||||
if bEmpty then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_ConfirmRoll_AlterEmpty"))
|
||||
return
|
||||
end
|
||||
if self.mapEquipment.bLock then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_ConfirmRoll_EquipmentLock"))
|
||||
return
|
||||
end
|
||||
local callback = function()
|
||||
self:RefreshAttr()
|
||||
self:RefreshAlterAttr()
|
||||
self:RefreshCoin()
|
||||
self:RefreshConfirm()
|
||||
self.animator:Play("EquipmentSelectPanel_in", 0, 0)
|
||||
end
|
||||
local sRoman = ConfigTable.GetUIText("RomanNumeral_" .. self.nSelectGemIndex)
|
||||
local sSuf = orderedFormat(ConfigTable.GetUIText("Equipment_NameIndexSuffix"), sRoman)
|
||||
local sName = self.mapGemCfg.Title .. sSuf
|
||||
self._mapNode.Replace:Open(sName, self.mapEquipment, self.nCharId, self.nSlotId, self.nSelectGemIndex, callback)
|
||||
end
|
||||
function EquipmentRollCtrl:OnBtnClick_Roll(btn)
|
||||
if self.mapEquipment.bLock then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_Roll_EquipmentLock"))
|
||||
return
|
||||
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"))
|
||||
return
|
||||
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 callback = function()
|
||||
self:RefreshAlterAttr(true)
|
||||
self:RefreshCoin()
|
||||
self:RefreshConfirm()
|
||||
WwiseAudioMgr:PostEvent("ui_charInfo_equipment_reforge_ani")
|
||||
end
|
||||
PlayerData.Equipment:SendCharGemRefreshReq(self.nCharId, self.nSlotId, self.nSelectGemIndex, tbLockAttrId, callback)
|
||||
end
|
||||
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
|
||||
if not bLock and nAlterRareCount >= ConfigTable.GetConfigNumber("CharGemHighQualityNum") then
|
||||
warning()
|
||||
elseif bLock and nRareCount < nAlterRareCount then
|
||||
warning()
|
||||
else
|
||||
roll()
|
||||
end
|
||||
else
|
||||
roll()
|
||||
end
|
||||
end
|
||||
return EquipmentRollCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local EquipmentRollPanel = class("EquipmentRollPanel", BasePanel)
|
||||
EquipmentRollPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Equipment/EquipmentRollPanel.prefab",
|
||||
sCtrlName = "Game.UI.Equipment.EquipmentRollCtrl"
|
||||
}
|
||||
}
|
||||
function EquipmentRollPanel:Awake()
|
||||
end
|
||||
function EquipmentRollPanel:OnEnable()
|
||||
end
|
||||
function EquipmentRollPanel:OnAfterEnter()
|
||||
end
|
||||
function EquipmentRollPanel:OnDisable()
|
||||
end
|
||||
function EquipmentRollPanel:OnDestroy()
|
||||
end
|
||||
function EquipmentRollPanel:OnRelease()
|
||||
end
|
||||
return EquipmentRollPanel
|
||||
@@ -0,0 +1,57 @@
|
||||
local EquipmentSlotItemCtrl = class("EquipmentSlotItemCtrl", BaseCtrl)
|
||||
EquipmentSlotItemCtrl._mapNodeConfig = {
|
||||
goEmpty = {},
|
||||
imgAbleBg = {sComponentName = "Image"},
|
||||
txtUnEquip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "CharEquipment_UnEquip"
|
||||
},
|
||||
imgLockBg = {sComponentName = "Image"},
|
||||
txtLockDesc = {sComponentName = "TMP_Text"},
|
||||
imgLockType = {sComponentName = "Image"},
|
||||
imgChoose = {},
|
||||
goEquip = {},
|
||||
imgEquipmentIcon = {sComponentName = "Image"}
|
||||
}
|
||||
EquipmentSlotItemCtrl._mapEventConfig = {}
|
||||
EquipmentSlotItemCtrl._mapRedDotConfig = {}
|
||||
function EquipmentSlotItemCtrl:Init(mapSlot, nCharId)
|
||||
self.mapSlot = mapSlot
|
||||
local bEmpty = mapSlot.nGemIndex == 0
|
||||
local bUnlock = mapSlot.bUnlock
|
||||
self._mapNode.goEmpty.gameObject:SetActive(bEmpty or not bUnlock)
|
||||
self._mapNode.imgAbleBg.gameObject:SetActive(bEmpty and bUnlock)
|
||||
self._mapNode.imgLockBg.gameObject:SetActive(not bUnlock)
|
||||
self._mapNode.goEquip.gameObject:SetActive(not bEmpty and bUnlock)
|
||||
local nGemId = PlayerData.Equipment:GetGemIdBySlot(nCharId, mapSlot.nSlotId)
|
||||
local mapGemCfg = ConfigTable.GetData("CharGem", nGemId)
|
||||
if not mapGemCfg then
|
||||
return
|
||||
end
|
||||
if not bUnlock then
|
||||
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)
|
||||
end
|
||||
if mapSlot.nSlotId == 1 and bEmpty and bUnlock then
|
||||
local mapSlotCfg = ConfigTable.GetData("CharGemSlotControl", mapSlot.nSlotId)
|
||||
local nHasCount = PlayerData.Item:GetItemCountByID(mapGemCfg.GenerateCostTid)
|
||||
if nHasCount >= mapSlotCfg.GeneratenCostQty then
|
||||
EventManager.Hit("Guide_PassiveCheck_Msg", "Guide_EquipmentSlot")
|
||||
end
|
||||
end
|
||||
self:SetChooseState(false)
|
||||
end
|
||||
function EquipmentSlotItemCtrl:SetChooseState(bChoose)
|
||||
self._mapNode.imgChoose.gameObject:SetActive(bChoose)
|
||||
end
|
||||
function EquipmentSlotItemCtrl:PlayAnim()
|
||||
local sAnimName = ""
|
||||
sAnimName = "imgEquipmentIcon_in"
|
||||
self.animRoot:Play(sAnimName, 0, 0)
|
||||
end
|
||||
function EquipmentSlotItemCtrl:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
return EquipmentSlotItemCtrl
|
||||
Reference in New Issue
Block a user