Files
Endfield-Data/LuaScripts/UI/Panels/CommonBook/CommonBookCtrl.lua
2025-12-02 20:37:18 +07:00

70 lines
1.2 KiB
Lua

local uiCtrl = require_ex('UI/Panels/Base/UICtrl')
local PANEL_ID = PanelId.CommonBook
CommonBookCtrl = HL.Class('CommonBookCtrl', uiCtrl.UICtrl)
CommonBookCtrl.m_onCloseCallback = HL.Field(HL.Function)
CommonBookCtrl.s_messages = HL.StaticField(HL.Table) << {
}
CommonBookCtrl.OnCreate = HL.Override(HL.Any) << function(self, arg)
self.view.closeButton.onClick:AddListener(function()
self:PlayAnimationOut()
end)
self.view.maskBtn.onClick:AddListener(function()
self:PlayAnimationOut()
end)
if arg.onConfirm then
self:BindInputPlayerAction("common_confirm", function()
self:PlayAnimationOut()
arg.onConfirm()
end)
end
if arg.onCloseCallback then
self.m_onCloseCallback = arg.onCloseCallback
end
self.view.titleText:SetAndResolveTextStyle(arg.title)
self.view.contentTxt:SetAndResolveTextStyle(arg.content)
self.view.controllerHintPlaceholder:InitControllerHintPlaceholder({self.view.inputGroup.groupId})
end
CommonBookCtrl.OnClose = HL.Override() << function(self)
if self.m_onCloseCallback then
self.m_onCloseCallback()
end
end
HL.Commit(CommonBookCtrl)