#104 目前调用 HideUI 会将 UIWindow 的 Visible 设置为 false,但是如果又调用 CloseUI 方法,会将刚才 Visible 设置为 false 的窗口重新设置为 true。

This commit is contained in:
Alex-Rachel
2024-12-22 13:13:59 +08:00
parent 37d88c2d94
commit b869a05220
2 changed files with 22 additions and 2 deletions

View File

@@ -382,12 +382,18 @@ namespace TEngine
CloseUI(type);
return;
}
window.Visible = false;
window.IsHide = true;
window.HideTimerId = GameModule.Timer.AddTimer((arg) =>
{
CloseUI(type);
},window.HideTimeToClose);
if (window.FullScreen)
{
OnSetWindowVisible();
}
}
/// <summary>
@@ -469,6 +475,10 @@ namespace TEngine
UIWindow window = _stack[i];
if (isHideNext == false)
{
if (window.IsHide)
{
continue;
}
window.Visible = true;
if (window.IsPrepare && window.FullScreen)
{

View File

@@ -18,10 +18,14 @@ namespace TEngine
private GameObject _panel;
private Canvas _canvas;
protected Canvas Canvas => _canvas;
private Canvas[] _childCanvas;
private GraphicRaycaster _raycaster;
protected GraphicRaycaster GraphicRaycaster => _raycaster;
private GraphicRaycaster[] _childRaycaster;
@@ -204,6 +208,11 @@ namespace TEngine
internal bool IsLoadDone = false;
internal bool IsDestroyed = false;
/// <summary>
/// UI是否隐藏标志位。
/// </summary>
public bool IsHide { internal set; get; } = false;
#endregion
public void Init(string name, int layer, bool fullScreen, string assetName, bool fromResources, int hideTimeToClose)
@@ -218,6 +227,7 @@ namespace TEngine
internal void TryInvoke(System.Action<UIWindow> prepareCallback, System.Object[] userDatas)
{
CancelHideToCloseTimer();
base.userDatas = userDatas;
if (IsPrepare)
{
@@ -227,7 +237,6 @@ namespace TEngine
{
_prepareCallback = prepareCallback;
}
CancelHideToCloseTimer();
}
internal async UniTaskVoid InternalLoad(string location, Action<UIWindow> prepareCallback, bool isAsync, System.Object[] userDatas)
@@ -437,6 +446,7 @@ namespace TEngine
internal void CancelHideToCloseTimer()
{
IsHide = false;
if (HideTimerId > 0)
{
GameModule.Timer.RemoveTimer(HideTimerId);