修了很多bug和增加功能,优化不少问题
This commit is contained in:
@@ -116,9 +116,7 @@ public class SongData : ScriptableObject
|
||||
[TextArea(3, 10)]
|
||||
public string thisLevel_overallDescription;
|
||||
|
||||
// [Header("Enemy Configuration")]
|
||||
// [Tooltip("DEPRECATED: Use enemyList in ChartFileEntry instead. List of enemy IDs for this song (0-5 enemies)")]
|
||||
// public List<int> enemyList = new List<int>();
|
||||
private bool _isPersistentDataLoaded = false;
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
@@ -291,6 +289,9 @@ public class SongData : ScriptableObject
|
||||
if (chartFileMap == null) chartFileMap = new Dictionary<int, TextAsset>();
|
||||
if (chartFiles == null) chartFiles = new List<ChartFileEntry>();
|
||||
|
||||
// 尝试从持久化存储加载数据
|
||||
LoadPersistent();
|
||||
|
||||
SyncRecordsFromChartFiles();
|
||||
SyncChartFileMap();
|
||||
}
|
||||
@@ -320,8 +321,16 @@ public class SongData : ScriptableObject
|
||||
/// </summary>
|
||||
public void SavePersistent()
|
||||
{
|
||||
if (songID == 0)
|
||||
{
|
||||
Debug.LogWarning($"[SongData] {songName} has songID=0. Saving to 'SongData_0.json' may overwrite other songs!");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// 在保存前确保 chartFiles 已同步,这样在编辑器中查看 SO 时数据也是最新的
|
||||
SyncEntriesFromMaps();
|
||||
|
||||
string path = System.IO.Path.Combine(Application.persistentDataPath, $"SongData_{songID}.json");
|
||||
SongDataSerializable serializable = new SongDataSerializable(this);
|
||||
|
||||
@@ -333,8 +342,15 @@ public class SongData : ScriptableObject
|
||||
|
||||
// 3. 再次序列化包含 Hash 的最终数据
|
||||
string finalJson = JsonUtility.ToJson(serializable, true);
|
||||
|
||||
// 确保目录存在
|
||||
string dir = System.IO.Path.GetDirectoryName(path);
|
||||
if (!System.IO.Directory.Exists(dir)) System.IO.Directory.CreateDirectory(dir);
|
||||
|
||||
System.IO.File.WriteAllText(path, finalJson);
|
||||
|
||||
Debug.Log($"[SongData] {songName} (ID:{songID}) saved to {path}");
|
||||
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
@@ -342,7 +358,6 @@ public class SongData : ScriptableObject
|
||||
UnityEditor.AssetDatabase.SaveAssets();
|
||||
}
|
||||
#endif
|
||||
Debug.Log($"[SongData] {songName} saved with hash validation.");
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
@@ -356,6 +371,8 @@ public class SongData : ScriptableObject
|
||||
/// </summary>
|
||||
public void LoadPersistent()
|
||||
{
|
||||
if (_isPersistentDataLoaded) return;
|
||||
|
||||
string path = System.IO.Path.Combine(Application.persistentDataPath, $"SongData_{songID}.json");
|
||||
if (System.IO.File.Exists(path))
|
||||
{
|
||||
@@ -368,36 +385,35 @@ public class SongData : ScriptableObject
|
||||
{
|
||||
serializable.ApplyTo(this);
|
||||
SyncEntriesFromMaps();
|
||||
// Debug.Log($"[SongData] {songName} data restored.");
|
||||
_isPersistentDataLoaded = true;
|
||||
Debug.Log($"[SongData] {songName} (ID:{songID}) data restored from persistent storage.");
|
||||
}
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Debug.LogWarning($"[SongData] {songName} 基础加载跳过: {e.Message}");
|
||||
Debug.LogWarning($"[SongData] {songName} 基础加载失败: {e.Message}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果不存在存档文件,也标记为已加载,防止重复检查
|
||||
_isPersistentDataLoaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearSaveDataAndReload()
|
||||
{
|
||||
game_enterTimes = 0;
|
||||
time_totalPlayingTime = 0f;
|
||||
current_levelProgress = 0f;
|
||||
_if_level_is_EASE = false;
|
||||
max_comboRecord = 0;
|
||||
personalRecord = 0;
|
||||
if (personalRecordMap != null) personalRecordMap.Clear();
|
||||
else personalRecordMap = new Dictionary<int, int>();
|
||||
|
||||
if (personalRecordMap == null) personalRecordMap = new Dictionary<int, int>();
|
||||
else personalRecordMap.Clear();
|
||||
if (idolRecordMap != null) idolRecordMap.Clear();
|
||||
else idolRecordMap = new Dictionary<int, int>();
|
||||
|
||||
if (idolRecordMap == null) idolRecordMap = new Dictionary<int, int>();
|
||||
else idolRecordMap.Clear();
|
||||
if (chartScoreMap != null) chartScoreMap.Clear();
|
||||
else chartScoreMap = new Dictionary<int, int>();
|
||||
|
||||
if (chartScoreMap == null) chartScoreMap = new Dictionary<int, int>();
|
||||
else chartScoreMap.Clear();
|
||||
|
||||
if (levelProgressMap == null) levelProgressMap = new Dictionary<int, float>();
|
||||
else levelProgressMap.Clear();
|
||||
if (levelProgressMap != null) levelProgressMap.Clear();
|
||||
else levelProgressMap = new Dictionary<int, float>();
|
||||
|
||||
if (chartFiles != null)
|
||||
{
|
||||
@@ -410,12 +426,47 @@ public class SongData : ScriptableObject
|
||||
entry.idolPersonalRecordForThisDifficulty = 0;
|
||||
entry.totalPersonalRecordForThisDifficulty = 0;
|
||||
entry.levelProgressForThisDifficulty = 0f;
|
||||
|
||||
int diff = entry.difficulty;
|
||||
personalRecordMap[diff] = 0;
|
||||
idolRecordMap[diff] = 0;
|
||||
chartScoreMap[diff] = 0;
|
||||
levelProgressMap[diff] = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (difficultyNumberMap != null && difficultyNumberMap.Count > 0)
|
||||
{
|
||||
foreach (var kvp in difficultyNumberMap)
|
||||
{
|
||||
int diff = kvp.Key;
|
||||
if (!personalRecordMap.ContainsKey(diff)) personalRecordMap[diff] = 0;
|
||||
if (!idolRecordMap.ContainsKey(diff)) idolRecordMap[diff] = 0;
|
||||
if (!chartScoreMap.ContainsKey(diff)) chartScoreMap[diff] = 0;
|
||||
if (!levelProgressMap.ContainsKey(diff)) levelProgressMap[diff] = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
game_enterTimes = 0;
|
||||
time_totalPlayingTime = 0f;
|
||||
current_levelProgress = 0f;
|
||||
_if_level_is_EASE = false;
|
||||
max_comboRecord = 0;
|
||||
personalRecord = 0;
|
||||
|
||||
UpdateOverallRecordsFromEntries();
|
||||
|
||||
string path = System.IO.Path.Combine(Application.persistentDataPath, $"SongData_{songID}.json");
|
||||
if (System.IO.File.Exists(path))
|
||||
{
|
||||
try { System.IO.File.Delete(path); } catch { }
|
||||
}
|
||||
|
||||
SavePersistent();
|
||||
LoadPersistent();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorUtility.SetDirty(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -564,8 +615,7 @@ public class SongData : ScriptableObject
|
||||
|
||||
chartScoreMap[difficulty] = total;
|
||||
|
||||
UpdateOverallRecordsFromEntries();
|
||||
ApplySerializableRoundTrip();
|
||||
SyncEntriesFromMaps();
|
||||
SavePersistent();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 237.8, y: 17.230005}
|
||||
m_SizeDelta: {x: 200, y: 40}
|
||||
m_AnchoredPosition: {x: 237.8, y: 16.7}
|
||||
m_SizeDelta: {x: 200, y: 60.21}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1366203894775410018
|
||||
CanvasRenderer:
|
||||
@@ -67,7 +67,7 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: cc180dff846d13a4d88ddaed6f77e5cd, type: 3}
|
||||
m_Font: {fileID: 12800000, guid: 8b8373b0af11dca46b89be60dbe469f8, type: 3}
|
||||
m_FontSize: 40
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
@@ -280,6 +280,7 @@ RectTransform:
|
||||
- {fileID: 5907833122203511268}
|
||||
- {fileID: 8205711265108694850}
|
||||
- {fileID: 7990419107466363714}
|
||||
- {fileID: 6592276605955103311}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
@@ -302,7 +303,7 @@ MonoBehaviour:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1198053886828452625}
|
||||
m_Enabled: 1
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
@@ -404,6 +405,9 @@ MonoBehaviour:
|
||||
songIDText: {fileID: 6350822755597574453}
|
||||
buttonImage: {fileID: 4974503315116154840}
|
||||
scoreLevelImage: {fileID: 9222537835252028022}
|
||||
lvl_img_01: {fileID: 6761260079816317346}
|
||||
lvl_img_02: {fileID: 7423277152801159337}
|
||||
lvl_img_03: {fileID: 8862666023782374080}
|
||||
profileImage: {fileID: 7018466335066945843}
|
||||
song_songSerialID: 0
|
||||
selected_boarder: {fileID: 4758992877847013954}
|
||||
@@ -448,6 +452,161 @@ RectTransform:
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &1811432700761358573
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1557960609061955033}
|
||||
- component: {fileID: 6923511498419407553}
|
||||
- component: {fileID: 7423277152801159337}
|
||||
m_Layer: 5
|
||||
m_Name: 1
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1557960609061955033
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1811432700761358573}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1786747130064482794}
|
||||
m_Father: {fileID: 6592276605955103311}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 25, y: 25}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6923511498419407553
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1811432700761358573}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7423277152801159337
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1811432700761358573}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &2090635385711355497
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1786747130064482794}
|
||||
- component: {fileID: 5772009328743146275}
|
||||
- component: {fileID: 7610213094827879109}
|
||||
m_Layer: 5
|
||||
m_Name: Text (Legacy)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1786747130064482794
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2090635385711355497}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1557960609061955033}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 65.8, y: 0.65}
|
||||
m_SizeDelta: {x: 160, y: 30}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5772009328743146275
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2090635385711355497}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7610213094827879109
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2090635385711355497}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: 8b8373b0af11dca46b89be60dbe469f8, type: 3}
|
||||
m_FontSize: 8
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 0
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 0
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: HD
|
||||
--- !u!1 &2356119867999498898
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -482,7 +641,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 264.87, y: -36.736988}
|
||||
m_AnchoredPosition: {x: 264.87, y: -37.99}
|
||||
m_SizeDelta: {x: 412, y: 21.276}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8887826047491577449
|
||||
@@ -514,8 +673,8 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: 775c674e81662c644b64550d2e8f74e0, type: 3}
|
||||
m_FontSize: 18
|
||||
m_Font: {fileID: 12800000, guid: 8b8373b0af11dca46b89be60dbe469f8, type: 3}
|
||||
m_FontSize: 12
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
@@ -526,7 +685,86 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: "\u6570\u636E\u4EE3\u53F7\uFF1A1002001"
|
||||
m_Text: "songid\uFF1A1002001"
|
||||
--- !u!1 &2362235791607603251
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5753355558868935913}
|
||||
- component: {fileID: 1336396162244346592}
|
||||
- component: {fileID: 3324170630053997330}
|
||||
m_Layer: 5
|
||||
m_Name: Text (Legacy)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &5753355558868935913
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2362235791607603251}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2149752462514565465}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 65.8, y: 0.65}
|
||||
m_SizeDelta: {x: 160, y: 30}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1336396162244346592
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2362235791607603251}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3324170630053997330
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2362235791607603251}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: 8b8373b0af11dca46b89be60dbe469f8, type: 3}
|
||||
m_FontSize: 8
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 0
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 0
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: EZ
|
||||
--- !u!1 &2535065286354064931
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -562,8 +800,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 312.8001, y: 3.2}
|
||||
m_SizeDelta: {x: 50, y: 50}
|
||||
m_AnchoredPosition: {x: 304.73, y: 3.2}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3397289974922444082
|
||||
CanvasRenderer:
|
||||
@@ -603,6 +841,82 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &2720353387567529425
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2149752462514565465}
|
||||
- component: {fileID: 3117658159281603999}
|
||||
- component: {fileID: 6761260079816317346}
|
||||
m_Layer: 5
|
||||
m_Name: 0
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2149752462514565465
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2720353387567529425}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5753355558868935913}
|
||||
m_Father: {fileID: 6592276605955103311}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 25, y: 25}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3117658159281603999
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2720353387567529425}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &6761260079816317346
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2720353387567529425}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &3188516354339195101
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -637,7 +951,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0.022387505, y: 30.489746}
|
||||
m_AnchoredPosition: {x: -8.899872, y: 30.29005}
|
||||
m_SizeDelta: {x: 99.91, y: 22}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4000680467974343741
|
||||
@@ -757,6 +1071,226 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &4907835288300161269
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6592276605955103311}
|
||||
- component: {fileID: 2717092400574726372}
|
||||
m_Layer: 5
|
||||
m_Name: hori
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6592276605955103311
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4907835288300161269}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2149752462514565465}
|
||||
- {fileID: 1557960609061955033}
|
||||
- {fileID: 7057225850442476593}
|
||||
m_Father: {fileID: 5796882771854016848}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 393.6, y: -11.76}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &2717092400574726372
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4907835288300161269}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 0
|
||||
m_Spacing: -24
|
||||
m_ChildForceExpandWidth: 1
|
||||
m_ChildForceExpandHeight: 1
|
||||
m_ChildControlWidth: 0
|
||||
m_ChildControlHeight: 0
|
||||
m_ChildScaleWidth: 0
|
||||
m_ChildScaleHeight: 0
|
||||
m_ReverseArrangement: 0
|
||||
--- !u!1 &5087111472769671888
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6458878320999319224}
|
||||
- component: {fileID: 5499559792392188294}
|
||||
- component: {fileID: 845881372332436585}
|
||||
m_Layer: 5
|
||||
m_Name: Text (Legacy)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6458878320999319224
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5087111472769671888}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7057225850442476593}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 65.8, y: 0.65}
|
||||
m_SizeDelta: {x: 160, y: 30}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5499559792392188294
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5087111472769671888}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &845881372332436585
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5087111472769671888}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: 8b8373b0af11dca46b89be60dbe469f8, type: 3}
|
||||
m_FontSize: 8
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 0
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 0
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: IN
|
||||
--- !u!1 &5428149837389638025
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7057225850442476593}
|
||||
- component: {fileID: 5018549670956333322}
|
||||
- component: {fileID: 8862666023782374080}
|
||||
m_Layer: 5
|
||||
m_Name: 2
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7057225850442476593
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5428149837389638025}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 6458878320999319224}
|
||||
m_Father: {fileID: 6592276605955103311}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 25, y: 25}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5018549670956333322
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5428149837389638025}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &8862666023782374080
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5428149837389638025}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &5538076544640874864
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1054,7 +1588,7 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: 775c674e81662c644b64550d2e8f74e0, type: 3}
|
||||
m_FontSize: 22
|
||||
m_FontSize: 17
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
@@ -1102,8 +1636,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 237.80005, y: -13.9}
|
||||
m_SizeDelta: {x: 200, y: 40}
|
||||
m_AnchoredPosition: {x: 237.80005, y: -15.1}
|
||||
m_SizeDelta: {x: 200, y: 59.4296}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1005138011238482332
|
||||
CanvasRenderer:
|
||||
@@ -1134,7 +1668,7 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: cc180dff846d13a4d88ddaed6f77e5cd, type: 3}
|
||||
m_Font: {fileID: 12800000, guid: 8b8373b0af11dca46b89be60dbe469f8, type: 3}
|
||||
m_FontSize: 40
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
|
||||
@@ -19,6 +19,10 @@ public class SongButton : MonoBehaviour
|
||||
public Text songIDText;
|
||||
public Image buttonImage;
|
||||
public Image scoreLevelImage;
|
||||
[Header("Difficulty Level Images")]
|
||||
public Image lvl_img_01;
|
||||
public Image lvl_img_02;
|
||||
public Image lvl_img_03;
|
||||
[Header("Inspector")]
|
||||
public Image profileImage;
|
||||
public int song_songSerialID;
|
||||
@@ -123,6 +127,9 @@ public class SongButton : MonoBehaviour
|
||||
|
||||
if (difficultyIDText != null) difficultyIDText.text = diffDisplay;
|
||||
|
||||
// Set rank images for the first three difficulties
|
||||
SetDifficultyRankImages(sd);
|
||||
|
||||
if (buttonImage != null) buttonImage.sprite = sd.backgroudPIC;
|
||||
|
||||
if (profileImage != null)
|
||||
@@ -153,6 +160,37 @@ public class SongButton : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private void SetDifficultyRankImages(SongData sd)
|
||||
{
|
||||
if (rankConfig == null) return;
|
||||
|
||||
Image[] rankImages = { lvl_img_01, lvl_img_02, lvl_img_03 };
|
||||
|
||||
for (int i = 0; i < rankImages.Length; i++)
|
||||
{
|
||||
if (rankImages[i] == null) continue;
|
||||
|
||||
if (sd.chartFiles != null && i < sd.chartFiles.Count)
|
||||
{
|
||||
var entry = sd.chartFiles[i];
|
||||
if (entry != null)
|
||||
{
|
||||
int score = entry.totalPersonalRecordForThisDifficulty;
|
||||
rankImages[i].sprite = rankConfig.GetRankSprite(score);
|
||||
rankImages[i].enabled = rankImages[i].sprite != null;
|
||||
}
|
||||
else
|
||||
{
|
||||
rankImages[i].enabled = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rankImages[i].enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnSongButtonClick()
|
||||
{
|
||||
Debug.Log("Song button clicked, song_songSerialID: " + song_songSerialID);
|
||||
|
||||
Reference in New Issue
Block a user