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
@@ -302,6 +302,51 @@ RegisterUIConfig(CachedTestWindow, {
|
||||
layer = "normal",
|
||||
cacheTag = "cache"
|
||||
})
|
||||
local FullscreenTestWindow = __TS__DefineClass("FullscreenTestWindow", __module)
|
||||
FullscreenTestWindow.name = "FullscreenTestWindow"
|
||||
__TS__ClassExtends(FullscreenTestWindow, UIWindow)
|
||||
function FullscreenTestWindow.prototype.OnBindWidgets(self)
|
||||
self:RequireWidget("BtnClose")
|
||||
end
|
||||
RegisterUIConfig(FullscreenTestWindow, {
|
||||
name = "FullscreenTestWindow",
|
||||
assetKey = ASSET_KEYS.MINI_SETTINGS_WIDGET,
|
||||
singleton = true,
|
||||
layer = "normal",
|
||||
type = "fullscreen",
|
||||
cacheTag = "no_cache",
|
||||
blockWorldClick = true
|
||||
})
|
||||
local ToastTestWindow = __TS__DefineClass("ToastTestWindow", __module)
|
||||
ToastTestWindow.name = "ToastTestWindow"
|
||||
__TS__ClassExtends(ToastTestWindow, UIWindow)
|
||||
function ToastTestWindow.prototype.OnBindWidgets(self)
|
||||
self:RequireWidget("TxtStatus")
|
||||
end
|
||||
RegisterUIConfig(ToastTestWindow, {
|
||||
name = "ToastTestWindow",
|
||||
assetKey = ASSET_KEYS.MINI_SETTINGS_WIDGET,
|
||||
singleton = false,
|
||||
layer = "tips",
|
||||
type = "popup",
|
||||
cacheTag = "no_cache",
|
||||
blockWorldClick = false
|
||||
})
|
||||
local SystemTestWindow = __TS__DefineClass("SystemTestWindow", __module)
|
||||
SystemTestWindow.name = "SystemTestWindow"
|
||||
__TS__ClassExtends(SystemTestWindow, UIWindow)
|
||||
function SystemTestWindow.prototype.OnBindWidgets(self)
|
||||
self:RequireWidget("BtnClose")
|
||||
end
|
||||
RegisterUIConfig(SystemTestWindow, {
|
||||
name = "SystemTestWindow",
|
||||
assetKey = ASSET_KEYS.MINI_SETTINGS_WIDGET,
|
||||
singleton = true,
|
||||
layer = "system",
|
||||
type = "popup",
|
||||
cacheTag = "no_cache",
|
||||
blockWorldClick = true
|
||||
})
|
||||
function ____exports.CreateUIAndResourceSuite()
|
||||
return {
|
||||
name = "Step2B_3.UIAndResource",
|
||||
@@ -467,6 +512,96 @@ function ____exports.CreateUIAndResourceSuite()
|
||||
)
|
||||
ctx:Dispose()
|
||||
end
|
||||
},
|
||||
{
|
||||
name = "UIManager fullscreen auto-hide/restore, non-blocking tips focus preservation, and layer ZOrder priority",
|
||||
fn = function()
|
||||
local ctx = __TS__New(GameInstanceContext)
|
||||
local resBackend = __TS__New(MockResourceBackend)
|
||||
local resSvc = __TS__New(ResourceService, ctx, resBackend)
|
||||
resBackend.service = resSvc
|
||||
local btnBackend = __TS__New(MockButtonBackend)
|
||||
local btnBridge = __TS__New(UIDelegateBridge, ctx, btnBackend)
|
||||
btnBackend.bridge = btnBridge
|
||||
ctx:RegisterService("resource", resSvc)
|
||||
ctx:RegisterService("uiDelegateBridge", btnBridge)
|
||||
local widgetFactory = __TS__New(MockWidgetFactory)
|
||||
local lp = ctx:GetOrCreateLocalPlayer(0)
|
||||
local uiMgr = lp:RegisterService(
|
||||
"uiManager",
|
||||
__TS__New(
|
||||
UIManager,
|
||||
ctx,
|
||||
lp,
|
||||
resSvc,
|
||||
widgetFactory,
|
||||
__TS__New(MockWidgetAdapter)
|
||||
)
|
||||
)
|
||||
local baseWin = uiMgr:ShowUI(CachedTestWindow)
|
||||
resBackend:FlushAll()
|
||||
Assert(
|
||||
baseWin:IsVisible(),
|
||||
"base window visible"
|
||||
)
|
||||
AssertEqual(
|
||||
uiMgr:GetDiagnostics().inputMode,
|
||||
"ui"
|
||||
)
|
||||
local toast1 = uiMgr:ShowUI(ToastTestWindow)
|
||||
resBackend:FlushAll()
|
||||
AssertEqual(
|
||||
uiMgr:GetDiagnostics().inputMode,
|
||||
"ui",
|
||||
"non-blocking tips preserves underlying UI input mode"
|
||||
)
|
||||
AssertEqual(
|
||||
uiMgr:GetDiagnostics().topWindowName,
|
||||
"ToastTestWindow",
|
||||
"tips has higher ZOrder than normal"
|
||||
)
|
||||
toast1:Close()
|
||||
local fullWin = uiMgr:ShowUI(FullscreenTestWindow)
|
||||
resBackend:FlushAll()
|
||||
Assert(
|
||||
not baseWin:IsVisible(),
|
||||
"base window hidden while fullscreen is active"
|
||||
)
|
||||
Assert(
|
||||
baseWin:IsHiddenByFullscreen(),
|
||||
"base window marked hiddenByFullscreen"
|
||||
)
|
||||
local sysWin = uiMgr:ShowUI(SystemTestWindow)
|
||||
resBackend:FlushAll()
|
||||
AssertEqual(
|
||||
uiMgr:GetDiagnostics().topWindowName,
|
||||
"SystemTestWindow"
|
||||
)
|
||||
local closedCount = uiMgr:CloseAllExcept(baseWin, false)
|
||||
AssertEqual(closedCount, 2, "closed fullscreen and system windows")
|
||||
Assert(
|
||||
baseWin:IsVisible(),
|
||||
"base window restored after fullscreen closed"
|
||||
)
|
||||
Assert(
|
||||
not baseWin:IsHiddenByFullscreen(),
|
||||
"hiddenByFullscreen cleared"
|
||||
)
|
||||
uiMgr:CloseAll(true)
|
||||
AssertEqual(
|
||||
uiMgr:GetDiagnostics().openWindows,
|
||||
0
|
||||
)
|
||||
AssertEqual(
|
||||
btnBackend:GetActiveBindingCount(),
|
||||
0
|
||||
)
|
||||
AssertEqual(
|
||||
resSvc:GetDiagnostics().nativeTotalRefCount,
|
||||
0
|
||||
)
|
||||
ctx:Dispose()
|
||||
end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user