优化ui,谱面替换,以及科研模糊

This commit is contained in:
FloatGaming
2026-02-25 03:44:41 +08:00
parent 332307d18c
commit 0b75e93f71
114 changed files with 160279 additions and 290 deletions
+84 -7
View File
@@ -1,5 +1,11 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Bansonic;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class userSettings : MonoBehaviour
{
@@ -25,15 +31,86 @@ public class userSettings : MonoBehaviour
[Tooltip("Documentation text normalized.")]
public Button view_detailedHighlight_button;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
private const string RuntimeResourcesPath = "song_songIndex";
private const string EditorAssetsPath = "Assets/Resources/song_songIndex";
[SerializeField] private float clearupConfirmSeconds = 2f;
private bool clearupPending;
private float clearupExpireTime;
private void OnEnable()
{
if (clearup_saveData_button != null)
clearup_saveData_button.onClick.AddListener(OnClearupSaveDataClicked);
}
// Update is called once per frame
void Update()
private void OnDisable()
{
if (clearup_saveData_button != null)
clearup_saveData_button.onClick.RemoveListener(OnClearupSaveDataClicked);
}
private void Update()
{
if (clearupPending && Time.unscaledTime > clearupExpireTime)
clearupPending = false;
}
private void OnClearupSaveDataClicked()
{
if (clearupPending && Time.unscaledTime <= clearupExpireTime)
{
clearupPending = false;
StartCoroutine(ClearSongDataRoutine());
return;
}
clearupPending = true;
clearupExpireTime = Time.unscaledTime + clearupConfirmSeconds;
gNotice.alarm.display("再次按下清空存档");
}
private IEnumerator ClearSongDataRoutine()
{
Dictionary<int, SongData> songs = new Dictionary<int, SongData>();
SongData[] runtimeSongs = Resources.LoadAll<SongData>(RuntimeResourcesPath);
if (runtimeSongs != null)
{
for (int i = 0; i < runtimeSongs.Length; i++)
{
SongData so = runtimeSongs[i];
if (so != null && !songs.ContainsKey(so.songID))
songs.Add(so.songID, so);
if ((i % 24) == 0)
yield return null;
}
}
#if UNITY_EDITOR
string[] guids = AssetDatabase.FindAssets("t:SongData", new[] { EditorAssetsPath });
if (guids != null)
{
for (int i = 0; i < guids.Length; i++)
{
string path = AssetDatabase.GUIDToAssetPath(guids[i]);
SongData so = AssetDatabase.LoadAssetAtPath<SongData>(path);
if (so != null && !songs.ContainsKey(so.songID))
songs.Add(so.songID, so);
if ((i % 24) == 0)
yield return null;
}
}
#endif
int index = 0;
foreach (var kvp in songs)
{
SongData so = kvp.Value;
if (so != null)
so.ClearSaveDataAndReload();
index++;
if ((index % 16) == 0)
yield return null;
}
}
}