AlicizaX/Client/Packages/com.alicizax.unity.ui/Runtime/UI/Manager/UIManager.cs

68 lines
1.8 KiB
C#
Raw Normal View History

2025-01-24 16:21:00 +08:00
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; }
2025-03-04 18:40:14 +08:00
private ITimerManager _timerManager;
2025-01-24 16:21:00 +08:00
void IModule.Dispose()
{
UITypeCollector.Clean();
}
void IModuleUpdate.Update(float elapseSeconds, float realElapseSeconds)
{
2025-03-04 18:40:14 +08:00
// 遍历所有层级
for (int layerIndex = 0; layerIndex < _openUI.Length; layerIndex++)
2025-01-24 16:21:00 +08:00
{
2025-03-04 18:40:14 +08:00
var layer = _openUI[layerIndex];
int count = layer.OrderList.Count;
if (count== 0) continue; // 跳过空层级
for (int i = 0; i < count; i++)
2025-01-24 16:21:00 +08:00
{
2025-03-04 18:40:14 +08:00
if (layer.OrderList.Count != count)
2025-01-24 16:21:00 +08:00
{
break;
}
2025-03-04 18:40:14 +08:00
var window = layer.OrderList[i];
window.View.InternalUpdate();
2025-01-24 16:21:00 +08:00
}
}
}
2025-03-11 21:03:30 +08:00
public UIBase ShowUI(UIMetadata meta, params System.Object[] userDatas)
2025-01-24 16:21:00 +08:00
{
2025-03-11 21:03:30 +08:00
return ShowUIImplSync(meta, userDatas);
2025-01-24 16:21:00 +08:00
}
2025-03-11 21:03:30 +08:00
public async UniTask<UIBase> ShowUIAsync(UIMetadata meta, params System.Object[] userDatas)
2025-01-24 16:21:00 +08:00
{
2025-03-11 21:03:30 +08:00
return await ShowUIImplAsync(meta, userDatas);
2025-01-24 16:21:00 +08:00
}
2025-03-11 21:03:30 +08:00
public void CloseUI(UIMetadata meta, bool force = false)
2025-01-24 16:21:00 +08:00
{
2025-03-11 21:03:30 +08:00
CloseUIImpl(meta, force);
2025-01-24 16:21:00 +08:00
}
2025-03-11 21:03:30 +08:00
public UIBase GetUI(UIMetadata meta)
2025-01-24 16:21:00 +08:00
{
2025-03-11 21:03:30 +08:00
return (UIWindow)GetUIImpl(meta);
2025-01-24 16:21:00 +08:00
}
void IUIManager.SetTimerManager(ITimerManager timerManager)
{
_timerManager = timerManager;
}
}
}