UI换了很多,spine主视觉停用
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.SceneManagement;
|
||||
@@ -159,7 +159,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
button_Music = btn.GetComponent<Button>();
|
||||
if (button_Music == null)
|
||||
{
|
||||
var any = FindByName("Button_Music");
|
||||
var any = SceneObjectLookupCache.Find("Button_Music");
|
||||
if (any != null) button_Music = any.GetComponent<Button>();
|
||||
}
|
||||
}
|
||||
@@ -169,7 +169,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
instantiateShowLevel = () => { gNotice.error.display("功能即将下线,禁止访问"); };
|
||||
// instantiateShowLevel = () => ShowLevelPrefab();
|
||||
instantiateEmail = () => ShowEmailPrefab();
|
||||
instantiateNotice = () => { gNotice.warning.display("姝ょ増鏈鍔熻兘鏆備笉鍙敤"); };
|
||||
instantiateNotice = () => { gNotice.warning.display("此版本该功能暂不可用"); };
|
||||
// instantiateNotice = () => ShowNoticePrefab();
|
||||
navGuideAction = () => ToggleGuideDisplay();
|
||||
instantiateMarket = () => ShowStorePrefab();
|
||||
@@ -210,7 +210,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
UpdateSteamUserInfo();
|
||||
InitializeMailRedPot();
|
||||
|
||||
var binder = BgmUiBinder.Instance != null ? BgmUiBinder.Instance : Object.FindAnyObjectByType<BgmUiBinder>();
|
||||
var binder = BgmUiBinder.Instance != null ? BgmUiBinder.Instance : SceneObjectLookupCache.FindAny<BgmUiBinder>();
|
||||
if (binder != null && musicPicRoot != null)
|
||||
{
|
||||
binder.SetMusicRoot(musicPicRoot);
|
||||
@@ -222,7 +222,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
// Try to find existing one in scene first
|
||||
if (settingsInstance == null)
|
||||
{
|
||||
var existing = GameObject.Find(settings_prefab.name + "(Clone)");
|
||||
var existing = SceneObjectLookupCache.Find(settings_prefab.name + "(Clone)");
|
||||
if (existing != null)
|
||||
{
|
||||
settingsInstance = existing;
|
||||
@@ -267,7 +267,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
{
|
||||
if (userInfoInstance == null)
|
||||
{
|
||||
var existing = GameObject.Find(userInfo_prefab.name + "(Clone)");
|
||||
var existing = SceneObjectLookupCache.Find(userInfo_prefab.name + "(Clone)");
|
||||
if (existing != null)
|
||||
{
|
||||
userInfoInstance = existing;
|
||||
@@ -339,7 +339,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
|
||||
private void ToggleMusicPic()
|
||||
{
|
||||
var binder = BgmUiBinder.Instance != null ? BgmUiBinder.Instance : Object.FindAnyObjectByType<BgmUiBinder>();
|
||||
var binder = BgmUiBinder.Instance != null ? BgmUiBinder.Instance : SceneObjectLookupCache.FindAny<BgmUiBinder>();
|
||||
if (binder != null)
|
||||
{
|
||||
binder.ToggleMusicPic();
|
||||
@@ -361,7 +361,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
musicPicRoot = child as RectTransform;
|
||||
return;
|
||||
}
|
||||
var sceneMusic = GameObject.Find("MusicPic");
|
||||
var sceneMusic = SceneObjectLookupCache.Find("MusicPic");
|
||||
if (sceneMusic != null)
|
||||
{
|
||||
musicPicRoot = sceneMusic.GetComponent<RectTransform>();
|
||||
@@ -393,7 +393,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
private void ToggleMusicPicLocal()
|
||||
{
|
||||
EnsureMusicPicRoot();
|
||||
var binder = BgmUiBinder.Instance != null ? BgmUiBinder.Instance : Object.FindAnyObjectByType<BgmUiBinder>();
|
||||
var binder = BgmUiBinder.Instance != null ? BgmUiBinder.Instance : SceneObjectLookupCache.FindAny<BgmUiBinder>();
|
||||
if (musicPicRoot == null)
|
||||
{
|
||||
if (binder != null)
|
||||
@@ -461,6 +461,8 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
|
||||
GameObject FindByName(string name)
|
||||
{
|
||||
var cached = SceneObjectLookupCache.Find(name);
|
||||
if (cached != null) return cached;
|
||||
var all = Resources.FindObjectsOfTypeAll<Transform>();
|
||||
for (int i = 0; i < all.Length; i++)
|
||||
{
|
||||
@@ -825,6 +827,15 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
EnsureSettingsLastSibling();
|
||||
BroadcastSettingsVisibility(true);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
RegisterManagedPanel(settingsInstance, () =>
|
||||
{
|
||||
if (settingsInstance != null)
|
||||
{
|
||||
settingsInstance.SetActive(false);
|
||||
BroadcastSettingsVisibility(false);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -838,6 +849,15 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
if (settingsInstance.activeSelf)
|
||||
{
|
||||
EnsureSettingsLastSibling();
|
||||
RegisterManagedPanel(settingsInstance, () =>
|
||||
{
|
||||
if (settingsInstance != null)
|
||||
{
|
||||
settingsInstance.SetActive(false);
|
||||
BroadcastSettingsVisibility(false);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
}
|
||||
});
|
||||
}
|
||||
BroadcastSettingsVisibility(settingsInstance.activeSelf);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
@@ -859,6 +879,14 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
PlacePanelBelowSettings(userInfoInstance);
|
||||
userInfoInstance.SetActive(true);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
RegisterManagedPanel(userInfoInstance, () =>
|
||||
{
|
||||
if (userInfoInstance != null)
|
||||
{
|
||||
userInfoInstance.SetActive(false);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -867,6 +895,14 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
if (userInfoInstance.activeSelf)
|
||||
{
|
||||
PlacePanelBelowSettings(userInfoInstance);
|
||||
RegisterManagedPanel(userInfoInstance, () =>
|
||||
{
|
||||
if (userInfoInstance != null)
|
||||
{
|
||||
userInfoInstance.SetActive(false);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
}
|
||||
});
|
||||
}
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
}
|
||||
@@ -910,6 +946,23 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
GlobalOverlayPanelVisibilityChanged?.Invoke(visible);
|
||||
}
|
||||
|
||||
private void RegisterManagedPanel(GameObject panel, System.Action closeAction)
|
||||
{
|
||||
if (panel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UIBackStack.RegisterOrBump(
|
||||
panel,
|
||||
() => panel != null && panel.activeInHierarchy,
|
||||
() =>
|
||||
{
|
||||
closeAction?.Invoke();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
private void ShowLevelPrefab()
|
||||
{
|
||||
if (ToggleIfAlreadyOpen(ref showLevelInstance))
|
||||
@@ -920,6 +973,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
if (OpenPrefab(showLevel_prefab, ref showLevelInstance))
|
||||
{
|
||||
CloseInfoPanels(showLevelInstance);
|
||||
RegisterManagedPanel(showLevelInstance, () => CloseManagedOverlay(showLevelInstance));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -933,6 +987,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
if (OpenPrefab(store_prefab, ref storeInstance))
|
||||
{
|
||||
CloseInfoPanels(storeInstance);
|
||||
RegisterManagedPanel(storeInstance, () => CloseManagedOverlay(storeInstance));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -946,6 +1001,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
if (OpenPrefab(email_prefab, ref emailInstance))
|
||||
{
|
||||
CloseInfoPanels(emailInstance);
|
||||
RegisterManagedPanel(emailInstance, () => CloseManagedOverlay(emailInstance));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -959,6 +1015,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
if (OpenPrefab(notice_prefab, ref noticeInstance))
|
||||
{
|
||||
CloseInfoPanels(noticeInstance);
|
||||
RegisterManagedPanel(noticeInstance, () => CloseManagedOverlay(noticeInstance));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -972,9 +1029,21 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
if (OpenPrefab(userBag_prefab, ref userBagInstance))
|
||||
{
|
||||
CloseInfoPanels(userBagInstance);
|
||||
RegisterManagedPanel(userBagInstance, () => CloseManagedOverlay(userBagInstance));
|
||||
}
|
||||
}
|
||||
|
||||
private void CloseManagedOverlay(GameObject instance)
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
instance.SetActive(false);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
}
|
||||
|
||||
private bool ToggleIfAlreadyOpen(ref GameObject instance)
|
||||
{
|
||||
if (instance == null)
|
||||
@@ -1089,7 +1158,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
}
|
||||
}
|
||||
|
||||
GameObject existing = GameObject.Find(prefab.name + "(Clone)");
|
||||
GameObject existing = SceneObjectLookupCache.Find(prefab.name + "(Clone)");
|
||||
return existing;
|
||||
}
|
||||
|
||||
@@ -1262,6 +1331,11 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
if (navSceneLoading) return;
|
||||
InitializeSceneHistoryIfNeeded();
|
||||
|
||||
if (UIBackStack.TryHandleTop())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string current = SceneManager.GetActiveScene().name ?? string.Empty;
|
||||
string target = null;
|
||||
|
||||
@@ -1330,7 +1404,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
{
|
||||
Debug.LogWarning("[Steam] SteamManager not initialized.");
|
||||
if (steamStatusText != null)
|
||||
steamStatusText.text = "Unknown Server";
|
||||
steamStatusText.text = LocalizationService.Get("steam.status.unknown", "Unknown Server");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1342,7 +1416,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
steamUserNameText.text = SteamFriends.GetPersonaName();
|
||||
|
||||
if (steamUserID64Text != null)
|
||||
steamUserID64Text.text = "Uid : " + steamID.m_SteamID.ToString();
|
||||
steamUserID64Text.text = LocalizationService.GetFormat("steam.uid_format", steamID.m_SteamID.ToString());
|
||||
|
||||
// Online status check
|
||||
EPersonaState state = SteamFriends.GetPersonaState();
|
||||
@@ -1350,7 +1424,9 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
|
||||
if (steamStatusText != null)
|
||||
{
|
||||
steamStatusText.text = isOffline ? "Steam Offline" : "Steam Online";
|
||||
steamStatusText.text = isOffline
|
||||
? LocalizationService.Get("steam.status.offline", "Steam Offline")
|
||||
: LocalizationService.Get("steam.status.online", "Steam Online");
|
||||
}
|
||||
|
||||
if (steamUserAvatarImage != null)
|
||||
@@ -1390,7 +1466,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
{
|
||||
Debug.LogError("[Steam] Error updating steam info: " + e);
|
||||
if (steamStatusText != null)
|
||||
steamStatusText.text = "Unknown Server";
|
||||
steamStatusText.text = LocalizationService.Get("steam.status.unknown", "Unknown Server");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user