UI update 02

This commit is contained in:
FloatGaming
2026-06-30 21:21:30 +08:00
parent b2a1e307a4
commit f62f643cfc
1666 changed files with 211081 additions and 22799 deletions
@@ -1538,7 +1538,7 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 8cdc81ed9eb4f4a41bdad444afbea4c2, type: 3}
m_Type: 3
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 1
@@ -5956,7 +5956,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_IgnoreReversedGraphics: 0
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
@@ -124,12 +124,15 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
private Coroutine musicPicFade;
private bool musicPicVisible = true;
private bool navSceneLoading = false;
private Coroutine deferredUiRefreshRoutine;
private bool lastSettingsVisibilityState;
private bool lastOverlayPanelsVisibilityState;
private readonly Dictionary<string, int> guideIndexByScene = new Dictionary<string, int>();
private string currentGuideScene = string.Empty;
private static btmandtopController activeInstance;
private RectTransform topNavigationRoot;
private bool topNavigationGeometryDirty = true;
private int lastTopNavigationParentChildCount = -1;
private static readonly List<string> sceneHistory = new List<string>();
private static bool sceneHistoryHooked = false;
@@ -203,6 +206,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
BindNewBackButtons();
EnsureTopNavigationFront();
ScheduleDeferredUiRefresh();
EnsureMusicPicRoot();
SetupMusicPicDefault();
@@ -279,14 +283,11 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
if (userInfoInstance == null)
{
userInfoInstance = Instantiate(userInfo_prefab, putPrefabsHere.transform);
TryAssignCanvasCamera(userInfoInstance);
PlacePanelBelowSettings(userInfoInstance);
userInfoInstance.SetActive(false);
}
else
{
userInfoInstance.transform.SetParent(putPrefabsHere.transform, false);
PlacePanelBelowSettings(userInfoInstance);
userInfoInstance.SetActive(false);
}
}
@@ -874,43 +875,16 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
private void ToggleUserInfoPrefab()
{
if (userInfo_prefab == null || putPrefabsHere == null) return;
if (userInfoInstance == null)
if (ToggleIfAlreadyOpen(ref userInfoInstance))
{
userInfoInstance = Instantiate(userInfo_prefab, putPrefabsHere.transform);
TryAssignCanvasCamera(userInfoInstance);
PlacePanelBelowSettings(userInfoInstance);
userInfoInstance.SetActive(true);
BroadcastOverlayPanelsVisibility();
RegisterManagedPanel(userInfoInstance, () =>
{
if (userInfoInstance != null)
{
userInfoInstance.SetActive(false);
BroadcastOverlayPanelsVisibility();
}
});
EnsureTopNavigationFront();
return;
}
userInfoInstance.transform.SetParent(putPrefabsHere.transform, false);
userInfoInstance.SetActive(!userInfoInstance.activeSelf);
if (userInfoInstance.activeSelf)
if (OpenPrefab(userInfo_prefab, ref userInfoInstance))
{
PlacePanelBelowSettings(userInfoInstance);
RegisterManagedPanel(userInfoInstance, () =>
{
if (userInfoInstance != null)
{
userInfoInstance.SetActive(false);
BroadcastOverlayPanelsVisibility();
}
});
CloseInfoPanels(userInfoInstance);
RegisterManagedPanel(userInfoInstance, () => CloseManagedOverlay(userInfoInstance));
}
BroadcastOverlayPanelsVisibility();
EnsureTopNavigationFront();
}
private void BroadcastSettingsVisibility(bool visible)
@@ -951,6 +925,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
lastOverlayPanelsVisibilityState = visible;
CurrentOverlayPanelsVisible = visible;
GlobalOverlayPanelVisibilityChanged?.Invoke(visible);
topNavigationGeometryDirty = true;
EnsureTopNavigationFront();
}
@@ -1079,7 +1054,6 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
if (instance == null)
{
instance = Instantiate(prefab, putPrefabsHere.transform);
TryAssignCanvasCamera(instance);
}
else
{
@@ -1097,7 +1071,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
instance.SetActive(true);
}
PlacePanelBelowSettings(instance);
TryAssignCanvasCamera(instance);
BroadcastOverlayPanelsVisibility();
EnsureTopNavigationFront();
return true;
@@ -1114,30 +1088,9 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
settingsInstance.transform.SetAsLastSibling();
}
private void PlacePanelBelowSettings(GameObject instance)
{
if (instance == null || putPrefabsHere == null)
{
return;
}
instance.transform.SetParent(putPrefabsHere.transform, false);
if (settingsInstance == null || instance == settingsInstance)
{
instance.transform.SetAsLastSibling();
return;
}
EnsureSettingsLastSibling();
int settingsIndex = settingsInstance.transform.GetSiblingIndex();
int targetIndex = Mathf.Clamp(settingsIndex, 0, putPrefabsHere.transform.childCount - 1);
instance.transform.SetSiblingIndex(targetIndex);
EnsureSettingsLastSibling();
}
private void CloseInfoPanels(GameObject keep)
{
CloseInstance(ref userInfoInstance, keep);
CloseInstance(ref storeInstance, keep);
CloseInstance(ref showLevelInstance, keep);
CloseInstance(ref emailInstance, keep);
@@ -1292,9 +1245,27 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
if (topNavigationRoot.GetSiblingIndex() != parent.childCount - 1)
{
topNavigationRoot.SetAsLastSibling();
topNavigationGeometryDirty = true;
}
RefreshTopNavigationGeometry();
// The parent's child count changing means a panel was shown/hidden, which can
// shift the top-bar layout. Use it as a cheap heuristic to re-settle geometry.
if (parent.childCount != lastTopNavigationParentChildCount)
{
lastTopNavigationParentChildCount = parent.childCount;
topNavigationGeometryDirty = true;
}
if (topNavigationGeometryDirty)
{
topNavigationGeometryDirty = false;
RefreshTopNavigationGeometry();
}
}
public void MarkTopNavigationGeometryDirty()
{
topNavigationGeometryDirty = true;
}
private void ResolveTopNavigationRoot()
@@ -1411,6 +1382,40 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
}
}
trackedCurrentScene = incoming;
if (activeInstance != null)
{
activeInstance.topNavigationGeometryDirty = true;
activeInstance.EnsureTopNavigationFront();
activeInstance.ScheduleDeferredUiRefresh();
}
}
private void ScheduleDeferredUiRefresh()
{
if (!isActiveAndEnabled)
{
return;
}
if (deferredUiRefreshRoutine != null)
{
StopCoroutine(deferredUiRefreshRoutine);
}
deferredUiRefreshRoutine = StartCoroutine(DeferredUiRefreshRoutine());
}
private System.Collections.IEnumerator DeferredUiRefreshRoutine()
{
for (int i = 0; i < 3; i++)
{
yield return null;
topNavigationGeometryDirty = true;
EnsureTopNavigationFront();
}
deferredUiRefreshRoutine = null;
}
private static string PopPreviousSceneName(string currentScene)
@@ -1490,11 +1495,23 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
navSceneLoading = true;
Time.timeScale = 1f;
if (gTransition.LoadScene(sceneName, LoadSceneMode.Single))
{
while (gTransition.IsBusy)
{
yield return null;
}
navSceneLoading = false;
yield break;
}
AsyncOperation op = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Single);
while (op != null && !op.isDone)
{
yield return null;
}
navSceneLoading = false;
}
@@ -1570,4 +1587,3 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
}
}
}