UI update 02

This commit is contained in:
FloatGaming
2026-06-30 21:21:30 +08:00
parent b2a1e307a4
commit f62f643cfc
1666 changed files with 211081 additions and 22799 deletions
@@ -31,12 +31,12 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6981887915199824553}
m_Father: {fileID: 5796882771854016848}
m_Father: {fileID: 8584723102662613781}
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: 16.7}
m_SizeDelta: {x: 200, y: 60.21}
m_AnchoredPosition: {x: 0.00015258789, y: 7.4}
m_SizeDelta: {x: 200, y: 75}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1366203894775410018
CanvasRenderer:
@@ -68,11 +68,11 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 8b8373b0af11dca46b89be60dbe469f8, type: 3}
m_FontSize: 40
m_FontSize: 50
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 4
m_MaxSize: 40
m_MaxSize: 50
m_Alignment: 3
m_AlignByGeometry: 0
m_RichText: 1
@@ -114,7 +114,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: -40.95352, y: 9.125019}
m_AnchoredPosition: {x: -92.2, y: 12.125}
m_SizeDelta: {x: 886, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8731776000903649617
@@ -147,7 +147,7 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 775c674e81662c644b64550d2e8f74e0, type: 3}
m_FontSize: 24
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
@@ -193,8 +193,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: -20, y: -28.1}
m_SizeDelta: {x: 160, y: 22}
m_AnchoredPosition: {x: -12.4, y: -34.3}
m_SizeDelta: {x: 200, y: 22}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5067636407003327723
CanvasRenderer:
@@ -237,7 +237,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "(\u6700\u9AD8\u5206\u6570\u96BE\u5EA6)"
m_Text: "(\u6240\u6709\u96BE\u5EA6\u4E2D\u6700\u9AD8\u5206)"
--- !u!1 &1198053886828452625
GameObject:
m_ObjectHideFlags: 0
@@ -275,9 +275,9 @@ RectTransform:
- {fileID: 1949858510484006560}
- {fileID: 6090665178754707047}
- {fileID: 2872838958536462890}
- {fileID: 2398537700304844637}
- {fileID: 1613555900959276112}
- {fileID: 8584723102662613781}
- {fileID: 660568125378752264}
- {fileID: 5294430880534511137}
- {fileID: 5907833122203511268}
- {fileID: 8205711265108694850}
- {fileID: 7990419107466363714}
@@ -287,7 +287,7 @@ RectTransform:
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: 752, y: 102}
m_SizeDelta: {x: 880, y: 134}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7385865423531423157
CanvasRenderer:
@@ -304,7 +304,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1198053886828452625}
m_Enabled: 0
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
@@ -317,7 +317,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: a4648288229ac424592b308acc603004, type: 3}
m_Sprite: {fileID: 21300000, guid: 315b4779a77139d4cb401fc417e07f13, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -501,7 +501,7 @@ RectTransform:
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_SizeDelta: {x: 50, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6923511498419407553
CanvasRenderer:
@@ -525,13 +525,13 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Sprite: {fileID: 21300000, guid: 30faa7080ac84a34da3f164587c650f1, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -575,7 +575,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: 65.8, y: 0.65}
m_AnchoredPosition: {x: 52.47, y: 6.7}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5772009328743146275
@@ -600,7 +600,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
@@ -608,7 +608,7 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 8b8373b0af11dca46b89be60dbe469f8, type: 3}
m_FontSize: 8
m_FontSize: 12
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
@@ -654,7 +654,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: -37.99}
m_AnchoredPosition: {x: 333.3, y: -57.7}
m_SizeDelta: {x: 412, y: 21.276}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8887826047491577449
@@ -733,7 +733,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: 65.8, y: 0.65}
m_AnchoredPosition: {x: 52.47, y: 6.7}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1336396162244346592
@@ -758,7 +758,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
@@ -766,7 +766,7 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 8b8373b0af11dca46b89be60dbe469f8, type: 3}
m_FontSize: 8
m_FontSize: 12
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
@@ -813,8 +813,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: 304.73, y: 3.2}
m_SizeDelta: {x: 100, y: 100}
m_AnchoredPosition: {x: 312.3, y: 0}
m_SizeDelta: {x: 200, y: 200}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3397289974922444082
CanvasRenderer:
@@ -838,14 +838,89 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 30faa7080ac84a34da3f164587c650f1, 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!1 &2540266224463487885
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5294430880534511137}
- component: {fileID: 1715426671254224839}
- component: {fileID: 534855682285959570}
m_Layer: 5
m_Name: btm
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &5294430880534511137
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2540266224463487885}
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: 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: -370.1, y: 0}
m_SizeDelta: {x: 105, y: 105}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1715426671254224839
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2540266224463487885}
m_CullTransparentMesh: 1
--- !u!114 &534855682285959570
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2540266224463487885}
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_Sprite: {fileID: 21300000, guid: 0d5b8d6154be0cb45b54e09bc61608a6, type: 3}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
@@ -890,7 +965,7 @@ RectTransform:
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_SizeDelta: {x: 50, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3117658159281603999
CanvasRenderer:
@@ -914,13 +989,13 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Sprite: {fileID: 21300000, guid: 30faa7080ac84a34da3f164587c650f1, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -964,8 +1039,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: -8.899872, y: 30.29005}
m_SizeDelta: {x: 99.91, y: 22}
m_AnchoredPosition: {x: 0, y: -44.5}
m_SizeDelta: {x: 116.5648, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4000680467974343741
CanvasRenderer:
@@ -996,8 +1071,8 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 775c674e81662c644b64550d2e8f74e0, type: 3}
m_FontSize: 22
m_Font: {fileID: 12800000, guid: d254d20d93651ae448ff13d10dff30ab, type: 3}
m_FontSize: 28
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
@@ -1043,8 +1118,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: -316.8, y: 2.25}
m_SizeDelta: {x: 77, y: 77}
m_AnchoredPosition: {x: -369.8, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6887914170870300267
CanvasRenderer:
@@ -1095,7 +1170,7 @@ GameObject:
- component: {fileID: 6592276605955103311}
- component: {fileID: 2717092400574726372}
m_Layer: 5
m_Name: hori
m_Name: veriti
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -1120,7 +1195,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: 393.6, y: -11.76}
m_AnchoredPosition: {x: 441.75, y: 5.1}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2717092400574726372
@@ -1141,7 +1216,7 @@ MonoBehaviour:
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_Spacing: -24
m_Spacing: -16.8
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 0
@@ -1183,7 +1258,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: 65.8, y: 0.65}
m_AnchoredPosition: {x: 52.47, y: 6.7}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5499559792392188294
@@ -1208,7 +1283,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
@@ -1216,7 +1291,7 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 8b8373b0af11dca46b89be60dbe469f8, type: 3}
m_FontSize: 8
m_FontSize: 12
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
@@ -1264,7 +1339,7 @@ RectTransform:
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_SizeDelta: {x: 50, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5018549670956333322
CanvasRenderer:
@@ -1288,13 +1363,13 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Sprite: {fileID: 21300000, guid: 30faa7080ac84a34da3f164587c650f1, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -1321,7 +1396,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1029705398409341139
RectTransform:
m_ObjectHideFlags: 0
@@ -1413,7 +1488,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: -40.95352, y: -6.8000126}
m_AnchoredPosition: {x: -92.2, y: -8.2}
m_SizeDelta: {x: 886, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5392575569123150279
@@ -1446,7 +1521,7 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 775c674e81662c644b64550d2e8f74e0, type: 3}
m_FontSize: 24
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
@@ -1493,8 +1568,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: 0, y: 1.5}
m_SizeDelta: {x: 752, y: 99}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 900, y: 154}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2072929526885726111
CanvasRenderer:
@@ -1524,7 +1599,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 7f3b1220317607e44bbb8f0e1998044a, type: 3}
m_Sprite: {fileID: 21300000, guid: 0725eded3a7bb264c9a5265e4a4fbe0f, type: 3}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 0
@@ -1533,7 +1608,7 @@ MonoBehaviour:
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 3
m_PixelsPerUnitMultiplier: 1
--- !u!1 &7738832080213160323
GameObject:
m_ObjectHideFlags: 0
@@ -1568,7 +1643,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: -40.95352, y: -25.125}
m_AnchoredPosition: {x: -92.19998, y: -39.51001}
m_SizeDelta: {x: 886, y: 44.5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1229009398401791618
@@ -1601,7 +1676,7 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 775c674e81662c644b64550d2e8f74e0, type: 3}
m_FontSize: 17
m_FontSize: 22
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
@@ -1645,13 +1720,13 @@ RectTransform:
m_Children:
- {fileID: 2006200464526798236}
- {fileID: 4553002270050802252}
m_Father: {fileID: 5796882771854016848}
m_Father: {fileID: 8584723102662613781}
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: -15.1}
m_SizeDelta: {x: 200, y: 59.4296}
m_Pivot: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -49.99991, y: -40.30004}
m_SizeDelta: {x: 224, y: 75}
m_Pivot: {x: 0, y: 0.5}
--- !u!222 &1005138011238482332
CanvasRenderer:
m_ObjectHideFlags: 0
@@ -1682,18 +1757,55 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 8b8373b0af11dca46b89be60dbe469f8, type: 3}
m_FontSize: 40
m_FontSize: 50
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 40
m_MaxSize: 60
m_Alignment: 3
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 350234
m_Text: 9999999
--- !u!1 &8367289350123973940
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8584723102662613781}
m_Layer: 5
m_Name: 2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8584723102662613781
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8367289350123973940}
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: 2398537700304844637}
- {fileID: 1613555900959276112}
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: 177.6, y: 13.76}
m_SizeDelta: {x: 100, y: 59.109898}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &8522042171786968858
GameObject:
m_ObjectHideFlags: 0
@@ -1705,6 +1817,7 @@ GameObject:
- component: {fileID: 3789207496639737857}
- component: {fileID: 3811727381774744114}
- component: {fileID: 4498636167143427938}
- component: {fileID: 5503388138454670332}
m_Layer: 5
m_Name: songname
m_TagString: Untagged
@@ -1728,9 +1841,9 @@ 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: -40.95352, y: 28.625}
m_SizeDelta: {x: 886, y: 48.5}
m_Pivot: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -312.74, y: 38.19995}
m_SizeDelta: {x: 0, y: 50}
m_Pivot: {x: 0, y: 0.5}
--- !u!222 &3811727381774744114
CanvasRenderer:
m_ObjectHideFlags: 0
@@ -1761,18 +1874,32 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: cc180dff846d13a4d88ddaed6f77e5cd, type: 3}
m_FontSize: 40
m_FontSize: 50
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 4
m_MaxSize: 40
m_MaxSize: 50
m_Alignment: 3
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: songName (Radio Edit)(Explicit)(Extended)
m_Text: songName (Radio Edit)(Explicit)
--- !u!114 &5503388138454670332
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: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 2
m_VerticalFit: 0
--- !u!1 &8959791018782282856
GameObject:
m_ObjectHideFlags: 0
@@ -1807,8 +1934,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: -20, y: 32.521484}
m_SizeDelta: {x: 160, y: 22}
m_AnchoredPosition: {x: -20, y: 36.4}
m_SizeDelta: {x: 160, y: 26}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8579632185648976666
CanvasRenderer:
@@ -1840,7 +1967,7 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 775c674e81662c644b64550d2e8f74e0, type: 3}
m_FontSize: 22
m_FontSize: 26
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
@@ -1923,8 +2050,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: -20, y: 30.497412}
m_SizeDelta: {x: 160, y: 22}
m_AnchoredPosition: {x: -31.1, y: 33.2}
m_SizeDelta: {x: 160, y: 26}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3306092845847053902
CanvasRenderer:
@@ -1956,7 +2083,7 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 775c674e81662c644b64550d2e8f74e0, type: 3}
m_FontSize: 22
m_FontSize: 26
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
@@ -7,6 +7,10 @@ using DG.Tweening;
public class SongButton : MonoBehaviour
{
private static readonly bool VerboseLogs = false;
private const string SongSelectedIndexPrefsPrefix = "song_selected_";
private const string SongSelectedIdPrefsPrefix = "song_selected_id_";
private const string SongSelectedDifficultyPrefsPrefix = "song_selected_difficulty_";
[Header("thisSong_so")]
public ScriptableObject thisSong_so;
[Header("Inspector")]
@@ -58,6 +62,23 @@ public class SongButton : MonoBehaviour
return song_songSerialID;
}
public static string BuildSongSelectedIndexPrefsKey(string dlcKey)
{
string safeDlcKey = string.IsNullOrEmpty(dlcKey) ? "default_0" : dlcKey;
return SongSelectedIndexPrefsPrefix + safeDlcKey;
}
public static string BuildSongSelectedIdPrefsKey(string dlcKey)
{
string safeDlcKey = string.IsNullOrEmpty(dlcKey) ? "default_0" : dlcKey;
return SongSelectedIdPrefsPrefix + safeDlcKey;
}
public static string BuildSongSelectedDifficultyPrefsKey(int songId)
{
return SongSelectedDifficultyPrefsPrefix + Mathf.Max(0, songId);
}
public void Start()
{
if (selected_boarder != null)
@@ -111,7 +132,7 @@ public class SongButton : MonoBehaviour
sd = SongDataLibrary.Instance.GetSongDataByID(songID) ?? sd;
if (sd != null)
{
Sprite resolvedBackground = sd.GetResolvedBackgroundPic();
Sprite resolvedIllustration = sd.GetResolvedIllustration();
Sprite resolvedProfile = sd.GetResolvedCardProfileImage();
if (songNameText != null) songNameText.text = sd.songName;
@@ -176,7 +197,7 @@ public class SongButton : MonoBehaviour
// Set rank images for the first three difficulties
SetDifficultyRankImages(sd);
if (buttonImage != null) buttonImage.sprite = resolvedBackground;
if (buttonImage != null) buttonImage.sprite = resolvedIllustration != null ? resolvedIllustration : songSprite;
if (profileImage != null)
{
@@ -252,10 +273,7 @@ public class SongButton : MonoBehaviour
{
selectedSong.EnsurePersistentDataLoaded();
selectedSong.GetAbsoluteHighestScore(out int bestTotal, out int bestDiff, out string bestDiffName);
if (bestDiff >= 0)
{
selectedSong.thisLevel_selectedDifficultyID = bestDiff;
}
selectedSong.thisLevel_selectedDifficultyID = ResolvePreferredDifficulty(selectedSong, bestDiff);
if (currentSelected != null && currentSelected != this)
{
currentSelected.FadeOutSelectedBorder();
@@ -273,9 +291,11 @@ public class SongButton : MonoBehaviour
// Save per-DLC selected song index to PlayerPrefs
string dlcKey = SongSelectUI.CurrentDlcKey;
if (string.IsNullOrEmpty(dlcKey)) dlcKey = "default_0";
string prefsKey = "song_selected_" + dlcKey;
string prefsKey = BuildSongSelectedIndexPrefsKey(dlcKey);
int index = GetIndexAmongSongButtons();
PlayerPrefs.SetInt(prefsKey, index);
PlayerPrefs.SetInt(BuildSongSelectedIdPrefsKey(dlcKey), selectedSong.songID);
PlayerPrefs.SetInt(BuildSongSelectedDifficultyPrefsKey(selectedSong.songID), selectedSong.thisLevel_selectedDifficultyID);
PlayerPrefs.Save();
if (VerboseLogs) Debug.Log($"SongButton: saved selected song index {index} for key {prefsKey}");
}
@@ -285,6 +305,82 @@ public class SongButton : MonoBehaviour
}
}
private int ResolvePreferredDifficulty(SongData selectedSong, int bestDiff)
{
if (selectedSong == null)
{
return 0;
}
int songId = selectedSong.songID;
string difficultyKey = BuildSongSelectedDifficultyPrefsKey(songId);
if (PlayerPrefs.HasKey(difficultyKey))
{
int savedDifficulty = PlayerPrefs.GetInt(difficultyKey, selectedSong.thisLevel_selectedDifficultyID);
if (IsDifficultyAvailable(selectedSong, savedDifficulty))
{
return savedDifficulty;
}
}
if (IsDifficultyAvailable(selectedSong, selectedSong.thisLevel_selectedDifficultyID))
{
return selectedSong.thisLevel_selectedDifficultyID;
}
if (bestDiff >= 0 && IsDifficultyAvailable(selectedSong, bestDiff))
{
return bestDiff;
}
return GetFirstAvailableDifficulty(selectedSong);
}
private bool IsDifficultyAvailable(SongData song, int difficulty)
{
if (song == null || difficulty < 0)
{
return false;
}
return song.GetResolvedChartFile(difficulty) != null;
}
private int GetFirstAvailableDifficulty(SongData song)
{
if (song == null)
{
return 0;
}
if (song.chartFiles != null)
{
for (int i = 0; i < song.chartFiles.Count; i++)
{
ChartFileEntry entry = song.chartFiles[i];
if (entry == null)
{
continue;
}
if (song.GetResolvedChartFile(entry.difficulty) != null)
{
return Mathf.Max(0, entry.difficulty);
}
}
}
for (int difficulty = 0; difficulty <= 3; difficulty++)
{
if (song.GetResolvedChartFile(difficulty) != null)
{
return difficulty;
}
}
return 0;
}
private int GetIndexAmongSongButtons()
{
// Use parent traversal to find only SongButton siblings, to avoid mismatch when other UI children exist.
@@ -32,6 +32,7 @@ public class SongSelectUI : MonoBehaviour
// Current DLC key used for per-DLC saved song selection
public static string CurrentDlcKey = "dlc_default_0";
public static bool ForceFirstSongOnNextRestore;
// Track pending restore to avoid multiple overlapping restores
private Coroutine restoreCoroutine;
@@ -115,8 +116,17 @@ public class SongSelectUI : MonoBehaviour
private IEnumerator LoadSceneAsync(string sceneName)
{
if (Bansonic.gTransition.LoadScene(sceneName, LoadSceneMode.Single))
{
while (Bansonic.gTransition.IsBusy)
{
yield return null;
}
yield break;
}
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Single);
while (!asyncLoad.isDone)
while (asyncLoad != null && !asyncLoad.isDone)
{
yield return null;
}
@@ -307,7 +317,8 @@ public class SongSelectUI : MonoBehaviour
{
// read saved index using CurrentDlcKey
string dlcKey = (string.IsNullOrEmpty(CurrentDlcKey) ? "default_0" : CurrentDlcKey);
string key = "song_selected_" + dlcKey;
string key = SongButton.BuildSongSelectedIndexPrefsKey(dlcKey);
string songIdKey = SongButton.BuildSongSelectedIdPrefsKey(dlcKey);
// collect song buttons under contentPanel
var allSongButtons = contentPanel.GetComponentsInChildren<SongButton>(true);
@@ -317,6 +328,19 @@ public class SongSelectUI : MonoBehaviour
return;
}
if (ForceFirstSongOnNextRestore)
{
SongDataHolder.SelectedSongData = null;
SongButton firstButton = allSongButtons[0];
ForceFirstSongOnNextRestore = false;
if (firstButton != null)
{
firstButton.OnSongButtonClick();
if (VerboseLogs) Debug.Log("SongSelectUI: forced fallback to the first song because no last-entered record was found.");
}
return;
}
// Ensure every DLC has a default persisted value (0)
int savedIndex;
if (!PlayerPrefs.HasKey(key))
@@ -333,20 +357,49 @@ public class SongSelectUI : MonoBehaviour
if (savedIndex < 0) savedIndex = 0;
if (savedIndex >= allSongButtons.Length) savedIndex = 0;
var btn = allSongButtons[savedIndex];
SongButton btn = null;
if (PlayerPrefs.HasKey(songIdKey))
{
int savedSongId = PlayerPrefs.GetInt(songIdKey, 0);
if (savedSongId > 0)
{
for (int i = 0; i < allSongButtons.Length; i++)
{
SongButton candidate = allSongButtons[i];
if (candidate == null)
{
continue;
}
if (candidate.GetSongSerialId() == savedSongId)
{
btn = candidate;
savedIndex = i;
break;
}
}
}
}
if (btn == null)
{
btn = allSongButtons[savedIndex];
}
if (btn == null)
{
// hard fallback to first
btn = allSongButtons[0];
savedIndex = 0;
}
if (btn != null)
{
// simulate click
btn.OnSongButtonClick();
if (VerboseLogs) 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()
{
@@ -391,16 +444,8 @@ public class SongSelectUI : MonoBehaviour
songButton.SetButtonData(song.songName, bestTotal, diffForDisplay, resolvedIllustration, song.songID);
}
Image songImage = songButtonObj.GetComponentInChildren<Image>();
TMP_Text[] texts = songButtonObj.GetComponentsInChildren<TMP_Text>();
Sprite displayIllustration = sd != null ? sd.GetResolvedIllustration() : song.GetResolvedIllustration();
if (songImage != null && displayIllustration != null)
{
songImage.sprite = displayIllustration;
songImage.enabled = true;
}
if (texts.Length >= 4)
{
texts[0].text = song.songName;
@@ -35,7 +35,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 25.636463, y: -5.3366528}
m_SizeDelta: {x: 197.413, y: 16}
m_SizeDelta: {x: 197.413, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4445277613365452210
CanvasRenderer:
@@ -58,7 +58,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_Color: {r: 0.41960785, g: 0.5411765, b: 0.8039216, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@@ -66,8 +66,8 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 775c674e81662c644b64550d2e8f74e0, type: 3}
m_FontSize: 16
m_Font: {fileID: 12800000, guid: d254d20d93651ae448ff13d10dff30ab, type: 3}
m_FontSize: 18
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
@@ -137,7 +137,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_Color: {r: 0.41960785, g: 0.5411765, b: 0.8039216, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@@ -145,7 +145,7 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 775c674e81662c644b64550d2e8f74e0, type: 3}
m_Font: {fileID: 12800000, guid: d254d20d93651ae448ff13d10dff30ab, type: 3}
m_FontSize: 16
m_FontStyle: 0
m_BestFit: 0
@@ -423,11 +423,11 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5010078828579475845}
m_Father: {fileID: 8175549184154350589}
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: -131.06, y: 2}
m_AnchoredPosition: {x: 0.4, y: 0.4}
m_SizeDelta: {x: 70, y: 70}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4297944811495197019
@@ -501,20 +501,20 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 67586661102091782}
- {fileID: 4819405071236471537}
- {fileID: 8175549184154350589}
- {fileID: 3510870173842254657}
- {fileID: 570804039580569020}
- {fileID: 333634122881333044}
- {fileID: 3306384613169609027}
- {fileID: 4819405071236471537}
- {fileID: 2939871135262439914}
- {fileID: 4144564644084054833}
- {fileID: 1253227257531515220}
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: 365, y: 102}
m_AnchoredPosition: {x: 0, y: -15.6417}
m_SizeDelta: {x: 347.46, y: 126.2}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2268568006775696577
CanvasRenderer:
@@ -544,7 +544,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: e2c536559de04a84bae8d1e1752633e7, type: 3}
m_Sprite: {fileID: 8854417684009032258, guid: 7fe79334beecbff45adc7f3141fb2c6e, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -636,6 +636,82 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 76ce63b908338a84c8a3aa071b90c46b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &4347938295897366626
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8175549184154350589}
- component: {fileID: 5641481700332760236}
- component: {fileID: 2992976557814521925}
m_Layer: 5
m_Name: btm
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8175549184154350589
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4347938295897366626}
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: 67586661102091782}
m_Father: {fileID: 5010078828579475845}
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: -119.1, y: 0}
m_SizeDelta: {x: 80, y: 80}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5641481700332760236
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4347938295897366626}
m_CullTransparentMesh: 1
--- !u!114 &2992976557814521925
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4347938295897366626}
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: 0d5b8d6154be0cb45b54e09bc61608a6, type: 3}
m_Type: 1
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 &5437805816395700444
GameObject:
m_ObjectHideFlags: 0
@@ -647,6 +723,7 @@ GameObject:
- component: {fileID: 2939871135262439914}
- component: {fileID: 5911944271956214811}
- component: {fileID: 6445397485245527728}
- component: {fileID: 1862562910589191625}
m_Layer: 5
m_Name: songAmount
m_TagString: Untagged
@@ -661,18 +738,18 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5437805816395700444}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
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: 5010078828579475845}
m_Father: {fileID: 4144564644084054833}
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: 156.45, y: 33.1}
m_SizeDelta: {x: 36.6942, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 69.4, y: 1.3}
m_SizeDelta: {x: 0, y: 45.14}
m_Pivot: {x: 1, y: 0.5}
--- !u!222 &5911944271956214811
CanvasRenderer:
m_ObjectHideFlags: 0
@@ -694,7 +771,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
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
@@ -703,7 +780,7 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: c1479b56d8329614e94637b5c5bafc87, type: 3}
m_FontSize: 18
m_FontSize: 24
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
@@ -714,7 +791,97 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 202
m_Text: 21474836
--- !u!114 &1862562910589191625
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5437805816395700444}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 2
m_VerticalFit: 0
--- !u!1 &5621086596225044490
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4144564644084054833}
- component: {fileID: 7024139255531550986}
- component: {fileID: 6978157329050736198}
m_Layer: 5
m_Name: songAmtBtm
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4144564644084054833
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5621086596225044490}
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: 2939871135262439914}
m_Father: {fileID: 5010078828579475845}
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: 101.14, y: 46.96}
m_SizeDelta: {x: 142, y: 29}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7024139255531550986
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5621086596225044490}
m_CullTransparentMesh: 1
--- !u!114 &6978157329050736198
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5621086596225044490}
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: a7d9a645eb24633489d4db848cda0cfd, 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!1 &6759998237426852132
GameObject:
m_ObjectHideFlags: 0
@@ -773,7 +940,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_Color: {r: 0.14117648, g: 0.34117648, b: 0.7764706, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@@ -811,7 +978,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &4819405071236471537
RectTransform:
m_ObjectHideFlags: 0
@@ -829,7 +996,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -0.0897, y: 1}
m_SizeDelta: {x: 364.8207, y: 100}
m_SizeDelta: {x: 369.1, y: 146.7}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &9008192983113540843
CanvasRenderer:
@@ -852,14 +1019,14 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.2264151, g: 0.2264151, b: 0.2264151, a: 1}
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: 7f3b1220317607e44bbb8f0e1998044a, type: 3}
m_Sprite: {fileID: 21300000, guid: 0725eded3a7bb264c9a5265e4a4fbe0f, type: 3}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 0
@@ -868,7 +1035,7 @@ MonoBehaviour:
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 3
m_PixelsPerUnitMultiplier: 1
--- !u!1 &8646457970808721701
GameObject:
m_ObjectHideFlags: 0
@@ -880,6 +1047,7 @@ GameObject:
- component: {fileID: 3306384613169609027}
- component: {fileID: 2498827089920741302}
- component: {fileID: 115205934777297662}
- component: {fileID: 2396493953949227310}
m_Layer: 5
m_Name: dlcID
m_TagString: Untagged
@@ -903,9 +1071,9 @@ 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: 94.8, y: -36.5}
m_SizeDelta: {x: 160, y: 12}
m_Pivot: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 169.2, y: -49.7}
m_SizeDelta: {x: 0, y: 16}
m_Pivot: {x: 1, y: 0.5}
--- !u!222 &2498827089920741302
CanvasRenderer:
m_ObjectHideFlags: 0
@@ -927,7 +1095,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_Color: {r: 0.41960785, g: 0.5411765, b: 0.8039216, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@@ -935,8 +1103,8 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 775c674e81662c644b64550d2e8f74e0, type: 3}
m_FontSize: 12
m_Font: {fileID: 12800000, guid: d254d20d93651ae448ff13d10dff30ab, type: 3}
m_FontSize: 16
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
@@ -948,3 +1116,17 @@ MonoBehaviour:
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: id
--- !u!114 &2396493953949227310
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8646457970808721701}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 2
m_VerticalFit: 0
+1 -1
View File
@@ -26,7 +26,7 @@ public class SongDataManager : MonoBehaviour
System.Collections.IEnumerator SaveAllSongDataToJsonRoutine()
{
SongData[] allSongData = Resources.LoadAll<SongData>("song_songIndex");
SongData[] allSongData = RuntimeResourcesCache.LoadSongIndex();
if (allSongData.Length == 0)
{
@@ -12,6 +12,7 @@ public class SongDataSerializable
public bool _if_level_is_EASE;
public int max_comboRecord;
public int personalRecord;
public int selectedDifficultyId;
public string dataHash; // 防篡改校验和
// public List<int> enemyList = new List<int>(); // Deprecated and removed
@@ -49,6 +50,7 @@ public class SongDataSerializable
this._if_level_is_EASE = source._if_level_is_EASE;
this.max_comboRecord = source.max_comboRecord;
this.personalRecord = source.personalRecord;
this.selectedDifficultyId = source.thisLevel_selectedDifficultyID;
// this.enemyList = new List<int>(source.enemyList); // Deprecated and removed
// 将字典转换为 List
@@ -72,6 +74,7 @@ public class SongDataSerializable
target._if_level_is_EASE = this._if_level_is_EASE;
target.max_comboRecord = this.max_comboRecord;
target.personalRecord = this.personalRecord;
target.thisLevel_selectedDifficultyID = this.selectedDifficultyId;
// target.enemyList = new List<int>(this.enemyList); // Deprecated and removed
// 将 List 还原回字典
+205 -72
View File
@@ -5,9 +5,14 @@ using System;
using System.Linq;
using System.Threading.Tasks;
using GameServer.Client;
using DG.Tweening;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
public class SongDetailsUI : MonoBehaviour
{
private const string BackSceneName = "selectYourSongFirst";
[Header("this_song_SO")]
public ScriptableObject this_song_SO;
@@ -60,6 +65,9 @@ public class SongDetailsUI : MonoBehaviour
public Image profound_image;
public Text detail_informations_text;
[Header("back to last scene")]
[SerializeField] private Button backtoLastScene;
[Header("Inspector")]
public Button Button_EZ;
public Button Button_HD;
@@ -69,9 +77,21 @@ public class SongDetailsUI : MonoBehaviour
private SongData currentSong;
private GameObject spawnedAskInstance;
private GameObject spawnedRoomDetailsInstance;
private SongData lastSyncedSong;
private int lastSyncedDifficultyId = int.MinValue;
private UnityAction difficultyEzAction;
private UnityAction difficultyHdAction;
private UnityAction difficultyInAction;
private UnityAction difficultyImAction;
private SongData ResolveCurrentSong()
{
if (SongDataHolder.SelectedSongData != null)
{
currentSong = SongDataHolder.SelectedSongData;
return currentSong;
}
if (currentSong != null)
{
return currentSong;
@@ -83,12 +103,6 @@ public class SongDetailsUI : MonoBehaviour
return currentSong;
}
if (SongDataHolder.SelectedSongData != null)
{
currentSong = SongDataHolder.SelectedSongData;
return currentSong;
}
return null;
}
@@ -120,6 +134,21 @@ public class SongDetailsUI : MonoBehaviour
roomButton.onClick.RemoveListener(OnRoomButtonClicked);
roomButton.onClick.AddListener(OnRoomButtonClicked);
}
if (backtoLastScene != null)
{
backtoLastScene.onClick.RemoveListener(OnBackToLastSceneClicked);
backtoLastScene.onClick.AddListener(OnBackToLastSceneClicked);
}
BindDifficultyButtons();
PrepareDifficultyButtons();
SyncSongDisplay(true);
}
private void Update()
{
SyncSongDisplay(false);
}
private void OnDisable()
@@ -139,6 +168,13 @@ public class SongDetailsUI : MonoBehaviour
{
roomButton.onClick.RemoveListener(OnRoomButtonClicked);
}
if (backtoLastScene != null)
{
backtoLastScene.onClick.RemoveListener(OnBackToLastSceneClicked);
}
UnbindDifficultyButtons();
}
private void HandleArenaRoomSnapshotChanged(ArenaRoomSnapshot snapshot)
@@ -193,9 +229,55 @@ public class SongDetailsUI : MonoBehaviour
SongDataHolder.SelectedSongData = song;
id_of_thisSong = song.songID;
RefreshSongPresentation(song);
SetDifficultyButtons(difficultyId);
UpdateDifficultyUI(difficultyId);
SyncSongDisplay(true);
}
private void SyncSongDisplay(bool force)
{
SongData song = ResolveCurrentSong();
if (song == null)
{
if (force || lastSyncedSong != null)
{
SetDifficultyButtons(-1);
if (difficultyText != null) difficultyText.text = string.Empty;
if (difficultyDesciptionText != null) difficultyDesciptionText.text = string.Empty;
if (difficultyIdText != null) difficultyIdText.text = string.Empty;
if (personalRecordText != null) personalRecordText.text = "0";
if (idolRecordText != null) idolRecordText.text = "0";
if (chartScoreText != null) chartScoreText.text = "0";
if (thisSong_lastScoreText != null) thisSong_lastScoreText.text = "0";
if (rankLevel_img != null && rc != null) rankLevel_img.sprite = rc.defaultSprite;
if (progressImage != null) progressImage.fillAmount = 0f;
UpdateProgressUI(0f);
}
lastSyncedSong = null;
lastSyncedDifficultyId = int.MinValue;
return;
}
currentSong = song;
this_song_SO = song;
id_of_thisSong = song.songID;
int selectedDifficulty = Mathf.Clamp(song.thisLevel_selectedDifficultyID, 0, 3);
bool songChanged = lastSyncedSong != song;
bool difficultyChanged = lastSyncedDifficultyId != selectedDifficulty;
if (force || songChanged)
{
RefreshSongPresentation(song);
}
if (force || songChanged || difficultyChanged)
{
SetDifficultyButtons(selectedDifficulty);
UpdateDifficultyUI(selectedDifficulty);
}
lastSyncedSong = song;
lastSyncedDifficultyId = selectedDifficulty;
}
private void RefreshSongPresentation(SongData song)
@@ -246,59 +328,10 @@ public class SongDetailsUI : MonoBehaviour
void Start()
{
if (SongDataHolder.SelectedSongData != null)
{
// Documentation text normalized.
currentSong = SongDataHolder.SelectedSongData;
this_song_SO = currentSong;
song_bgImage.sprite = currentSong.GetResolvedBackgroundPic();
// Documentation text normalized.
songNameText.text = currentSong.songName;
artistNameText.text = currentSong.artistName;
painterNameText.text = currentSong.painter;
charterNameText.text = currentSong.level_creator;
dlcNameText.text = currentSong.belongsTo_whichDLC;
songSerialNumberText.text = currentSong.songID.ToString();
bpmText.text = LocalizationService.GetFormat("song.details.bpm", currentSong.bpm);
profound_image.sprite = currentSong.GetResolvedFullscreenSongPicture();
if (timeSpentText != null) timeSpentText.text = LocalizationService.GetFormat("song.details.play_time", currentSong.time_totalPlayingTime.ToString("F0"));
if (enterTimeText != null) enterTimeText.text = LocalizationService.GetFormat("song.details.play_count", currentSong.game_enterTimes);
id_of_thisSong = currentSong.songID;
detail_informations_text.text = LocalizationService.GetFormat("song.details.information",
currentSong.artistName, currentSong.songName, currentSong.painter, currentSong.level_creator, currentSong.belongsTo_whichDLC);
if (currentSong.GetResolvedIllustration() != null)
{
//songImage.sprite = currentSong.illustration;
//songImage.enabled = true;
}
else
{
Debug.LogWarning(LocalizationService.GetFormat("song.details.no_song_cover", currentSong.songName));
}
Debug.Log("加载歌曲数据: " + currentSong.songName);
}
else
{
// Documentation text normalized.
}
picDetail.SetActive(false);
// Documentation text normalized.
if (currentSong != null)
{
SetDifficultyButtons(currentSong.thisLevel_selectedDifficultyID);
UpdateDifficultyUI(currentSong.thisLevel_selectedDifficultyID);
Button_EZ.onClick.AddListener(() => OnDifficultySelected(0));
Button_HD.onClick.AddListener(() => OnDifficultySelected(1));
Button_IN.onClick.AddListener(() => OnDifficultySelected(2));
Button_IM.onClick.AddListener(() => OnDifficultySelected(3));
}
BindDifficultyButtons();
PrepareDifficultyButtons();
SyncSongDisplay(true);
}
public void OnRankingButtonClicked()
@@ -319,6 +352,14 @@ public class SongDetailsUI : MonoBehaviour
rkl.Open(song.songID.ToString(), song.songName);
}
public void OnBackToLastSceneClicked()
{
if (!Bansonic.gTransition.LoadScene(BackSceneName, LoadSceneMode.Single))
{
SceneManager.LoadScene(BackSceneName, LoadSceneMode.Single);
}
}
public async void OnRoomButtonClicked()
{
SongData song = ResolveCurrentSong();
@@ -605,10 +646,87 @@ public class SongDetailsUI : MonoBehaviour
private void SetDifficultyButtons(int selectedDifficulty)
{
Button_EZ.image.color = new Color(1, 1, 1, selectedDifficulty == 0 ? 1 : 0);
Button_HD.image.color = new Color(1, 1, 1, selectedDifficulty == 1 ? 1 : 0);
Button_IN.image.color = new Color(1, 1, 1, selectedDifficulty == 2 ? 1 : 0);
Button_IM.image.color = new Color(1, 1, 1, selectedDifficulty == 3 ? 1 : 0);
SetDifficultyButtonAlpha(Button_EZ, selectedDifficulty == 0);
SetDifficultyButtonAlpha(Button_HD, selectedDifficulty == 1);
SetDifficultyButtonAlpha(Button_IN, selectedDifficulty == 2);
SetDifficultyButtonAlpha(Button_IM, selectedDifficulty == 3);
}
private void BindDifficultyButtons()
{
BindDifficultyButton(Button_EZ, 0, ref difficultyEzAction);
BindDifficultyButton(Button_HD, 1, ref difficultyHdAction);
BindDifficultyButton(Button_IN, 2, ref difficultyInAction);
BindDifficultyButton(Button_IM, 3, ref difficultyImAction);
}
private void UnbindDifficultyButtons()
{
UnbindDifficultyButton(Button_EZ, difficultyEzAction);
UnbindDifficultyButton(Button_HD, difficultyHdAction);
UnbindDifficultyButton(Button_IN, difficultyInAction);
UnbindDifficultyButton(Button_IM, difficultyImAction);
}
private void BindDifficultyButton(Button button, int difficultyId, ref UnityAction cachedAction)
{
if (button == null)
{
return;
}
if (cachedAction != null)
{
button.onClick.RemoveListener(cachedAction);
}
cachedAction = () => OnDifficultySelected(difficultyId);
button.onClick.AddListener(cachedAction);
}
private void UnbindDifficultyButton(Button button, UnityAction cachedAction)
{
if (button == null || cachedAction == null)
{
return;
}
button.onClick.RemoveListener(cachedAction);
}
private void PrepareDifficultyButtons()
{
ForceDifficultyButtonVisualMode(Button_EZ);
ForceDifficultyButtonVisualMode(Button_HD);
ForceDifficultyButtonVisualMode(Button_IN);
ForceDifficultyButtonVisualMode(Button_IM);
}
private void ForceDifficultyButtonVisualMode(Button button)
{
if (button == null)
{
return;
}
button.transition = Selectable.Transition.None;
}
private void SetDifficultyButtonAlpha(Button button, bool active)
{
if (button == null)
{
return;
}
Graphic graphic = button.targetGraphic != null ? button.targetGraphic : button.image;
if (graphic == null)
{
return;
}
graphic.DOKill(false);
graphic.DOFade(active ? 1f : 0f, 0.18f).SetEase(Ease.OutCubic);
}
private void OnDifficultySelected(int difficulty)
@@ -623,14 +741,21 @@ public class SongDetailsUI : MonoBehaviour
private void UpdateDifficultyUI(int difficulty)
{
if (currentSong == null)
{
return;
}
var entry = GetChartEntry(difficulty);
if (entry != null)
{
difficultyText.text = entry.difficultyLEVEL.ToString();
difficultyDesciptionText.text = entry.difficultyDescription;
if (difficultyText != null)
difficultyText.text = entry.difficultyLEVEL.ToString("0.0");
if (difficultyDesciptionText != null)
difficultyDesciptionText.text = string.IsNullOrEmpty(entry.difficultyDescription) ? entry.difficultyName : entry.difficultyDescription;
if (difficultyIdText != null)
difficultyIdText.text = entry.difficultyLEVEL.ToString();
difficultyIdText.text = entry.difficultyLEVEL.ToString("0.0");
if (progressImage != null)
progressImage.fillAmount = entry.levelProgressForThisDifficulty;
@@ -678,14 +803,17 @@ public class SongDetailsUI : MonoBehaviour
}
else
{
difficultyText.text = difficulty.ToString();
if (difficultyText != null)
difficultyText.text = difficulty.ToString();
if (difficultyIdText != null)
difficultyIdText.text = difficulty.ToString();
if (progressImage != null)
progressImage.fillAmount = 0f;
UpdateProgressUI(0f);
difficultyDesciptionText.text = "";
personalRecordText.text = "0";
if (difficultyDesciptionText != null)
difficultyDesciptionText.text = "";
if (personalRecordText != null)
personalRecordText.text = "0";
if (idolRecordText != null)
idolRecordText.text = "0";
if (chartScoreText != null)
@@ -730,9 +858,14 @@ public class SongDetailsUI : MonoBehaviour
private ChartFileEntry GetChartEntry(int difficulty)
{
if (currentSong == null || currentSong.chartFiles == null)
{
return null;
}
foreach (var entry in currentSong.chartFiles)
{
if (entry.difficulty == difficulty)
if (entry != null && entry.difficulty == difficulty)
return entry;
}
return null;
@@ -278,12 +278,6 @@ public static class SongDlcContentResolver
}
#endif
SongDlcContentSO[] loaded = RuntimeResourcesCache.LoadAllSongDlcContents();
if (loaded != null && loaded.Length > 0)
{
return loaded;
}
return Resources.LoadAll<SongDlcContentSO>(string.Empty) ?? Array.Empty<SongDlcContentSO>();
return RuntimeResourcesCache.LoadAllSongDlcContents() ?? Array.Empty<SongDlcContentSO>();
}
}
+83 -92
View File
@@ -38,9 +38,6 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
private static List<dlcData> cachedAll = new List<dlcData>();
private static bool cacheBuilt = false;
private static bool cacheBuilding = false;
private static string cachedFolder = string.Empty;
// Selection management (shared across all dlcButton instances)
private static List<dlcButton> allButtons = new List<dlcButton>();
private static int selectedIndex = -1;
@@ -49,6 +46,20 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
private int instanceIndex = -1;
private Coroutine hoverCoroutine;
private void UpdateSongsAmountText()
{
if (dlcSongsAmount != null)
{
dlcSongsAmount.text = dlcContent != null ? dlcContent.Count.ToString() : "0";
}
}
public static void ResetSelectionState()
{
allButtons.Clear();
selectedIndex = -1;
}
public void OnPointerEnter(PointerEventData eventData)
{
if (hoverCoroutine != null) StopCoroutine(hoverCoroutine);
@@ -61,6 +72,12 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
if (dlcDetailParent != null) dlcDetailParent.SetActive(false);
}
public void SetDlcData(dlcData so)
{
dlcDataSO = so;
ApplyDlcData(so);
}
private IEnumerator HandleHover()
{
yield return new WaitForSecondsRealtime(0.5f);
@@ -109,18 +126,21 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
_btn.onClick.AddListener(OnButtonClicked_ShowSongs);
}
// register this button for centralized selection handling
RegisterInstance();
// ensure border initial state
if (dlc_nowSelectedImageBoarder != null)
{
if (!dlc_nowSelectedImageBoarder.gameObject.activeSelf)
{
dlc_nowSelectedImageBoarder.gameObject.SetActive(true);
}
var c = dlc_nowSelectedImageBoarder.color;
c.a = 0f;
dlc_nowSelectedImageBoarder.color = c;
dlc_nowSelectedImageBoarder.gameObject.SetActive(false);
}
// register this button for centralized selection handling
RegisterInstance();
if (VerboseLogs) Debug.Log($"dlcButton.Awake: registered '{gameObject.name}' as index {instanceIndex}");
}
@@ -149,19 +169,25 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
SetSelectedVisual(false, immediate: true);
}
}
else
{
instanceIndex = allButtons.IndexOf(this);
}
}
private void UnregisterInstance()
{
if (allButtons.Contains(this))
int idx = allButtons.IndexOf(this);
if (idx >= 0)
{
int idx = allButtons.IndexOf(this);
allButtons.Remove(this);
// if removed index was before selectedIndex, adjust saved index
if (idx >= 0 && idx < instanceIndex)
if (selectedIndex == idx)
{
// nothing: instanceIndex only used at registration time
selectedIndex = -1;
}
else if (selectedIndex > idx)
{
selectedIndex--;
}
}
}
@@ -207,7 +233,10 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
if (immediate)
{
dlc_nowSelectedImageBoarder.gameObject.SetActive(selected);
if (!dlc_nowSelectedImageBoarder.gameObject.activeSelf)
{
dlc_nowSelectedImageBoarder.gameObject.SetActive(true);
}
var c = dlc_nowSelectedImageBoarder.color;
c.a = selected ? 1f : 0f;
dlc_nowSelectedImageBoarder.color = c;
@@ -237,10 +266,6 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
var final = img.color;
final.a = targetAlpha;
img.color = final;
if (Mathf.Approximately(targetAlpha, 0f))
{
img.gameObject.SetActive(false);
}
borderFadeCoroutine = null;
}
@@ -309,10 +334,35 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
return false;
}
ui.DisplaySongsFromList(dlcContent);
if (SongSelectUI.ForceFirstSongOnNextRestore)
{
SongDataHolder.SelectedSongData = null;
}
ui.DisplaySongsFromList(GetAccessibleDlcContent());
return true;
}
private List<SongData> GetAccessibleDlcContent()
{
List<SongData> accessible = new List<SongData>();
if (dlcContent == null)
{
return accessible;
}
for (int i = 0; i < dlcContent.Count; i++)
{
SongData song = dlcContent[i];
if (song != null && DlcContentAccess.IsSongAccessible(song))
{
accessible.Add(song);
}
}
return accessible;
}
private IEnumerator RetryDisplaySongsWhenUIReady()
{
const int maxRetryFrames = 8;
@@ -373,14 +423,14 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
// Runtime: search Resources (load all dlcData then filter by name prefix)
try
{
var arr = Resources.LoadAll<dlcData>(runtimeResourcesFolder);
if (VerboseLogs) Debug.Log($"dlcButton.LoadDlcDataById: Resources.LoadAll('{runtimeResourcesFolder}') returned {(arr != null ? arr.Length : 0)} items");
if (arr != null)
var all = RuntimeResourcesCache.LoadAllDlcs();
if (VerboseLogs) Debug.Log($"dlcButton.LoadDlcDataById: runtime cache returned {(all != null ? all.Length : 0)} items");
if (all != null)
{
foreach (var so in arr)
foreach (var so in all)
{
if (so == null) continue;
if (so.name.StartsWith(id.ToString()))
if (so.dlcID == id || so.name.StartsWith(id.ToString()))
{
if (VerboseLogs) Debug.Log($"dlcButton.LoadDlcDataById: found runtime dlcData '{so.name}' for id={id}");
dlcDataSO = so;
@@ -392,25 +442,7 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
}
catch (System.Exception e)
{
Debug.LogWarning($"dlcButton.LoadDlcDataById: Resources search failed: {e.Message}");
}
// fallback: search all Resources
var all = Resources.LoadAll<dlcData>("");
if (VerboseLogs) Debug.Log("dlcButton.LoadDlcDataById: Resources.LoadAll(\"\") returned " + (all != null ? all.Length : 0) + " items");
if (all != null)
{
foreach (var so in all)
{
if (so == null) continue;
if (so.name.StartsWith(id.ToString()))
{
if (VerboseLogs) Debug.Log($"dlcButton.LoadDlcDataById: found fallback dlcData '{so.name}' for id={id}");
dlcDataSO = so;
ApplyDlcData(so);
return;
}
}
Debug.LogWarning($"dlcButton.LoadDlcDataById: runtime cache search failed: {e.Message}");
}
// if no dlcData found, keep dlcContent empty but attempt old behavior: search SongData by id prefix
@@ -429,10 +461,7 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
if (s != null) dlcContent.Add(s);
}
if (dlcSongsAmount != null)
{
dlcSongsAmount.text = dlcContent.Count.ToString();
}
UpdateSongsAmountText();
if (dlcName != null) dlcName.text = so.dlcName ?? dlcName.text;
if (dlcProducer != null) dlcProducer.text = so.dlcProducer ?? dlcProducer.text;
@@ -474,31 +503,17 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
}
}
#endif
if (!string.IsNullOrEmpty(runtimeResourcesFolder))
SongData[] allSongs = RuntimeResourcesCache.LoadAllSongs();
if (allSongs != null)
{
var arr = Resources.LoadAll<SongData>(runtimeResourcesFolder);
if (arr != null)
foreach (var so in allSongs)
{
foreach (var so in arr)
{
if (so == null) continue;
if (so.name.StartsWith(id.ToString())) dlcContent.Add(so);
}
if (so == null) continue;
if (so.name.StartsWith(id.ToString())) dlcContent.Add(so);
}
}
if (dlcContent.Count == 0)
{
var arr2 = Resources.LoadAll<SongData>("");
if (arr2 != null)
{
foreach (var so in arr2)
{
if (so == null) continue;
if (so.name.StartsWith(id.ToString())) dlcContent.Add(so);
}
}
}
UpdateSongsAmountText();
if (VerboseLogs) Debug.Log($"dlcButton: Loaded {dlcContent.Count} SongData entries for DLC id={id} (fallback search)");
}
@@ -601,21 +616,6 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
return false;
}
private static string NormalizeResourcesPath(string path)
{
if (string.IsNullOrEmpty(path))
{
return string.Empty;
}
string p = path.Replace("\\", "/");
int idx = p.IndexOf("Resources/", System.StringComparison.OrdinalIgnoreCase);
if (idx >= 0)
{
p = p.Substring(idx + "Resources/".Length);
}
return p.Trim('/');
}
private static IEnumerator BuildCacheIfNeeded(string runtimeFolder)
{
if (cacheBuilt)
@@ -634,20 +634,11 @@ public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandle
cacheBuilding = true;
cachedById.Clear();
cachedAll.Clear();
cachedFolder = NormalizeResourcesPath(runtimeFolder);
// allow one frame before heavy load
yield return null;
dlcData[] arr = null;
if (!string.IsNullOrEmpty(cachedFolder))
{
arr = Resources.LoadAll<dlcData>(cachedFolder);
}
if (arr == null || arr.Length == 0)
{
arr = Resources.LoadAll<dlcData>("");
}
dlcData[] arr = RuntimeResourcesCache.LoadAllDlcs();
if (arr != null)
{
+132 -30
View File
@@ -7,6 +7,8 @@ public class loadDlcListPrefab : MonoBehaviour
{
private static readonly bool VerboseLogs = false;
private const string RuntimeInstalledColumnName = "Installed DLC";
private const int DefaultFallbackDlcId = 66001;
private const string DlcSelectedIndexPrefsKey = "dlc_selected_index";
[System.Serializable]
public class Column
{
@@ -35,6 +37,8 @@ public class loadDlcListPrefab : MonoBehaviour
{
if (dlc_scContent == null) return;
dlcButton.ResetSelectionState();
for (int i = dlc_scContent.transform.childCount - 1; i >= 0; i--)
{
var c = dlc_scContent.transform.GetChild(i).gameObject;
@@ -89,16 +93,7 @@ public class loadDlcListPrefab : MonoBehaviour
{
if (dlc != null)
{
if (btn.dlc_profileImgae != null)
{
btn.dlc_profileImgae.sprite = dlc.dlc_image;
btn.dlc_profileImgae.enabled = dlc.dlc_image != null;
}
if (btn.dlcName != null) btn.dlcName.text = dlc.dlcName ?? "(Unnamed)";
if (btn.dlcID != null) btn.dlcID.text = dlc.dlcID.ToString();
if (btn.dlcProducer != null) btn.dlcProducer.text = dlc.dlcProducer ?? "";
if (btn.dlcPubliushDate != null) btn.dlcPubliushDate.text = dlc.dlcPublishDate ?? "";
if (btn.dlcDescription != null) btn.dlcDescription.text = dlc.dlcDescription ?? "";
btn.SetDlcData(dlc);
}
else
{
@@ -106,6 +101,7 @@ public class loadDlcListPrefab : MonoBehaviour
if (btn.dlcID != null) btn.dlcID.text = "";
if (btn.dlc_profileImgae != null) btn.dlc_profileImgae.enabled = false;
if (btn.dlcDescription != null) btn.dlcDescription.text = "";
if (btn.dlcSongsAmount != null) btn.dlcSongsAmount.text = "0";
}
}
}
@@ -135,29 +131,135 @@ public class loadDlcListPrefab : MonoBehaviour
// Let layout and any fades settle for a frame
yield return null;
// Restore last selected DLC button from PlayerPrefs and simulate a click on it
int savedIndex = PlayerPrefs.GetInt("dlc_selected_index", 0);
if (allButtons != null && allButtons.Length > 0)
{
if (savedIndex < 0) savedIndex = 0;
if (savedIndex >= allButtons.Length) savedIndex = 0;
var savedBtn = allButtons[savedIndex];
if (savedBtn != null)
{
// simulate a user clicking the button: this will Select() and display its songs
savedBtn.OnButtonClicked_ShowSongs();
if (VerboseLogs) Debug.Log($"loadDlcListPrefab: restored and clicked saved dlc button index={savedIndex} name={savedBtn.gameObject.name}");
}
else
{
if (VerboseLogs) Debug.LogWarning($"loadDlcListPrefab: saved dlc button at index {savedIndex} was null");
}
}
else
if (allButtons == null || allButtons.Length == 0)
{
if (VerboseLogs) Debug.LogWarning("loadDlcListPrefab: no dlc buttons found after RefreshUI");
yield break;
}
dlcButton targetButton = ResolvePreferredRestoreButton(allButtons, out bool forceFirstSong);
if (targetButton == null)
{
targetButton = allButtons[0];
forceFirstSong = true;
}
SongSelectUI.ForceFirstSongOnNextRestore = forceFirstSong;
targetButton.OnButtonClicked_ShowSongs();
if (VerboseLogs)
{
Debug.Log(
$"loadDlcListPrefab: restored dlc button '{targetButton.gameObject.name}', " +
$"dlcId={GetDlcId(targetButton)}, forceFirstSong={forceFirstSong}");
}
}
private dlcButton ResolvePreferredRestoreButton(dlcButton[] allButtons, out bool forceFirstSong)
{
forceFirstSong = true;
if (allButtons == null || allButtons.Length == 0)
{
return null;
}
int savedIndex = PlayerPrefs.GetInt(DlcSelectedIndexPrefsKey, 0);
if (savedIndex >= 0 && savedIndex < allButtons.Length)
{
dlcButton savedButton = allButtons[savedIndex];
if (HasSavedSongSelection(savedButton))
{
forceFirstSong = false;
return savedButton;
}
}
dlcButton fallbackById = FindButtonByDlcId(allButtons, DefaultFallbackDlcId);
if (fallbackById != null)
{
return fallbackById;
}
return allButtons[0];
}
private dlcButton FindButtonByDlcId(dlcButton[] allButtons, int dlcId)
{
if (allButtons == null)
{
return null;
}
for (int i = 0; i < allButtons.Length; i++)
{
dlcButton button = allButtons[i];
if (button == null)
{
continue;
}
if (GetDlcId(button) == dlcId)
{
return button;
}
}
return null;
}
private bool HasSavedSongSelection(dlcButton button)
{
if (button == null)
{
return false;
}
string dlcKey = BuildDlcKey(button);
if (string.IsNullOrEmpty(dlcKey))
{
return false;
}
string songIdKey = SongButton.BuildSongSelectedIdPrefsKey(dlcKey);
if (PlayerPrefs.HasKey(songIdKey) && PlayerPrefs.GetInt(songIdKey, 0) > 0)
{
return true;
}
string songIndexKey = SongButton.BuildSongSelectedIndexPrefsKey(dlcKey);
return PlayerPrefs.HasKey(songIndexKey);
}
private string BuildDlcKey(dlcButton button)
{
int dlcId = GetDlcId(button);
if (dlcId > 0)
{
return "dlc_" + dlcId;
}
return null;
}
private int GetDlcId(dlcButton button)
{
if (button == null)
{
return 0;
}
if (button.dlcDataSO != null && button.dlcDataSO.dlcID > 0)
{
return button.dlcDataSO.dlcID;
}
if (button.dlcID != null && int.TryParse(button.dlcID.text, out int parsedId))
{
return parsedId;
}
return 0;
}
private List<Column> BuildDisplayColumns()
+151 -54
View File
@@ -10,6 +10,7 @@ using Bansonic;
public class selected_songInfo : MonoBehaviour
{
private static readonly bool VerboseLogs = false;
private const string LastEnteredSongIdPrefsKey = "last_entered_song_id";
[Header("ranking")]
public Button rankingButton;
public rankingList s_rl;
@@ -17,6 +18,7 @@ public class selected_songInfo : MonoBehaviour
[Header("Music Controls")]
public Button playpausebutton;
public Button stopbutton;
public Image playPauseStateImage;
public Text currentTime;
public Text maxtime;
public Slider playbarSlider;
@@ -44,10 +46,18 @@ public class selected_songInfo : MonoBehaviour
public Color _16d5to22;
public Color _equal22;
[Header("autoplay button")]
public Button autoplayButton;
public Sprite ap_enabled;
public Sprite ap_disabled;
[Header("Inspector")]
public List<Button> difficultyButtons = new List<Button>();
[Header("Inspector")]
public List<Text> difficultyTexts = new List<Text>();
[Header("Difficulty Text Colors")]
[SerializeField] private Color difficultySelectedTextColor = Color.white;
[SerializeField] private Color difficultyUnselectedTextColor = Color.black;
[Header("enter detail page")]
public Button enterDetailPageButton;
[Header("quick enter game play")]
@@ -77,6 +87,9 @@ public class selected_songInfo : MonoBehaviour
private bool _promptAwaitingChoice = false;
private bool _doNotShowAgainPrompt = false;
private bool _doNotShowPrefLoaded = false;
private Image autoplayButtonImage;
private SpriteState cachedAutoplaySpriteState;
private bool hasCachedAutoplaySpriteState;
private const string QuickEnterPromptSkipPrefKey = "quickenter_team_warning_skip";
@@ -244,6 +257,7 @@ public class selected_songInfo : MonoBehaviour
void OnEnable()
{
LogVerbose("selected_songInfo.OnEnable called");
GameConfig.LoadPrefs();
EnsurePromptReferences();
LoadDoNotShowAgainPreference();
SetPromptRootVisible(false);
@@ -251,6 +265,8 @@ public class selected_songInfo : MonoBehaviour
ResolveDifficultyIdDisplayTexts();
InitializeMusicControls();
BindAutoplayButton();
RefreshAutoplayButtonVisual();
// register listeners here to ensure binding even if Start wasn't called yet
if (enterDetailPageButton != null)
@@ -294,6 +310,7 @@ public class selected_songInfo : MonoBehaviour
LogVerbose("selected_songInfo.OnDisable called");
UnbindMusicControls();
UnbindAutoplayButton();
if (enterDetailPageButton != null)
{
@@ -385,6 +402,9 @@ public class selected_songInfo : MonoBehaviour
SetPromptRootVisible(false);
ApplyDoNotShowAgainVisual();
ResolveDifficultyIdDisplayTexts();
GameConfig.LoadPrefs();
CacheAutoplayButtonImage();
RefreshAutoplayButtonVisual();
// ensure black mask is transparent and inactive at start
if (blackMaskImage != null)
@@ -431,6 +451,94 @@ public class selected_songInfo : MonoBehaviour
LogVerbose($"selected_songInfo.Start: SongDataHolder.SelectedSongData is {(SongDataHolder.SelectedSongData == null ? "NULL" : SongDataHolder.SelectedSongData.songName)}");
}
private void BindAutoplayButton()
{
if (autoplayButton == null)
{
return;
}
CacheAutoplayButtonImage();
autoplayButton.onClick.RemoveListener(OnAutoplayButtonClicked);
autoplayButton.onClick.AddListener(OnAutoplayButtonClicked);
}
private void UnbindAutoplayButton()
{
if (autoplayButton == null)
{
return;
}
autoplayButton.onClick.RemoveListener(OnAutoplayButtonClicked);
}
private void CacheAutoplayButtonImage()
{
if (autoplayButton == null)
{
autoplayButtonImage = null;
return;
}
if (autoplayButtonImage == null)
{
autoplayButtonImage = autoplayButton.GetComponent<Image>();
if (autoplayButtonImage == null)
{
autoplayButtonImage = autoplayButton.targetGraphic as Image;
}
}
if (!hasCachedAutoplaySpriteState)
{
cachedAutoplaySpriteState = autoplayButton.spriteState;
hasCachedAutoplaySpriteState = true;
}
}
private void OnAutoplayButtonClicked()
{
bool next = !GameConfig.autoPlayEnabled;
GameConfig.SetAutoPlayEnabled(next);
RefreshAutoplayButtonVisual();
}
private void RefreshAutoplayButtonVisual()
{
CacheAutoplayButtonImage();
if (autoplayButtonImage == null)
{
return;
}
Sprite targetSprite = GameConfig.autoPlayEnabled ? ap_enabled : ap_disabled;
if (targetSprite == null)
{
return;
}
autoplayButtonImage.sprite = targetSprite;
autoplayButtonImage.overrideSprite = targetSprite;
autoplayButtonImage.SetAllDirty();
if (autoplayButton != null)
{
SpriteState state = hasCachedAutoplaySpriteState ? cachedAutoplaySpriteState : autoplayButton.spriteState;
state.highlightedSprite = targetSprite;
state.pressedSprite = targetSprite;
state.selectedSprite = targetSprite;
autoplayButton.spriteState = state;
if (autoplayButton.targetGraphic is Image targetGraphicImage && targetGraphicImage != autoplayButtonImage)
{
targetGraphicImage.sprite = targetSprite;
targetGraphicImage.overrideSprite = targetSprite;
targetGraphicImage.SetAllDirty();
}
}
}
private SongData GetCurrentSelectedSong()
{
if (SongDataHolder.SelectedSongData != null)
@@ -620,17 +728,15 @@ public class selected_songInfo : MonoBehaviour
private void UpdatePlayPauseButtonSprite(bool isPlaying)
{
if (playpausebutton == null) return;
Image btnImg = playpausebutton.GetComponent<Image>();
if (btnImg == null) return;
if (playPauseStateImage == null) return;
if (isPlaying)
{
if (pauseSprite != null) btnImg.sprite = pauseSprite;
if (pauseSprite != null) playPauseStateImage.sprite = pauseSprite;
}
else
{
if (playSprite != null) btnImg.sprite = playSprite;
if (playSprite != null) playPauseStateImage.sprite = playSprite;
}
}
@@ -699,47 +805,6 @@ public class selected_songInfo : MonoBehaviour
// fill amount is ratio of difficultyLevel / maxDifficulty
float fill = Mathf.Clamp01(difficultyLevel / (float)maxDifficulty);
c_DifficultyImage.fillAmount = fill;
// choose color by ranges: left-closed, right-open, intervals of 5.5
// [0,5.5), [5.5,11), [11,16.5), [16.5,22), exactly 22 -> equal color
Color chosen = _0to5d5;
if (Mathf.Approximately(difficultyLevel, maxDifficulty))
{
chosen = _equal22;
}
else if (difficultyLevel >= 16.5f)
{
chosen = _16d5to22;
}
else if (difficultyLevel >= 11f)
{
chosen = _11to16d5;
}
else if (difficultyLevel >= 5.5f)
{
chosen = _5d5to11;
}
else if (difficultyLevel >= 0)
{
chosen = _0to5d5;
}
else
{
chosen = Color.white;
}
// ensure color is opaque
chosen.a = 1f;
// apply color to the mask image if available, otherwise fall back to the difficulty image
if (c_imageMask != null)
{
c_imageMask.color = chosen;
}
else
{
c_DifficultyImage.color = chosen;
}
}
// Update sumScore_thisDifficulty based on currently selected difficulty
@@ -855,7 +920,7 @@ public class selected_songInfo : MonoBehaviour
// set corresponding text (if exists) to white
if (difficultyTexts != null && i < difficultyTexts.Count && difficultyTexts[i] != null)
{
difficultyTexts[i].color = Color.white;
difficultyTexts[i].color = difficultySelectedTextColor;
}
}
else
@@ -868,7 +933,7 @@ public class selected_songInfo : MonoBehaviour
// set corresponding text (if exists) to black
if (difficultyTexts != null && i < difficultyTexts.Count && difficultyTexts[i] != null)
{
difficultyTexts[i].color = Color.black;
difficultyTexts[i].color = difficultyUnselectedTextColor;
}
}
}
@@ -880,6 +945,7 @@ public class selected_songInfo : MonoBehaviour
if (SongDataHolder.SelectedSongData != null)
{
SongDataHolder.SelectedSongData.thisLevel_selectedDifficultyID = Mathf.Clamp(index, 0, 3);
PersistSelectedSongDifficulty(SongDataHolder.SelectedSongData);
// immediately update UI to reflect new selection
SetDifficultyButtonBackground(SongDataHolder.SelectedSongData.thisLevel_selectedDifficultyID);
@@ -893,6 +959,18 @@ public class selected_songInfo : MonoBehaviour
}
}
private void PersistSelectedSongDifficulty(SongData song)
{
if (song == null)
{
return;
}
int difficulty = Mathf.Clamp(song.thisLevel_selectedDifficultyID, 0, 3);
PlayerPrefs.SetInt(SongButton.BuildSongSelectedDifficultyPrefsKey(song.songID), difficulty);
PlayerPrefs.Save();
}
private void EnsureSongInfoRoot()
{
if (songInfo_Root == null)
@@ -991,8 +1069,17 @@ public class selected_songInfo : MonoBehaviour
private IEnumerator LoadSceneAsync(string sceneName)
{
if (gTransition.LoadScene(sceneName, LoadSceneMode.Single))
{
while (gTransition.IsBusy)
{
yield return null;
}
yield break;
}
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneName);
while (!asyncLoad.isDone)
while (asyncLoad != null && !asyncLoad.isDone)
{
yield return null;
}
@@ -1275,6 +1362,8 @@ public class selected_songInfo : MonoBehaviour
// keep selected in holder to make it accessible in new scene
SongDataHolder.SelectedSongData = sd;
PlayerPrefs.SetInt(LastEnteredSongIdPrefsKey, sd.songID);
PlayerPrefs.Save();
// start fade and load sequence
StartCoroutine(QuickEnterSequence());
@@ -1386,10 +1475,18 @@ public class selected_songInfo : MonoBehaviour
LogVerbose("Fade complete, loading gameplay scene...");
// selected_songInfo is scene UI and must not survive scene switching.
// Gameplay startup is already handled by BeatmapManager/GameManager via pendingSongData.
if (gTransition.LoadScene("gamePlay_gamePlay", LoadSceneMode.Single))
{
while (gTransition.IsBusy)
{
yield return null;
}
yield break;
}
var asyncOp = SceneManager.LoadSceneAsync("gamePlay_gamePlay");
if (asyncOp != null)
{
// wait until load completes
while (!asyncOp.isDone)
{
yield return null;
@@ -1397,11 +1494,11 @@ public class selected_songInfo : MonoBehaviour
}
else
{
// fallback to synchronous load
SceneManager.LoadScene("gamePlay_gamePlay");
if (!gTransition.LoadScene("gamePlay_gamePlay", LoadSceneMode.Single))
{
SceneManager.LoadScene("gamePlay_gamePlay");
}
}
yield break;
}
private SongData FindSongDataFromSelectedButton()