AlicizaX/Client/Packages/com.alicizax.unity.ui/Runtime/UI/Manager/UIManager.cs
2025-03-04 18:40:14 +08:00

68 lines
1.8 KiB
C#

using System;
using AlicizaX.Resource.Runtime;
using AlicizaX.Runtime;
using AlicizaX.Timer.Runtime;
using Cysharp.Threading.Tasks;
namespace AlicizaX.UI.Runtime
{
internal sealed partial class UIManager : IUIManager
{
public int Priority { get; }
private ITimerManager _timerManager;
void IModule.Dispose()
{
UITypeCollector.Clean();
}
void IModuleUpdate.Update(float elapseSeconds, float realElapseSeconds)
{
// 遍历所有层级
for (int layerIndex = 0; layerIndex < _openUI.Length; layerIndex++)
{
var layer = _openUI[layerIndex];
int count = layer.OrderList.Count;
if (count== 0) continue; // 跳过空层级
for (int i = 0; i < count; i++)
{
if (layer.OrderList.Count != count)
{
break;
}
var window = layer.OrderList[i];
window.View.InternalUpdate();
}
}
}
public UIBase ShowUI(Type type, params System.Object[] userDatas)
{
return ShowUIImplSync(type.TypeHandle, userDatas);
}
public async UniTask<UIBase> ShowUIAsync(Type type, params System.Object[] userDatas)
{
return await ShowUIImplAsync(type.TypeHandle, userDatas);
}
public void CloseUI(Type type, bool force = false)
{
CloseUIImpl(type.TypeHandle, force);
}
public UIBase GetUI(Type type)
{
return (UIWindow)GetUIImpl(type.TypeHandle);
}
void IUIManager.SetTimerManager(ITimerManager timerManager)
{
_timerManager = timerManager;
}
}
}