PGRData/Script/matrix/xui/xuimain/XUiMainOther.lua

73 lines
2 KiB
Lua
Raw Permalink Normal View History

local XUiPanelSignBoard = require("XUi/XUiMain/XUiChildView/XUiPanelSignBoard")
2024-09-01 20:49:41 +00:00
local XUiMainPanelBase = require("XUi/XUiMain/XUiMainPanelBase")
---@class XUiMainOther:XUiMainPanelBase
local XUiMainOther = XClass(XUiMainPanelBase, "XUiMainOther")
2024-09-01 20:49:41 +00:00
function XUiMainOther:OnStart(rootUi)
-- self.Transform = rootUi.PanelOther.gameObject.transform
-- XTool.InitUiObject(self)
self.RootUi = rootUi
2024-09-01 20:49:41 +00:00
--self.SignBoard = XUiPanelSignBoard.New(self.PanelSignBoard, self.RootUi, XUiPanelSignBoard.SignBoardOpenType.MAIN)
--RedPoint
2024-09-01 20:49:41 +00:00
XEventManager.AddEventListener(XEventId.EVENT_PHOTO_SYNC_CHANGE_TO_MAIN, self.OnChangeSync, self)
end
function XUiMainOther:OnEnable()
if self.SignBoard then
2024-09-01 20:49:41 +00:00
local displayCharacterId = XDataCenter.DisplayManager.GetRandomDisplayCharByList().Id
XDataCenter.DisplayManager.SetNextDisplayChar(nil)
self.SignBoard:SetDisplayCharacterId(displayCharacterId)
self.SignBoard:OnEnable()
end
end
function XUiMainOther:OnDisable()
if self.SignBoard then
self.SignBoard:OnDisable()
end
end
function XUiMainOther:OnDestroy()
if self.SignBoard then
self.SignBoard:OnDestroy()
end
2024-09-01 20:49:41 +00:00
self.SignBoard = nil
XEventManager.RemoveEventListener(XEventId.EVENT_PHOTO_SYNC_CHANGE_TO_MAIN, self.OnChangeSync, self)
end
2024-09-01 20:49:41 +00:00
function XUiMainOther:Stop()
if not self.SignBoard then
return
end
self.SignBoard:Stop()
end
function XUiMainOther:SetSignBoardEnable(enable)
if not self.SignBoard then
return
end
self.SignBoard:SetEnable(enable)
end
function XUiMainOther:SafeCreateSignBoard()
if self.SignBoard then
return
end
---@type XUiPanelSignBoard
self.SignBoard = XUiPanelSignBoard.New(self.PanelSignBoard, self.RootUi, XUiPanelSignBoard.SignBoardOpenType.MAIN)
self:OnEnable()
end
function XUiMainOther:OnChangeSync()
if self.SignBoard then
self.SignBoard:OnDestroy()
end
2024-09-01 20:49:41 +00:00
self.SignBoard = nil
end
return XUiMainOther