fix():修复重启时花屏效果未关闭的BUG
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -18,4 +18,4 @@
|
|||||||
一七三上下不与世业东丝两个中为主么义之九也了争事二于互五些交产人什从他代以们件任会传但位体作你使便保信俩倒做先光党入全公关其内军农决几出分切则删利别到制前力加动化北区十半南即压原去参又及反发取受变口只可台右号各合同名后向吗吧启员命和品器四回因团国图在地基墙增处外多够大天头她好如始子学它定实家对导射将小少就展山工左已常干平年并应度建开式强当形往很得循心必志思性总情想意成我或战房所手把抗指按换据掉探接控提撞收放政效数文料新方无日时明易是最月有朝期未本术机村条来极果样根模次正此比民气水求没油治法活流济海消清激点热然物特环现理生用由电登百的直相看着知短碰示社种称程穿立第等答管系索约级线组经结给统编置老者而能自色行表被装西要见规角解计认论设识说读象质资走起足路较辑边过运还这进远连送通造道那部都里重量金键长门问间阅队阶际除难需非面革领题高黑默龙!,:
|
一七三上下不与世业东丝两个中为主么义之九也了争事二于互五些交产人什从他代以们件任会传但位体作你使便保信俩倒做先光党入全公关其内军农决几出分切则删利别到制前力加动化北区十半南即压原去参又及反发取受变口只可台右号各合同名后向吗吧启员命和品器四回因团国图在地基墙增处外多够大天头她好如始子学它定实家对导射将小少就展山工左已常干平年并应度建开式强当形往很得循心必志思性总情想意成我或战房所手把抗指按换据掉探接控提撞收放政效数文料新方无日时明易是最月有朝期未本术机村条来极果样根模次正此比民气水求没油治法活流济海消清激点热然物特环现理生用由电登百的直相看着知短碰示社种称程穿立第等答管系索约级线组经结给统编置老者而能自色行表被装西要见规角解计认论设识说读象质资走起足路较辑边过运还这进远连送通造道那部都里重量金键长门问间阅队阶际除难需非面革领题高黑默龙!,:
|
||||||
|
|
||||||
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||||
:;,。?!—()[]<>/\#%&*+-=@"'
|
:;,。?!—()[]<>/\#%&*+-=@"'-——_£$€¥¢©®™¶§±÷×µºª°„“”‘’´`´¨^~|{}©®™¶§±÷×µºª°„“”‘’´`´¨^~|{}
|
||||||
|
|||||||
@@ -467,7 +467,7 @@ PrefabInstance:
|
|||||||
m_AddedGameObjects: []
|
m_AddedGameObjects: []
|
||||||
m_AddedComponents: []
|
m_AddedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: ad835ac5dceb04d439d7480bd8843d31, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: ad835ac5dceb04d439d7480bd8843d31, type: 3}
|
||||||
--- !u!1001 &1724973291
|
--- !u!1001 &1421961696
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -881,12 +881,12 @@ SceneRoots:
|
|||||||
m_Roots:
|
m_Roots:
|
||||||
- {fileID: 6429745761262824323}
|
- {fileID: 6429745761262824323}
|
||||||
- {fileID: 6277645971226662819}
|
- {fileID: 6277645971226662819}
|
||||||
|
- {fileID: 1421961696}
|
||||||
- {fileID: 472728359}
|
- {fileID: 472728359}
|
||||||
- {fileID: 696350469}
|
- {fileID: 696350469}
|
||||||
- {fileID: 1420802831}
|
- {fileID: 1420802831}
|
||||||
- {fileID: 490529182}
|
- {fileID: 490529182}
|
||||||
- {fileID: 599193259}
|
- {fileID: 599193259}
|
||||||
- {fileID: 2044057185}
|
- {fileID: 2044057185}
|
||||||
- {fileID: 1724973291}
|
|
||||||
- {fileID: 3828981172913243262}
|
- {fileID: 3828981172913243262}
|
||||||
- {fileID: 3374228375542675864}
|
- {fileID: 3374228375542675864}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
namespace Core
|
namespace Core
|
||||||
{
|
{
|
||||||
@@ -13,6 +14,11 @@ namespace Core
|
|||||||
UIManager.Instance.RegisterLayer(layer, transform);
|
UIManager.Instance.RegisterLayer(layer, transform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
UIManager.Instance.UnRegisterLayer(layer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,25 +21,37 @@ namespace Core
|
|||||||
public bool IsHasBackgroundUIActive
|
public bool IsHasBackgroundUIActive
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{ return openedUIs.Values.Any(ui => ui.gameObject.activeSelf && ui.transform.parent == layerRoots[UILayer.Background]); }
|
{
|
||||||
|
return openedUIs.Values.Any(ui =>
|
||||||
|
ui.gameObject.activeSelf && ui.transform.parent == layerRoots[UILayer.Background]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsHasNormalUIActive
|
public bool IsHasNormalUIActive
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{ return openedUIs.Values.Any(ui => ui.gameObject.activeSelf && ui.transform.parent == layerRoots[UILayer.Normal]); }
|
{
|
||||||
|
return openedUIs.Values.Any(ui =>
|
||||||
|
ui.gameObject.activeSelf && ui.transform.parent == layerRoots[UILayer.Normal]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsHasPopupUIActive
|
public bool IsHasPopupUIActive
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{ return openedUIs.Values.Any(ui => ui.gameObject.activeSelf && ui.transform.parent == layerRoots[UILayer.Popup]); }
|
{
|
||||||
|
return openedUIs.Values.Any(ui =>
|
||||||
|
ui.gameObject.activeSelf && ui.transform.parent == layerRoots[UILayer.Popup]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsHasTopUIActive
|
public bool IsHasTopUIActive
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{ return openedUIs.Values.Any(ui => ui.gameObject.activeSelf && ui.transform.parent == layerRoots[UILayer.Top]); }
|
{
|
||||||
|
return openedUIs.Values.Any(ui =>
|
||||||
|
ui.gameObject.activeSelf && ui.transform.parent == layerRoots[UILayer.Top]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<UILayer, Transform> layerRoots = new Dictionary<UILayer, Transform>();
|
private Dictionary<UILayer, Transform> layerRoots = new Dictionary<UILayer, Transform>();
|
||||||
@@ -72,6 +84,22 @@ namespace Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UnRegisterLayer(UILayer layer)
|
||||||
|
{
|
||||||
|
// 先移除该层级下的UI注册
|
||||||
|
var uiToRemove = openedUIs.Values.Where(ui => ui.transform.parent == layerRoots[layer]).ToList();
|
||||||
|
foreach (var ui in uiToRemove)
|
||||||
|
{
|
||||||
|
openedUIs.Remove(ui.gameObject.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 然后移除层级根节点
|
||||||
|
if (layerRoots.ContainsKey(layer))
|
||||||
|
{
|
||||||
|
layerRoots.Remove(layer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public T OpenUI<T>(UILayer layer = UILayer.Normal) where T : Component
|
public T OpenUI<T>(UILayer layer = UILayer.Normal) where T : Component
|
||||||
{
|
{
|
||||||
string uiName = typeof(T).Name;
|
string uiName = typeof(T).Name;
|
||||||
@@ -81,6 +109,7 @@ namespace Core
|
|||||||
UpdateCursorState();
|
UpdateCursorState();
|
||||||
return openedUIs[uiName] as T;
|
return openedUIs[uiName] as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载UI预制体
|
// 加载UI预制体
|
||||||
GameObject prefab = Resources.Load<GameObject>("UI/" + uiName); // 从 Resources/UI 文件夹加载UI预制体
|
GameObject prefab = Resources.Load<GameObject>("UI/" + uiName); // 从 Resources/UI 文件夹加载UI预制体
|
||||||
if (prefab == null)
|
if (prefab == null)
|
||||||
@@ -109,21 +138,25 @@ namespace Core
|
|||||||
|
|
||||||
public void ClosePopupUI()
|
public void ClosePopupUI()
|
||||||
{
|
{
|
||||||
var popupUIs = openedUIs.Values.Where(ui => ui.gameObject.activeSelf && ui.transform.parent == layerRoots[UILayer.Popup]);
|
var popupUIs = openedUIs.Values.Where(ui =>
|
||||||
|
ui.gameObject.activeSelf && ui.transform.parent == layerRoots[UILayer.Popup]);
|
||||||
foreach (var ui in popupUIs)
|
foreach (var ui in popupUIs)
|
||||||
{
|
{
|
||||||
ui.Hide();
|
ui.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateCursorState();
|
UpdateCursorState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CloseTopUI()
|
public void CloseTopUI()
|
||||||
{
|
{
|
||||||
var topUIs = openedUIs.Values.Where(ui => ui.gameObject.activeSelf && ui.transform.parent == layerRoots[UILayer.Top]);
|
var topUIs = openedUIs.Values.Where(ui =>
|
||||||
|
ui.gameObject.activeSelf && ui.transform.parent == layerRoots[UILayer.Top]);
|
||||||
foreach (var ui in topUIs)
|
foreach (var ui in topUIs)
|
||||||
{
|
{
|
||||||
ui.Hide();
|
ui.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateCursorState();
|
UpdateCursorState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,8 +188,10 @@ namespace Core
|
|||||||
if (uiBase != null)
|
if (uiBase != null)
|
||||||
uiList.Add(uiBase.gameObject);
|
uiList.Add(uiBase.gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
result[layer] = uiList;
|
result[layer] = uiList;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,8 +208,8 @@ namespace Core
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
inputManager.SetCursorState(true, CursorLockMode.None);
|
inputManager.SetCursorState(true, CursorLockMode.None);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inputManager.SetInputForLook(shouldLockCursor);
|
inputManager.SetInputForLook(shouldLockCursor);
|
||||||
inputManager.SetInputForMove(shouldLockCursor);
|
inputManager.SetInputForMove(shouldLockCursor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace Script.Gameplay.Global
|
|||||||
{
|
{
|
||||||
int beTriggerCycle = GameDataManager.Instance.TotalLoopCount;
|
int beTriggerCycle = GameDataManager.Instance.TotalLoopCount;
|
||||||
stackOverflowBugLogs.Add(new StackOverflowBUGLog(targetTransform, beTriggerCycle));
|
stackOverflowBugLogs.Add(new StackOverflowBUGLog(targetTransform, beTriggerCycle));
|
||||||
GameManager.Instance.ReStartGame();
|
StartCoroutine(GameManager.Instance.ReStartGame());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GenerateBUGCubes()
|
public void GenerateBUGCubes()
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace Script.Gameplay.Global
|
|||||||
_gameCountdownManager.OnFinish.AddListener(() =>
|
_gameCountdownManager.OnFinish.AddListener(() =>
|
||||||
{
|
{
|
||||||
if (IsOpenRestartGameOnCountdownFinish)
|
if (IsOpenRestartGameOnCountdownFinish)
|
||||||
StartCoroutine(OnCountDown());
|
StartCoroutine(GameManager.Instance.ReStartGame());
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -36,12 +36,5 @@ namespace Script.Gameplay.Global
|
|||||||
{
|
{
|
||||||
_gameCountdownManager.StartLevelTimer();
|
_gameCountdownManager.StartLevelTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator OnCountDown()
|
|
||||||
{
|
|
||||||
StartCoroutine(ScreenGlitchManager.Instance.TriggerGlitchEffect());
|
|
||||||
yield return new WaitForSeconds(1.0f);
|
|
||||||
GameManager.Instance.ReStartGame();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using Core;
|
using Core;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Script.Gameplay.Global
|
namespace Script.Gameplay.Global
|
||||||
{
|
{
|
||||||
public class GameManager : MonoSingleton<GameManager>
|
public class GameManager : MonoSingleton<GameManager>
|
||||||
@@ -26,8 +29,10 @@ namespace Script.Gameplay.Global
|
|||||||
OnGameStart?.Invoke();
|
OnGameStart?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReStartGame()
|
public IEnumerator ReStartGame()
|
||||||
{
|
{
|
||||||
|
StartCoroutine(ScreenGlitchManager.Instance.TriggerGlitchEffect());
|
||||||
|
yield return new WaitForSeconds(1.0f);
|
||||||
ScenesManager.Instance.LoadGameplay(currentStartGameMode);
|
ScenesManager.Instance.LoadGameplay(currentStartGameMode);
|
||||||
OnGameStart?.Invoke();
|
OnGameStart?.Invoke();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,5 +45,12 @@ namespace Script.Gameplay.Global
|
|||||||
yield return new WaitForSeconds(glitchDuration);
|
yield return new WaitForSeconds(glitchDuration);
|
||||||
SetFeatureActive(false);
|
SetFeatureActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnDestroy()
|
||||||
|
{
|
||||||
|
base.OnDestroy();
|
||||||
|
// 确保在销毁时禁用特效
|
||||||
|
SetFeatureActive(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ namespace Script.Gameplay.Player
|
|||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
OnDeath += () => StartCoroutine(GameFlowManager.Instance.OnCountDown());
|
OnDeath += () => StartCoroutine(GameManager.Instance.ReStartGame());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TakeDamage(int damage)
|
public void TakeDamage(int damage)
|
||||||
|
|||||||
@@ -27,50 +27,32 @@ namespace UI
|
|||||||
{
|
{
|
||||||
base.Start();
|
base.Start();
|
||||||
inputManager = InputManager.Instance;
|
inputManager = InputManager.Instance;
|
||||||
inputManager.Input.Player.Setting.performed += (ctx) => { UIManager.Instance.SwitchUI<SettingViewer>(); };
|
inputManager.Input.Player.Setting.performed += OnSettingOnperformed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSettingOnperformed(InputAction.CallbackContext ctx)
|
||||||
|
{
|
||||||
|
UIManager.Instance.SwitchUI<SettingViewer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnReloadButtonClicked()
|
private void OnReloadButtonClicked()
|
||||||
{
|
{
|
||||||
GameManager.Instance.ReStartGame();
|
StartCoroutine(GameManager.Instance.ReStartGame());
|
||||||
ContentText.text = "循环次数:" + GameDataManager.Instance.TotalLoopCount.ToString();
|
|
||||||
inputManager.SetCursorState(false, CursorLockMode.Locked);
|
|
||||||
inputManager.SetInputForLook(true);
|
|
||||||
inputManager.SetInputForMove(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegisterInput(InputAction.CallbackContext ctx)
|
|
||||||
{
|
|
||||||
if (!isActiveAndEnabled)
|
|
||||||
{
|
|
||||||
Show();
|
|
||||||
inputManager.SetCursorState(true, CursorLockMode.Confined);
|
|
||||||
inputManager.SetInputForLook(false);
|
|
||||||
inputManager.SetInputForMove(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Hide();
|
|
||||||
inputManager.SetCursorState(false, CursorLockMode.Locked);
|
|
||||||
inputManager.SetInputForLook(true);
|
|
||||||
inputManager.SetInputForMove(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Show()
|
public override void Show()
|
||||||
{
|
{
|
||||||
base.Show();
|
base.Show();
|
||||||
ContentText.text = "循环次数:" + GameDataManager.Instance.TotalLoopCount.ToString();
|
ContentText.text = "循环次数:" + GameDataManager.Instance.TotalLoopCount.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
inputManager.Input.Player.Setting.performed -= OnSettingOnperformed;
|
||||||
|
}
|
||||||
|
|
||||||
public override void Hide()
|
public override void Hide()
|
||||||
{
|
{
|
||||||
base.Hide();
|
base.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
|
||||||
{
|
|
||||||
inputManager.Input.Player.Setting.performed -= RegisterInput;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user