【loading】 过场时,loading界面统一提前遮盖

main
Ma Yuanzheng 2024-01-09 18:11:00 +08:00
parent 88fe4dd68b
commit 2fff125ed4
10 changed files with 36 additions and 17 deletions

View File

@ -8,7 +8,7 @@ public enum UIWindowLayer
ForeGround, //
Tips, //提示层级
Guide,//新手引导层
Waiting, //菊花层级
Waiting, //菊花, 断线,错误等
Max //最高层级
}

View File

@ -51,14 +51,14 @@ public partial class UIManager
_WindowMeta(UINameConst.UI_VehicleChoose, UIWindowLayer.Normal);
_WindowMeta(UINameConst.UI_VehicleCultivate, UIWindowLayer.Normal);
_WindowMeta(UINameConst.UI_VehicleLevelUp, UIWindowLayer.Normal);
_WindowMeta(UINameConst.UI_Update, UIWindowLayer.Max);
_WindowMeta(UINameConst.UI_LogIn, UIWindowLayer.Max);
_WindowMeta(UINameConst.UI_Update, UIWindowLayer.Tips);
_WindowMeta(UINameConst.UI_LogIn, UIWindowLayer.Normal);
_WindowMeta(UINameConst.UI_LoginTips, UIWindowLayer.Max);
_WindowMeta(UINameConst.UI_Loading, UIWindowLayer.Max);
_WindowMeta(UINameConst.UIReconnect, UIWindowLayer.Max);
_WindowMeta(UINameConst.UIReconnectConfirm, UIWindowLayer.Max);
_WindowMeta(UINameConst.UIReconnectNotice, UIWindowLayer.Max);
_WindowMeta(UINameConst.UIBackReturn, UIWindowLayer.Max);
_WindowMeta(UINameConst.UI_Loading, UIWindowLayer.Waiting);
_WindowMeta(UINameConst.UIReconnect, UIWindowLayer.Waiting);
_WindowMeta(UINameConst.UIReconnectConfirm, UIWindowLayer.Waiting);
_WindowMeta(UINameConst.UIReconnectNotice, UIWindowLayer.Waiting);
_WindowMeta(UINameConst.UIBackReturn, UIWindowLayer.Waiting);
_WindowMeta(UINameConst.UI_Email, UIWindowLayer.Normal);
_WindowMeta(UINameConst.UIGiftCodeAwards, UIWindowLayer.Normal);
_WindowMeta(UINameConst.UITask, UIWindowLayer.Normal);
@ -67,7 +67,7 @@ public partial class UIManager
_WindowMeta(UINameConst.UI_Shop, UIWindowLayer.Normal);
_WindowMeta(UINameConst.UI_Purchase, UIWindowLayer.Normal);
_WindowMeta(UINameConst.UI_GetItemWindow, UIWindowLayer.Normal);
_WindowMeta(UINameConst.UINoticeOne, UIWindowLayer.Max);
_WindowMeta(UINameConst.UINoticeOne, UIWindowLayer.Tips);
_WindowMeta(UINameConst.UI_PVPMain,UIWindowLayer.Normal);
}

View File

@ -293,6 +293,20 @@ public partial class UIManager : Singlenton<UIManager>, IInitable
}
}
public void ForeachUI(Action<UIWindow> action)
{
var windowList = mMemoryWindows.ToList();
foreach (var kv in windowList)
{
var window = kv.Value;
if (window != null)
{
action?.Invoke(kv.Value);
}
}
}
public void CloseAllUI(UIWindowCloseType closeType )
{
var windowList = mMemoryWindows.ToList();

View File

@ -22,7 +22,6 @@ public class GameStateLevel : IState
public void OnExit()
{
UIManager.Instance.CloseAllUI(UIWindowCloseType.HideAndDestroy);
LevelManager.Instance.UnloadLevel();
}
}

View File

@ -20,6 +20,5 @@ public class GameStateMainScene : IState
public void OnExit()
{
UIManager.Instance.CloseAllUI(UIWindowCloseType.HideAndDestroy);
}
}

View File

@ -21,8 +21,19 @@ public class GameStateManager : Singlenton<GameStateManager> , IUpdatable, IInit
_stateMachine = null;
}
public void ChangeState(IState state)
public async void ChangeState(IState state)
{
_stateMachine.ChangeState(state);
var ui = await UIManager.Instance.OpenWindow(UINameConst.UI_Loading) as UI_LoadingController;
if (ui != null)
{
UIManager.Instance.ForeachUI(delegate(UIWindow window)
{
if (window != null && window != ui)
{
window.CloseWindow(UIWindowCloseType.HideAndDestroy);
}
});
_stateMachine.ChangeState(state);
}
}
}

View File

@ -21,6 +21,5 @@ public class GameStateStart : IState
public void OnExit()
{
UIManager.Instance.CloseAllUI(UIWindowCloseType.HideAndDestroy);
}
}

View File

@ -72,7 +72,6 @@ namespace Code.Scripts.Gameplay.Game
public void OnExit()
{
UIManager.Instance.CloseAllUI(UIWindowCloseType.HideAndDestroy);
EventManager.Instance.Unregister(EventManager.EventName.STORY_CLICK_SKIP, _OnRecvExit);
// TODO: 卸载场景
StoryManager.instance.DisposeForGame();

View File

@ -85,7 +85,6 @@ public class UILoginController : UIWindow
{
PlayerPrefs.SetString("LoginAccount", _Input.text);
Gameplay.Net.Actor.Instance.StartLogin(NLDPB.LoginType.Phxh, _Input.text);
CloseWindow();
}

View File

@ -192,7 +192,6 @@ public class UI_LogInController : UIWindow
PlayerPrefs.SetString("LoginAccount", InputField_Pass.text);
Gameplay.Net.Actor.Instance.StartLogin(NLDPB.LoginType.Phxh, InputField_Pass.text);
CloseWindow();
}
//invoke when open window
protected override void OnOpenWindow()