original ver 25/06/01

This commit is contained in:
2025-06-02 00:48:08 +08:00
committed by akangz
commit 89e03899f0
1065 changed files with 183622 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f1f9e8d592bda4a4fb76de9ad862c69d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,29 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 02ad5b531cc1df24dacd3a175979618d, type: 3}
m_Name: SongData01_testSong
m_EditorClassIdentifier:
usernameID: user_TestUser@FloatGaming
thisSong_songName: testSong
thisSong_artistName:
thisSong_illustrator:
thisSong_charter:
thisSong_belongsTo_whichDLC:
thisSong_difficultyID: 0
thisSong_personalRecord: 0
thisSong_personalLevel: 0
thisSong_illustration: {fileID: 0}
thisSong_audioFile: {fileID: 0}
thisSong_chartFile: {fileID: 0}
bpm: 0
songDuration: 0
coverImage: {fileID: 0}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f23a6bf697c295b46b8fe13c7eb2d1e7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
+39
View File
@@ -0,0 +1,39 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 02ad5b531cc1df24dacd3a175979618d, type: 3}
m_Name: NewSongData
m_EditorClassIdentifier:
usernameID: user_TestUser@FloatGaming
songName:
songID: 0
songLength_second: 0
artistName:
painter:
level_creator:
belongsTo_whichDLC:
bpm: 0
songDuration: 0
game_enterTimes: 0
time_totalPlayingTime: 0
illustration: {fileID: 0}
backgroudPIC: {fileID: 0}
fullscreen_songPicture: {fileID: 0}
audioFile: {fileID: 0}
audio_previewAudio: {fileID: 0}
chartFiles:
- difficulty: 0
chartFile: {fileID: 0}
personalRecord: 0
difficultyID: 0
current_levelProgress: 0
_if_level_is_EASE: 0
max_comboRecord: 0
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 83bccb49bcc7e124883df1a80fec815b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
+144
View File
@@ -0,0 +1,144 @@
using System;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class ChartFileEntry
{
public int difficulty; // 该谱面对应的难度
public TextAsset chartFile; // 谱面文件
}
[CreateAssetMenu(fileName = "NewSongData", menuName = "EaseOut/SongData")]
public class SongData : ScriptableObject
{
public string usernameID = "user_TestUser@FloatGaming";
public string songName;
public int songID;
public int songLength_second;
public string artistName;
public string painter;
public string level_creator;
public string belongsTo_whichDLC;
public int bpm;
public float songDuration;
public int game_enterTimes;
public int time_totalPlayingTime;
public DateTime uploadData;
public Sprite illustration;
public Sprite backgroudPIC;
public Sprite fullscreen_songPicture;
public AudioClip audioFile;
public AudioClip audio_previewAudio;
// 支持不同难度的数据
public Dictionary<int, int> difficultyNumberMap = new Dictionary<int, int>(); // 各个难度的难度数值
public Dictionary<int, int> personalRecordMap = new Dictionary<int, int>(); // 各个难度的最高分
public Dictionary<int, TextAsset> chartFileMap = new Dictionary<int, TextAsset>(); // 各个难度下的谱面文件
// 用于在 Inspector 选择谱面文件
public List<ChartFileEntry> chartFiles = new List<ChartFileEntry>();
// 个人最高记录(所有难度中的最高分)
public int personalRecord;
// 当前游玩的难度
public int difficultyID;
public float current_levelProgress;
public bool _if_level_is_EASE;
public int max_comboRecord;
// 构造函数:从 JSON 数据创建 SongData
public SongData(SongDataSerializable jsonData)
{
usernameID = jsonData.usernameID;
songName = jsonData.songName;
songID = jsonData.songID;
songLength_second = jsonData.songLength_second;
artistName = jsonData.artistName;
painter = jsonData.painter;
level_creator = jsonData.level_creator;
belongsTo_whichDLC = jsonData.belongsTo_whichDLC;
bpm = jsonData.bpm;
songDuration = jsonData.songDuration;
game_enterTimes = jsonData.game_enterTimes;
time_totalPlayingTime = jsonData.time_totalPlayingTime;
uploadData = DateTime.Parse(jsonData.uploadData);
difficultyID = jsonData.difficultyID;
current_levelProgress = jsonData.current_levelProgress;
_if_level_is_EASE = jsonData._if_level_is_EASE;
max_comboRecord = jsonData.max_comboRecord;
difficultyNumberMap = jsonData.difficultyNumberMap;
personalRecordMap = jsonData.personalRecordMap;
personalRecord = jsonData.personalRecord; // 赋值最高成绩
// 确保 JSON 里的谱面文件映射到可用的 List
foreach (var kvp in jsonData.chartFileMap)
{
chartFiles.Add(new ChartFileEntry { difficulty = kvp.Key, chartFile = Resources.Load<TextAsset>("Charts/" + kvp.Value) });
}
SyncChartFileMap();
}
// 获取所有难度中最高的成绩
public int CalculateHighestPersonalRecord()
{
int highest = 0;
foreach (var score in personalRecordMap.Values)
{
if (score > highest)
{
highest = score;
}
}
personalRecord = highest;
return highest;
}
// 更新指定难度的最高成绩
public void UpdatePersonalRecord(int difficulty, int newScore)
{
if (!personalRecordMap.ContainsKey(difficulty) || newScore > personalRecordMap[difficulty])
{
personalRecordMap[difficulty] = newScore;
}
CalculateHighestPersonalRecord();
}
// 获取特定难度的最高分
public int GetPersonalRecord(int difficulty)
{
return personalRecordMap.ContainsKey(difficulty) ? personalRecordMap[difficulty] : 0;
}
// 获取指定难度的谱面文件
public TextAsset GetChartFile(int difficulty)
{
foreach (var entry in chartFiles)
{
if (entry.difficulty == difficulty)
return entry.chartFile;
}
return null;
}
// 同步 Dictionary 和 List 确保数据一致
public void SyncChartFileMap()
{
chartFileMap.Clear();
foreach (var entry in chartFiles)
{
if (entry.chartFile != null)
{
chartFileMap[entry.difficulty] = entry.chartFile;
}
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 02ad5b531cc1df24dacd3a175979618d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 08998297ea3a5b646991a4924cef9953
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,828 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &441488742126471890
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2398537700304844637}
- component: {fileID: 1366203894775410018}
- component: {fileID: 5007961131855444592}
m_Layer: 5
m_Name: difID
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2398537700304844637
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 441488742126471890}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_ConstrainProportionsScale: 0
m_Children: []
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: 267.46, y: -20.89}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1366203894775410018
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 441488742126471890}
m_CullTransparentMesh: 1
--- !u!114 &5007961131855444592
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 441488742126471890}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, 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_text: difID
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 72
m_fontSizeBase: 72
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 1
m_HorizontalAlignment: 2
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &1198053886828452625
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5796882771854016848}
- component: {fileID: 7385865423531423157}
- component: {fileID: 4974503315116154840}
- component: {fileID: 3426324857204153236}
- component: {fileID: 7779480480503833965}
m_Layer: 5
m_Name: Button
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5796882771854016848
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1198053886828452625}
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: 3789207496639737857}
- {fileID: 1613555900959276112}
- {fileID: 660568125378752264}
- {fileID: 2398537700304844637}
- {fileID: 9167626739960448940}
m_Father: {fileID: 0}
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, y: 0}
m_SizeDelta: {x: 442, y: 135.1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7385865423531423157
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1198053886828452625}
m_CullTransparentMesh: 1
--- !u!114 &4974503315116154840
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1198053886828452625}
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: 21300000, guid: 571ef8413e2586c4586471bc35e5c21b, type: 3}
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!114 &3426324857204153236
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1198053886828452625}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 4974503315116154840}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 7779480480503833965}
m_TargetAssemblyTypeName: SongButton, Assembly-CSharp
m_MethodName: OnSongButtonClick
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &7779480480503833965
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1198053886828452625}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4f1bb9821fb0694d90ed48dac653559, type: 3}
m_Name:
m_EditorClassIdentifier:
songNameText: {fileID: 2314746461018929374}
highestScoreText: {fileID: 3228643349149077744}
difficultyIDText: {fileID: 5007961131855444592}
songIDText: {fileID: 954526167279754237}
buttonImage: {fileID: 4974503315116154840}
song_songSerialID: 0
--- !u!1 &2356119867999498898
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 660568125378752264}
- component: {fileID: 8887826047491577449}
- component: {fileID: 954526167279754237}
m_Layer: 5
m_Name: songID
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &660568125378752264
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2356119867999498898}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_ConstrainProportionsScale: 0
m_Children: []
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: 191, y: -89.4}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8887826047491577449
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2356119867999498898}
m_CullTransparentMesh: 1
--- !u!114 &954526167279754237
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2356119867999498898}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, 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_text: songID
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 36
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 1
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: -229.56958, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &3267487057632429568
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 9167626739960448940}
- component: {fileID: 5337038456231856502}
- component: {fileID: 5249600600882849598}
m_Layer: 5
m_Name: dif
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &9167626739960448940
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3267487057632429568}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_ConstrainProportionsScale: 0
m_Children: []
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: 267.46, y: 1.8}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5337038456231856502
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3267487057632429568}
m_CullTransparentMesh: 1
--- !u!114 &5249600600882849598
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3267487057632429568}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, 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_text: "\u96BE\u5EA6:"
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: c95ab61f13e39254e8e3cbf4059d88c5, type: 2}
m_sharedMaterial: {fileID: 4492750392876140565, guid: c95ab61f13e39254e8e3cbf4059d88c5, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 36
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 1
m_HorizontalAlignment: 2
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &8183110207890197194
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1613555900959276112}
- component: {fileID: 1005138011238482332}
- component: {fileID: 3228643349149077744}
m_Layer: 5
m_Name: pr
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1613555900959276112
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8183110207890197194}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_ConstrainProportionsScale: 0
m_Children: []
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: -9, y: -89.4}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1005138011238482332
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8183110207890197194}
m_CullTransparentMesh: 1
--- !u!114 &3228643349149077744
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8183110207890197194}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, 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_text: pr123456
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 36
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 1
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: -229.56958, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &8522042171786968858
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3789207496639737857}
- component: {fileID: 3811727381774744114}
- component: {fileID: 2314746461018929374}
m_Layer: 5
m_Name: songname
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3789207496639737857
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8522042171786968858}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_ConstrainProportionsScale: 0
m_Children: []
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: -209.1, y: -89.4}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3811727381774744114
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8522042171786968858}
m_CullTransparentMesh: 1
--- !u!114 &2314746461018929374
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8522042171786968858}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, 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_text: songname
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 36
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 1
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: -196.01709, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ce2cc510e6c307947a5dbf185318777e
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,49 @@
using UnityEngine;
using TMPro;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class SongButton : MonoBehaviour
{
public TextMeshProUGUI songNameText; // 歌曲名称文本
public TextMeshProUGUI highestScoreText; // 个人最高分文本
public TextMeshProUGUI difficultyIDText; // 难度ID文本
public TextMeshProUGUI songIDText;
public Image buttonImage; // 按钮的 Image 组件,用于设置背景图像
public int song_songSerialID; // 按钮对应的歌曲ID
// 设置按钮的数据
public void Start()
{
}
public void SetButtonData(string songName, int highestScore, int difficultyID, Sprite songSprite, int songID)
{
Debug.Log("SetButtonData 被调用, songID 参数: " + songID);
songNameText.text = songName;
highestScoreText.text = "PR: " + highestScore.ToString();
difficultyIDText.text = "" + difficultyID.ToString();
buttonImage.sprite = songSprite;
song_songSerialID = songID;
songIDText.text = "Song ID: " + song_songSerialID.ToString();
}
// 按钮点击事件:根据 song_songSerialID 查找对应的 SongData,并传递到下个场景
public void OnSongButtonClick()
{
Debug.Log("点击按钮的 song_songSerialID: " + song_songSerialID);
SongData selectedSong = SongDataLibrary.Instance.GetSongDataByID(song_songSerialID);
if (selectedSong != null)
{
SongDataHolder.SelectedSongData = selectedSong;
SceneManager.LoadScene("Songs_Select");
}
else
{
Debug.LogError("未找到对应的 SongData, songID: " + song_songSerialID);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f4f1bb9821fb0694d90ed48dac653559
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,20 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7c972c378bd4832459dead70062eeb5c, type: 3}
m_Name: SongList
m_EditorClassIdentifier:
songs:
- {fileID: 11400000, guid: 955a44007aeca3245a438a8af3e97e04, type: 2}
- {fileID: 11400000, guid: 23248216085203145b3c154e9da5a0dd, type: 2}
- {fileID: 11400000, guid: 0737633aca7fca844b2b4ae0572dcc87, type: 2}
- {fileID: 11400000, guid: e8e4a1801ca7b1f47b60f5d67f792d7b, type: 2}
- {fileID: 11400000, guid: 958379745549ed54ba4da95ba82b0049, type: 2}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5819ea7db5da6904e9b10a75c4baaabe
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "SongList", menuName = "Music/SongList")]
public class SongList : ScriptableObject
{
public List<SongData> songs = new List<SongData>(); // 存储所有歌曲的数据
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7c972c378bd4832459dead70062eeb5c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,91 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class SongSelectUI : MonoBehaviour
{
public SongList songList; // 存储歌曲列表的 ScriptableObject
public GameObject songButtonPrefab; // 歌曲按钮的 Prefab (Button)
public Transform contentPanel; // 滚动视图的 Content 面板
void Start()
{
if (songList == null || songButtonPrefab == null || contentPanel == null)
{
Debug.LogError("请在 Inspector 中分配所有字段!");
return;
}
DisplaySongs();
}
// 显示所有歌曲
void DisplaySongs()
{
// 清空现有按钮
foreach (Transform child in contentPanel)
{
Destroy(child.gameObject);
}
// 为每首歌曲创建一个按钮
foreach (SongData song in songList.songs)
{
GameObject songButtonObj = Instantiate(songButtonPrefab, contentPanel);
songButtonObj.transform.SetParent(contentPanel, false); // 确保 UI 结构正确
// 获取 SongButton 组件
SongButton songButton = songButtonObj.GetComponent<SongButton>();
if (songButton != null)
{
// 调用 SetButtonData 赋值
songButton.SetButtonData(song.songName, song.personalRecord, song.difficultyID, song.illustration, song.songID);
Debug.Log(" SetButtonData 被调用,songID: " + song.songID);
}
else
{
Debug.LogError(" SongButton 组件未找到!");
}
// **获取组件**
Image songImage = songButtonObj.GetComponentInChildren<Image>(); // 获取图片组件
TMP_Text[] texts = songButtonObj.GetComponentsInChildren<TMP_Text>();
if (songImage != null && song.illustration != null)
{
songImage.sprite = song.illustration; // 设置歌曲图片
songImage.enabled = true;
Debug.Log(" 设置图片:" + song.songName);
}
else
{
Debug.LogWarning(" Illustration 为空:" + song.songName);
}
if (texts.Length >= 4)
{
texts[0].text = song.songName;
texts[1].text = "Record : " + song.personalRecord;
texts[3].text = "" + song.difficultyID;
texts[2].text = "SongID : " + song.songID.ToString();
Debug.Log(" 设置文本:" + song.songName);
}
else
{
Debug.LogWarning("TextMeshPro 组件未找到");
}
// **添加按钮事件**
Button button = songButtonObj.GetComponent<Button>();
button.onClick.AddListener(() => songButton.OnSongButtonClick());
}
}
// 处理点击事件
void OnSongButtonClicked(SongData song)
{
Debug.Log("🎵 选择歌曲:" + song.songName);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 476464d443256964eb8b3eeac58bfc2f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,38 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 02ad5b531cc1df24dacd3a175979618d, type: 3}
m_Name: test_Song 1
m_EditorClassIdentifier:
usernameID: user_TestUser@FloatGaming
songName: test_Song1
songID: 1002003
songLength_second: 123
artistName: 112
painter: 323
level_creator: 4
belongsTo_whichDLC: 2
difficultyID: 122
difficultyNumber: 12
recent_lastScore: 123121
personalRecord: 123123
personalLevel: 0
current_levelProgress: 0
game_enterTimes: 0
_if_level_is_EASE: 0
max_comboRecord: 0
time_totalPlayingTime: 0
illustration: {fileID: 0}
backgroudPIC: {fileID: 0}
audioFile: {fileID: 0}
chartFile: {fileID: 0}
bpm: 0
songDuration: 0
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8c6d84ba0864dc848888f59d6e9a6032
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,38 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 02ad5b531cc1df24dacd3a175979618d, type: 3}
m_Name: test_Song 2
m_EditorClassIdentifier:
usernameID: user_TestUser@FloatGaming
songName: test_Song2
songID: 1002004
songLength_second: 123
artistName: 112
painter: 323
level_creator: 4
belongsTo_whichDLC: 2
difficultyID: 122
difficultyNumber: 12
recent_lastScore: 123121
personalRecord: 123123
personalLevel: 0
current_levelProgress: 0
game_enterTimes: 0
_if_level_is_EASE: 0
max_comboRecord: 0
time_totalPlayingTime: 0
illustration: {fileID: 0}
backgroudPIC: {fileID: 0}
audioFile: {fileID: 0}
chartFile: {fileID: 0}
bpm: 0
songDuration: 0
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7f15eec0857065f428f7b36148b6f4ed
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,38 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 02ad5b531cc1df24dacd3a175979618d, type: 3}
m_Name: test_Song
m_EditorClassIdentifier:
usernameID: user_TestUser@FloatGaming
songName: test_Song
songID: 1002002
songLength_second: 123
artistName: 112
painter: 323
level_creator: 4
belongsTo_whichDLC: 2
difficultyID: 122
difficultyNumber: 12
recent_lastScore: 123121
personalRecord: 123123
personalLevel: 0
current_levelProgress: 0
game_enterTimes: 0
_if_level_is_EASE: 0
max_comboRecord: 0
time_totalPlayingTime: 0
illustration: {fileID: 0}
backgroudPIC: {fileID: 0}
audioFile: {fileID: 0}
chartFile: {fileID: 0}
bpm: 0
songDuration: 0
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f78d9b3f6969c6a49aa7d7230319f01c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

@@ -0,0 +1,114 @@
fileFormatVersion: 2
guid: 571ef8413e2586c4586471bc35e5c21b
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
+72
View File
@@ -0,0 +1,72 @@
using UnityEngine;
using System.Collections.Generic;
public class SongDataLibrary : MonoBehaviour
{
public static SongDataLibrary Instance;
private Dictionary<int, SongData> songDataDictionary = new Dictionary<int, SongData>();
// 指定存放在 "song_songIndex" 目录下的各个子文件夹名称
// 例如:如果你有 Assets/Resources/song_songIndex/FolderA 和 FolderB,则在 Inspector 中填写 { "FolderA", "FolderB" }
public string[] subfolderNames;
private void Awake()
{
if (Instance == null)
{
Instance = this;
DontDestroyOnLoad(gameObject);
LoadSongData();
}
else
{
Destroy(gameObject);
}
}
private void LoadSongData()
{
// 先加载直接放在 "song_songIndex" 目录下的 SongData
SongData[] assets = Resources.LoadAll<SongData>("song_songIndex");
foreach (SongData data in assets)
{
if (!songDataDictionary.ContainsKey(data.songID))
{
songDataDictionary.Add(data.songID, data);
Debug.Log("加载到 SongData, songID: " + data.songID + ", 名称: " + data.songName);
}
else
{
Debug.LogWarning("重复的 songID: " + data.songID);
}
}
// 再遍历每个子文件夹,加载其中的 SongData
foreach (string subfolder in subfolderNames)
{
SongData[] subAssets = Resources.LoadAll<SongData>("song_songIndex/" + subfolder);
foreach (SongData data in subAssets)
{
if (!songDataDictionary.ContainsKey(data.songID))
{
songDataDictionary.Add(data.songID, data);
Debug.Log("从 " + subfolder + " 加载到 SongData, songID: " + data.songID + ", 名称: " + data.songName);
}
else
{
Debug.LogWarning("重复的 songID: " + data.songID);
}
}
}
}
public SongData GetSongDataByID(int songID)
{
if (songDataDictionary.ContainsKey(songID))
{
return songDataDictionary[songID];
}
Debug.LogError("未找到 songID: " + songID);
return null;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f2ff5945b20d1d644a62f93302e8ce59
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+35
View File
@@ -0,0 +1,35 @@
using System.Collections.Generic;
using System.IO;
using UnityEngine;
public class SongDataLoader : MonoBehaviour
{
private string jsonDirectory;
public List<SongDataSerializable> loadedSongs = new List<SongDataSerializable>();
void Start()
{
jsonDirectory = Path.Combine(Application.persistentDataPath, "SongDataJson");
LoadAllSongsFromJson();
}
void LoadAllSongsFromJson()
{
if (!Directory.Exists(jsonDirectory))
{
Debug.LogError("JSON Îļþ¼Ð²»´æÔÚ£¡");
return;
}
loadedSongs.Clear();
string[] jsonFiles = Directory.GetFiles(jsonDirectory, "*.json");
foreach (string file in jsonFiles)
{
string json = File.ReadAllText(file);
SongDataSerializable jsonData = JsonUtility.FromJson<SongDataSerializable>(json);
loadedSongs.Add(jsonData);
Debug.Log($"Loaded song: {jsonData.songName}");
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5645bf5dba95b214fbbedea8b9b22efd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+58
View File
@@ -0,0 +1,58 @@
using System.IO;
using UnityEngine;
public class SongDataManager : MonoBehaviour
{
// 保存 JSON 文件的目录路径
private string jsonDirectory;
void Start()
{
// 获取持久化数据路径,并在其下创建 "SongDataJson" 文件夹
jsonDirectory = Path.Combine(Application.persistentDataPath, "SongDataJson");
// 如果目录不存在,则创建目录
if (!Directory.Exists(jsonDirectory))
{
Directory.CreateDirectory(jsonDirectory);
Debug.Log("创建 JSON 存储目录: " + jsonDirectory);
}
else
{
Debug.Log("JSON 存储目录已存在: " + jsonDirectory);
}
// 调用方法,将所有 SongData 资源转换为 JSON 并保存
SaveAllSongDataToJson();
}
void SaveAllSongDataToJson()
{
// 从 Resources 文件夹下的 "SongData" 子目录加载所有 SongData 资源
SongData[] allSongData = Resources.LoadAll<SongData>("song_songIndex");
// 如果没有加载到任何 SongData,输出警告信息
if (allSongData.Length == 0)
{
Debug.LogWarning("未在 Resources/SongData 中找到任何 SongData 资源!");
}
// 遍历每个 SongData 资源
foreach (SongData song in allSongData)
{
// 使用 SongDataSerializable 将 SongData 转换为可序列化对象
SongDataSerializable jsonData = new SongDataSerializable(song);
// 将对象转换为 JSON 格式字符串,true 表示格式化输出(便于阅读)
string json = JsonUtility.ToJson(jsonData, true);
// 构造 JSON 文件的完整路径,文件名使用 songID 命名,例如 "123.json"
string filePath = Path.Combine(jsonDirectory, song.songID + ".json");
// 将 JSON 内容写入文件
File.WriteAllText(filePath, json);
// 输出调试信息,显示已保存的 JSON 文件路径
Debug.Log("已保存 JSON 文件: " + filePath);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 57e22173c8367b743b734ed83762dfb0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class SongDataSerializable
{
public string usernameID;
public string songName;
public int songID;
public int songLength_second;
public string artistName;
public string painter;
public string level_creator;
public string belongsTo_whichDLC;
public int bpm;
public float songDuration;
public int game_enterTimes;
public int time_totalPlayingTime;
public string uploadData;
public int difficultyID;
public float current_levelProgress;
public bool _if_level_is_EASE;
public int max_comboRecord;
public int personalRecord; // 存储全局最高分
public Dictionary<int, int> difficultyNumberMap = new Dictionary<int, int>();
public Dictionary<int, int> personalRecordMap = new Dictionary<int, int>();
public Dictionary<int, string> chartFileMap = new Dictionary<int, string>();
public SongDataSerializable(SongData songData)
{
usernameID = songData.usernameID;
songName = songData.songName;
songID = songData.songID;
songLength_second = songData.songLength_second;
artistName = songData.artistName;
painter = songData.painter;
level_creator = songData.level_creator;
belongsTo_whichDLC = songData.belongsTo_whichDLC;
bpm = songData.bpm;
songDuration = songData.songDuration;
game_enterTimes = songData.game_enterTimes;
time_totalPlayingTime = songData.time_totalPlayingTime;
uploadData = songData.uploadData.ToString();
difficultyID = songData.difficultyID;
current_levelProgress = songData.current_levelProgress;
_if_level_is_EASE = songData._if_level_is_EASE;
max_comboRecord = songData.max_comboRecord;
difficultyNumberMap = songData.difficultyNumberMap;
personalRecordMap = songData.personalRecordMap;
personalRecord = songData.personalRecord; // 存储全局最高分
chartFileMap = new Dictionary<int, string>();
/*foreach (var kvp in songData.chartFileMap)
{
if (songData.chartFileMap == null) return;
chartFileMap[kvp.Key] = kvp.Value ? kvp.Value.name : "";
}*/
}
public void ApplyTo(SongData songData)
{
songData.usernameID = usernameID;
songData.songName = songName;
songData.songID = songID;
songData.songLength_second = songLength_second;
songData.artistName = artistName;
songData.painter = painter;
songData.level_creator = level_creator;
songData.belongsTo_whichDLC = belongsTo_whichDLC;
songData.bpm = bpm;
songData.songDuration = songDuration;
songData.game_enterTimes = game_enterTimes;
songData.time_totalPlayingTime = time_totalPlayingTime;
songData.uploadData = DateTime.Parse(uploadData);
songData.difficultyID = difficultyID;
songData.current_levelProgress = current_levelProgress;
songData._if_level_is_EASE = _if_level_is_EASE;
songData.max_comboRecord = max_comboRecord;
songData.difficultyNumberMap = difficultyNumberMap;
songData.personalRecordMap = personalRecordMap;
songData.personalRecord = personalRecord; // 赋值全局最高分
foreach (var kvp in chartFileMap)
{
songData.chartFileMap[kvp.Key] = Resources.Load<TextAsset>("Charts/" + kvp.Value);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ebe51efda6781244fb86a59a9a8a653d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+58
View File
@@ -0,0 +1,58 @@
using UnityEngine;
using TMPro;
using UnityEngine.UI;
public class SongDetailsUI : MonoBehaviour
{
public Image song_bgImage;
public TextMeshProUGUI songNameText;
public TextMeshProUGUI artistNameText;
public TextMeshProUGUI painterNameText;
public TextMeshProUGUI difficultyText;
public TextMeshProUGUI charterNameText;
public TextMeshProUGUI dlcNameText;
public TextMeshProUGUI songSerialNumberText;
public TextMeshProUGUI personalRecordText;
//public Image songImage;
public int id_of_thisSong;
void Start()
{
if (SongDataHolder.SelectedSongData != null)
{
// 读取选中的 SongData
SongData song = SongDataHolder.SelectedSongData;
song_bgImage.sprite = song.backgroudPIC;
// 更新 UI 显示
songNameText.text = song.songName;
artistNameText.text = song.artistName;
difficultyText.text = song.difficultyID.ToString();
painterNameText.text = song.painter;
charterNameText.text = song.level_creator;
dlcNameText.text = song.belongsTo_whichDLC;
songSerialNumberText.text = song.songID.ToString();
personalRecordText.text = song.personalRecord.ToString();
id_of_thisSong = song.songID;
if (song.illustration != null)
{
//songImage.sprite = song.illustration;
//songImage.enabled = true;
}
else
{
Debug.LogWarning("歌曲封面为空:" + song.songName);
}
Debug.Log("加载歌曲数据: " + song.songName);
}
else
{
Debug.LogError("SongDataHolder.SelectedSongData 为空!");
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a1a8aa0bed76a214eaf172151ea30f16
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1acb4e3eeceef60408e2b57b70ed6784
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

+114
View File
@@ -0,0 +1,114 @@
fileFormatVersion: 2
guid: de1adecd2148d7d48975b78f73f899ff
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant: