养成基本完毕,新UI,修bug,装备初步,
This commit is contained in:
@@ -11,7 +11,9 @@ using Steamworks;
|
||||
public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
{
|
||||
public static event System.Action<bool> GlobalSettingsVisibilityChanged;
|
||||
public static event System.Action<bool> GlobalOverlayPanelVisibilityChanged;
|
||||
public static bool CurrentSettingsVisible { get; private set; }
|
||||
public static bool CurrentOverlayPanelsVisible { get; private set; }
|
||||
|
||||
public event System.Action<bool> SettingsVisibilityChanged;
|
||||
|
||||
@@ -113,6 +115,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
private bool musicPicVisible = true;
|
||||
private bool navSceneLoading = false;
|
||||
private bool lastSettingsVisibilityState;
|
||||
private bool lastOverlayPanelsVisibilityState;
|
||||
private readonly Dictionary<string, int> guideIndexByScene = new Dictionary<string, int>();
|
||||
private string currentGuideScene = string.Empty;
|
||||
|
||||
@@ -145,7 +148,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
}
|
||||
instantiateSettings = () => ToggleSettingsPrefab();
|
||||
instantiateUserInfo = () => ToggleUserInfoPrefab();
|
||||
instantiateStore = () => ShowStorePrefab();
|
||||
instantiateStore = () => { };
|
||||
instantiateShowLevel = () => { gNotice.error.display("功能即将下线,禁止访问"); };
|
||||
// instantiateShowLevel = () => ShowLevelPrefab();
|
||||
instantiateEmail = () => ShowEmailPrefab();
|
||||
@@ -266,6 +269,8 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
}
|
||||
|
||||
lastSettingsVisibilityState = IsSettingsPanelVisible;
|
||||
lastOverlayPanelsVisibilityState = AreOverlayPanelsVisible();
|
||||
CurrentOverlayPanelsVisible = lastOverlayPanelsVisibilityState;
|
||||
}
|
||||
|
||||
|
||||
@@ -285,16 +290,28 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
{
|
||||
BroadcastSettingsVisibility(false);
|
||||
}
|
||||
if (CurrentOverlayPanelsVisible)
|
||||
{
|
||||
lastOverlayPanelsVisibilityState = false;
|
||||
CurrentOverlayPanelsVisible = false;
|
||||
GlobalOverlayPanelVisibilityChanged?.Invoke(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
bool visible = IsSettingsPanelVisible;
|
||||
if (visible == lastSettingsVisibilityState)
|
||||
if (visible != lastSettingsVisibilityState)
|
||||
{
|
||||
return;
|
||||
BroadcastSettingsVisibility(visible);
|
||||
}
|
||||
|
||||
BroadcastSettingsVisibility(visible);
|
||||
bool overlayVisible = AreOverlayPanelsVisible();
|
||||
if (overlayVisible != lastOverlayPanelsVisibilityState)
|
||||
{
|
||||
lastOverlayPanelsVisibilityState = overlayVisible;
|
||||
CurrentOverlayPanelsVisible = overlayVisible;
|
||||
GlobalOverlayPanelVisibilityChanged?.Invoke(overlayVisible);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -660,6 +677,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
settingsInstance.SetActive(true);
|
||||
EnsureSettingsLastSibling();
|
||||
BroadcastSettingsVisibility(true);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -675,6 +693,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
EnsureSettingsLastSibling();
|
||||
}
|
||||
BroadcastSettingsVisibility(settingsInstance.activeSelf);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
}
|
||||
|
||||
public bool IsSettingsPanelVisible
|
||||
@@ -692,6 +711,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
TryAssignCanvasCamera(userInfoInstance);
|
||||
PlacePanelBelowSettings(userInfoInstance);
|
||||
userInfoInstance.SetActive(true);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -701,6 +721,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
{
|
||||
PlacePanelBelowSettings(userInfoInstance);
|
||||
}
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
}
|
||||
|
||||
private void BroadcastSettingsVisibility(bool visible)
|
||||
@@ -724,6 +745,23 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
return string.Equals(sceneName, targetScene, System.StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private bool AreOverlayPanelsVisible()
|
||||
{
|
||||
return (settingsInstance != null && settingsInstance.activeInHierarchy)
|
||||
|| (storeInstance != null && storeInstance.activeInHierarchy)
|
||||
|| (showLevelInstance != null && showLevelInstance.activeInHierarchy)
|
||||
|| (emailInstance != null && emailInstance.activeInHierarchy)
|
||||
|| (noticeInstance != null && noticeInstance.activeInHierarchy);
|
||||
}
|
||||
|
||||
private void BroadcastOverlayPanelsVisibility()
|
||||
{
|
||||
bool visible = AreOverlayPanelsVisible();
|
||||
lastOverlayPanelsVisibilityState = visible;
|
||||
CurrentOverlayPanelsVisible = visible;
|
||||
GlobalOverlayPanelVisibilityChanged?.Invoke(visible);
|
||||
}
|
||||
|
||||
private void ShowLevelPrefab()
|
||||
{
|
||||
bool opened = ShowPrefab(showLevel_prefab, ref showLevelInstance);
|
||||
@@ -782,10 +820,12 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
instance.SetActive(shouldOpen);
|
||||
if (!shouldOpen)
|
||||
{
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
return false;
|
||||
}
|
||||
|
||||
PlacePanelBelowSettings(instance);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -834,6 +874,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
{
|
||||
if (instance == null || instance == keep) return;
|
||||
instance.SetActive(false);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
}
|
||||
|
||||
private GameObject FindExistingInstance(GameObject prefab)
|
||||
|
||||
Reference in New Issue
Block a user