初始化提交
This commit is contained in:
41
Content/Lua/UI/UILayerManager.lua
Normal file
41
Content/Lua/UI/UILayerManager.lua
Normal file
@ -0,0 +1,41 @@
|
||||
local UILayerManager = {}
|
||||
local EWidgetLayoutType = import("EWidgetLayoutType")
|
||||
|
||||
function UILayerManager:ctor()
|
||||
self.layer_mapping = {}
|
||||
end
|
||||
|
||||
function UILayerManager:OnInitialized()
|
||||
self.layer_mapping = {
|
||||
[EWidgetLayoutType.MainLayer] = self.MainLayer,
|
||||
[EWidgetLayoutType.PopupLayer] = self.PopupLayer,
|
||||
[EWidgetLayoutType.FloatLayer] = self.FloatLayer,
|
||||
[EWidgetLayoutType.TopLayer] = self.TopLayer,
|
||||
}
|
||||
end
|
||||
|
||||
function UILayerManager:ShowWidget(widget, args)
|
||||
local layer = self.layer_mapping[widget.LayoutType]
|
||||
if layer == nil then
|
||||
return
|
||||
end
|
||||
layer:AddChild(widget)
|
||||
if widget.Refresh then
|
||||
widget:Refresh(args)
|
||||
end
|
||||
widget.Slot:SetVerticalAlignment(0)
|
||||
widget.Slot:SetHorizontalAlignment(0)
|
||||
widget:SetVisible(true)
|
||||
end
|
||||
|
||||
function UILayerManager:HideWidget(widget)
|
||||
widget:SetVisible(false)
|
||||
end
|
||||
|
||||
function UILayerManager:CloseWidget(widget)
|
||||
widget:SetVisible(false)
|
||||
end
|
||||
|
||||
|
||||
|
||||
return Class(nil, nil, UILayerManager)
|
||||
Reference in New Issue
Block a user