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:
SL1900
2025-12-03 01:00:00 +09:00
commit 5e0d58cfad
3595 changed files with 9373562 additions and 0 deletions
@@ -0,0 +1,136 @@
local MessageBoxCharBoxCtrl = class("MessageBoxCharBoxCtrl", BaseCtrl)
MessageBoxCharBoxCtrl._mapNodeConfig = {
aniMessageBox = {
sNodeName = "goMessageBox",
sComponentName = "Animator"
},
txtWindowTitle = {
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_Title"
},
goCharItem = {},
imgItemIcon = {sComponentName = "Image"},
imgItemRare = {sComponentName = "Image"},
txtCharName = {sComponentName = "TMP_Text"},
txtContentMain = {sComponentName = "TMP_Text"},
txtContentSub = {sComponentName = "TMP_Text"},
btnClose = {sComponentName = "UIButton"},
btnCancel = {sComponentName = "UIButton"},
btnConfirm = {nCount = 2, sComponentName = "UIButton"},
txtCancel = {
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_Cancel"
},
txtConfirm = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_Confirm"
},
btnAgain = {sComponentName = "NaviButton"},
againSelect = {},
texAgainTip = {
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_TodayWarning"
},
goAgain = {}
}
function MessageBoxCharBoxCtrl:OpenBox(mapMsg, ctrlBase)
local sContent = mapMsg.sContent
local sContentSub = mapMsg.sContentSub
local sTitle = mapMsg.sTitle
local sConfirm = mapMsg.sConfirm
local sCancel = mapMsg.sCancel
local callbackConfirm = mapMsg.callbackConfirm
local callbackCancel = mapMsg.callbackCancel
local callbackAgain = mapMsg.callbackAgain
local nCharId = mapMsg.nCharId
self._mapNode.btnConfirm[1].gameObject:SetActive(true)
self._mapNode.btnConfirm[2].gameObject:SetActive(false)
self._mapNode.btnCancel.gameObject:SetActive(true)
self._mapNode.btnAgain.gameObject:SetActive(callbackAgain ~= nil)
self._mapNode.againSelect:SetActive(false)
self._mapNode.goAgain.gameObject:SetActive(callbackAgain ~= nil)
self._mapNode.txtContentSub.gameObject:SetActive(sContentSub)
if sContentSub then
NovaAPI.SetTMPText(self._mapNode.txtContentSub, sContentSub)
end
NovaAPI.SetTMPText(self._mapNode.txtContentMain, sContent)
if sTitle then
NovaAPI.SetTMPText(self._mapNode.txtWindowTitle, sTitle)
end
if nCharId then
local mapCharCfg = ConfigTable.GetData_Character(nCharId)
if mapCharCfg then
NovaAPI.SetTMPText(self._mapNode.txtCharName, mapCharCfg.Name)
local nCharSkinId = mapCharCfg.DefaultSkinId
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
if mapCharSkin then
self:SetPngSprite(self._mapNode.imgItemIcon, mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.XXL)
end
local rareIconName = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[mapCharCfg.Grade]
self:SetAtlasSprite(self._mapNode.imgItemRare, "12_rare", rareIconName)
end
end
if sConfirm then
NovaAPI.SetTMPText(self._mapNode.txtConfirm[1], sConfirm)
end
if sCancel then
NovaAPI.SetTMPText(self._mapNode.txtCancel, sCancel)
end
if self.handlerConfirm then
self._mapNode.btnConfirm[1].onClick:RemoveListener(self.handlerConfirm)
end
self.handlerConfirm = nil
local func_confirm = function()
if self._panel.bBlur then
self._mapNode.aniMessageBox:Play("t_window_04_t_out")
end
ctrlBase:DefaultClick(callbackConfirm)
end
self.handlerConfirm = ui_handler(self, func_confirm, self._mapNode.btnConfirm[1])
self._mapNode.btnConfirm[1].onClick:AddListener(self.handlerConfirm)
if self.handlerCancel then
self._mapNode.btnCancel.onClick:RemoveListener(self.handlerCancel)
end
self.handlerCancel = nil
local func_cancel = function()
if self._panel.bBlur then
self._mapNode.aniMessageBox:Play("t_window_04_t_out")
end
ctrlBase:DefaultClick(callbackCancel)
end
self.handlerCancel = ui_handler(self, func_cancel, self._mapNode.btnCancel)
self._mapNode.btnCancel.onClick:AddListener(self.handlerCancel)
if self.handlerClose then
self._mapNode.btnClose.onClick:RemoveListener(self.handlerClose)
end
self.handlerClose = nil
local func_close = function()
if self._panel.bBlur then
self._mapNode.aniMessageBox:Play("t_window_04_t_out")
end
ctrlBase:DefaultClick(callbackCancel)
end
self.handlerClose = ui_handler(self, func_close, self._mapNode.btnClose)
self._mapNode.btnClose.onClick:AddListener(self.handlerClose)
if self.handlerAgain then
self._mapNode.btnAgain.onClick:RemoveListener(self.handlerAgain)
end
self.handlerAgain = nil
if callbackAgain ~= nil then
local func_again = function()
self._mapNode.againSelect:SetActive(not self._mapNode.againSelect.activeSelf)
callbackAgain(self._mapNode.againSelect.activeSelf)
end
self.handlerAgain = ui_handler(self, func_again, self._mapNode.btnAgain)
self._mapNode.btnAgain.onClick:AddListener(self.handlerAgain)
end
self._mapNode.aniMessageBox:Play("t_window_04_t_in", 0, 0)
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
end
function MessageBoxCharBoxCtrl:Close()
if self.handlerClose then
self.handlerClose()
end
end
return MessageBoxCharBoxCtrl
@@ -0,0 +1,306 @@
local MessageBoxCommonCtrl = class("MessageBoxCommonCtrl", BaseCtrl)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
MessageBoxCommonCtrl._mapNodeConfig = {
aniMessageBox = {
sNodeName = "goMessageBox",
sComponentName = "Animator"
},
txtWindowTitle = {
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_Title"
},
txtContentMain = {sComponentName = "TMP_Text"},
txtContentSub = {sComponentName = "TMP_Text"},
btnClose = {sComponentName = "UIButton"},
btnCancel = {sComponentName = "NaviButton", sAction = "Back"},
btnCancel2 = {sComponentName = "NaviButton", sAction = "Back"},
btnConfirm = {
nCount = 2,
sComponentName = "NaviButton",
sAction = "Confirm"
},
btnConfirmDisable = {sComponentName = "NaviButton", sAction = "Confirm"},
txtBtnCancel = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_Cancel"
},
txtCancel2_ = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_Cancel"
},
txtConfirmDisable = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_Confirm"
},
txtConfirm2_ = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_Confirm"
},
txtConfirm1_ = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_Confirm"
},
btnAgain = {sComponentName = "NaviButton"},
againSelect = {},
texAgainTip = {
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_TodayWarning"
},
goAgain = {}
}
MessageBoxCommonCtrl._mapEventConfig = {}
function MessageBoxCommonCtrl:OpenBox(mapMsg, ctrlBase)
if mapMsg.nType == AllEnum.MessageBox.Alert then
self:RefreshAlert(mapMsg, ctrlBase)
elseif mapMsg.nType == AllEnum.MessageBox.Confirm then
self:RefreshConfirm(mapMsg, ctrlBase)
end
end
function MessageBoxCommonCtrl:RefreshPlainText(mapMsg, ctrlBase)
local sContent = mapMsg.sContent
local sTitle = mapMsg.sTitle
local callbackCancel = mapMsg.callbackCancel
self._mapNode.txtContentSub.gameObject:SetActive(false)
self._mapNode.btnConfirm[1].gameObject:SetActive(false)
self._mapNode.btnConfirm[2].gameObject:SetActive(false)
self._mapNode.btnCancel.gameObject:SetActive(false)
self._mapNode.btnAgain.gameObject:SetActive(false)
self._mapNode.goAgain.gameObject:SetActive(false)
NovaAPI.SetTMPText(self._mapNode.txtContentMain, sContent)
if sTitle then
NovaAPI.SetTMPText(self._mapNode.txtWindowTitle, sTitle)
end
if self.handlerClose then
self._mapNode.btnClose.onClick:RemoveListener(self.handlerClose)
end
self.handlerClose = nil
local func_close = function()
if self._panel.bBlur then
self._mapNode.aniMessageBox:Play("t_window_04_t_out")
end
ctrlBase:DefaultClick(callbackCancel)
end
self.handlerClose = ui_handler(self, func_close, self._mapNode.btnClose)
self._mapNode.btnClose.onClick:AddListener(self.handlerClose)
self._mapNode.aniMessageBox:Play("t_window_04_t_in", 0, 0)
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
end
function MessageBoxCommonCtrl:RefreshConfirm(mapMsg, ctrlBase)
local sContent = mapMsg.sContent
local sContentSub = mapMsg.sContentSub
local sTitle = mapMsg.sTitle
local sConfirm = mapMsg.sConfirm
local sCancel = mapMsg.sCancel
local callbackConfirm = mapMsg.callbackConfirm
local callbackConfirmAfterClose = mapMsg.callbackConfirmAfterClose
local callbackCancel = mapMsg.callbackCancel
local callbackAgain = mapMsg.callbackAgain
self.bDisableSnap = mapMsg.bDisableSnap
self.bCloseNoHandler = mapMsg.bCloseNoHandler
self._mapNode.txtContentSub.gameObject:SetActive(sContentSub)
self._mapNode.btnConfirm[1].gameObject:SetActive(mapMsg.bGrayConfirm ~= true)
self._mapNode.btnConfirmDisable.gameObject:SetActive(mapMsg.bGrayConfirm == true)
self._mapNode.btnConfirm[2].gameObject:SetActive(false)
self._mapNode.btnCancel.gameObject:SetActive(mapMsg.bRedCancel ~= true)
self._mapNode.btnCancel2.gameObject:SetActive(mapMsg.bRedCancel == true)
self._mapNode.btnAgain.gameObject:SetActive(callbackAgain ~= nil)
self._mapNode.againSelect:SetActive(false)
self._mapNode.goAgain.gameObject:SetActive(callbackAgain ~= nil)
if mapMsg.sAgain then
NovaAPI.SetTMPText(self._mapNode.texAgainTip, mapMsg.sAgain)
end
if sContentSub then
NovaAPI.SetTMPText(self._mapNode.txtContentSub, sContentSub)
end
if sConfirm then
for i = 1, 3 do
NovaAPI.SetTMPText(self._mapNode.txtConfirm1_[i], sConfirm)
end
for i = 1, 3 do
NovaAPI.SetTMPText(self._mapNode.txtConfirmDisable[i], sConfirm)
end
else
for i = 1, 3 do
NovaAPI.SetTMPText(self._mapNode.txtConfirm1_[i], ConfigTable.GetUIText("MessageBox_Confirm"))
end
for i = 1, 3 do
NovaAPI.SetTMPText(self._mapNode.txtConfirmDisable[i], ConfigTable.GetUIText("MessageBox_Confirm"))
end
end
if sCancel then
for i = 1, 3 do
NovaAPI.SetTMPText(self._mapNode.txtBtnCancel[i], sCancel)
NovaAPI.SetTMPText(self._mapNode.txtCancel2_[i], sCancel)
end
else
for i = 1, 3 do
NovaAPI.SetTMPText(self._mapNode.txtBtnCancel[i], ConfigTable.GetUIText("MessageBox_Cancel"))
NovaAPI.SetTMPText(self._mapNode.txtCancel2_[i], ConfigTable.GetUIText("MessageBox_Cancel"))
end
end
NovaAPI.SetTMPText(self._mapNode.txtContentMain, sContent)
if sTitle then
NovaAPI.SetTMPText(self._mapNode.txtWindowTitle, sTitle)
end
if self.handlerConfirm then
self._mapNode.btnConfirm[1].onClick:RemoveListener(self.handlerConfirm)
end
self.handlerConfirm = nil
local func_confirm = function()
if self._panel.bBlur then
self._mapNode.aniMessageBox:Play("t_window_04_t_out")
end
ctrlBase:DefaultClick(callbackConfirm, callbackConfirmAfterClose)
end
self.handlerConfirm = ui_handler(self, func_confirm, self._mapNode.btnConfirm[1])
self._mapNode.btnConfirm[1].onClick:AddListener(self.handlerConfirm)
if self.handlerConfirmGray then
self._mapNode.btnConfirmDisable.onClick:RemoveListener(self.handlerConfirmGray)
end
self.handlerConfirmGray = nil
local func_confirmGray = function()
callbackConfirm()
end
self.handlerConfirmGray = ui_handler(self, func_confirmGray, self._mapNode.btnConfirmDisable)
self._mapNode.btnConfirmDisable.onClick:AddListener(self.handlerConfirmGray)
if self.handlerCancel then
self._mapNode.btnCancel.onClick:RemoveListener(self.handlerCancel)
self._mapNode.btnCancel2.onClick:RemoveListener(self.handlerCancel)
end
self.handlerCancel = nil
local func_cancel = function()
if self._panel.bBlur then
self._mapNode.aniMessageBox:Play("t_window_04_t_out")
end
ctrlBase:DefaultClick(callbackCancel)
end
self.handlerCancel = ui_handler(self, func_cancel, self._mapNode.btnCancel)
self._mapNode.btnCancel.onClick:AddListener(self.handlerCancel)
self._mapNode.btnCancel2.onClick:AddListener(self.handlerCancel)
if self.handlerClose then
self._mapNode.btnClose.onClick:RemoveListener(self.handlerClose)
end
self.handlerClose = nil
local func_close = function()
if self._panel.bBlur then
self._mapNode.aniMessageBox:Play("t_window_04_t_out")
end
ctrlBase:DefaultClick(nil)
end
if self.bCloseNoHandler then
self.handlerClose = ui_handler(self, func_close, self._mapNode.btnClose)
else
self.handlerClose = ui_handler(self, func_cancel, self._mapNode.btnClose)
end
self._mapNode.btnClose.onClick:AddListener(self.handlerClose)
if self.handlerAgain then
self._mapNode.btnAgain.onClick:RemoveListener(self.handlerAgain)
end
self.handlerAgain = nil
if callbackAgain ~= nil then
local func_again = function()
self._mapNode.againSelect:SetActive(not self._mapNode.againSelect.activeSelf)
callbackAgain(self._mapNode.againSelect.activeSelf)
end
self.handlerAgain = ui_handler(self, func_again, self._mapNode.btnAgain)
self._mapNode.btnAgain.onClick:AddListener(self.handlerAgain)
end
self._mapNode.aniMessageBox:Play("t_window_04_t_in", 0, 0)
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
end
function MessageBoxCommonCtrl:RefreshAlert(mapMsg, ctrlBase)
local sContent = mapMsg.sContent
local sContentSub = mapMsg.sContentSub
local sTitle = mapMsg.sTitle
local sConfirm = mapMsg.sConfirm
local callbackConfirm = mapMsg.callbackConfirm
local callbackConfirmAfterClose = mapMsg.callbackConfirmAfterClose
self.bDisableSnap = mapMsg.bDisableSnap
self._mapNode.txtContentSub.gameObject:SetActive(sContentSub)
self._mapNode.btnConfirm[1].gameObject:SetActive(false)
self._mapNode.btnConfirm[2].gameObject:SetActive(true)
self._mapNode.btnCancel.gameObject:SetActive(false)
self._mapNode.btnAgain.gameObject:SetActive(false)
self._mapNode.goAgain.gameObject:SetActive(false)
if sContentSub then
NovaAPI.SetTMPText(self._mapNode.txtContentSub, sContentSub)
end
if sConfirm then
for i = 1, 3 do
NovaAPI.SetTMPText(self._mapNode.txtConfirm2_[i], sConfirm)
end
for i = 1, 3 do
NovaAPI.SetTMPText(self._mapNode.txtConfirmDisable[i], sConfirm)
end
else
for i = 1, 3 do
NovaAPI.SetTMPText(self._mapNode.txtConfirm2_[i], ConfigTable.GetUIText("MessageBox_Confirm"))
end
for i = 1, 3 do
NovaAPI.SetTMPText(self._mapNode.txtConfirmDisable[i], ConfigTable.GetUIText("MessageBox_Confirm"))
end
end
NovaAPI.SetTMPText(self._mapNode.txtContentMain, sContent)
if sTitle then
NovaAPI.SetTMPText(self._mapNode.txtWindowTitle, sTitle)
end
if self.handlerConfirm then
self._mapNode.btnConfirm[2].onClick:RemoveListener(self.handlerConfirm)
end
self.handlerConfirm = nil
local func_confirm = function()
if self._panel.bBlur then
self._mapNode.aniMessageBox:Play("t_window_04_t_out")
end
ctrlBase:DefaultClick(callbackConfirm, callbackConfirmAfterClose)
end
self.handlerConfirm = ui_handler(self, func_confirm, self._mapNode.btnConfirm[2])
self._mapNode.btnConfirm[2].onClick:AddListener(self.handlerConfirm)
if self.handlerClose then
self._mapNode.btnClose.onClick:RemoveListener(self.handlerClose)
end
self.handlerClose = nil
local func_close = function()
if self._panel.bBlur then
self._mapNode.aniMessageBox:Play("t_window_04_t_out")
end
ctrlBase:DefaultClick(callbackConfirm)
end
self.handlerClose = ui_handler(self, func_close, self._mapNode.btnClose)
self._mapNode.btnClose.onClick:AddListener(self.handlerClose)
self._mapNode.aniMessageBox:Play("t_window_04_t_in", 0, 0)
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
end
function MessageBoxCommonCtrl:Close()
if self.bDisableSnap then
return
end
if self.handlerClose then
self.handlerClose()
end
end
function MessageBoxCommonCtrl:Awake()
self.tbGamepadUINode = self:GetGamepadUINode()
end
function MessageBoxCommonCtrl:OnEnable()
if GamepadUIManager.GetInputState() then
GamepadUIManager.EnableGamepadUI("MessageBoxCommonCtrl", self.tbGamepadUINode)
else
for _, v in pairs(self.tbGamepadUINode) do
if v.sComponentName == "NaviButton" then
NovaAPI.SetNaviButtonAction(v.mapNode, false)
end
end
end
end
function MessageBoxCommonCtrl:OnDisable()
if GamepadUIManager.GetInputState() then
GamepadUIManager.DisableGamepadUI("MessageBoxCommonCtrl")
end
end
return MessageBoxCommonCtrl
+181
View File
@@ -0,0 +1,181 @@
local MessageBoxCtrl = class("MessageBoxCtrl", BaseCtrl)
MessageBoxCtrl._mapNodeConfig = {
aniBlur = {sComponentName = "Animator"},
aniBlur2 = {sComponentName = "Animator"},
btnBlur = {
sNodeName = "snapshot",
sComponentName = "Button",
callback = "OnBtnClick_Close"
},
btnBlur2 = {
sNodeName = "snapshot2",
sComponentName = "Button",
callback = "OnBtnClick_Close"
},
MessageBox = {
sNodeName = "--MessageBox--"
},
ctrlBox = {
sNodeName = "--MessageBox--",
sCtrlName = "Game.UI.MessageBoxEx.MessageBoxCommonCtrl"
},
DescBox = {
sNodeName = "--DescBox--"
},
ctrlDesc = {
sNodeName = "--DescBox--",
sCtrlName = "Game.UI.MessageBoxEx.MessageBoxDescCtrl"
},
ItemBox = {
sNodeName = "--ItemBox--"
},
ctrlItem = {
sNodeName = "--ItemBox--",
sCtrlName = "Game.UI.MessageBoxEx.MessageBoxItemCtrl"
},
ItemList = {
sNodeName = "--ItemList--"
},
ctrlItemList = {
sNodeName = "--ItemList--",
sCtrlName = "Game.UI.MessageBoxEx.MessageBoxItemListCtrl"
},
PlainText = {
sNodeName = "--PlainText--"
},
ctrlPlainText = {
sNodeName = "--PlainText--",
sCtrlName = "Game.UI.MessageBoxEx.MessageBoxPlainTextCtrl"
},
CharBox = {
sNodeName = "--CharBox--"
},
ctrlCharBox = {
sNodeName = "--CharBox--",
sCtrlName = "Game.UI.MessageBoxEx.MessageBoxCharBoxCtrl"
}
}
MessageBoxCtrl._mapEventConfig = {
ContinueMessageBox = "ProcessParam"
}
function MessageBoxCtrl:ProcessParam(mapMsg)
table.insert(self.tbQueue, mapMsg)
self:OpenQueue()
end
function MessageBoxCtrl:OpenQueue()
if self.bOpening == false then
self.bOpening = true
local bChangeType = false
self.nCurType = self.tbQueue[1].nType
if not self.nBeforeType or self.nBeforeType ~= self.nCurType then
bChangeType = true
end
if bChangeType then
self._mapNode.MessageBox:SetActive(self.nCurType == AllEnum.MessageBox.Alert or self.nCurType == AllEnum.MessageBox.Confirm)
self._mapNode.DescBox:SetActive(self.nCurType == AllEnum.MessageBox.Desc)
self._mapNode.ItemBox:SetActive(self.nCurType == AllEnum.MessageBox.Item)
self._mapNode.ItemList:SetActive(self.nCurType == AllEnum.MessageBox.ItemList)
self._mapNode.PlainText:SetActive(self.nCurType == AllEnum.MessageBox.PlainText)
self._mapNode.CharBox:SetActive(self.nCurType == AllEnum.MessageBox.Char)
end
if self.nCurType == AllEnum.MessageBox.Alert or self.nCurType == AllEnum.MessageBox.Confirm then
self._mapNode.ctrlBox:OpenBox(self.tbQueue[1], self)
elseif self.nCurType == AllEnum.MessageBox.Desc then
self._mapNode.ctrlDesc:OpenBox(self.tbQueue[1], self)
elseif self.nCurType == AllEnum.MessageBox.Item then
self._mapNode.ctrlItem:OpenBox(self.tbQueue[1], self)
elseif self.nCurType == AllEnum.MessageBox.ItemList then
self._mapNode.ctrlItemList:OpenBox(self.tbQueue[1], self)
elseif self.nCurType == AllEnum.MessageBox.PlainText then
self._mapNode.ctrlPlainText:OpenBox(self.tbQueue[1], self)
elseif self.nCurType == AllEnum.MessageBox.Char then
self._mapNode.ctrlCharBox:OpenBox(self.tbQueue[1], self)
end
self.nBeforeType = self.nCurType
end
end
function MessageBoxCtrl:CloseMessageBox(callback, callbackAfterClose)
if callback then
callback()
end
if #self.tbQueue == 0 then
if self._panel.bBlur then
self._mapNode.aniBlur:SetTrigger("tOut")
self:AddTimer(1, 0.1, function()
EventManager.Hit(EventId.CloseMessageBox)
if callbackAfterClose then
callbackAfterClose()
end
end, true, true, true)
else
self._mapNode.aniBlur2.gameObject:SetActive(false)
EventManager.Hit(EventId.CloseMessageBox)
if callbackAfterClose then
callbackAfterClose()
end
end
else
self:ReOpenQueue()
end
end
function MessageBoxCtrl:ReOpenQueue(_, callback)
if callback then
callback()
end
self.bOpening = false
self:OpenQueue()
end
function MessageBoxCtrl:DefaultClick(callback, callbackAfterClose)
table.remove(self.tbQueue, 1)
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
if #self.tbQueue == 0 then
if self._panel.bBlur then
self:AddTimer(1, 0.2, function()
self:CloseMessageBox(callback, callbackAfterClose)
end, true, true, true)
else
self:CloseMessageBox(callback, callbackAfterClose)
end
else
self:AddTimer(1, 0.2, "ReOpenQueue", true, true, true, callback)
end
end
function MessageBoxCtrl:Awake()
self.canvas = self.gameObject:GetComponent("Canvas")
end
function MessageBoxCtrl:OnEnable()
self._panel:SetTop(self.canvas)
self.tbQueue = {}
self.bOpening = false
self.nBeforeType = nil
local mapMsg = self:GetPanelParam()
if mapMsg.bBlur ~= nil then
self._panel.bBlur = mapMsg.bBlur
end
self._mapNode.aniBlur.gameObject:SetActive(self._panel.bBlur == true)
self._mapNode.aniBlur2.gameObject:SetActive(self._panel.bBlur == false)
self:ProcessParam(mapMsg)
end
function MessageBoxCtrl:OnDisable()
self.tbQueue = nil
self.bOpening = false
self.nBeforeType = nil
end
function MessageBoxCtrl:OnDestroy()
end
function MessageBoxCtrl:OnBtnClick_Close()
if self.nCurType == AllEnum.MessageBox.Alert or self.nCurType == AllEnum.MessageBox.Confirm then
self._mapNode.ctrlBox:Close()
elseif self.nCurType == AllEnum.MessageBox.Desc then
self._mapNode.ctrlDesc:Close()
elseif self.nCurType == AllEnum.MessageBox.Item then
self._mapNode.ctrlItem:Close()
elseif self.nCurType == AllEnum.MessageBox.ItemList then
self._mapNode.ctrlItemList:Close()
elseif self.nCurType == AllEnum.MessageBox.PlainText then
self._mapNode.ctrlPlainText:Close()
elseif self.nCurType == AllEnum.MessageBox.Char then
self._mapNode.ctrlCharBox:Close()
end
end
return MessageBoxCtrl
@@ -0,0 +1,68 @@
local MessageBoxDescCtrl = class("MessageBoxDescCtrl", BaseCtrl)
MessageBoxDescCtrl._mapNodeConfig = {
aniBox = {sNodeName = "goDescBox", sComponentName = "Animator"},
txtWindowTitle = {
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_Desc"
},
txtContent = {sComponentName = "TMP_Text"},
btnClose = {sComponentName = "UIButton"},
btnConfirm2 = {sComponentName = "UIButton"},
txtConfirm2 = {
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_Confirm"
}
}
MessageBoxDescCtrl._mapEventConfig = {}
function MessageBoxDescCtrl:OpenBox(mapMsg, ctrlBase)
self:Refresh(mapMsg, ctrlBase)
end
function MessageBoxDescCtrl:Refresh(mapMsg, ctrlBase)
local sContent = mapMsg.sContent
local sTitle = mapMsg.sTitle
local sConfirm = mapMsg.sConfirm
local callbackConfirm = mapMsg.callbackConfirm
self.bDisableSnap = mapMsg.bDisableSnap
if sConfirm then
NovaAPI.SetTMPText(self._mapNode.txtConfirm2, sConfirm)
end
NovaAPI.SetTMPText(self._mapNode.txtContent, sContent)
if sTitle then
NovaAPI.SetTMPText(self._mapNode.txtWindowTitle, sTitle)
end
if self.handlerConfirm then
self._mapNode.btnConfirm2.onClick:RemoveListener(self.handlerConfirm)
end
self.handlerConfirm = nil
local func_confirm = function()
if self._panel.bBlur then
self._mapNode.aniBox:Play("t_window_04_t_out")
end
ctrlBase:DefaultClick(callbackConfirm)
end
self.handlerConfirm = ui_handler(self, func_confirm, self._mapNode.btnConfirm2)
self._mapNode.btnConfirm2.onClick:AddListener(self.handlerConfirm)
if self.handlerClose then
self._mapNode.btnClose.onClick:RemoveListener(self.handlerClose)
end
self.handlerClose = nil
local func_close = function()
if self._panel.bBlur then
self._mapNode.aniBox:Play("t_window_04_t_out")
end
ctrlBase:DefaultClick(callbackConfirm)
end
self.handlerClose = ui_handler(self, func_close, self._mapNode.btnClose)
self._mapNode.btnClose.onClick:AddListener(self.handlerClose)
self._mapNode.aniBox:Play("t_window_04_t_in", 0, 0)
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
end
function MessageBoxDescCtrl:Close()
if self.bDisableSnap then
return
end
if self.handlerClose then
self.handlerClose()
end
end
return MessageBoxDescCtrl
@@ -0,0 +1,171 @@
local MessageBoxItemCtrl = class("MessageBoxItemCtrl", BaseCtrl)
MessageBoxItemCtrl._mapNodeConfig = {
aniMessageBox = {
sNodeName = "goMessageBox",
sComponentName = "Animator"
},
txtWindowTitle = {
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_Title"
},
txtContentMain = {sComponentName = "TMP_Text"},
txtContentSub = {sComponentName = "TMP_Text"},
rtItem = {},
goItem = {
nCount = 5,
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
},
btnItem = {
nCount = 5,
sNodeName = "goItem",
sComponentName = "UIButton",
callback = "OnBtnClick_Tips"
},
goItemList = {},
sv = {
sComponentName = "LoopScrollView"
},
btnClose = {sComponentName = "UIButton"},
btnCancel = {sComponentName = "UIButton"},
btnConfirm = {nCount = 2, sComponentName = "UIButton"},
txtCancel = {
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_Cancel"
},
txtConfirm = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_Confirm"
}
}
MessageBoxItemCtrl._mapEventConfig = {}
function MessageBoxItemCtrl:OpenBox(mapMsg, ctrlBase)
self:RefreshConfirm(mapMsg, ctrlBase)
end
function MessageBoxItemCtrl:RefreshConfirm(mapMsg, ctrlBase)
local sContent = mapMsg.sContent
local sContentSub = mapMsg.sContentSub
local tbItem = mapMsg.tbItem
self.tbItem = tbItem
local sTitle = mapMsg.sTitle
local sConfirm = mapMsg.sConfirm
local sCancel = mapMsg.sCancel
local callbackConfirm = mapMsg.callbackConfirm
local callbackCancel = mapMsg.callbackCancel
self.bDisableSnap = mapMsg.bDisableSnap
self._mapNode.txtContentSub.gameObject:SetActive(sContentSub)
self._mapNode.btnConfirm[1].gameObject:SetActive(true)
self._mapNode.btnConfirm[2].gameObject:SetActive(false)
self._mapNode.btnCancel.gameObject:SetActive(true)
if sContentSub then
NovaAPI.SetTMPText(self._mapNode.txtContentSub, sContentSub)
end
if sConfirm then
NovaAPI.SetTMPText(self._mapNode.txtConfirm[1], sConfirm)
end
if sCancel then
NovaAPI.SetTMPText(self._mapNode.txtCancel, sCancel)
end
local nItemCount = #tbItem
self._mapNode.rtItem:SetActive(nItemCount <= 5)
self._mapNode.goItemList:SetActive(5 < nItemCount)
if nItemCount <= 5 then
for i = 1, 5 do
self._mapNode.goItem[i].gameObject:SetActive(i <= nItemCount)
if i <= nItemCount then
self._mapNode.goItem[i]:SetItem(tbItem[i].nTid, nil, tbItem[i].nCount)
end
end
else
self._mapNode.sv:Init(nItemCount, self, self.OnGridRefresh, self.OnGridBtnClick)
end
NovaAPI.SetTMPText(self._mapNode.txtContentMain, sContent)
if sTitle then
NovaAPI.SetTMPText(self._mapNode.txtWindowTitle, sTitle)
end
if self.handlerConfirm then
self._mapNode.btnConfirm[1].onClick:RemoveListener(self.handlerConfirm)
end
self.handlerConfirm = nil
local func_confirm = function()
if self._panel.bBlur then
self._mapNode.aniMessageBox:Play("t_window_04_t_out")
end
ctrlBase:DefaultClick(callbackConfirm)
end
self.handlerConfirm = ui_handler(self, func_confirm, self._mapNode.btnConfirm[1])
self._mapNode.btnConfirm[1].onClick:AddListener(self.handlerConfirm)
if self.handlerCancel then
self._mapNode.btnCancel.onClick:RemoveListener(self.handlerCancel)
end
self.handlerCancel = nil
local func_cancel = function()
if self._panel.bBlur then
self._mapNode.aniMessageBox:Play("t_window_04_t_out")
end
ctrlBase:DefaultClick(callbackCancel)
end
self.handlerCancel = ui_handler(self, func_cancel, self._mapNode.btnCancel)
self._mapNode.btnCancel.onClick:AddListener(self.handlerCancel)
if self.handlerClose then
self._mapNode.btnClose.onClick:RemoveListener(self.handlerClose)
end
self.handlerClose = nil
local func_close = function()
if self._panel.bBlur then
self._mapNode.aniMessageBox:Play("t_window_04_t_out")
end
ctrlBase:DefaultClick(callbackCancel)
end
self.handlerClose = ui_handler(self, func_close, self._mapNode.btnClose)
self._mapNode.btnClose.onClick:AddListener(self.handlerClose)
self._mapNode.aniMessageBox:Play("t_window_04_t_in", 0, 0)
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
end
function MessageBoxItemCtrl:OnGridRefresh(goGrid, gridIndex)
local nIndex = gridIndex + 1
local mapItem = self.tbItem[nIndex]
local nInstanceId = goGrid:GetInstanceID()
if not self.tbGridCtrl[nInstanceId] then
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid.transform:Find("btnGrid").gameObject, "Game.UI.TemplateEx.TemplateItemCtrl")
end
self.tbGridCtrl[nInstanceId]:SetItem(mapItem.nTid, nil, mapItem.nCount)
end
function MessageBoxItemCtrl:OnGridBtnClick(goGrid, gridIndex)
local nIndex = gridIndex + 1
local mapItemCfgData = ConfigTable.GetData_Item(self.tbItem[nIndex].nTid)
if mapItemCfgData and (mapItemCfgData.Type == GameEnum.itemType.Disc or mapItemCfgData.Type == GameEnum.itemType.Char) then
return
end
self._mapNode.sv:SetScrollGridPos(gridIndex, 0.1, 1)
EventManager.Hit(EventId.TemporaryBlockInput, 0.1)
self:AddTimer(1, 0.1, function()
UTILS.ClickItemGridWithTips(self.tbItem[nIndex].nTid, goGrid.transform:Find("btnGrid"), true, true, false)
end, true, true, true)
end
function MessageBoxItemCtrl:Close()
if self.bDisableSnap then
return
end
if self.handlerClose then
self.handlerClose()
end
end
function MessageBoxItemCtrl:Awake()
self.tbGridCtrl = {}
end
function MessageBoxItemCtrl:OnDisable()
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self.tbGridCtrl = {}
end
function MessageBoxItemCtrl:OnBtnClick_Tips(btn, nIndex)
local mapItemCfgData = ConfigTable.GetData_Item(self.tbItem[nIndex].nTid)
if mapItemCfgData and (mapItemCfgData.Type == GameEnum.itemType.Disc or mapItemCfgData.Type == GameEnum.itemType.Char) then
return
end
UTILS.ClickItemGridWithTips(self.tbItem[nIndex].nTid, btn.transform, true, true, false)
end
return MessageBoxItemCtrl
@@ -0,0 +1,97 @@
local MessageBoxItemListCtrl = class("MessageBoxItemListCtrl", BaseCtrl)
MessageBoxItemListCtrl._mapNodeConfig = {
aniMessageBox = {
sNodeName = "goMessageBox",
sComponentName = "Animator"
},
txtWindowTitle = {
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_Reward"
},
sv = {
sComponentName = "LoopScrollView"
},
btnClose = {sComponentName = "UIButton"}
}
MessageBoxItemListCtrl._mapEventConfig = {}
function MessageBoxItemListCtrl:OpenBox(mapMsg, ctrlBase)
self:RefreshConfirm(mapMsg, ctrlBase)
end
function MessageBoxItemListCtrl:RefreshConfirm(mapMsg, ctrlBase)
self.tbItem = mapMsg.tbItem
local sTitle = mapMsg.sTitle
self.bDisableSnap = mapMsg.bDisableSnap
local nItemCount = #self.tbItem
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
if 0 < nItemCount then
self._mapNode.sv:SetAnim(0.04)
self._mapNode.sv:Init(nItemCount, self, self.OnGridRefresh, self.OnGridBtnClick)
end
if sTitle then
NovaAPI.SetTMPText(self._mapNode.txtWindowTitle, sTitle)
end
if self.handlerClose then
self._mapNode.btnClose.onClick:RemoveListener(self.handlerClose)
end
self.handlerClose = nil
local func_close = function()
if self._panel.bBlur then
self._mapNode.aniMessageBox:Play("t_window_04_t_out")
end
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
ctrlBase:DefaultClick()
end
self.handlerClose = ui_handler(self, func_close, self._mapNode.btnClose)
self._mapNode.btnClose.onClick:AddListener(self.handlerClose)
self._mapNode.aniMessageBox:Play("t_window_04_t_in", 0, 0)
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
end
function MessageBoxItemListCtrl:OnGridRefresh(goGrid, gridIndex)
local nIndex = gridIndex + 1
local mapData = self.tbItem[nIndex]
local nInstanceID = goGrid:GetInstanceID()
if not self.tbGridCtrl[nInstanceID] then
self.tbGridCtrl[nInstanceID] = self:BindCtrlByNode(goGrid, "Game.UI.TemplateEx.TemplateItemCtrl")
end
self.tbGridCtrl[nInstanceID]:SetItem(mapData.nId, nil, mapData.nCount, nil, mapData.bReceived, mapData.bFirstPass, mapData.bThreePass, true)
end
function MessageBoxItemListCtrl:OnGridBtnClick(goGrid, gridIndex)
local nIndex = gridIndex + 1
local mapItem = self.tbItem[nIndex]
local rtItem = goGrid.transform:Find("AnimRoot/Item")
self._mapNode.sv:SetScrollGridPos(gridIndex, 0.1, 1)
local mapItemCfgData = ConfigTable.GetData_Item(mapItem.nId)
if mapItemCfgData and (mapItemCfgData.Type == GameEnum.itemType.Disc or mapItemCfgData.Type == GameEnum.itemType.Char) then
return
end
EventManager.Hit(EventId.BlockInput, true)
self:AddTimer(1, 0.1, function()
EventManager.Hit(EventId.BlockInput, false)
UTILS.ClickItemGridWithTips(mapItem.nId, rtItem, false, true, false)
end, true, true, true)
end
function MessageBoxItemListCtrl:Close()
if self.bDisableSnap then
return
end
if self.handlerClose then
self.handlerClose()
end
end
function MessageBoxItemListCtrl:Awake()
self.tbGridCtrl = {}
end
function MessageBoxItemListCtrl:OnDisable()
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self.tbGridCtrl = {}
end
return MessageBoxItemListCtrl
@@ -0,0 +1,22 @@
local MessageBoxPanel = class("MessageBoxPanel", BasePanel)
MessageBoxPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
MessageBoxPanel._bAddToBackHistory = false
MessageBoxPanel._tbDefine = {
{
sPrefabPath = "MessageBoxEx/MessageBoxPanel.prefab",
sCtrlName = "Game.UI.MessageBoxEx.MessageBoxCtrl"
}
}
function MessageBoxPanel:SetTop(goCanvas)
end
function MessageBoxPanel:Awake()
self.bBlur = true
self.trUIRoot = GameObject.Find("---- UI TOP ----").transform
end
function MessageBoxPanel:OnEnable()
end
function MessageBoxPanel:OnDisable()
end
function MessageBoxPanel:OnDestroy()
end
return MessageBoxPanel
@@ -0,0 +1,42 @@
local MessageBoxPlainTextCtrl = class("MessageBoxPlainTextCtrl", BaseCtrl)
MessageBoxPlainTextCtrl._mapNodeConfig = {
aniMessageBox = {
sNodeName = "goMessageBox",
sComponentName = "Animator"
},
txtWindowTitle = {
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_Title"
},
txtContent = {sComponentName = "TMP_Text"},
btnClose = {sComponentName = "UIButton"}
}
function MessageBoxPlainTextCtrl:OpenBox(mapMsg, ctrlBase)
local sContent = mapMsg.sContent
local sTitle = mapMsg.sTitle
local callbackCancel = mapMsg.callbackCancel
NovaAPI.SetTMPText(self._mapNode.txtContent, sContent)
if sTitle then
NovaAPI.SetTMPText(self._mapNode.txtWindowTitle, sTitle)
end
if self.handlerClose then
self._mapNode.btnClose.onClick:RemoveListener(self.handlerClose)
end
self.handlerClose = nil
local func_close = function()
if self._panel.bBlur then
self._mapNode.aniMessageBox:Play("t_window_04_t_out")
end
ctrlBase:DefaultClick(callbackCancel)
end
self.handlerClose = ui_handler(self, func_close, self._mapNode.btnClose)
self._mapNode.btnClose.onClick:AddListener(self.handlerClose)
self._mapNode.aniMessageBox:Play("t_window_04_t_in", 0, 0)
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
end
function MessageBoxPlainTextCtrl:Close()
if self.handlerClose then
self.handlerClose()
end
end
return MessageBoxPlainTextCtrl
@@ -0,0 +1,98 @@
local PopupTipsCtrl = class("PopupTipsCtrl", BaseCtrl)
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
PopupTipsCtrl._mapNodeConfig = {
trContent = {sComponentName = "Transform"},
goPool = {sComponentName = "Transform"},
goTips = {sComponentName = "GameObject"}
}
PopupTipsCtrl._mapEventConfig = {
ContinuePopupTips = "ProcessParam"
}
local HEIGHT = 90
local MOVE_TIME = 0.2
local WAIT_TIME = 0.5
local RECYCLE_TIME = 1.3
function PopupTipsCtrl:GetItem()
local goItem
if #self.tbPool > 0 then
local nlast = #self.tbPool
goItem = self.tbPool[nlast]
table.remove(self.tbPool, nlast)
goItem.gameObject.transform:SetParent(self._mapNode.trContent)
goItem.gameObject.transform.localPosition = Vector3(0, 0, 0)
return goItem
else
goItem = instantiate(self._mapNode.goTips, self._mapNode.trContent)
goItem.gameObject.transform.localPosition = Vector3(0, 0, 0)
goItem:SetActive(true)
return goItem
end
end
function PopupTipsCtrl:RecycleItem()
local goItem = self.tbShowItem[1]
goItem.gameObject.transform:SetParent(self._mapNode.goPool)
table.remove(self.tbTipsQueue, 1)
table.remove(self.tbShowItem, 1)
table.insert(self.tbPool, goItem)
if self.tbTweener[1] then
self.tbTweener[1]:Kill()
table.remove(self.tbTweener, 1)
end
if #self.tbTipsQueue == 0 then
EventManager.Hit(EventId.ClosePopupTips)
end
end
function PopupTipsCtrl:PopupTips()
for nIndex, goOther in pairs(self.tbShowItem) do
local rtOther = goOther.gameObject:GetComponent("RectTransform")
local nCount = #self.tbShowItem + 1 - nIndex
local v3Target = Vector3(0, nCount * HEIGHT, 0)
self.tbTweener[nIndex] = rtOther:DOLocalMove(v3Target, MOVE_TIME):SetUpdate(true):SetEase(Ease.OutCubic)
end
local goItem = self:GetItem()
table.insert(self.tbShowItem, goItem)
local mapTip = self.tbTipsQueue[#self.tbTipsQueue]
NovaAPI.SetTMPText(goItem.gameObject.transform:Find("imgBg/txtTips"):GetComponent("TMP_Text"), mapTip.sContent)
if mapTip.sSound then
WwiseAudioMgr:PlaySound(mapTip.sSound)
elseif mapTip.bPositive then
WwiseAudioMgr:PlaySound("ui_common_feedback_success")
else
WwiseAudioMgr:PlaySound("ui_common_feedback_error")
end
self:AddTimer(1, RECYCLE_TIME, "RecycleItem", true, true, true)
end
function PopupTipsCtrl:EnableReceive()
self.bReceive = true
end
function PopupTipsCtrl:PopupTipsText(mapTip)
if self.bReceive then
self.bReceive = false
self:AddTimer(1, WAIT_TIME, "EnableReceive", true, true, true)
table.insert(self.tbTipsQueue, mapTip)
self:PopupTips()
end
end
function PopupTipsCtrl:ProcessParam(mapMsg)
self:PopupTipsText(mapMsg)
end
function PopupTipsCtrl:Awake()
self.tbTipsQueue = {}
self.tbShowItem = {}
self.tbPool = {}
self.tbTweener = {}
self.bReceive = true
local mapMsg = self:GetPanelParam()
self:ProcessParam(mapMsg)
end
function PopupTipsCtrl:OnEnable()
end
function PopupTipsCtrl:OnDisable()
self.tbTipsQueue = nil
self.tbShowItem = nil
self.tbPool = nil
self.tbTweener = nil
end
function PopupTipsCtrl:OnDestroy()
end
return PopupTipsCtrl
@@ -0,0 +1,18 @@
local PopupTipsPanel = class("PopupTipsPanel", BasePanel)
PopupTipsPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
PopupTipsPanel._bAddToBackHistory = false
PopupTipsPanel._tbDefine = {
{
sPrefabPath = "PopupTips/PopupTipsPanel.prefab",
sCtrlName = "Game.UI.MessageBoxEx.PopupTipsCtrl"
}
}
function PopupTipsPanel:Awake()
end
function PopupTipsPanel:OnEnable()
end
function PopupTipsPanel:OnDisable()
end
function PopupTipsPanel:OnDestroy()
end
return PopupTipsPanel