功能批量实现 优化 服务端 新浮动小游戏框架 新界面UI

This commit is contained in:
FloatGaming
2026-04-24 13:20:16 +08:00
parent e0bc0bbf08
commit 5eec879582
257 changed files with 38481 additions and 1288 deletions
+65 -33
View File
@@ -9,6 +9,7 @@ using Bansonic;
public class selected_songInfo : MonoBehaviour
{
private const bool VerboseLogs = false;
[Header("ranking")]
public Button rankingButton;
public rankingList s_rl;
@@ -320,6 +321,8 @@ public class selected_songInfo : MonoBehaviour
StopCoroutine(difficultyIdRollCoroutine);
difficultyIdRollCoroutine = null;
}
KillTweens();
}
void OnDestroy()
@@ -327,6 +330,50 @@ public class selected_songInfo : MonoBehaviour
LogVerbose("selected_songInfo.OnDestroy called");
// ensure we remove sceneLoaded subscription if still present
SceneManager.sceneLoaded -= OnSceneLoadedAfterQuickEnter;
KillTweens();
}
private void KillTweens()
{
if (songInfo_Root != null)
{
songInfo_Root.DOKill();
}
if (songInfo_Canvas != null)
{
songInfo_Canvas.DOKill();
}
if (currentDifficulty != null)
{
currentDifficulty.DOKill();
}
if (sumScore_thisDifficulty != null)
{
sumScore_thisDifficulty.DOKill();
}
if (c_DifficultyImage != null)
{
c_DifficultyImage.DOKill();
}
if (c_imageMask != null)
{
c_imageMask.DOKill();
}
if (blackMaskImage != null)
{
blackMaskImage.DOKill();
}
if (Music_Mgr.Singleton != null && Music_Mgr.Singleton.AudioSource != null)
{
Music_Mgr.Singleton.AudioSource.DOKill();
}
}
void Start()
@@ -1225,8 +1272,6 @@ public class selected_songInfo : MonoBehaviour
// keep selected in holder to make it accessible in new scene
SongDataHolder.SelectedSongData = sd;
// mark this object to persist across scene load so callbacks/coroutines are valid
DontDestroyOnLoad(this.gameObject);
// start fade and load sequence
StartCoroutine(QuickEnterSequence());
}
@@ -1335,8 +1380,8 @@ public class selected_songInfo : MonoBehaviour
}
LogVerbose("Fade complete, loading gameplay scene...");
// after black screen, load gameplay scene asynchronously and wait for completion
SceneManager.sceneLoaded += OnSceneLoadedAfterQuickEnter;
// selected_songInfo is scene UI and must not survive scene switching.
// Gameplay startup is already handled by BeatmapManager/GameManager via pendingSongData.
var asyncOp = SceneManager.LoadSceneAsync("gamePlay_gamePlay");
if (asyncOp != null)
{
@@ -1364,39 +1409,26 @@ public class selected_songInfo : MonoBehaviour
if (sb == null) continue;
try
{
// log selection marker info for each button to help debugging
var field = sb.GetType().GetField("selected_boarder", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public);
Image img = null;
if (field != null) img = field.GetValue(sb) as Image;
Image img = sb.selected_boarder;
float alpha = img != null ? img.color.a : -1f;
LogVerbose($"SongButton id field value for '{sb.name}': selected_boarder alpha={alpha}");
if (img != null && img.color.a > 0.5f)
if (sb.IsSelectedForQuickEnter())
{
// prefer thisSong_so if present
var soField = sb.GetType().GetField("thisSong_so", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic);
if (soField != null)
SongData assignedSong = sb.GetAssignedSongData();
if (assignedSong != null)
{
var soObj = soField.GetValue(sb);
if (soObj != null && soObj is SongData)
{
LogVerbose($"Selected SongButton has thisSong_so assigned: {((SongData)soObj).songName}");
return soObj as SongData;
}
LogVerbose($"Selected SongButton has thisSong_so assigned: {assignedSong.songName}");
return assignedSong;
}
// fallback: use song id on SongButton
var idField = sb.GetType().GetField("song_songSerialID", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic);
if (idField != null)
int id = sb.GetSongSerialId();
LogVerbose($"Selected SongButton id = {id}");
var sd = SongDataLibrary.Instance != null ? SongDataLibrary.Instance.GetSongDataByID(id) : null;
if (sd != null)
{
int id = (int)idField.GetValue(sb);
LogVerbose($"Selected SongButton id = {id}");
var sd = SongDataLibrary.Instance != null ? SongDataLibrary.Instance.GetSongDataByID(id) : null;
if (sd != null)
{
LogVerbose($"Found SongData by id: {sd.songName}");
return sd;
}
LogVerbose($"Found SongData by id: {sd.songName}");
return sd;
}
}
}
@@ -1448,7 +1480,7 @@ public class selected_songInfo : MonoBehaviour
LogVerbose("OnSceneLoadedAfterQuickEnter: SelectedSongData is null");
SceneManager.sceneLoaded -= OnSceneLoadedAfterQuickEnter;
// allow this object to be destroyed now
Destroy(this.gameObject);
Destroy(gameObject);
return;
}
@@ -1511,11 +1543,11 @@ public class selected_songInfo : MonoBehaviour
{
gameManager.musicSource.mute = true;
gameManager.musicSource.Play();
Debug.LogWarning("Warmed audio playback (muted) after assigning SongData.audioFile");
if (VerboseLogs) Debug.Log("Warmed audio playback (muted) after assigning SongData.audioFile");
}
catch (System.Exception ex)
{
Debug.LogWarning("Failed to Play() for warmup: " + ex.Message);
if (VerboseLogs) Debug.Log("Failed to Play() for warmup: " + ex.Message);
}
LogVerbose("Assigned SongData.audioFile to GameManager.musicSource.clip (playOnAwake disabled)");
@@ -1672,7 +1704,7 @@ public class selected_songInfo : MonoBehaviour
}
// done with this helper object - allow it to be destroyed
Destroy(this.gameObject);
Destroy(gameObject);
yield break;
}