UI HUGE UPDATE
This commit is contained in:
@@ -129,6 +129,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
private readonly Dictionary<string, int> guideIndexByScene = new Dictionary<string, int>();
|
||||
private string currentGuideScene = string.Empty;
|
||||
private static btmandtopController activeInstance;
|
||||
private RectTransform topNavigationRoot;
|
||||
|
||||
private static readonly List<string> sceneHistory = new List<string>();
|
||||
private static bool sceneHistoryHooked = false;
|
||||
@@ -201,6 +202,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
closeGuideButton.onClick.AddListener(CloseGuideDisplay);
|
||||
|
||||
BindNewBackButtons();
|
||||
EnsureTopNavigationFront();
|
||||
|
||||
EnsureMusicPicRoot();
|
||||
SetupMusicPicDefault();
|
||||
@@ -333,6 +335,8 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
CurrentOverlayPanelsVisible = overlayVisible;
|
||||
GlobalOverlayPanelVisibilityChanged?.Invoke(overlayVisible);
|
||||
}
|
||||
|
||||
EnsureTopNavigationFront();
|
||||
}
|
||||
|
||||
|
||||
@@ -887,6 +891,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
}
|
||||
});
|
||||
EnsureTopNavigationFront();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -905,6 +910,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
});
|
||||
}
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
EnsureTopNavigationFront();
|
||||
}
|
||||
|
||||
private void BroadcastSettingsVisibility(bool visible)
|
||||
@@ -931,6 +937,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
private bool AreOverlayPanelsVisible()
|
||||
{
|
||||
return (settingsInstance != null && settingsInstance.activeInHierarchy)
|
||||
|| (userInfoInstance != null && userInfoInstance.activeInHierarchy)
|
||||
|| (storeInstance != null && storeInstance.activeInHierarchy)
|
||||
|| (showLevelInstance != null && showLevelInstance.activeInHierarchy)
|
||||
|| (emailInstance != null && emailInstance.activeInHierarchy)
|
||||
@@ -944,6 +951,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
lastOverlayPanelsVisibilityState = visible;
|
||||
CurrentOverlayPanelsVisible = visible;
|
||||
GlobalOverlayPanelVisibilityChanged?.Invoke(visible);
|
||||
EnsureTopNavigationFront();
|
||||
}
|
||||
|
||||
private void RegisterManagedPanel(GameObject panel, System.Action closeAction)
|
||||
@@ -1091,6 +1099,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
|
||||
PlacePanelBelowSettings(instance);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
EnsureTopNavigationFront();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1237,10 +1246,18 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
settings_navButton.onClick.RemoveListener(navSettingsAction);
|
||||
settings_navButton.onClick.AddListener(navSettingsAction);
|
||||
}
|
||||
|
||||
EnsureTopNavigationFront();
|
||||
}
|
||||
|
||||
private void ResolveNewBackButtons()
|
||||
{
|
||||
Transform topRoot = FindChildRecursive(transform, "TOP");
|
||||
if (topRoot != null)
|
||||
{
|
||||
topNavigationRoot = topRoot as RectTransform;
|
||||
}
|
||||
|
||||
Transform navRoot = FindChildRecursive(transform, "New back");
|
||||
if (navRoot == null)
|
||||
{
|
||||
@@ -1257,6 +1274,89 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
settings_navButton = FindButtonByName(navRoot, "settings");
|
||||
}
|
||||
|
||||
private void EnsureTopNavigationFront()
|
||||
{
|
||||
ResolveTopNavigationRoot();
|
||||
|
||||
if (topNavigationRoot == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Transform parent = topNavigationRoot.parent;
|
||||
if (parent == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (topNavigationRoot.GetSiblingIndex() != parent.childCount - 1)
|
||||
{
|
||||
topNavigationRoot.SetAsLastSibling();
|
||||
}
|
||||
|
||||
RefreshTopNavigationGeometry();
|
||||
}
|
||||
|
||||
private void ResolveTopNavigationRoot()
|
||||
{
|
||||
if (topNavigationRoot != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Transform topRoot = FindChildRecursive(transform, "TOP");
|
||||
if (topRoot == null)
|
||||
{
|
||||
GameObject sceneTop = FindByName("TOP");
|
||||
if (sceneTop != null)
|
||||
{
|
||||
topRoot = sceneTop.transform;
|
||||
}
|
||||
}
|
||||
|
||||
if (topRoot != null)
|
||||
{
|
||||
topNavigationRoot = topRoot as RectTransform;
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshTopNavigationGeometry()
|
||||
{
|
||||
if (topNavigationRoot == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Canvas.ForceUpdateCanvases();
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(topNavigationRoot);
|
||||
|
||||
RectTransform navRoot = null;
|
||||
if (back_navButton != null)
|
||||
{
|
||||
navRoot = back_navButton.transform.parent as RectTransform;
|
||||
}
|
||||
if (navRoot == null)
|
||||
{
|
||||
Transform candidate = FindChildRecursive(topNavigationRoot, "New back");
|
||||
navRoot = candidate as RectTransform;
|
||||
}
|
||||
if (navRoot != null)
|
||||
{
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(navRoot);
|
||||
}
|
||||
|
||||
if (back_navButton != null)
|
||||
{
|
||||
RectTransform backRect = back_navButton.transform as RectTransform;
|
||||
if (backRect != null)
|
||||
{
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(backRect);
|
||||
}
|
||||
}
|
||||
|
||||
Canvas.ForceUpdateCanvases();
|
||||
}
|
||||
|
||||
private static Transform FindChildRecursive(Transform root, string childName)
|
||||
{
|
||||
if (root == null || string.IsNullOrEmpty(childName)) return null;
|
||||
|
||||
Reference in New Issue
Block a user