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

81 lines
1.7 KiB
Lua

local uiCtrl = require_ex('UI/Panels/Base/UICtrl')
local PANEL_ID = PanelId.CharInfoPhoto
CharInfoPhotoCtrl = HL.Class('CharInfoPhotoCtrl', uiCtrl.UICtrl)
CharInfoPhotoCtrl.s_messages = HL.StaticField(HL.Table) << {
}
CharInfoPhotoCtrl.OnCreate = HL.Override(HL.Any) << function(self, arg)
self.view.btnBack.onClick:AddListener(function()
self:PlayAnimationOutAndClose()
if arg.onClose then
arg.onClose()
end
end)
local pictureId = arg.charPictureId
if string.isEmpty(pictureId) and not string.isEmpty(arg.unlockItemId) then
_, pictureId = Tables.pictureItemTable:TryGetValue(arg.unlockItemId)
end
local _, posterData = Tables.pictureTable:TryGetValue(pictureId)
if not posterData then
logger.error("立绘数据不存在:"..pictureId)
return
end
if not GameInstance.player.charBag:IsCharPotentialPictureRead(pictureId) then
GameInstance.player.charBag:SetCharPotentialPictureRead({ pictureId })
end
self.view.picture.texture = self.loader:LoadTexture(string.format(UIConst.POSTER_TEXTURE_PATH, posterData.imgId))
self.view.txtPhotoName.text = posterData.name
self.view.txtAuthorName.text = posterData.author
self.view.controllerHintPlaceholder:InitControllerHintPlaceholder({self.view.inputGroup.groupId})
end
CharInfoPhotoCtrl.OnShow = HL.Override() << function(self)
UIManager:Hide(PanelId.UIDPanel)
end
CharInfoPhotoCtrl.OnHide = HL.Override() << function (self)
UIManager:Show(PanelId.UIDPanel)
end
CharInfoPhotoCtrl.OnClose = HL.Override() << function (self)
UIManager:Show(PanelId.UIDPanel)
end
HL.Commit(CharInfoPhotoCtrl)