feat(demo): add Bootstrap Demo Hub, Chinese UI font, and UI Demo showcase scene
This commit is contained in:
1 parent
3572f2da43
commit
4c83c086f4
49 files changed
+7864
-131
No files matched your search
@@ -20,7 +20,9 @@ function UIWindow.prototype.____constructor(self, ...)
|
||||
self.isVisible = false
|
||||
self.isClosing = false
|
||||
self.isCached = false
|
||||
self.buttonBindings = {}
|
||||
self.hiddenByFullscreen = false
|
||||
self.currentZOrder = 0
|
||||
self.widgetBindings = {}
|
||||
end
|
||||
function UIWindow.prototype.InitContextInternal(self, ctx, uiManager, config, widgetAdapter)
|
||||
self.ctx = ctx
|
||||
@@ -31,6 +33,9 @@ end
|
||||
function UIWindow.prototype.GetWidget(self)
|
||||
return self.widget
|
||||
end
|
||||
function UIWindow.prototype.GetZOrder(self)
|
||||
return self.currentZOrder
|
||||
end
|
||||
function UIWindow.prototype.IsLoading(self)
|
||||
return self.isLoading
|
||||
end
|
||||
@@ -46,6 +51,12 @@ end
|
||||
function UIWindow.prototype.IsCached(self)
|
||||
return self.isCached
|
||||
end
|
||||
function UIWindow.prototype.IsHiddenByFullscreen(self)
|
||||
return self.hiddenByFullscreen
|
||||
end
|
||||
function UIWindow.prototype.SetHiddenByFullscreenInternal(self, hidden)
|
||||
self.hiddenByFullscreen = hidden
|
||||
end
|
||||
function UIWindow.prototype.SetLoadingStateInternal(self, loading, handle)
|
||||
self.isLoading = loading
|
||||
self.classLoadHandle = handle
|
||||
@@ -69,30 +80,99 @@ function UIWindow.prototype.RequireWidget(self, widgetName)
|
||||
)
|
||||
return child
|
||||
end
|
||||
function UIWindow.prototype.BindButtonClick(self, button, callback)
|
||||
function UIWindow.prototype.TrackWidgetBinding(self, handle)
|
||||
if handle ~= nil then
|
||||
self.widgetBindings[#self.widgetBindings + 1] = handle
|
||||
end
|
||||
return handle
|
||||
end
|
||||
function UIWindow.prototype.GetDelegateBridge(self)
|
||||
local bridge = self.ctx:GetService("uiDelegateBridge")
|
||||
if bridge == nil then
|
||||
logger:Warn("UIDelegateBridge not registered on context", {window = self.config.name})
|
||||
return nil
|
||||
end
|
||||
local handle = bridge:BindButtonClick(button, callback, self)
|
||||
self.buttonBindings[#self.buttonBindings + 1] = handle
|
||||
return handle
|
||||
return bridge
|
||||
end
|
||||
function UIWindow.prototype.UnbindAllButtons(self)
|
||||
function UIWindow.prototype.BindButtonClick(self, button, callback)
|
||||
local bridge = self:GetDelegateBridge()
|
||||
if bridge == nil then
|
||||
return nil
|
||||
end
|
||||
return self:TrackWidgetBinding(bridge:BindButtonClick(button, callback, self))
|
||||
end
|
||||
function UIWindow.prototype.BindButtonHovered(self, button, callback)
|
||||
local bridge = self:GetDelegateBridge()
|
||||
if bridge == nil then
|
||||
return nil
|
||||
end
|
||||
return self:TrackWidgetBinding(bridge:BindButtonHovered(button, callback, self))
|
||||
end
|
||||
function UIWindow.prototype.BindButtonUnhovered(self, button, callback)
|
||||
local bridge = self:GetDelegateBridge()
|
||||
if bridge == nil then
|
||||
return nil
|
||||
end
|
||||
return self:TrackWidgetBinding(bridge:BindButtonUnhovered(button, callback, self))
|
||||
end
|
||||
function UIWindow.prototype.BindCheckBoxChanged(self, checkBox, callback)
|
||||
local bridge = self:GetDelegateBridge()
|
||||
if bridge == nil then
|
||||
return nil
|
||||
end
|
||||
return self:TrackWidgetBinding(bridge:BindCheckBoxChanged(checkBox, callback, self))
|
||||
end
|
||||
function UIWindow.prototype.BindSliderChanged(self, slider, callback)
|
||||
local bridge = self:GetDelegateBridge()
|
||||
if bridge == nil then
|
||||
return nil
|
||||
end
|
||||
return self:TrackWidgetBinding(bridge:BindSliderChanged(slider, callback, self))
|
||||
end
|
||||
function UIWindow.prototype.BindSpinBoxChanged(self, spinBox, callback)
|
||||
local bridge = self:GetDelegateBridge()
|
||||
if bridge == nil then
|
||||
return nil
|
||||
end
|
||||
return self:TrackWidgetBinding(bridge:BindSpinBoxChanged(spinBox, callback, self))
|
||||
end
|
||||
function UIWindow.prototype.BindEditableTextChanged(self, textBox, callback)
|
||||
local bridge = self:GetDelegateBridge()
|
||||
if bridge == nil then
|
||||
return nil
|
||||
end
|
||||
return self:TrackWidgetBinding(bridge:BindEditableTextChanged(textBox, callback, self))
|
||||
end
|
||||
function UIWindow.prototype.BindEditableTextCommitted(self, textBox, callback)
|
||||
local bridge = self:GetDelegateBridge()
|
||||
if bridge == nil then
|
||||
return nil
|
||||
end
|
||||
return self:TrackWidgetBinding(bridge:BindEditableTextCommitted(textBox, callback, self))
|
||||
end
|
||||
function UIWindow.prototype.BindComboBoxChanged(self, comboBox, callback)
|
||||
local bridge = self:GetDelegateBridge()
|
||||
if bridge == nil then
|
||||
return nil
|
||||
end
|
||||
return self:TrackWidgetBinding(bridge:BindComboBoxSelectionChanged(comboBox, callback, self))
|
||||
end
|
||||
function UIWindow.prototype.UnbindAllWidgetEvents(self)
|
||||
do
|
||||
local i = 0
|
||||
while i < #self.buttonBindings do
|
||||
self.buttonBindings[i + 1]:Dispose()
|
||||
while i < #self.widgetBindings do
|
||||
self.widgetBindings[i + 1]:Dispose()
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
self.buttonBindings = {}
|
||||
self.widgetBindings = {}
|
||||
end
|
||||
function UIWindow.prototype.ShowInternal(self, zOrder, args)
|
||||
if self:IsDisposed() or self.isClosing then
|
||||
return
|
||||
end
|
||||
self.currentZOrder = zOrder
|
||||
self.hiddenByFullscreen = false
|
||||
tbpcall(function()
|
||||
self:OnPreShow(args)
|
||||
end)
|
||||
@@ -111,6 +191,7 @@ function UIWindow.prototype.ReuseInternal(self, zOrder, args)
|
||||
end
|
||||
self.isCached = false
|
||||
self.isClosing = false
|
||||
self.hiddenByFullscreen = false
|
||||
self:EnableAllEventListeners()
|
||||
self:OnBindWidgets()
|
||||
tbpcall(function()
|
||||
@@ -118,6 +199,22 @@ function UIWindow.prototype.ReuseInternal(self, zOrder, args)
|
||||
end)
|
||||
self:ShowInternal(zOrder, args)
|
||||
end
|
||||
function UIWindow.prototype.RestoreFromFullscreenInternal(self)
|
||||
if self:IsDisposed() or self.isClosing or self.isCached or not self.isLoaded then
|
||||
return
|
||||
end
|
||||
self.hiddenByFullscreen = false
|
||||
if self.isVisible then
|
||||
return
|
||||
end
|
||||
if self.widget ~= nil and self.widgetAdapter:IsWidgetValid(self.widget) then
|
||||
self.widgetAdapter:SetVisible(self.widget, true)
|
||||
end
|
||||
self.isVisible = true
|
||||
tbpcall(function()
|
||||
self:OnShow()
|
||||
end)
|
||||
end
|
||||
function UIWindow.prototype.Hide(self)
|
||||
if not self.isVisible then
|
||||
return
|
||||
@@ -143,9 +240,10 @@ function UIWindow.prototype.Close(self, onClosed)
|
||||
local canCache = self.config.cacheTag == "cache" and self.isLoaded and self.widget ~= nil and self.widgetAdapter:IsWidgetValid(self.widget) and not self.ctx:IsShuttingDown()
|
||||
if canCache then
|
||||
self.isVisible = false
|
||||
self.hiddenByFullscreen = false
|
||||
self.isCached = true
|
||||
self.isClosing = false
|
||||
self:UnbindAllButtons()
|
||||
self:UnbindAllWidgetEvents()
|
||||
self:DisableAllEventListeners()
|
||||
self.widgetAdapter:RemoveFromParent(self.widget)
|
||||
tbpcall(function()
|
||||
@@ -163,7 +261,8 @@ function UIWindow.prototype.Close(self, onClosed)
|
||||
end)
|
||||
end
|
||||
self.isVisible = false
|
||||
self:UnbindAllButtons()
|
||||
self.hiddenByFullscreen = false
|
||||
self:UnbindAllWidgetEvents()
|
||||
if self.widget ~= nil and self.widgetAdapter:IsWidgetValid(self.widget) then
|
||||
self.widgetAdapter:RemoveFromParent(self.widget)
|
||||
end
|
||||
@@ -176,7 +275,8 @@ function UIWindow.prototype.Close(self, onClosed)
|
||||
end
|
||||
function UIWindow.prototype.ForceDisposeFromCacheInternal(self)
|
||||
self.isCached = false
|
||||
self:UnbindAllButtons()
|
||||
self.hiddenByFullscreen = false
|
||||
self:UnbindAllWidgetEvents()
|
||||
if self.widget ~= nil and self.widgetAdapter:IsWidgetValid(self.widget) then
|
||||
self.widgetAdapter:RemoveFromParent(self.widget)
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user