功能批量实现 优化 服务端 新浮动小游戏框架 新界面UI
This commit is contained in:
@@ -8,6 +8,7 @@ using DG.Tweening;
|
||||
|
||||
public class SongSelectUI : MonoBehaviour
|
||||
{
|
||||
private const bool VerboseLogs = false;
|
||||
public SongList songList; // Documentation text normalized.
|
||||
public GameObject songButtonPrefab; // Documentation text normalized.
|
||||
public Transform contentPanel; // Documentation text normalized.
|
||||
@@ -70,6 +71,48 @@ public class SongSelectUI : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
KillActiveTweensAndCoroutines();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
KillActiveTweensAndCoroutines();
|
||||
}
|
||||
|
||||
private void KillActiveTweensAndCoroutines()
|
||||
{
|
||||
if (buildCoroutine != null)
|
||||
{
|
||||
StopCoroutine(buildCoroutine);
|
||||
buildCoroutine = null;
|
||||
}
|
||||
|
||||
if (switchCoroutine != null)
|
||||
{
|
||||
StopCoroutine(switchCoroutine);
|
||||
switchCoroutine = null;
|
||||
}
|
||||
|
||||
if (restoreCoroutine != null)
|
||||
{
|
||||
StopCoroutine(restoreCoroutine);
|
||||
restoreCoroutine = null;
|
||||
}
|
||||
|
||||
RectTransform root = GetListAnimRoot();
|
||||
if (root != null)
|
||||
{
|
||||
root.DOKill();
|
||||
}
|
||||
|
||||
if (listCanvasGroup != null)
|
||||
{
|
||||
listCanvasGroup.DOKill();
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator LoadSceneAsync(string sceneName)
|
||||
{
|
||||
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Single);
|
||||
@@ -270,7 +313,7 @@ public class SongSelectUI : MonoBehaviour
|
||||
var allSongButtons = contentPanel.GetComponentsInChildren<SongButton>(true);
|
||||
if (allSongButtons == null || allSongButtons.Length == 0)
|
||||
{
|
||||
Debug.LogWarning("SongSelectUI.RestoreSelectedSongForCurrentDlc: no song buttons found to restore selection");
|
||||
if (VerboseLogs) Debug.LogWarning("SongSelectUI.RestoreSelectedSongForCurrentDlc: no song buttons found to restore selection");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -300,10 +343,10 @@ public class SongSelectUI : MonoBehaviour
|
||||
if (btn != null)
|
||||
{
|
||||
// simulate click
|
||||
btn.OnSongButtonClick();
|
||||
Debug.Log($"SongSelectUI: restored and clicked song index={savedIndex} for key={key}, totalButtons={allSongButtons.Length}");
|
||||
btn.OnSongButtonClick();
|
||||
if (VerboseLogs) Debug.Log($"SongSelectUI: restored and clicked song index={savedIndex} for key={key}, totalButtons={allSongButtons.Length}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearSongList()
|
||||
{
|
||||
@@ -372,8 +415,7 @@ public class SongSelectUI : MonoBehaviour
|
||||
}
|
||||
|
||||
Button button = songButtonObj.GetComponent<Button>();
|
||||
if (button != null && songButton != null)
|
||||
button.onClick.AddListener(() => songButton.OnSongButtonClick());
|
||||
// SongButton.Awake already binds its own click handler. Avoid double invocation here.
|
||||
}
|
||||
|
||||
// helper to avoid hardcoding scene name string in delegate - keeps serializer-friendly field
|
||||
|
||||
Reference in New Issue
Block a user