UI换了很多,spine主视觉停用
This commit is contained in:
@@ -6,7 +6,7 @@ using DG.Tweening;
|
||||
|
||||
public class SongButton : MonoBehaviour
|
||||
{
|
||||
private const bool VerboseLogs = false;
|
||||
private static readonly bool VerboseLogs = false;
|
||||
[Header("thisSong_so")]
|
||||
public ScriptableObject thisSong_so;
|
||||
[Header("Inspector")]
|
||||
@@ -114,13 +114,13 @@ public class SongButton : MonoBehaviour
|
||||
if (songNameText != null) songNameText.text = sd.songName;
|
||||
|
||||
if (multiNameText != null)
|
||||
multiNameText.text = "Artist: " + sd.artistName + " | Illustrator: " + sd.painter + " | Charter: " + sd.level_creator;
|
||||
multiNameText.text = LocalizationService.GetFormat("song.button.artist_info", sd.artistName, sd.painter, sd.level_creator);
|
||||
|
||||
if (joinTime_and_dlcName_Text != null)
|
||||
{
|
||||
string join = string.IsNullOrEmpty(sd.thisLevel_addDateString) ? "Unknown" : sd.thisLevel_addDateString;
|
||||
string dlc = string.IsNullOrEmpty(sd.belongsTo_whichDLC) ? "Unknown DLC" : sd.belongsTo_whichDLC;
|
||||
joinTime_and_dlcName_Text.text = "Release: " + join + " | DLC: " + dlc;
|
||||
joinTime_and_dlcName_Text.text = LocalizationService.GetFormat("song.button.release_info", join, dlc);
|
||||
}
|
||||
|
||||
if (songOverallDescriptionText != null)
|
||||
@@ -190,16 +190,16 @@ public class SongButton : MonoBehaviour
|
||||
}
|
||||
|
||||
song_songSerialID = songID;
|
||||
if (songIDText != null) songIDText.text = "Song ID: " + song_songSerialID.ToString();
|
||||
if (songIDText != null) songIDText.text = LocalizationService.GetFormat("song.button.song_id", song_songSerialID);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (songNameText != null) songNameText.text = songName;
|
||||
if (highestScoreText != null) highestScoreText.text = "PR: " + highestScore.ToString();
|
||||
if (highestScoreText != null) highestScoreText.text = LocalizationService.GetFormat("song.button.highest_score", highestScore);
|
||||
if (difficultyIDText != null) difficultyIDText.text = difficultyID.ToString();
|
||||
if (buttonImage != null) buttonImage.sprite = songSprite;
|
||||
song_songSerialID = songID;
|
||||
if (songIDText != null) songIDText.text = "Song ID: " + song_songSerialID.ToString();
|
||||
if (songIDText != null) songIDText.text = LocalizationService.GetFormat("song.button.song_id", song_songSerialID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ public class SongButton : MonoBehaviour
|
||||
FadeInSelectedBorder();
|
||||
|
||||
SongDataHolder.SelectedSongData = selectedSong;
|
||||
var selectedInfo = Object.FindAnyObjectByType<selected_songInfo>();
|
||||
var selectedInfo = SceneObjectLookupCache.FindAny<selected_songInfo>();
|
||||
if (selectedInfo != null)
|
||||
{
|
||||
selectedInfo.UpdateSelectedSongDisplay();
|
||||
|
||||
@@ -8,7 +8,7 @@ using DG.Tweening;
|
||||
|
||||
public class SongSelectUI : MonoBehaviour
|
||||
{
|
||||
private const bool VerboseLogs = false;
|
||||
private static readonly bool VerboseLogs = false;
|
||||
public SongList songList; // Documentation text normalized.
|
||||
public GameObject songButtonPrefab; // Documentation text normalized.
|
||||
public Transform contentPanel; // Documentation text normalized.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
|
||||
@@ -11,7 +11,7 @@ public class SongDataLibrary : MonoBehaviour
|
||||
private static void EnsureRuntimeInstance()
|
||||
{
|
||||
if (Instance != null) return;
|
||||
if (Object.FindAnyObjectByType<SongDataLibrary>() != null) return;
|
||||
if (SceneObjectLookupCache.FindAny<SongDataLibrary>() != null) return;
|
||||
var go = new GameObject(nameof(SongDataLibrary));
|
||||
Object.DontDestroyOnLoad(go);
|
||||
go.AddComponent<SongDataLibrary>();
|
||||
@@ -64,7 +64,7 @@ public class SongDataLibrary : MonoBehaviour
|
||||
{
|
||||
if (songList == null)
|
||||
{
|
||||
SongSelectUI ui = Object.FindAnyObjectByType<SongSelectUI>();
|
||||
SongSelectUI ui = SceneObjectLookupCache.FindAny<SongSelectUI>();
|
||||
if (ui != null)
|
||||
{
|
||||
songList = ui.songList;
|
||||
|
||||
@@ -212,14 +212,14 @@ public class SongDetailsUI : MonoBehaviour
|
||||
if (charterNameText != null) charterNameText.text = song.level_creator;
|
||||
if (dlcNameText != null) dlcNameText.text = song.belongsTo_whichDLC;
|
||||
if (songSerialNumberText != null) songSerialNumberText.text = song.songID.ToString();
|
||||
if (bpmText != null) bpmText.text = "BPM : " + song.bpm.ToString();
|
||||
if (bpmText != null) bpmText.text = LocalizationService.GetFormat("song.details.bpm", song.bpm);
|
||||
if (profound_image != null) profound_image.sprite = song.fullscreen_songPicture;
|
||||
if (timeSpentText != null) timeSpentText.text = "PlayTime: " + song.time_totalPlayingTime.ToString("F0") + "s";
|
||||
if (enterTimeText != null) enterTimeText.text = "PlayCount: " + song.game_enterTimes.ToString();
|
||||
if (timeSpentText != null) timeSpentText.text = LocalizationService.GetFormat("song.details.play_time", song.time_totalPlayingTime.ToString("F0"));
|
||||
if (enterTimeText != null) enterTimeText.text = LocalizationService.GetFormat("song.details.play_count", song.game_enterTimes);
|
||||
if (detail_informations_text != null)
|
||||
{
|
||||
detail_informations_text.text =
|
||||
$"{song.artistName} - {song.songName} | 曲绘: {song.painter} | 制谱: {song.level_creator} | DLC: {song.belongsTo_whichDLC}";
|
||||
detail_informations_text.text = LocalizationService.GetFormat("song.details.information",
|
||||
song.artistName, song.songName, song.painter, song.level_creator, song.belongsTo_whichDLC);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,19 +261,15 @@ public class SongDetailsUI : MonoBehaviour
|
||||
dlcNameText.text = currentSong.belongsTo_whichDLC;
|
||||
songSerialNumberText.text = currentSong.songID.ToString();
|
||||
|
||||
bpmText.text = "BPM : " + currentSong.bpm.ToString();
|
||||
bpmText.text = LocalizationService.GetFormat("song.details.bpm", currentSong.bpm);
|
||||
profound_image.sprite = currentSong.fullscreen_songPicture;
|
||||
|
||||
if (timeSpentText != null) timeSpentText.text = "PlayTime: " + currentSong.time_totalPlayingTime.ToString("F0") + "s";
|
||||
if (enterTimeText != null) enterTimeText.text = "PlayCount: " + currentSong.game_enterTimes.ToString();
|
||||
if (timeSpentText != null) timeSpentText.text = LocalizationService.GetFormat("song.details.play_time", currentSong.time_totalPlayingTime.ToString("F0"));
|
||||
if (enterTimeText != null) enterTimeText.text = LocalizationService.GetFormat("song.details.play_count", currentSong.game_enterTimes);
|
||||
|
||||
id_of_thisSong = currentSong.songID;
|
||||
detail_informations_text.text =
|
||||
$"{currentSong.artistName}" + " - " +
|
||||
$"{currentSong.songName}" + " | " +
|
||||
$"曲绘: {currentSong.painter}" + " | " +
|
||||
$"制谱: {currentSong.level_creator}" + " | " +
|
||||
$"DLC: {currentSong.belongsTo_whichDLC}";
|
||||
detail_informations_text.text = LocalizationService.GetFormat("song.details.information",
|
||||
currentSong.artistName, currentSong.songName, currentSong.painter, currentSong.level_creator, currentSong.belongsTo_whichDLC);
|
||||
if (currentSong.illustration != null)
|
||||
{
|
||||
//songImage.sprite = currentSong.illustration;
|
||||
@@ -281,7 +277,7 @@ public class SongDetailsUI : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("歌曲封面为空:" + currentSong.songName);
|
||||
Debug.LogWarning(LocalizationService.GetFormat("song.details.no_song_cover", currentSong.songName));
|
||||
}
|
||||
|
||||
Debug.Log("加载歌曲数据: " + currentSong.songName);
|
||||
@@ -388,6 +384,7 @@ public class SongDetailsUI : MonoBehaviour
|
||||
|
||||
spawnedAskInstance = Instantiate(askTemplate, ResolveRoomSpawnParent(), false);
|
||||
PrepareSpawnedPanel(spawnedAskInstance);
|
||||
RegisterManagedOverlay(spawnedAskInstance, DestroyAskInstance);
|
||||
|
||||
roomAsk ask = spawnedAskInstance.GetComponent<roomAsk>();
|
||||
if (ask == null)
|
||||
@@ -440,6 +437,7 @@ public class SongDetailsUI : MonoBehaviour
|
||||
{
|
||||
existing.ConfigureRoomRanking(roomRankingPrefab, ResolveRoomSpawnParent());
|
||||
existing.Bind(roomService);
|
||||
RegisterManagedOverlay(spawnedRoomDetailsInstance, DestroyRoomDetailsInstance);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -453,6 +451,7 @@ public class SongDetailsUI : MonoBehaviour
|
||||
|
||||
spawnedRoomDetailsInstance = Instantiate(roomTemplate, ResolveRoomSpawnParent(), false);
|
||||
PrepareSpawnedPanel(spawnedRoomDetailsInstance);
|
||||
RegisterManagedOverlay(spawnedRoomDetailsInstance, DestroyRoomDetailsInstance);
|
||||
|
||||
roomDetails details = spawnedRoomDetailsInstance.GetComponent<roomDetails>();
|
||||
if (details == null)
|
||||
@@ -469,6 +468,7 @@ public class SongDetailsUI : MonoBehaviour
|
||||
{
|
||||
if (spawnedAskInstance != null)
|
||||
{
|
||||
UIBackStack.Unregister(spawnedAskInstance);
|
||||
Destroy(spawnedAskInstance);
|
||||
spawnedAskInstance = null;
|
||||
}
|
||||
@@ -478,6 +478,7 @@ public class SongDetailsUI : MonoBehaviour
|
||||
{
|
||||
if (spawnedRoomDetailsInstance != null)
|
||||
{
|
||||
UIBackStack.Unregister(spawnedRoomDetailsInstance);
|
||||
Destroy(spawnedRoomDetailsInstance);
|
||||
spawnedRoomDetailsInstance = null;
|
||||
}
|
||||
@@ -559,6 +560,23 @@ public class SongDetailsUI : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private void RegisterManagedOverlay(GameObject panel, Action closeAction)
|
||||
{
|
||||
if (panel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UIBackStack.RegisterOrBump(
|
||||
panel,
|
||||
() => panel != null && panel.activeInHierarchy,
|
||||
() =>
|
||||
{
|
||||
closeAction?.Invoke();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
private Button FindButtonByName(string objectName)
|
||||
{
|
||||
Button[] buttons = Resources.FindObjectsOfTypeAll<Button>();
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.IO;
|
||||
|
||||
public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
private const bool VerboseLogs = false;
|
||||
private static readonly bool VerboseLogs = false;
|
||||
[Header("Inspector")]
|
||||
public Image dlc_profileImgae;
|
||||
public Text dlcName;
|
||||
@@ -65,7 +65,7 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(0.5f);
|
||||
|
||||
// 尝试从场景中查找 dlcDetailParent (如果自身引用的为空)
|
||||
// 灏濊瘯浠庡満鏅腑鏌ユ壘 dlcDetailParent (濡傛灉鑷韩寮曠敤鐨勪负绌?
|
||||
if (dlcDetailParent == null)
|
||||
{
|
||||
var details = GameObject.FindObjectsByType<dlcButton>(FindObjectsInactive.Include, FindObjectsSortMode.None);
|
||||
@@ -83,16 +83,18 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
|
||||
if (dlcDetailParent != null)
|
||||
{
|
||||
dlcDetailParent.SetActive(true);
|
||||
// 更新简介信息
|
||||
// 鏇存柊绠€浠嬩俊鎭?
|
||||
if (dlcDescription != null)
|
||||
{
|
||||
if (dlcDataSO != null)
|
||||
{
|
||||
dlcDescription.text = string.IsNullOrEmpty(dlcDataSO.dlcDescription) ? "暂无DLC简介信息。" : dlcDataSO.dlcDescription;
|
||||
dlcDescription.text = string.IsNullOrEmpty(dlcDataSO.dlcDescription)
|
||||
? LocalizationService.Get("dlc.no_description", "暂无DLC简介信息。")
|
||||
: dlcDataSO.dlcDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
dlcDescription.text = "暂无DLC简介信息。";
|
||||
dlcDescription.text = LocalizationService.Get("dlc.no_description", "暂无DLC简介信息。");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -284,7 +286,7 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
|
||||
|
||||
private SongSelectUI FindSongSelectUI()
|
||||
{
|
||||
var ui = Object.FindAnyObjectByType<SongSelectUI>();
|
||||
var ui = SceneObjectLookupCache.FindAny<SongSelectUI>();
|
||||
if (ui != null)
|
||||
{
|
||||
return ui;
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Collections.Generic;
|
||||
|
||||
public class loadDlcListPrefab : MonoBehaviour
|
||||
{
|
||||
private const bool VerboseLogs = false;
|
||||
private static readonly bool VerboseLogs = false;
|
||||
[System.Serializable]
|
||||
public class Column
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using Bansonic;
|
||||
|
||||
public class selected_songInfo : MonoBehaviour
|
||||
{
|
||||
private const bool VerboseLogs = false;
|
||||
private static readonly bool VerboseLogs = false;
|
||||
[Header("ranking")]
|
||||
public Button rankingButton;
|
||||
public rankingList s_rl;
|
||||
@@ -541,7 +541,7 @@ public class selected_songInfo : MonoBehaviour
|
||||
else
|
||||
{
|
||||
// 鲁棒性处理:显示错误提示
|
||||
gNotice.error.display("暂无预览文件");
|
||||
gNotice.error.display(LocalizationService.Get("song.selected.no_preview", "暂无预览文件"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -799,7 +799,7 @@ public class selected_songInfo : MonoBehaviour
|
||||
}
|
||||
if (songNameText != null)
|
||||
{
|
||||
songNameText.text = "未选择歌曲";
|
||||
songNameText.text = LocalizationService.Get("song.selected.no_song", "未选择歌曲");
|
||||
}
|
||||
|
||||
// restore original difficulty button backgrounds and text colors
|
||||
@@ -1260,7 +1260,7 @@ public class selected_songInfo : MonoBehaviour
|
||||
if (chart == null)
|
||||
{
|
||||
Debug.LogError($"QuickEnter aborted: Song '{sd.songName}' has no chart file for difficulty {sd.thisLevel_selectedDifficultyID}.");
|
||||
gNotice.error.display("未找到此难度的关卡");
|
||||
gNotice.error.display(LocalizationService.Get("song.selected.difficulty_not_found", "未找到此难度的关卡"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1485,8 +1485,8 @@ public class selected_songInfo : MonoBehaviour
|
||||
}
|
||||
|
||||
// find managers in the new scene
|
||||
var beatmapManager = UnityEngine.Object.FindAnyObjectByType<BeatmapManager>();
|
||||
var gameManager = UnityEngine.Object.FindAnyObjectByType<GameManager>();
|
||||
var beatmapManager = SceneObjectLookupCache.FindAny<BeatmapManager>();
|
||||
var gameManager = SceneObjectLookupCache.FindAny<GameManager>();
|
||||
|
||||
LogVerbose($"selected song: {selected.songName} (id {selected.songID}), difficulty {selected.thisLevel_selectedDifficultyID}");
|
||||
|
||||
@@ -1600,7 +1600,7 @@ public class selected_songInfo : MonoBehaviour
|
||||
|
||||
// Start coroutine to wait for player input (Space) to begin playback and spawning
|
||||
// Use a safe host for coroutine in case this MonoBehaviour is destroyed unexpectedly
|
||||
var pauseMgr = PauseManager.Instance != null ? PauseManager.Instance : UnityEngine.Object.FindAnyObjectByType<PauseManager>();
|
||||
var pauseMgr = PauseManager.Instance != null ? PauseManager.Instance : SceneObjectLookupCache.FindAny<PauseManager>();
|
||||
MonoBehaviour coroutineHost = (pauseMgr as MonoBehaviour) ?? (gameManager as MonoBehaviour) ?? (beatmapManager as MonoBehaviour) ?? this;
|
||||
if (coroutineHost != null)
|
||||
{
|
||||
@@ -1650,7 +1650,7 @@ public class selected_songInfo : MonoBehaviour
|
||||
}
|
||||
|
||||
// Prewarm particle systems via AnimationController to avoid first-play hitch
|
||||
var anim = AnimationController.Global != null ? AnimationController.Global : UnityEngine.Object.FindAnyObjectByType<AnimationController>();
|
||||
var anim = AnimationController.Global != null ? AnimationController.Global : SceneObjectLookupCache.FindAny<AnimationController>();
|
||||
if (anim != null)
|
||||
{
|
||||
LogVerbose("Starting AnimationController particle prewarm (will wait until complete)...");
|
||||
@@ -1660,7 +1660,7 @@ public class selected_songInfo : MonoBehaviour
|
||||
}
|
||||
|
||||
// Unpause via PauseManager
|
||||
var pauseMgr = PauseManager.Instance != null ? PauseManager.Instance : UnityEngine.Object.FindAnyObjectByType<PauseManager>();
|
||||
var pauseMgr = PauseManager.Instance != null ? PauseManager.Instance : SceneObjectLookupCache.FindAny<PauseManager>();
|
||||
if (pauseMgr != null) pauseMgr.Pause(false);
|
||||
|
||||
// small buffer to avoid hitching immediately after unpause: wait configured delay from GameManager
|
||||
@@ -1717,7 +1717,7 @@ public class selected_songInfo : MonoBehaviour
|
||||
private void RequestPauseManagerPause()
|
||||
{
|
||||
if (pauseRequested) return;
|
||||
var pm = PauseManager.Instance != null ? PauseManager.Instance : UnityEngine.Object.FindAnyObjectByType<PauseManager>();
|
||||
var pm = PauseManager.Instance != null ? PauseManager.Instance : SceneObjectLookupCache.FindAny<PauseManager>();
|
||||
if (pm != null)
|
||||
{
|
||||
pm.Pause(true);
|
||||
|
||||
Reference in New Issue
Block a user