galgame,编辑器内蓝图

This commit is contained in:
FloatGaming
2026-03-08 13:11:52 +08:00
parent 1f4077cf21
commit 4aa8d0492a
17 changed files with 5046 additions and 314 deletions
File diff suppressed because one or more lines are too long
+210 -131
View File
@@ -153,9 +153,9 @@ RectTransform:
- {fileID: 392380760}
m_Father: {fileID: 425295052}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 50, y: -18.034874}
m_SizeDelta: {x: 100, y: 10}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &2178223
@@ -2682,9 +2682,9 @@ RectTransform:
- {fileID: 1579840624}
m_Father: {fileID: 1181698751}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 307.76, y: -60.5}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &140317858
@@ -3559,9 +3559,9 @@ MonoBehaviour:
m_EditorClassIdentifier:
enableGalgame: 0
enableLyricsSO: 1
golSO: {fileID: 0}
galgamePrefab: {fileID: 0}
where_to_put: {fileID: 0}
golSO: {fileID: 11400000, guid: e3d476a4d3a88f840ba9668263c66b6c, type: 2}
galgamePrefab: {fileID: 7323059121263764531, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
where_to_put: {fileID: 167834970}
--- !u!4 &167834972
Transform:
m_ObjectHideFlags: 0
@@ -3574,7 +3574,8 @@ Transform:
m_LocalPosition: {x: 2405.392, y: 1088.3488, z: 833.92206}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Children:
- {fileID: 437888250}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &173374970
@@ -10071,9 +10072,9 @@ RectTransform:
- {fileID: 1328532447}
m_Father: {fileID: 590261241}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 81, y: -50}
m_SizeDelta: {x: 162, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &228531561
@@ -10523,9 +10524,9 @@ RectTransform:
- {fileID: 807575964}
m_Father: {fileID: 590261241}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 606, y: -50}
m_SizeDelta: {x: 162, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &247015384
@@ -12175,7 +12176,7 @@ RectTransform:
m_Father: {fileID: 1374351887}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
@@ -12586,9 +12587,9 @@ RectTransform:
m_Children: []
m_Father: {fileID: 1121766410}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 43, y: -50}
m_SizeDelta: {x: 10, y: 12}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &315535051
@@ -14105,9 +14106,9 @@ RectTransform:
- {fileID: 55210105}
m_Father: {fileID: 1181698751}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 50, y: -60.5}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &354769595
@@ -16404,9 +16405,9 @@ RectTransform:
- {fileID: 81893893}
m_Father: {fileID: 1181698751}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 178.88, y: -60.5}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &405968940
@@ -17935,6 +17936,11 @@ Transform:
m_CorrespondingSourceObject: {fileID: 1430437502662273503, guid: 5f0f778a23a4b7343a7cfc40a7d35fc7, type: 3}
m_PrefabInstance: {fileID: 9208846667362070857}
m_PrefabAsset: {fileID: 0}
--- !u!4 &437888250 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2908967551141921026, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
m_PrefabInstance: {fileID: 7930799055938051885}
m_PrefabAsset: {fileID: 0}
--- !u!1 &438137427
GameObject:
m_ObjectHideFlags: 0
@@ -32255,7 +32261,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &874962972
Transform:
m_ObjectHideFlags: 0
@@ -34461,9 +34467,9 @@ RectTransform:
m_Father: {fileID: 725274684}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 20}
m_SizeDelta: {x: -4.44, y: 20}
m_Pivot: {x: 0, y: 0}
--- !u!114 &985131518
MonoBehaviour:
@@ -34688,9 +34694,9 @@ RectTransform:
- {fileID: 841673123}
m_Father: {fileID: 590261241}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 256, y: -50}
m_SizeDelta: {x: 162, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &999995736
@@ -39219,9 +39225,9 @@ RectTransform:
- {fileID: 208898303}
m_Father: {fileID: 425295052}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 50, y: -5}
m_SizeDelta: {x: 100, y: 10}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!4 &1154758974 stripped
@@ -46693,9 +46699,9 @@ RectTransform:
- {fileID: 1740052537}
m_Father: {fileID: 1181698751}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 436.64, y: -60.5}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1454903926
@@ -50897,9 +50903,9 @@ RectTransform:
m_Children: []
m_Father: {fileID: 1121766410}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 24, y: -50}
m_SizeDelta: {x: 10, y: 12}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1628161349
@@ -51436,9 +51442,9 @@ RectTransform:
m_Father: {fileID: 725274684}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_SizeDelta: {x: -4.44, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &1658081545
MonoBehaviour:
@@ -52512,9 +52518,9 @@ RectTransform:
- {fileID: 1461351369}
m_Father: {fileID: 590261241}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 431, y: -50}
m_SizeDelta: {x: 162, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1705000562
@@ -54215,9 +54221,9 @@ RectTransform:
- {fileID: 578526358}
m_Father: {fileID: 425295052}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 50, y: -31.069748}
m_SizeDelta: {x: 100, y: 10}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1771996335
@@ -56793,9 +56799,9 @@ RectTransform:
- {fileID: 616492490}
m_Father: {fileID: 425295052}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 50, y: -44.10462}
m_SizeDelta: {x: 100, y: 10}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1904135294
@@ -59776,9 +59782,9 @@ RectTransform:
m_Children: []
m_Father: {fileID: 1121766410}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 5, y: -50}
m_SizeDelta: {x: 10, y: 12}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2043797911
@@ -67359,6 +67365,79 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1001 &7930799055938051885
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 167834972}
m_Modifications:
- target: {fileID: 2908967551141921026, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2908967551141921026, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2908967551141921026, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2908967551141921026, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2908967551141921026, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2908967551141921026, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2908967551141921026, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2908967551141921026, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2908967551141921026, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2908967551141921026, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3004090556593261747, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
propertyPath: m_AnchoredPosition.y
value: -6.005001
objectReference: {fileID: 0}
- target: {fileID: 7323059121263764531, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
propertyPath: m_Name
value: inGal
objectReference: {fileID: 0}
- target: {fileID: 7323059121263764531, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8228997081257688641, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
propertyPath: m_Camera
value:
objectReference: {fileID: 754533170}
- target: {fileID: 8558459100393576918, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
propertyPath: m_AnchoredPosition.y
value: -6.005001
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 00f0e57cae6a4694e99e3bc9d5d021af, type: 3}
--- !u!222 &8064170404795133453
CanvasRenderer:
m_ObjectHideFlags: 0
@@ -67404,115 +67483,115 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 122756198372604741, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 122756198372604741, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 122756198372604741, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 50
objectReference: {fileID: 0}
- target: {fileID: 122756198372604741, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -108.729996
objectReference: {fileID: 0}
- target: {fileID: 187557561287668015, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 187557561287668015, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 187557561287668015, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 85
objectReference: {fileID: 0}
- target: {fileID: 187557561287668015, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -50
objectReference: {fileID: 0}
- target: {fileID: 412937744056933375, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 412937744056933375, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 412937744056933375, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 17.5
objectReference: {fileID: 0}
- target: {fileID: 412937744056933375, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -50
objectReference: {fileID: 0}
- target: {fileID: 678618177608988214, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 678618177608988214, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 678618177608988214, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 17.5
objectReference: {fileID: 0}
- target: {fileID: 678618177608988214, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -50
objectReference: {fileID: 0}
- target: {fileID: 796738331562133123, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 796738331562133123, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 796738331562133123, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 100
objectReference: {fileID: 0}
- target: {fileID: 796738331562133123, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -53.66
objectReference: {fileID: 0}
- target: {fileID: 1813990329505698292, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1813990329505698292, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1813990329505698292, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 50
objectReference: {fileID: 0}
- target: {fileID: 1813990329505698292, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -25
objectReference: {fileID: 0}
- target: {fileID: 2418429837761252522, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2418429837761252522, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2418429837761252522, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 100
objectReference: {fileID: 0}
- target: {fileID: 2418429837761252522, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -25
objectReference: {fileID: 0}
- target: {fileID: 2613971938742376913, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_Pivot.x
@@ -67528,7 +67607,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2613971938742376913, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2613971938742376913, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.x
@@ -67536,7 +67615,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2613971938742376913, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2613971938742376913, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_SizeDelta.x
@@ -67576,11 +67655,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2613971938742376913, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 50
objectReference: {fileID: 0}
- target: {fileID: 2613971938742376913, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -50
objectReference: {fileID: 0}
- target: {fileID: 2613971938742376913, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@@ -67612,19 +67691,19 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2770405465405990285, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2770405465405990285, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2770405465405990285, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 12.5
objectReference: {fileID: 0}
- target: {fileID: 2770405465405990285, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -50
objectReference: {fileID: 0}
- target: {fileID: 4148755058004053777, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
@@ -67632,35 +67711,35 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4704552103312105881, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4704552103312105881, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4704552103312105881, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 17.5
objectReference: {fileID: 0}
- target: {fileID: 4704552103312105881, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -50
objectReference: {fileID: 0}
- target: {fileID: 4821968732813134168, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4821968732813134168, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4821968732813134168, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 17.5
objectReference: {fileID: 0}
- target: {fileID: 4821968732813134168, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -50
objectReference: {fileID: 0}
- target: {fileID: 4929852368789569139, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
@@ -67680,67 +67759,67 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 5213525157689929386, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5213525157689929386, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5213525157689929386, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 50
objectReference: {fileID: 0}
- target: {fileID: 5213525157689929386, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -80.82
objectReference: {fileID: 0}
- target: {fileID: 5278958300364593933, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5278958300364593933, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5278958300364593933, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 50
objectReference: {fileID: 0}
- target: {fileID: 5278958300364593933, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -52.91
objectReference: {fileID: 0}
- target: {fileID: 6349925019039213472, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6349925019039213472, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6349925019039213472, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 85
objectReference: {fileID: 0}
- target: {fileID: 6349925019039213472, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -50
objectReference: {fileID: 0}
- target: {fileID: 6354168271256631497, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6354168271256631497, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6354168271256631497, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 85
objectReference: {fileID: 0}
- target: {fileID: 6354168271256631497, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -50
objectReference: {fileID: 0}
- target: {fileID: 6494845825576441926, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_LocalPosition.z
@@ -67764,19 +67843,19 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 6964822682335917845, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6964822682335917845, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6964822682335917845, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 84.55
objectReference: {fileID: 0}
- target: {fileID: 6964822682335917845, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -50
objectReference: {fileID: 0}
- target: {fileID: 7228302987943925696, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.x
@@ -67804,19 +67883,19 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 7489680557431120668, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7489680557431120668, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7489680557431120668, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 84.55
objectReference: {fileID: 0}
- target: {fileID: 7489680557431120668, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -50
objectReference: {fileID: 0}
- target: {fileID: 7889622464149315732, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_IsActive
@@ -67824,19 +67903,19 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 8162043787242817865, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8162043787242817865, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8162043787242817865, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 85
objectReference: {fileID: 0}
- target: {fileID: 8162043787242817865, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -50
objectReference: {fileID: 0}
- target: {fileID: 8281064337243533176, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
@@ -67856,19 +67935,19 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 8790025443345388889, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8790025443345388889, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8790025443345388889, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 12.5
objectReference: {fileID: 0}
- target: {fileID: 8790025443345388889, guid: 83349f645e9e9764ab6c8c66e5b107a3, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -50
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
@@ -0,0 +1,470 @@
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Experimental.GraphView;
using UnityEditor.UIElements;
using UnityEngine;
using UnityEngine.UIElements;
using System.Collections.Generic;
public class IngameGalgameGraphWindow : EditorWindow
{
private ingame_galgame_so currentSo;
private IngameGalgameGraphView graphView;
private ObjectField soField;
public static void Open(ingame_galgame_so so)
{
var window = GetWindow<IngameGalgameGraphWindow>("Galgame 蓝图");
window.Show();
window.SetSo(so);
}
private void OnEnable()
{
CreateGraphView();
CreateToolbar();
if (currentSo == null)
{
currentSo = Selection.activeObject as ingame_galgame_so;
}
SetSo(currentSo);
}
private void OnDisable()
{
rootVisualElement.Clear();
graphView = null;
}
private void CreateGraphView()
{
graphView = new IngameGalgameGraphView();
graphView.StretchToParentSize();
rootVisualElement.Add(graphView);
}
private void CreateToolbar()
{
var toolbar = new Toolbar();
var addBtn = new ToolbarButton(() => graphView?.CreateNodeAt(graphView.GetDefaultNodePosition())) { text = "+" };
var delBtn = new ToolbarButton(() => graphView?.DeleteSelected()) { text = "-" };
toolbar.Add(addBtn);
toolbar.Add(delBtn);
soField = new ObjectField("数据") { objectType = typeof(ingame_galgame_so), allowSceneObjects = false };
soField.RegisterValueChangedCallback(evt => SetSo(evt.newValue as ingame_galgame_so));
toolbar.Add(soField);
var refreshBtn = new ToolbarButton(RefreshGraph) { text = "刷新" };
toolbar.Add(refreshBtn);
rootVisualElement.Add(toolbar);
}
private void SetSo(ingame_galgame_so so)
{
currentSo = so;
if (soField != null && soField.value != so)
{
soField.SetValueWithoutNotify(so);
}
RefreshGraph();
}
private void RefreshGraph()
{
if (graphView == null) return;
graphView.Build(currentSo);
}
}
class IngameGalgameGraphView : GraphView
{
private ingame_galgame_so currentSo;
public IngameGalgameGraphView()
{
this.AddManipulator(new ContentZoomer());
this.AddManipulator(new ContentDragger());
this.AddManipulator(new SelectionDragger());
this.AddManipulator(new RectangleSelector());
var grid = new GridBackground();
Insert(0, grid);
grid.StretchToParentSize();
SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);
RegisterCallback<KeyDownEvent>(OnKeyDown);
}
public void Build(ingame_galgame_so so)
{
ClearGraph();
currentSo = so;
if (so == null) return;
var serialized = new SerializedObject(so);
var dialogueList = serialized.FindProperty("dialogueList");
if (dialogueList == null || !dialogueList.isArray) return;
var speakerNames = BuildSpeakerNames(serialized);
DialogueTextNode prev = null;
for (int i = 0; i < dialogueList.arraySize; i++)
{
var elemProp = dialogueList.GetArrayElementAtIndex(i);
var positionTagProp = elemProp.FindPropertyRelative("positionTag");
var textListProp = elemProp.FindPropertyRelative("textList");
if (textListProp == null || !textListProp.isArray) continue;
for (int j = 0; j < textListProp.arraySize; j++)
{
var textProp = textListProp.GetArrayElementAtIndex(j);
var node = CreateTextNode(serialized, positionTagProp, textProp, speakerNames, i, j);
node.SetPosition(new Rect(80 + i * 420, 80 + j * 260, 360, 220));
AddElement(node);
if (prev != null)
{
var edge = prev.output.ConnectTo(node.input);
AddElement(edge);
}
prev = node;
}
}
}
private void ClearGraph()
{
var toRemove = new List<GraphElement>();
foreach (var element in graphElements)
{
toRemove.Add(element);
}
DeleteElements(toRemove);
}
private DialogueTextNode CreateTextNode(SerializedObject so, SerializedProperty positionTagProp, SerializedProperty textProp, string[] speakerNames, int elemIndex, int textIndex)
{
var node = new DialogueTextNode();
node.title = $"段落 {elemIndex + 1} / 文本 {textIndex + 1}";
node.elementIndex = elemIndex;
node.textIndex = textIndex;
node.input = node.InstantiatePort(Orientation.Horizontal, Direction.Input, Port.Capacity.Multi, typeof(float));
node.input.portName = "输入";
node.output = node.InstantiatePort(Orientation.Horizontal, Direction.Output, Port.Capacity.Single, typeof(float));
node.output.portName = "输出";
node.inputContainer.Add(node.input);
node.outputContainer.Add(node.output);
if (positionTagProp != null)
{
var field = new PropertyField(positionTagProp, "位置标签");
field.Bind(so);
node.extensionContainer.Add(field);
}
AddTextField(node, so, textProp.FindPropertyRelative("content"), "内容");
AddIntPopup(node, so, textProp.FindPropertyRelative("senderIndex"), speakerNames);
AddField(node, so, textProp.FindPropertyRelative("imagePos"), "图片位置");
AddField(node, so, textProp.FindPropertyRelative("flipX"), "水平翻转");
AddField(node, so, textProp.FindPropertyRelative("appearTime"), "出现时间");
AddField(node, so, textProp.FindPropertyRelative("duration"), "持续时间");
AddField(node, so, textProp.FindPropertyRelative("stepMethod"), "步进方式");
AddField(node, so, textProp.FindPropertyRelative("timeAction"), "时间动作");
AddField(node, so, textProp.FindPropertyRelative("slowMotionScale"), "慢动作倍率");
AddField(node, so, textProp.FindPropertyRelative("endAction"), "结束动作");
node.RefreshExpandedState();
node.RefreshPorts();
return node;
}
private void AddTextField(Node node, SerializedObject so, SerializedProperty prop, string label)
{
if (prop == null) return;
var field = new PropertyField(prop, label);
field.Bind(so);
node.extensionContainer.Add(field);
}
private void AddField(Node node, SerializedObject so, SerializedProperty prop, string label)
{
if (prop == null) return;
var field = new PropertyField(prop, label);
field.Bind(so);
node.extensionContainer.Add(field);
}
private void AddIntPopup(Node node, SerializedObject so, SerializedProperty senderIndexProp, string[] speakerNames)
{
if (senderIndexProp == null) return;
if (speakerNames == null || speakerNames.Length == 0)
{
AddField(node, so, senderIndexProp, "发言者索引");
return;
}
var imgui = new IMGUIContainer(() =>
{
so.Update();
int current = Mathf.Clamp(senderIndexProp.intValue + 1, 0, speakerNames.Length - 1);
int chosen = EditorGUILayout.Popup("发言者", current, speakerNames);
senderIndexProp.intValue = Mathf.Max(-1, chosen - 1);
so.ApplyModifiedProperties();
});
node.extensionContainer.Add(imgui);
}
private string[] BuildSpeakerNames(SerializedObject so)
{
var speakersDataSOProp = so.FindProperty("speakersDataSO");
if (speakersDataSOProp == null || speakersDataSOProp.objectReferenceValue == null) return null;
var speakersSO = new SerializedObject(speakersDataSOProp.objectReferenceValue);
var speakersList = speakersSO.FindProperty("speakers");
if (speakersList == null || !speakersList.isArray) return null;
int c = speakersList.arraySize;
var names = new string[c + 1];
names[0] = "(无)";
for (int i = 0; i < c; i++)
{
var e = speakersList.GetArrayElementAtIndex(i);
var nameProp = e.FindPropertyRelative("spkrName");
names[i + 1] = nameProp != null ? nameProp.stringValue : $"Speaker {i}";
}
return names;
}
public Vector2 GetDefaultNodePosition()
{
var worldCenter = new Vector2(layout.xMin + layout.width * 0.5f, layout.yMin + layout.height * 0.5f);
return contentViewContainer.WorldToLocal(worldCenter);
}
public void CreateNodeAt(Vector2 position)
{
if (currentSo == null) return;
Undo.RecordObject(currentSo, "Create Dialogue Node");
var so = new SerializedObject(currentSo);
var dialogueList = so.FindProperty("dialogueList");
if (dialogueList == null) return;
int elemIndex = dialogueList.arraySize;
dialogueList.arraySize++;
var elemProp = dialogueList.GetArrayElementAtIndex(elemIndex);
if (elemProp != null)
{
var positionTagProp = elemProp.FindPropertyRelative("positionTag");
if (positionTagProp != null) positionTagProp.enumValueIndex = 0;
var textListProp = elemProp.FindPropertyRelative("textList");
if (textListProp != null)
{
textListProp.arraySize = 1;
var textProp = textListProp.GetArrayElementAtIndex(0);
ApplyTextDefaults(textProp);
}
}
so.ApplyModifiedProperties();
EditorUtility.SetDirty(currentSo);
Build(currentSo);
}
public void DeleteSelected()
{
if (currentSo == null) return;
var selectedNodes = new List<DialogueTextNode>();
foreach (var e in selection)
{
if (e is DialogueTextNode n) selectedNodes.Add(n);
}
if (selectedNodes.Count == 0) return;
selectedNodes.Sort((a, b) =>
{
int c = b.elementIndex.CompareTo(a.elementIndex);
return c != 0 ? c : b.textIndex.CompareTo(a.textIndex);
});
Undo.RecordObject(currentSo, "Delete Dialogue Node");
var so = new SerializedObject(currentSo);
var dialogueList = so.FindProperty("dialogueList");
if (dialogueList == null) return;
foreach (var node in selectedNodes)
{
if (node.elementIndex < 0 || node.elementIndex >= dialogueList.arraySize) continue;
var elemProp = dialogueList.GetArrayElementAtIndex(node.elementIndex);
if (elemProp == null) continue;
var textListProp = elemProp.FindPropertyRelative("textList");
if (textListProp == null) continue;
if (node.textIndex >= 0 && node.textIndex < textListProp.arraySize)
{
textListProp.DeleteArrayElementAtIndex(node.textIndex);
}
if (textListProp.arraySize <= 0)
{
dialogueList.DeleteArrayElementAtIndex(node.elementIndex);
}
}
so.ApplyModifiedProperties();
EditorUtility.SetDirty(currentSo);
Build(currentSo);
}
public override void BuildContextualMenu(ContextualMenuPopulateEvent evt)
{
evt.menu.AppendAction("新建节点", _ => CreateNodeAt(evt.localMousePosition));
bool hasSelection = false;
foreach (var e in selection)
{
if (e is DialogueTextNode) { hasSelection = true; break; }
}
evt.menu.AppendAction("删除所选", _ => DeleteSelected(), hasSelection ? DropdownMenuAction.Status.Normal : DropdownMenuAction.Status.Disabled);
}
private void OnKeyDown(KeyDownEvent evt)
{
if (evt.ctrlKey && evt.keyCode == KeyCode.C)
{
EditorGUIUtility.systemCopyBuffer = SerializeSelection();
evt.StopPropagation();
}
else if (evt.ctrlKey && evt.keyCode == KeyCode.V)
{
PasteFromClipboard();
evt.StopPropagation();
}
else if (evt.keyCode == KeyCode.Delete || evt.keyCode == KeyCode.Backspace)
{
DeleteSelected();
evt.StopPropagation();
}
}
private string SerializeSelection()
{
if (currentSo == null) return string.Empty;
var payload = new DialogueCopyPayload();
var so = new SerializedObject(currentSo);
var dialogueList = so.FindProperty("dialogueList");
foreach (var e in selection)
{
if (e is not DialogueTextNode node) continue;
if (dialogueList == null) continue;
if (node.elementIndex < 0 || node.elementIndex >= dialogueList.arraySize) continue;
var elemProp = dialogueList.GetArrayElementAtIndex(node.elementIndex);
if (elemProp == null) continue;
var positionTagProp = elemProp.FindPropertyRelative("positionTag");
var textListProp = elemProp.FindPropertyRelative("textList");
if (textListProp == null) continue;
if (node.textIndex < 0 || node.textIndex >= textListProp.arraySize) continue;
var textProp = textListProp.GetArrayElementAtIndex(node.textIndex);
if (textProp == null) continue;
var data = new DialogueTextCopyData();
data.positionTag = positionTagProp != null ? positionTagProp.enumValueIndex : 0;
data.content = textProp.FindPropertyRelative("content")?.stringValue;
data.textNumber = textProp.FindPropertyRelative("textNumber")?.intValue ?? 0;
data.senderIndex = textProp.FindPropertyRelative("senderIndex")?.intValue ?? -1;
data.imagePos = textProp.FindPropertyRelative("imagePos")?.enumValueIndex ?? 0;
data.flipX = textProp.FindPropertyRelative("flipX")?.boolValue ?? false;
data.appearTime = textProp.FindPropertyRelative("appearTime")?.floatValue ?? 0f;
data.duration = textProp.FindPropertyRelative("duration")?.floatValue ?? 0f;
data.stepMethod = textProp.FindPropertyRelative("stepMethod")?.enumValueIndex ?? 0;
data.timeAction = textProp.FindPropertyRelative("timeAction")?.enumValueIndex ?? 0;
data.slowMotionScale = textProp.FindPropertyRelative("slowMotionScale")?.floatValue ?? 0f;
data.endAction = textProp.FindPropertyRelative("endAction")?.enumValueIndex ?? 0;
payload.items.Add(data);
}
return payload.items.Count == 0 ? string.Empty : JsonUtility.ToJson(payload);
}
private bool CanPasteDataInternal(string serializedData)
{
if (string.IsNullOrEmpty(serializedData)) return false;
var payload = JsonUtility.FromJson<DialogueCopyPayload>(serializedData);
return payload != null && payload.items != null && payload.items.Count > 0;
}
private void PasteFromClipboard()
{
if (currentSo == null) return;
var serializedData = EditorGUIUtility.systemCopyBuffer;
if (!CanPasteDataInternal(serializedData)) return;
var payload = JsonUtility.FromJson<DialogueCopyPayload>(serializedData);
if (payload == null || payload.items == null || payload.items.Count == 0) return;
Undo.RecordObject(currentSo, "Paste Dialogue Node");
var so = new SerializedObject(currentSo);
var dialogueList = so.FindProperty("dialogueList");
if (dialogueList == null) return;
foreach (var item in payload.items)
{
int elemIndex = dialogueList.arraySize;
dialogueList.arraySize++;
var elemProp = dialogueList.GetArrayElementAtIndex(elemIndex);
if (elemProp == null) continue;
var positionTagProp = elemProp.FindPropertyRelative("positionTag");
if (positionTagProp != null) positionTagProp.enumValueIndex = item.positionTag;
var textListProp = elemProp.FindPropertyRelative("textList");
if (textListProp != null)
{
textListProp.arraySize = 1;
var textProp = textListProp.GetArrayElementAtIndex(0);
ApplyTextData(textProp, item);
}
}
so.ApplyModifiedProperties();
EditorUtility.SetDirty(currentSo);
Build(currentSo);
}
private void ApplyTextDefaults(SerializedProperty textProp)
{
if (textProp == null) return;
textProp.FindPropertyRelative("content").stringValue = string.Empty;
textProp.FindPropertyRelative("textNumber").intValue = 1;
textProp.FindPropertyRelative("senderIndex").intValue = -1;
textProp.FindPropertyRelative("imagePos").enumValueIndex = 0;
var flipXProp = textProp.FindPropertyRelative("flipX");
if (flipXProp != null) flipXProp.boolValue = false;
textProp.FindPropertyRelative("appearTime").floatValue = 0f;
textProp.FindPropertyRelative("duration").floatValue = 0f;
textProp.FindPropertyRelative("stepMethod").enumValueIndex = 0;
textProp.FindPropertyRelative("timeAction").enumValueIndex = 0;
textProp.FindPropertyRelative("slowMotionScale").floatValue = 0f;
textProp.FindPropertyRelative("endAction").enumValueIndex = 0;
}
private void ApplyTextData(SerializedProperty textProp, DialogueTextCopyData data)
{
if (textProp == null || data == null) return;
textProp.FindPropertyRelative("content").stringValue = data.content ?? string.Empty;
textProp.FindPropertyRelative("textNumber").intValue = data.textNumber;
textProp.FindPropertyRelative("senderIndex").intValue = data.senderIndex;
textProp.FindPropertyRelative("imagePos").enumValueIndex = data.imagePos;
var flipXProp = textProp.FindPropertyRelative("flipX");
if (flipXProp != null) flipXProp.boolValue = data.flipX;
textProp.FindPropertyRelative("appearTime").floatValue = data.appearTime;
textProp.FindPropertyRelative("duration").floatValue = data.duration;
textProp.FindPropertyRelative("stepMethod").enumValueIndex = data.stepMethod;
textProp.FindPropertyRelative("timeAction").enumValueIndex = data.timeAction;
textProp.FindPropertyRelative("slowMotionScale").floatValue = data.slowMotionScale;
textProp.FindPropertyRelative("endAction").enumValueIndex = data.endAction;
}
[System.Serializable]
private class DialogueTextCopyData
{
public int positionTag;
public string content;
public int textNumber;
public int senderIndex;
public int imagePos;
public bool flipX;
public float appearTime;
public float duration;
public int stepMethod;
public int timeAction;
public float slowMotionScale;
public int endAction;
}
[System.Serializable]
private class DialogueCopyPayload
{
public List<DialogueTextCopyData> items = new List<DialogueTextCopyData>();
}
}
class DialogueTextNode : Node
{
public Port input;
public Port output;
public int elementIndex;
public int textIndex;
}
#endif
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5d28dfb6d5ec60d4590e7d1b15af33fb
@@ -1,6 +1,9 @@
#if UNITY_EDITOR
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
using System.Collections.Generic;
using System.Reflection;
[CustomEditor(typeof(ScriptableObject), true)]
public class ingame_galgame_so_Editor : Editor
@@ -11,6 +14,28 @@ public class ingame_galgame_so_Editor : Editor
private SerializedProperty speakersDataSOProp;
private SerializedProperty dialogueListProp;
private ReorderableList dialogueListRl;
private readonly Dictionary<string, ReorderableList> textListRlMap = new Dictionary<string, ReorderableList>();
private string[] speakerNames;
private readonly GUIContent labelDialogueType = new GUIContent("对话类型");
private readonly GUIContent labelTriggerMethod = new GUIContent("触发方式");
private readonly GUIContent labelTimelineStandard = new GUIContent("时间线基准");
private readonly GUIContent labelSpeakers = new GUIContent("角色数据");
private readonly GUIContent labelPositionTag = new GUIContent("位置标签");
private readonly GUIContent labelContent = new GUIContent("内容");
private readonly GUIContent labelTextNumber = new GUIContent("文本序号");
private readonly GUIContent labelSender = new GUIContent("发言者");
private readonly GUIContent labelSenderIndex = new GUIContent("发言者索引");
private readonly GUIContent labelImagePos = new GUIContent("图片位置");
private readonly GUIContent labelFlipX = new GUIContent("水平翻转");
private readonly GUIContent labelAppearTime = new GUIContent("出现时间");
private readonly GUIContent labelDuration = new GUIContent("持续时间");
private readonly GUIContent labelStepMethod = new GUIContent("步进方式");
private readonly GUIContent labelTimeAction = new GUIContent("时间动作");
private readonly GUIContent labelSlowMotionScale = new GUIContent("慢动作倍率");
private readonly GUIContent labelEndAction = new GUIContent("结束动作");
private void OnEnable()
{
if (target != null && target.GetType().Name == "ingame_galgame_so")
@@ -21,6 +46,8 @@ public class ingame_galgame_so_Editor : Editor
speakersDataSOProp = serializedObject.FindProperty("speakersDataSO");
dialogueListProp = serializedObject.FindProperty("dialogueList");
}
dialogueListRl = null;
textListRlMap.Clear();
}
public override void OnInspectorGUI()
@@ -33,192 +60,232 @@ public class ingame_galgame_so_Editor : Editor
serializedObject.Update();
EnsureProperties();
BuildSpeakerNames();
if (dialogueTypeProp != null) EditorGUILayout.PropertyField(dialogueTypeProp);
if (triggerMethodProp != null) EditorGUILayout.PropertyField(triggerMethodProp);
if (timelineStandardProp != null) EditorGUILayout.PropertyField(timelineStandardProp);
if (speakersDataSOProp != null) EditorGUILayout.PropertyField(speakersDataSOProp);
DrawGlobalSection();
DrawDialogueSection();
EditorGUILayout.Space();
EditorGUILayout.LabelField("Dialogue List", EditorStyles.boldLabel);
serializedObject.ApplyModifiedProperties();
}
// speaker dropdown data
string[] speakerNames = null;
Object speakersObj = speakersDataSOProp != null ? speakersDataSOProp.objectReferenceValue : null;
if (speakersObj != null)
private void DrawGlobalSection()
{
EditorGUILayout.BeginVertical("box");
EditorGUILayout.LabelField("全局配置", EditorStyles.boldLabel);
if (dialogueTypeProp != null) EditorGUILayout.PropertyField(dialogueTypeProp, labelDialogueType);
if (triggerMethodProp != null) EditorGUILayout.PropertyField(triggerMethodProp, labelTriggerMethod);
if (timelineStandardProp != null) EditorGUILayout.PropertyField(timelineStandardProp, labelTimelineStandard);
if (speakersDataSOProp != null) EditorGUILayout.PropertyField(speakersDataSOProp, labelSpeakers);
if (GUILayout.Button("打开蓝图视图"))
{
var speakersSO = new SerializedObject(speakersObj);
var speakersList = speakersSO.FindProperty("speakers");
if (speakersList != null && speakersList.isArray)
{
int c = speakersList.arraySize;
speakerNames = new string[c + 1];
speakerNames[0] = "(None)";
for (int i = 0; i < c; i++)
{
var e = speakersList.GetArrayElementAtIndex(i);
var nameProp = e.FindPropertyRelative("spkrName");
speakerNames[i + 1] =
nameProp != null ? nameProp.stringValue : $"Speaker {i}";
}
}
var t = typeof(ingame_galgame_so_Editor).Assembly.GetType("IngameGalgameGraphWindow");
var m = t != null ? t.GetMethod("Open", BindingFlags.Public | BindingFlags.Static) : null;
if (m != null) m.Invoke(null, new object[] { target as ingame_galgame_so });
}
EditorGUILayout.EndVertical();
}
private void DrawDialogueSection()
{
if (dialogueListProp == null)
{
serializedObject.ApplyModifiedProperties();
return;
}
// ===== DRAW ELEMENTS =====
EnsureDialogueList();
EditorGUILayout.BeginVertical("box");
dialogueListRl.DoLayoutList();
EditorGUILayout.EndVertical();
}
for (int i = 0; i < dialogueListProp.arraySize; i++)
private void EnsureDialogueList()
{
if (dialogueListRl != null && dialogueListRl.serializedProperty == dialogueListProp) return;
dialogueListRl = new ReorderableList(serializedObject, dialogueListProp, true, true, true, true);
dialogueListRl.drawHeaderCallback = rect => EditorGUI.LabelField(rect, "对话列表");
dialogueListRl.elementHeightCallback = index =>
{
var elemProp = dialogueListProp.GetArrayElementAtIndex(i);
EditorGUILayout.BeginHorizontal();
elemProp.isExpanded =
EditorGUILayout.Foldout(elemProp.isExpanded, $"Element {i}", true);
// Move up
GUI.enabled = i > 0;
if (GUILayout.Button("Up", GUILayout.Width(32)))
var elemProp = dialogueListProp.GetArrayElementAtIndex(index);
float line = EditorGUIUtility.singleLineHeight;
float space = EditorGUIUtility.standardVerticalSpacing;
float h = line + space;
if (elemProp != null && elemProp.isExpanded)
{
dialogueListProp.MoveArrayElement(i, i - 1);
}
// Move down
GUI.enabled = i < dialogueListProp.arraySize - 1;
if (GUILayout.Button("Down", GUILayout.Width(42)))
{
dialogueListProp.MoveArrayElement(i, i + 1);
}
GUI.enabled = true;
// Duplicate
if (GUILayout.Button("D", GUILayout.Width(25)))
{
dialogueListProp.InsertArrayElementAtIndex(i);
}
// Delete
GUI.color = Color.red;
if (GUILayout.Button("X", GUILayout.Width(25)))
{
if (EditorUtility.DisplayDialog(
"Delete Element",
"Are you sure you want to delete this element?",
"Delete",
"Cancel"))
var positionTagProp = elemProp.FindPropertyRelative("positionTag");
if (positionTagProp != null) h += EditorGUI.GetPropertyHeight(positionTagProp, true) + space;
var textListProp = elemProp.FindPropertyRelative("textList");
if (textListProp != null)
{
dialogueListProp.DeleteArrayElementAtIndex(i);
break;
var rl = GetTextList(textListProp);
if (rl != null) h += rl.GetHeight() + space;
}
}
GUI.color = Color.white;
EditorGUILayout.EndHorizontal();
if (!elemProp.isExpanded)
continue;
return h;
};
dialogueListRl.drawElementCallback = (rect, index, isActive, isFocused) =>
{
var elemProp = dialogueListProp.GetArrayElementAtIndex(index);
if (elemProp == null) return;
float line = EditorGUIUtility.singleLineHeight;
float space = EditorGUIUtility.standardVerticalSpacing;
Rect r = rect;
r.height = line;
elemProp.isExpanded = EditorGUI.Foldout(r, elemProp.isExpanded, $"段落 {index + 1}", true);
if (!elemProp.isExpanded) return;
r.y += line + space;
EditorGUI.indentLevel++;
var positionTagProp = elemProp.FindPropertyRelative("positionTag");
if (positionTagProp != null)
{
EditorGUILayout.PropertyField(positionTagProp);
EditorGUI.PropertyField(r, positionTagProp, labelPositionTag);
r.y += line + space;
}
var textListProp = elemProp.FindPropertyRelative("textList");
if (textListProp != null)
{
var rl = GetTextList(textListProp);
if (rl != null)
{
r.height = rl.GetHeight();
rl.DoList(r);
}
}
EditorGUI.indentLevel--;
};
}
private ReorderableList GetTextList(SerializedProperty textListProp)
{
if (textListProp == null) return null;
string key = textListProp.propertyPath;
if (!textListRlMap.TryGetValue(key, out var rl) || rl.serializedProperty != textListProp)
{
rl = new ReorderableList(serializedObject, textListProp, true, true, true, true);
rl.drawHeaderCallback = rect => EditorGUI.LabelField(rect, "文本列表");
rl.elementHeightCallback = index =>
{
var textProp = textListProp.GetArrayElementAtIndex(index);
return GetTextElementHeight(textProp);
};
rl.drawElementCallback = (rect, index, isActive, isFocused) =>
{
var textProp = textListProp.GetArrayElementAtIndex(index);
DrawTextElement(rect, textProp);
};
textListRlMap[key] = rl;
}
return rl;
}
private float GetTextElementHeight(SerializedProperty textProp)
{
if (textProp == null) return EditorGUIUtility.singleLineHeight;
float space = EditorGUIUtility.standardVerticalSpacing;
float h = 0f;
float padding = 4f;
SerializedProperty prop;
prop = textProp.FindPropertyRelative("content"); if (prop != null) h += EditorGUI.GetPropertyHeight(prop, true) + space;
prop = textProp.FindPropertyRelative("textNumber"); if (prop != null) h += EditorGUI.GetPropertyHeight(prop, true) + space;
prop = textProp.FindPropertyRelative("senderIndex"); if (prop != null) h += EditorGUI.GetPropertyHeight(prop, true) + space;
prop = textProp.FindPropertyRelative("imagePos"); if (prop != null) h += EditorGUI.GetPropertyHeight(prop, true) + space;
prop = textProp.FindPropertyRelative("flipX"); if (prop != null) h += EditorGUI.GetPropertyHeight(prop, true) + space;
prop = textProp.FindPropertyRelative("appearTime"); if (prop != null) h += EditorGUI.GetPropertyHeight(prop, true) + space;
prop = textProp.FindPropertyRelative("duration"); if (prop != null) h += EditorGUI.GetPropertyHeight(prop, true) + space;
prop = textProp.FindPropertyRelative("stepMethod"); if (prop != null) h += EditorGUI.GetPropertyHeight(prop, true) + space;
prop = textProp.FindPropertyRelative("timeAction"); if (prop != null) h += EditorGUI.GetPropertyHeight(prop, true) + space;
prop = textProp.FindPropertyRelative("slowMotionScale"); if (prop != null) h += EditorGUI.GetPropertyHeight(prop, true) + space;
prop = textProp.FindPropertyRelative("endAction"); if (prop != null) h += EditorGUI.GetPropertyHeight(prop, true) + space;
return h + padding * 2f;
}
private void DrawTextElement(Rect rect, SerializedProperty textProp)
{
if (textProp == null) return;
float line = EditorGUIUtility.singleLineHeight;
float space = EditorGUIUtility.standardVerticalSpacing;
float padding = 4f;
Rect r = rect;
r.y += padding;
var contentProp = textProp.FindPropertyRelative("content");
var textNumberProp = textProp.FindPropertyRelative("textNumber");
var senderIndexProp = textProp.FindPropertyRelative("senderIndex");
var imagePosProp = textProp.FindPropertyRelative("imagePos");
var flipXProp = textProp.FindPropertyRelative("flipX");
var appearTimeProp = textProp.FindPropertyRelative("appearTime");
var durationProp = textProp.FindPropertyRelative("duration");
var stepMethodProp = textProp.FindPropertyRelative("stepMethod");
var timeActionProp = textProp.FindPropertyRelative("timeAction");
var slowMotionProp = textProp.FindPropertyRelative("slowMotionScale");
var endActionProp = textProp.FindPropertyRelative("endAction");
if (contentProp != null)
{
r.height = EditorGUI.GetPropertyHeight(contentProp, true);
EditorGUI.PropertyField(r, contentProp, labelContent, true);
r.y += r.height + space;
}
r.height = line;
if (textNumberProp != null) EditorGUI.PropertyField(r, textNumberProp, labelTextNumber);
r.y += line + space;
if (senderIndexProp != null)
{
if (speakerNames != null && speakerNames.Length > 0)
{
int current = Mathf.Clamp(senderIndexProp.intValue + 1, 0, speakerNames.Length - 1);
int chosen = EditorGUI.Popup(r, "发言者", current, speakerNames);
senderIndexProp.intValue = Mathf.Max(-1, chosen - 1);
}
else
{
var customPosProp = elemProp.FindPropertyRelative("customPositions");
if (customPosProp != null) EditorGUILayout.PropertyField(customPosProp, true);
EditorGUI.PropertyField(r, senderIndexProp, labelSenderIndex);
}
var textListProp = elemProp.FindPropertyRelative("textList");
if (textListProp != null)
{
EditorGUILayout.LabelField("Texts", EditorStyles.boldLabel);
for (int j = 0; j < textListProp.arraySize; j++)
{
var textProp = textListProp.GetArrayElementAtIndex(j);
if (textProp == null)
continue;
textProp.isExpanded =
EditorGUILayout.Foldout(textProp.isExpanded, $"Text {j}");
if (!textProp.isExpanded)
continue;
EditorGUI.indentLevel++;
var contentProp = textProp.FindPropertyRelative("content");
var textNumberProp = textProp.FindPropertyRelative("textNumber");
var senderIndexProp = textProp.FindPropertyRelative("senderIndex");
var imagePosProp = textProp.FindPropertyRelative("imagePos");
var appearTimeProp = textProp.FindPropertyRelative("appearTime");
var durationProp = textProp.FindPropertyRelative("duration");
var stepMethodProp = textProp.FindPropertyRelative("stepMethod");
var timeActionProp = textProp.FindPropertyRelative("timeAction");
var slowMotionProp = textProp.FindPropertyRelative("slowMotionScale");
var endActionProp = textProp.FindPropertyRelative("endAction");
EditorGUILayout.PropertyField(contentProp);
EditorGUILayout.PropertyField(textNumberProp);
if (speakerNames != null)
{
int current =
Mathf.Clamp(senderIndexProp.intValue + 1, 0, speakerNames.Length - 1);
int chosen =
EditorGUILayout.Popup("Sender", current, speakerNames);
senderIndexProp.intValue =
Mathf.Max(-1, chosen - 1);
}
else
{
EditorGUILayout.PropertyField(senderIndexProp);
}
EditorGUILayout.PropertyField(imagePosProp);
EditorGUILayout.PropertyField(appearTimeProp);
EditorGUILayout.PropertyField(durationProp);
EditorGUILayout.PropertyField(stepMethodProp);
EditorGUILayout.PropertyField(timeActionProp);
EditorGUILayout.PropertyField(slowMotionProp);
EditorGUILayout.PropertyField(endActionProp);
EditorGUI.indentLevel--;
EditorGUILayout.Space();
}
}
EditorGUI.indentLevel--;
EditorGUILayout.Space();
r.y += line + space;
}
EditorGUILayout.Space();
if (imagePosProp != null) EditorGUI.PropertyField(r, imagePosProp, labelImagePos);
r.y += line + space;
if (GUILayout.Button("Add Dialogue Element"))
if (flipXProp != null) EditorGUI.PropertyField(r, flipXProp, labelFlipX);
r.y += line + space;
if (appearTimeProp != null) EditorGUI.PropertyField(r, appearTimeProp, labelAppearTime);
r.y += line + space;
if (durationProp != null) EditorGUI.PropertyField(r, durationProp, labelDuration);
r.y += line + space;
if (stepMethodProp != null) EditorGUI.PropertyField(r, stepMethodProp, labelStepMethod);
r.y += line + space;
if (timeActionProp != null) EditorGUI.PropertyField(r, timeActionProp, labelTimeAction);
r.y += line + space;
if (slowMotionProp != null) EditorGUI.PropertyField(r, slowMotionProp, labelSlowMotionScale);
r.y += line + space;
if (endActionProp != null) EditorGUI.PropertyField(r, endActionProp, labelEndAction);
}
private void BuildSpeakerNames()
{
speakerNames = null;
Object speakersObj = speakersDataSOProp != null ? speakersDataSOProp.objectReferenceValue : null;
if (speakersObj == null) return;
var speakersSO = new SerializedObject(speakersObj);
var speakersList = speakersSO.FindProperty("speakers");
if (speakersList == null || !speakersList.isArray) return;
int c = speakersList.arraySize;
speakerNames = new string[c + 1];
speakerNames[0] = "(无)";
for (int i = 0; i < c; i++)
{
dialogueListProp.InsertArrayElementAtIndex(dialogueListProp.arraySize);
var e = speakersList.GetArrayElementAtIndex(i);
var nameProp = e.FindPropertyRelative("spkrName");
speakerNames[i + 1] = nameProp != null ? nameProp.stringValue : $"Speaker {i}";
}
serializedObject.ApplyModifiedProperties();
}
private void EnsureProperties()
+76
View File
@@ -0,0 +1,76 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class galPrefab : MonoBehaviour
{
[Header("NowUsing")]
[SerializeField] private int nowUsing = 0; // 0: none, 1: RoleHost, 2: RoleHint, 3: Narration, 4: HintOrLyrics
[Header("publics")]
public Color defaultTextColor;
[Header("mode1: RoleHost")]
public Image roleHostBGbar;
public Image L_roleHostImage;
public Image R_roleHosetImage;
public TextMeshProUGUI roleHostName;
public TextMeshProUGUI roleHostMessage;
public Button host_nextButton;
[Header("mode2: RoleHint")]
public Image roleHintBGbar;
public Image roleHintImage;
public TextMeshProUGUI roleHintName;
public TextMeshProUGUI roleHintMessage;
public Button hint_nextButton;
[Header("mode3: Narration")]
public Image narrationBGbar;
public TextMeshProUGUI narrationMessage;
[Header("mode4: HintOrLyrics")]
public Image hintOrLyricsBGbar;
public TextMeshProUGUI hintOrLyricsMessage;
[Header("fathers of 4modes")]
public GameObject roleHostFather;
public GameObject roleHintFather;
public GameObject narrationFather;
public GameObject hintOrLyricsFather;
private void Start()
{
// Try to find cameras from Camera.allCameras first
Camera foundCamera = null;
Camera[] cameras = Camera.allCameras;
if (cameras != null && cameras.Length > 0)
{
foundCamera = cameras[0];
}
else
{
Camera[] camObjs = FindObjectsOfType<Camera>();
if (camObjs != null && camObjs.Length > 0)
{
foundCamera = camObjs[0];
}
camObjs = null; // release temporary reference
}
if (foundCamera == null)
foundCamera = Camera.main;
if (foundCamera != null)
{
Canvas parentCanvas = GetComponentInParent<Canvas>();
if (parentCanvas != null)
{
parentCanvas.worldCamera = foundCamera;
}
}
// release temporary reference
cameras = null;
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6c868a66b282da94faaf38c62d26fcbe
@@ -1,5 +1,6 @@
using UnityEngine;
using System.Collections.Generic;
using Spine.Unity.Editor;
[System.Serializable]
public class Speaker
@@ -12,7 +13,8 @@ public class Speaker
[TextArea(3, 10)]
public string spkrDescription;
public Sprite spkrSprite;
public Sprite spkrHD_Sprite;
public Sprite spkrProfile_Sprite;
}
public enum speakerType{
File diff suppressed because it is too large Load Diff
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 00f0e57cae6a4694e99e3bc9d5d021af
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+3 -1
View File
@@ -20,6 +20,8 @@ public class ingame_galgame_so : ScriptableObject
public enum ImagePosition { Left, Right }
[Tooltip("对象图片左右位置")]
public ImagePosition imagePos; // 对象图片左右位置
[Tooltip("对象图片是否水平翻转")]
public bool flipX;
[Tooltip("文本出现时间")]
public float appearTime; // 文本出现时间
@@ -46,7 +48,7 @@ public class ingame_galgame_so : ScriptableObject
[System.Serializable]
public class DialogueElement
{
public enum PositionTag { Default, Left, Right, Upper, Down, Center }
public enum PositionTag { RoleHost, RoleHint, Narration, HintOrLyrics }
[Header("位置配置")]
public PositionTag positionTag;
+21 -4
View File
@@ -13,17 +13,18 @@ MonoBehaviour:
m_Name: opGalSO
m_EditorClassIdentifier:
dialogueType: 0
triggerMethod: 0
triggerMethod: 1
timelineStandard: 0
speakersDataSO: {fileID: 11400000, guid: 8e500b367b7861f44897e5396b1989ce, type: 2}
dialogueList:
- positionTag: 0
customPositions: []
textList:
- content: "\u7535\u68CD\u7B11\u4F20\u4E4B\u8E29\u8E29\u80CC"
- content: 1
textNumber: 1
senderIndex: 0
imagePos: 0
flipX: 0
appearTime: 0
duration: 0
stepMethod: 1
@@ -33,10 +34,11 @@ MonoBehaviour:
- positionTag: 0
customPositions: []
textList:
- content: "\u7535\u68CD\u7B11\u4F20\u4E4B\u8E29\u8E29\u80CC"
- content: 2
textNumber: 1
senderIndex: 0
imagePos: 0
flipX: 0
appearTime: 0
duration: 0
stepMethod: 0
@@ -46,13 +48,28 @@ MonoBehaviour:
- positionTag: 0
customPositions: []
textList:
- content: "\u7535\u68CD\u7B11\u4F20\u4E4B\u8E29\u8E29\u80CC"
- content: 3
textNumber: 1
senderIndex: 0
imagePos: 0
flipX: 0
appearTime: 0
duration: 0
stepMethod: 1
timeAction: 0
slowMotionScale: 0
endAction: 0
- positionTag: 0
customPositions: []
textList:
- content: 4
textNumber: 1
senderIndex: -1
imagePos: 0
flipX: 0
appearTime: 0
duration: 0
stepMethod: 0
timeAction: 0
slowMotionScale: 0
endAction: 0
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: afd23282207542e47978d91b28f4ddbd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,625 @@
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Experimental.GraphView;
using UnityEditor.UIElements;
using UnityEngine;
using UnityEngine.UIElements;
using System.Text;
[CustomEditor(typeof(AllyHero_SO))]
public class AllyHero_SO_Editor : Editor
{
public override void OnInspectorGUI()
{
if (GUILayout.Button("打开蓝图视图"))
{
AllyHeroBlueprintWindow.Open(target as AllyHero_SO);
}
EditorGUILayout.Space();
DrawDefaultInspector();
}
}
public class AllyHeroBlueprintWindow : EditorWindow
{
private AllyHero_SO currentSo;
private AllyHeroGraphView graphView;
private ObjectField soField;
public static void Open(AllyHero_SO so)
{
var window = GetWindow<AllyHeroBlueprintWindow>("AllyHero 蓝图");
window.Show();
window.SetSo(so);
}
private void OnEnable()
{
CreateGraphView();
CreateToolbar();
if (currentSo == null)
{
currentSo = Selection.activeObject as AllyHero_SO;
}
SetSo(currentSo);
}
private void OnDisable()
{
rootVisualElement.Clear();
graphView = null;
}
private void CreateGraphView()
{
graphView = new AllyHeroGraphView();
graphView.StretchToParentSize();
rootVisualElement.Add(graphView);
}
private void CreateToolbar()
{
var toolbar = new Toolbar();
soField = new ObjectField("数据") { objectType = typeof(AllyHero_SO), allowSceneObjects = false };
soField.RegisterValueChangedCallback(evt => SetSo(evt.newValue as AllyHero_SO));
toolbar.Add(soField);
var refreshBtn = new ToolbarButton(RefreshGraph) { text = "刷新" };
toolbar.Add(refreshBtn);
rootVisualElement.Add(toolbar);
}
private void SetSo(AllyHero_SO so)
{
currentSo = so;
if (soField != null && soField.value != so)
{
soField.SetValueWithoutNotify(so);
}
RefreshGraph();
}
private void RefreshGraph()
{
if (graphView == null) return;
graphView.Build(currentSo);
}
}
class AllyHeroGraphView : GraphView
{
public AllyHeroGraphView()
{
this.AddManipulator(new ContentZoomer());
this.AddManipulator(new ContentDragger());
this.AddManipulator(new SelectionDragger());
this.AddManipulator(new RectangleSelector());
var grid = new GridBackground();
Insert(0, grid);
grid.StretchToParentSize();
SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);
}
public void Build(AllyHero_SO so)
{
ClearGraph();
if (so == null) return;
var basicNode = CreateNode("基础信息", BuildBasicInfo(so));
basicNode.SetPosition(new Rect(40, 80, 360, 340));
AddElement(basicNode);
var levelNode = CreateNode("等级信息", BuildLevelInfoMerged(so));
levelNode.SetPosition(new Rect(420, 80, 480, 460));
AddElement(levelNode);
var skillNode = CreateNode("技能配置", BuildSkillOverview(so));
skillNode.SetPosition(new Rect(40, 500, 520, 220));
AddElement(skillNode);
AddElement(basicNode.output.ConnectTo(levelNode.input));
AddElement(levelNode.output.ConnectTo(skillNode.input));
var skillCards = BuildSkillCards(so, skillNode);
if (skillCards != null)
{
foreach (var card in skillCards)
{
AddElement(card);
}
}
}
private void ClearGraph()
{
DeleteElements(graphElements);
}
private AllyHeroNode CreateNode(string title, VisualElement content)
{
var node = new AllyHeroNode();
node.title = title;
node.style.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.95f);
node.style.borderTopWidth = 1;
node.style.borderBottomWidth = 1;
node.style.borderLeftWidth = 1;
node.style.borderRightWidth = 1;
node.style.borderTopColor = new Color(0.2f, 0.2f, 0.2f);
node.style.borderBottomColor = new Color(0.2f, 0.2f, 0.2f);
node.style.borderLeftColor = new Color(0.2f, 0.2f, 0.2f);
node.style.borderRightColor = new Color(0.2f, 0.2f, 0.2f);
node.titleContainer.style.backgroundColor = new Color(0.14f, 0.14f, 0.14f, 1f);
node.titleContainer.style.paddingLeft = 8;
node.titleContainer.style.paddingRight = 8;
node.titleContainer.style.paddingTop = 4;
node.titleContainer.style.paddingBottom = 4;
node.input = node.InstantiatePort(Orientation.Horizontal, Direction.Input, Port.Capacity.Multi, typeof(float));
node.output = node.InstantiatePort(Orientation.Horizontal, Direction.Output, Port.Capacity.Single, typeof(float));
node.input.portName = "";
node.output.portName = "";
node.inputContainer.Add(node.input);
node.outputContainer.Add(node.output);
if (content != null)
{
content.style.marginLeft = 6;
content.style.marginRight = 6;
content.style.marginTop = 4;
content.style.marginBottom = 4;
node.extensionContainer.Add(content);
}
node.RefreshExpandedState();
node.RefreshPorts();
return node;
}
private VisualElement BuildBasicInfo(AllyHero_SO so)
{
var container = new VisualElement();
container.style.flexDirection = FlexDirection.Column;
container.Add(CreateTitleLabel($"名称: {so.ally_heroName}"));
container.Add(CreatePrimaryLabel($"称号: {so.ally_heroDesignation}"));
container.Add(CreatePrimaryLabel($"ID: {so.ally_heroID}"));
container.Add(CreateMutedLabel($"主题色: {so.ally_heroThemeColor}"));
container.Add(CreatePrimaryLabel($"当前经验: {so.ally_currentEXP}"));
if (!string.IsNullOrEmpty(so.ally_heroDescription))
{
container.Add(CreatePrimaryLabel("描述:"));
var desc = CreateMutedLabel(WrapText(so.ally_heroDescription, 24));
desc.style.whiteSpace = WhiteSpace.Normal;
container.Add(desc);
}
container.Add(CreatePrimaryLabel("缩略图:"));
var thumbRow = new VisualElement();
thumbRow.style.flexDirection = FlexDirection.Row;
thumbRow.style.flexWrap = Wrap.Wrap;
thumbRow.Add(CreateSpriteThumb("形象", so.ally_heroImage));
thumbRow.Add(CreateSpriteThumb("头像", so.ally_heroProfile));
thumbRow.Add(CreateSpriteThumb("选择图标", so.ally_heroSelectIcon));
thumbRow.Add(CreateSpriteThumb("图标", so.ally_heroIcon));
thumbRow.Add(CreateSpriteThumb("海报", so.ally_heroPoster));
thumbRow.Add(CreateSpriteThumb("高清图", so.ally_hero_HD_image));
thumbRow.Add(CreateSpriteThumb("方形头像", so.ally_hero_squareProfile));
container.Add(thumbRow);
return container;
}
private VisualElement BuildLevelInfoMerged(AllyHero_SO so)
{
var container = new VisualElement();
container.style.flexDirection = FlexDirection.Column;
if (so.levelStats == null || so.levelStats.Count == 0)
{
container.Add(CreateLineLabel("空"));
return container;
}
int currentIndex = GetCurrentLevelIndex(so);
var levelNames = new string[so.levelStats.Count];
var levelIds = new string[so.levelStats.Count];
var attacks = new string[so.levelStats.Count];
var maxHPs = new string[so.levelStats.Count];
var resistances = new string[so.levelStats.Count];
var maxManas = new string[so.levelStats.Count];
var scoreEffs = new string[so.levelStats.Count];
var reqExps = new string[so.levelStats.Count];
var slotLimits = new string[so.levelStats.Count];
var manaGains = new string[so.levelStats.Count];
var dmgMultis = new string[so.levelStats.Count];
var missLoss = new string[so.levelStats.Count];
for (int i = 0; i < so.levelStats.Count; i++)
{
var lvl = so.levelStats[i];
if (lvl == null) continue;
levelNames[i] = lvl.levelName;
levelIds[i] = lvl.levelID.ToString();
attacks[i] = lvl.attack.ToString();
maxHPs[i] = lvl.maxHP.ToString();
resistances[i] = FormatNumber(lvl.damageResistance);
maxManas[i] = lvl.maxMana.ToString();
scoreEffs[i] = FormatNumber(lvl.scoreEfficiency);
reqExps[i] = lvl.requiredEXP.ToString();
slotLimits[i] = lvl.skill_slot_limited.ToString();
manaGains[i] = $"{lvl.manaGainGood}/{lvl.manaGainGreat}/{lvl.manaGainPerfect}/{lvl.manaGainOnMiss}";
dmgMultis[i] = $"{FormatNumber(lvl.damageMultiplierGood)}/{FormatNumber(lvl.damageMultiplierGreat)}/{FormatNumber(lvl.damageMultiplierPerfect)}";
missLoss[i] = FormatNumber(lvl.missHpLossBase);
}
AddSlashRow(container, "等级名", levelNames, currentIndex);
AddSlashRow(container, "等级ID", levelIds, currentIndex);
AddSlashRow(container, "攻击", attacks, currentIndex);
AddSlashRow(container, "最大生命", maxHPs, currentIndex);
AddSlashRow(container, "减伤", resistances, currentIndex);
AddSlashRow(container, "最大法力", maxManas, currentIndex);
AddSlashRow(container, "偶像分效率", scoreEffs, currentIndex);
AddSlashRow(container, "所需经验", reqExps, currentIndex);
AddSlashRow(container, "技能槽上限", slotLimits, currentIndex);
AddSlashRow(container, "回蓝 Good/Great/Perfect/Miss", manaGains, currentIndex);
AddSlashRow(container, "伤害倍率 Good/Great/Perfect", dmgMultis, currentIndex);
AddSlashRow(container, "Miss 基础扣血", missLoss, currentIndex);
return container;
}
private VisualElement BuildSkillOverview(AllyHero_SO so)
{
var container = new VisualElement();
container.style.flexDirection = FlexDirection.Column;
container.Add(CreatePrimaryLabel("概览"));
container.Add(CreateMutedLabel($"可用技能数: {(so.availableSkills == null ? 0 : so.availableSkills.Length)}"));
container.Add(CreateMutedLabel($"主技能索引: {so.primarySkillIndex}"));
container.Add(CreateMutedLabel($"已选技能索引: {JoinInts(so.selectedSkillIndices)}"));
container.Add(CreateMutedLabel($"技能组数量: {(so.skillGroups == null ? 0 : so.skillGroups.Length)}"));
container.Add(CreateMutedLabel($"已装备技能组ID: {JoinInts(so.equippedSkillGroupIDs)}"));
return container;
}
private string GetSpriteName(Sprite sprite)
{
return sprite != null ? sprite.name : "(无)";
}
private string GetSkillName(SkillDefinition def)
{
if (def == null) return "(无)";
var name = string.IsNullOrEmpty(def.displayName) ? def.name : def.displayName;
var id = string.IsNullOrEmpty(def.skillId) ? "-" : def.skillId;
return $"{name} ({id})";
}
private string JoinInts(int[] arr)
{
if (arr == null || arr.Length == 0) return "(无)";
return string.Join(",", arr);
}
private Label CreateLineLabel(string text)
{
return CreateLineLabel(text, 11, new Color(0.75f, 0.75f, 0.75f), false);
}
private Label CreateLineLabel(string text, int fontSize, Color? color, bool bold)
{
var label = new Label(text ?? "");
label.style.whiteSpace = WhiteSpace.Normal;
label.style.unityTextAlign = TextAnchor.UpperLeft;
label.style.fontSize = fontSize;
if (bold) label.style.unityFontStyleAndWeight = FontStyle.Bold;
if (color.HasValue) label.style.color = color.Value;
return label;
}
private Label CreateTitleLabel(string text)
{
return CreateLineLabel(text, 14, new Color(0.95f, 0.95f, 0.95f), true);
}
private Label CreatePrimaryLabel(string text)
{
return CreateLineLabel(text, 12, new Color(0.85f, 0.85f, 0.85f), true);
}
private Label CreateMutedLabel(string text)
{
return CreateLineLabel(text, 11, new Color(0.7f, 0.7f, 0.7f), false);
}
private VisualElement CreateSpriteThumb(string label, Sprite sprite)
{
var container = new VisualElement();
container.style.flexDirection = FlexDirection.Column;
container.style.width = 88;
container.style.marginRight = 6;
container.style.marginBottom = 6;
var imageBox = new VisualElement();
imageBox.style.width = 80;
imageBox.style.height = 60;
imageBox.style.borderTopWidth = 1;
imageBox.style.borderBottomWidth = 1;
imageBox.style.borderLeftWidth = 1;
imageBox.style.borderRightWidth = 1;
imageBox.style.borderTopColor = new Color(0.2f, 0.2f, 0.2f);
imageBox.style.borderBottomColor = new Color(0.2f, 0.2f, 0.2f);
imageBox.style.borderLeftColor = new Color(0.2f, 0.2f, 0.2f);
imageBox.style.borderRightColor = new Color(0.2f, 0.2f, 0.2f);
var img = new Image();
img.image = sprite != null ? sprite.texture : null;
img.scaleMode = ScaleMode.ScaleToFit;
img.style.width = 80;
img.style.height = 60;
imageBox.Add(img);
var nameLabel = new Label(string.IsNullOrEmpty(label) ? GetSpriteName(sprite) : $"{label}\n{GetSpriteName(sprite)}");
nameLabel.style.whiteSpace = WhiteSpace.Normal;
nameLabel.style.fontSize = 9;
nameLabel.style.unityTextAlign = TextAnchor.UpperCenter;
container.Add(imageBox);
container.Add(nameLabel);
return container;
}
private void AddSlashRow(VisualElement container, string title, string[] values, int highlightIndex)
{
var row = new VisualElement();
row.style.flexDirection = FlexDirection.Row;
row.style.flexWrap = Wrap.Wrap;
row.style.alignItems = Align.Center;
row.style.marginBottom = 2;
var titleLabel = new Label($"{title}: ");
titleLabel.style.unityFontStyleAndWeight = FontStyle.Bold;
titleLabel.style.fontSize = 12;
titleLabel.style.color = new Color(0.85f, 0.85f, 0.85f);
row.Add(titleLabel);
for (int i = 0; i < values.Length; i++)
{
if (i > 0)
{
row.Add(new Label("/"));
}
var valueText = string.IsNullOrEmpty(values[i]) ? "-" : values[i];
var valueLabel = new Label(valueText);
valueLabel.style.fontSize = 11;
valueLabel.style.color = new Color(0.75f, 0.75f, 0.75f);
if (i == highlightIndex)
{
valueLabel.style.color = new Color(0.25f, 0.6f, 1f);
valueLabel.style.unityFontStyleAndWeight = FontStyle.Bold;
}
row.Add(valueLabel);
}
container.Add(row);
}
private int GetCurrentLevelIndex(AllyHero_SO so)
{
if (so.levelStats == null || so.levelStats.Count == 0) return -1;
int bestIndex = -1;
int currentExp = so.ally_currentEXP;
for (int i = 0; i < so.levelStats.Count; i++)
{
var lvl = so.levelStats[i];
if (lvl == null) continue;
if (bestIndex < 0)
{
bestIndex = i;
if (currentExp < lvl.requiredEXP) continue;
}
var best = so.levelStats[bestIndex];
if (best == null) continue;
if (currentExp >= lvl.requiredEXP && lvl.requiredEXP >= best.requiredEXP)
{
bestIndex = i;
}
}
return bestIndex < 0 ? 0 : bestIndex;
}
private string FormatNumber(float value)
{
return value.ToString("0.###");
}
private System.Collections.Generic.HashSet<int> BuildEquippedSet(int[] ids)
{
var set = new System.Collections.Generic.HashSet<int>();
if (ids == null) return set;
for (int i = 0; i < ids.Length; i++)
{
set.Add(ids[i]);
}
return set;
}
private string GetSkillEffectSummary(SkillDefinition def)
{
if (def == null) return "(无)";
if (!string.IsNullOrEmpty(def.summaryInfo)) return def.summaryInfo;
if (!string.IsNullOrEmpty(def.description)) return def.description;
if (!string.IsNullOrEmpty(def.formula)) return def.formula;
return "(无)";
}
private System.Collections.Generic.List<AllyHeroNode> BuildSkillCards(AllyHero_SO so, AllyHeroNode rootNode)
{
if (so == null || so.skillGroups == null || so.skillGroups.Length == 0) return null;
var list = new System.Collections.Generic.List<AllyHeroNode>();
int currentLevelNumber = GetCurrentLevelIndex(so) + 1;
var equippedSet = BuildEquippedSet(so.equippedSkillGroupIDs);
float startX = 580f;
float startY = 500f;
float cardW = 300f;
float cardH = 180f;
float gapX = 26f;
float gapY = 22f;
int cols = 2;
int index = 0;
for (int i = 0; i < so.skillGroups.Length; i++)
{
var g = so.skillGroups[i];
if (g == null) continue;
bool equipped = equippedSet.Contains(g.skillGroupID);
bool unlocked = currentLevelNumber >= g.thisSkill_levelLimit;
if (g.skills == null || g.skills.Length == 0)
{
var node = CreateNode(g.groupName, BuildSkillCard(g, null, equipped, unlocked));
node.SetPosition(new Rect(startX + (index % cols) * (cardW + gapX), startY + (index / cols) * (cardH + gapY), cardW, cardH));
AddElement(rootNode.output.ConnectTo(node.input));
list.Add(node);
index++;
continue;
}
for (int s = 0; s < g.skills.Length; s++)
{
var sd = g.skills[s];
var node = CreateNode(g.groupName, BuildSkillCard(g, sd, equipped, unlocked));
node.SetPosition(new Rect(startX + (index % cols) * (cardW + gapX), startY + (index / cols) * (cardH + gapY), cardW, cardH));
AddElement(rootNode.output.ConnectTo(node.input));
list.Add(node);
index++;
}
}
return list;
}
private VisualElement BuildSkillCard(SkillGroup group, SkillDefinition skill, bool equipped, bool unlocked)
{
var container = new VisualElement();
container.style.flexDirection = FlexDirection.Row;
container.style.flexWrap = Wrap.NoWrap;
var accent = new VisualElement();
accent.style.width = 4;
accent.style.marginRight = 6;
accent.style.backgroundColor = equipped ? new Color(0.25f, 0.6f, 1f) : (unlocked ? new Color(0.2f, 0.8f, 0.35f) : new Color(0.95f, 0.3f, 0.3f));
container.Add(accent);
var body = new VisualElement();
body.style.flexDirection = FlexDirection.Column;
var status = equipped ? "已装备" : (unlocked ? "已解锁" : "未解锁");
var header = CreatePrimaryLabel($"{group.groupName} {status} 等级限制:{group.thisSkill_levelLimit}");
header.style.fontSize = 12;
header.style.color = equipped ? new Color(0.25f, 0.6f, 1f) : (unlocked ? new Color(0.2f, 0.8f, 0.35f) : new Color(0.95f, 0.3f, 0.3f));
body.Add(header);
var sub = CreateMutedLabel($"ID:{group.skillGroupID} 列:{group.columnID}-{group.columnName}");
body.Add(sub);
if (!string.IsNullOrEmpty(group.skillDescriptionsText))
{
var desc = CreateMutedLabel(WrapText(group.skillDescriptionsText, 22));
desc.style.whiteSpace = WhiteSpace.Normal;
body.Add(desc);
}
if (skill != null)
{
var name = CreatePrimaryLabel(GetSkillName(skill));
name.style.fontSize = 12;
body.Add(name);
var effect = CreateMutedLabel(WrapText(GetSkillEffectSummary(skill), 22));
effect.style.whiteSpace = WhiteSpace.Normal;
body.Add(effect);
}
container.Add(body);
return container;
}
private string WrapText(string text, int maxCharsPerLine)
{
if (string.IsNullOrEmpty(text) || maxCharsPerLine <= 0) return text;
var sb = new System.Text.StringBuilder();
var lines = text.Split('\n');
for (int i = 0; i < lines.Length; i++)
{
var line = lines[i];
int count = 0;
for (int c = 0; c < line.Length; c++)
{
sb.Append(line[c]);
count++;
if (count >= maxCharsPerLine && c < line.Length - 1)
{
sb.Append('\n');
count = 0;
}
}
if (i < lines.Length - 1) sb.Append('\n');
}
return sb.ToString();
}
private VisualElement CreateCard()
{
var card = new VisualElement();
card.style.backgroundColor = new Color(0.12f, 0.12f, 0.12f, 0.6f);
card.style.borderTopWidth = 1;
card.style.borderBottomWidth = 1;
card.style.borderLeftWidth = 1;
card.style.borderRightWidth = 1;
card.style.borderTopColor = new Color(0.2f, 0.2f, 0.2f);
card.style.borderBottomColor = new Color(0.2f, 0.2f, 0.2f);
card.style.borderLeftColor = new Color(0.2f, 0.2f, 0.2f);
card.style.borderRightColor = new Color(0.2f, 0.2f, 0.2f);
card.style.paddingLeft = 6;
card.style.paddingRight = 6;
card.style.paddingTop = 6;
card.style.paddingBottom = 6;
card.style.marginTop = 6;
return card;
}
private VisualElement CreateSkillChip(SkillDefinition def)
{
var chip = new VisualElement();
chip.style.backgroundColor = new Color(0.18f, 0.18f, 0.18f, 0.9f);
chip.style.borderTopWidth = 1;
chip.style.borderBottomWidth = 1;
chip.style.borderLeftWidth = 1;
chip.style.borderRightWidth = 1;
chip.style.borderTopColor = new Color(0.25f, 0.25f, 0.25f);
chip.style.borderBottomColor = new Color(0.25f, 0.25f, 0.25f);
chip.style.borderLeftColor = new Color(0.25f, 0.25f, 0.25f);
chip.style.borderRightColor = new Color(0.25f, 0.25f, 0.25f);
chip.style.paddingLeft = 6;
chip.style.paddingRight = 6;
chip.style.paddingTop = 4;
chip.style.paddingBottom = 4;
chip.style.marginRight = 6;
chip.style.marginBottom = 6;
chip.style.maxWidth = 300;
var name = CreatePrimaryLabel(GetSkillName(def));
name.style.fontSize = 12;
var effect = CreateMutedLabel(GetSkillEffectSummary(def));
effect.style.whiteSpace = WhiteSpace.Normal;
chip.Add(name);
chip.Add(effect);
return chip;
}
}
class AllyHeroNode : Node
{
public Port input;
public Port output;
}
#endif
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 46f5c89b016a1254fbdae28aa0c4fd49
@@ -0,0 +1,484 @@
#if UNITY_EDITOR
using System;
using System.Text;
using UnityEditor;
using UnityEditor.Experimental.GraphView;
using UnityEditor.UIElements;
using UnityEngine;
using UnityEngine.UIElements;
[CustomEditor(typeof(SongData))]
public class SongData_Editor : Editor
{
public override void OnInspectorGUI()
{
if (GUILayout.Button("打开蓝图视图"))
{
SongDataBlueprintWindow.Open(target as SongData);
}
EditorGUILayout.Space();
DrawDefaultInspector();
}
}
public class SongDataBlueprintWindow : EditorWindow
{
private SongData currentSo;
private SongDataGraphView graphView;
private ObjectField soField;
public static void Open(SongData so)
{
var window = GetWindow<SongDataBlueprintWindow>("SongData 蓝图");
window.Show();
window.SetSo(so);
}
private void OnEnable()
{
CreateGraphView();
CreateToolbar();
if (currentSo == null)
{
currentSo = Selection.activeObject as SongData;
}
SetSo(currentSo);
}
private void OnDisable()
{
rootVisualElement.Clear();
graphView = null;
}
private void CreateGraphView()
{
graphView = new SongDataGraphView();
graphView.StretchToParentSize();
rootVisualElement.Add(graphView);
}
private void CreateToolbar()
{
var toolbar = new Toolbar();
soField = new ObjectField("数据") { objectType = typeof(SongData), allowSceneObjects = false };
soField.RegisterValueChangedCallback(evt => SetSo(evt.newValue as SongData));
toolbar.Add(soField);
var refreshBtn = new ToolbarButton(RefreshGraph) { text = "刷新" };
toolbar.Add(refreshBtn);
rootVisualElement.Add(toolbar);
}
private void SetSo(SongData so)
{
currentSo = so;
if (soField != null && soField.value != so)
{
soField.SetValueWithoutNotify(so);
}
RefreshGraph();
}
private void RefreshGraph()
{
if (graphView == null) return;
graphView.Build(currentSo);
}
}
class SongDataGraphView : GraphView
{
public SongDataGraphView()
{
this.AddManipulator(new ContentZoomer());
this.AddManipulator(new ContentDragger());
this.AddManipulator(new SelectionDragger());
this.AddManipulator(new RectangleSelector());
var grid = new GridBackground();
Insert(0, grid);
grid.StretchToParentSize();
SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);
}
public void Build(SongData so)
{
ClearGraph();
if (so == null) return;
var basicNode = CreateNode("基础信息", BuildBasicInfo(so));
basicNode.SetPosition(new Rect(40, 80, 420, 360));
AddElement(basicNode);
var mediaNode = CreateNode("媒体资源", BuildMediaInfo(so));
mediaNode.SetPosition(new Rect(480, 80, 520, 360));
AddElement(mediaNode);
AddElement(basicNode.output.ConnectTo(mediaNode.input));
var chartsNode = CreateNode("谱面/难度概览", BuildChartsOverview(so));
chartsNode.SetPosition(new Rect(40, 470, 620, 260));
AddElement(chartsNode);
AddElement(mediaNode.output.ConnectTo(chartsNode.input));
var chartNodes = BuildChartCards(so, chartsNode);
if (chartNodes != null)
{
foreach (var n in chartNodes)
{
AddElement(n);
}
}
}
private void ClearGraph()
{
DeleteElements(graphElements);
}
private SongDataNode CreateNode(string title, VisualElement content)
{
var node = new SongDataNode();
node.title = title;
node.style.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.95f);
node.style.borderTopWidth = 1;
node.style.borderBottomWidth = 1;
node.style.borderLeftWidth = 1;
node.style.borderRightWidth = 1;
node.style.borderTopColor = new Color(0.2f, 0.2f, 0.2f);
node.style.borderBottomColor = new Color(0.2f, 0.2f, 0.2f);
node.style.borderLeftColor = new Color(0.2f, 0.2f, 0.2f);
node.style.borderRightColor = new Color(0.2f, 0.2f, 0.2f);
node.titleContainer.style.backgroundColor = new Color(0.14f, 0.14f, 0.14f, 1f);
node.titleContainer.style.paddingLeft = 8;
node.titleContainer.style.paddingRight = 8;
node.titleContainer.style.paddingTop = 4;
node.titleContainer.style.paddingBottom = 4;
node.input = node.InstantiatePort(Orientation.Horizontal, Direction.Input, Port.Capacity.Multi, typeof(float));
node.output = node.InstantiatePort(Orientation.Horizontal, Direction.Output, Port.Capacity.Single, typeof(float));
node.input.portName = "";
node.output.portName = "";
node.inputContainer.Add(node.input);
node.outputContainer.Add(node.output);
if (content != null)
{
content.style.marginLeft = 6;
content.style.marginRight = 6;
content.style.marginTop = 4;
content.style.marginBottom = 4;
node.extensionContainer.Add(content);
}
node.RefreshExpandedState();
node.RefreshPorts();
return node;
}
private VisualElement BuildBasicInfo(SongData so)
{
var container = new VisualElement();
container.style.flexDirection = FlexDirection.Column;
container.Add(CreateTitleLabel($"{Safe(so.songName)}"));
container.Add(CreatePrimaryLabel($"ID: {so.songID}"));
container.Add(CreateMutedLabel($"用户: {Safe(so.usernameID)}"));
container.Add(CreatePrimaryLabel($"艺术家: {Safe(so.artistName)}"));
container.Add(CreateMutedLabel($"曲绘: {Safe(so.painter)}"));
container.Add(CreateMutedLabel($"谱师: {Safe(so.level_creator)}"));
container.Add(CreateMutedLabel($"DLC: {Safe(so.belongsTo_whichDLC)}"));
container.Add(CreatePrimaryLabel($"BPM: {so.bpm} 时长(s): {so.songLength_second} Duration: {so.songDuration:0.###}"));
container.Add(CreateMutedLabel($"进入次数: {so.game_enterTimes} 总游玩时长: {so.time_totalPlayingTime:0.###}"));
container.Add(CreateMutedLabel($"上传时间: {FormatDateTime(so.uploadData)}"));
if (!string.IsNullOrEmpty(so.thisLevel_addDateString))
{
container.Add(CreateMutedLabel($"添加日期: {so.thisLevel_addDateString}"));
}
container.Add(CreateMutedLabel($"当前选择难度ID: {so.thisLevel_selectedDifficultyID}"));
if (!string.IsNullOrEmpty(so.thisLevel_overallDescription))
{
container.Add(CreatePrimaryLabel("总体描述:"));
var desc = CreateMutedLabel(WrapText(so.thisLevel_overallDescription, 26));
desc.style.whiteSpace = WhiteSpace.Normal;
container.Add(desc);
}
return container;
}
private VisualElement BuildMediaInfo(SongData so)
{
var container = new VisualElement();
container.style.flexDirection = FlexDirection.Column;
container.Add(CreatePrimaryLabel("图片:"));
var thumbs = new VisualElement();
thumbs.style.flexDirection = FlexDirection.Row;
thumbs.style.flexWrap = Wrap.Wrap;
thumbs.Add(CreateSpriteThumb("插画", so.illustration));
thumbs.Add(CreateSpriteThumb("背景", so.backgroudPIC));
thumbs.Add(CreateSpriteThumb("全屏图", so.fullscreen_songPicture));
thumbs.Add(CreateSpriteThumb("卡片", so.card_profileImage));
thumbs.Add(CreateSpriteThumb("右下图", so.right_pic_bottom_image));
thumbs.Add(CreateSpriteThumb("右上图", so.right_pic_top_image));
container.Add(thumbs);
container.Add(CreatePrimaryLabel("音频:"));
container.Add(CreateMutedLabel($"主音频: {GetObjName(so.audioFile)}"));
container.Add(CreateMutedLabel($"预览音频: {GetObjName(so.audio_previewAudio)}"));
return container;
}
private VisualElement BuildChartsOverview(SongData so)
{
var container = new VisualElement();
container.style.flexDirection = FlexDirection.Column;
int chartCount = so.chartFiles == null ? 0 : so.chartFiles.Count;
container.Add(CreatePrimaryLabel($"ChartFiles: {chartCount}"));
container.Add(CreateMutedLabel($"difficultyID: {so.difficultyID}"));
container.Add(CreateMutedLabel($"personalRecord: {so.personalRecord}"));
container.Add(CreateMutedLabel($"maxComboRecord: {so.max_comboRecord}"));
container.Add(CreateMutedLabel($"levelProgress: {so.current_levelProgress:0.###} ifEase: {so._if_level_is_EASE}"));
container.Add(CreateMutedLabel($"difficultyNumberMap: {CountDict(so.difficultyNumberMap)}"));
container.Add(CreateMutedLabel($"personalRecordMap: {CountDict(so.personalRecordMap)}"));
container.Add(CreateMutedLabel($"idolRecordMap: {CountDict(so.idolRecordMap)}"));
container.Add(CreateMutedLabel($"chartScoreMap: {CountDict(so.chartScoreMap)}"));
container.Add(CreateMutedLabel($"levelProgressMap: {CountDict(so.levelProgressMap)}"));
container.Add(CreateMutedLabel($"chartFileMap: {CountDict(so.chartFileMap)}"));
return container;
}
private System.Collections.Generic.List<SongDataNode> BuildChartCards(SongData so, SongDataNode rootNode)
{
if (so == null || so.chartFiles == null || so.chartFiles.Count == 0) return null;
var list = new System.Collections.Generic.List<SongDataNode>();
float startX = 680f;
float startY = 470f;
float cardW = 360f;
float cardH = 240f;
float gapX = 26f;
float gapY = 22f;
int cols = 2;
int index = 0;
for (int i = 0; i < so.chartFiles.Count; i++)
{
var entry = so.chartFiles[i];
if (entry == null) continue;
var node = CreateNode($"难度 {entry.difficulty}", BuildChartEntry(entry));
node.SetPosition(new Rect(startX + (index % cols) * (cardW + gapX), startY + (index / cols) * (cardH + gapY), cardW, cardH));
AddElement(rootNode.output.ConnectTo(node.input));
list.Add(node);
index++;
}
return list;
}
private VisualElement BuildChartEntry(ChartFileEntry entry)
{
var container = new VisualElement();
container.style.flexDirection = FlexDirection.Column;
container.Add(CreateTitleLabel($"{Safe(entry.difficultyName)} Lv:{entry.difficultyLEVEL:0.###}"));
container.Add(CreateMutedLabel($"difficulty: {entry.difficulty}"));
container.Add(CreateMutedLabel($"总血倍率: {entry.enemyTotalHP_Multiplier:0.###} 经验: {entry.experienceProvidedForThisDifficulty}"));
container.Add(CreateMutedLabel($"lastScore: {entry.lastScoreForThisDifficulty}"));
container.Add(CreateMutedLabel($"PR: chart {entry.chartPersonalRecordForThisDifficulty} + idol {entry.idolPersonalRecordForThisDifficulty} = total {entry.totalPersonalRecordForThisDifficulty}"));
container.Add(CreateMutedLabel($"进度: {entry.levelProgressForThisDifficulty:0.###} 上次游玩: {FormatDateTime(entry.lastPlayTimeForThisDifficulty)}"));
container.Add(CreateMutedLabel($"谱面文件: {GetObjName(entry.chartFile)}"));
if (!string.IsNullOrEmpty(entry.difficultyDescription))
{
container.Add(CreatePrimaryLabel("描述:"));
var desc = CreateMutedLabel(WrapText(entry.difficultyDescription, 26));
desc.style.whiteSpace = WhiteSpace.Normal;
container.Add(desc);
}
container.Add(CreatePrimaryLabel("敌人配置:"));
var enemies = new VisualElement();
enemies.style.flexDirection = FlexDirection.Column;
enemies.style.flexWrap = Wrap.NoWrap;
enemies.style.marginTop = 2;
if (entry.enemyConfigList == null || entry.enemyConfigList.Count == 0)
{
enemies.Add(CreateMutedLabel("(无)"));
}
else
{
for (int i = 0; i < entry.enemyConfigList.Count; i++)
{
var c = entry.enemyConfigList[i];
enemies.Add(CreateEnemyChip(i, c.enemyID, c.hpPercentage));
}
}
container.Add(enemies);
return container;
}
private VisualElement CreateEnemyChip(int index, int enemyId, int hpPercent)
{
var chip = new VisualElement();
chip.style.backgroundColor = new Color(0.18f, 0.18f, 0.18f, 0.9f);
chip.style.borderTopWidth = 1;
chip.style.borderBottomWidth = 1;
chip.style.borderLeftWidth = 1;
chip.style.borderRightWidth = 1;
chip.style.borderTopColor = new Color(0.25f, 0.25f, 0.25f);
chip.style.borderBottomColor = new Color(0.25f, 0.25f, 0.25f);
chip.style.borderLeftColor = new Color(0.25f, 0.25f, 0.25f);
chip.style.borderRightColor = new Color(0.25f, 0.25f, 0.25f);
chip.style.paddingLeft = 6;
chip.style.paddingRight = 6;
chip.style.paddingTop = 4;
chip.style.paddingBottom = 4;
chip.style.marginBottom = 6;
chip.style.width = Length.Percent(100);
chip.style.maxWidth = Length.Percent(100);
var idColor = enemyId == 0 ? new Color(0.6f, 0.6f, 0.6f) : new Color(0.2f, 0.8f, 0.35f);
var header = CreatePrimaryLabel($"#{index + 1} EnemyID:{enemyId} HP:{hpPercent}%");
header.style.fontSize = 11;
header.style.color = idColor;
chip.Add(header);
return chip;
}
private Label CreateLineLabel(string text)
{
return CreateLineLabel(text, 11, new Color(0.75f, 0.75f, 0.75f), false);
}
private Label CreateLineLabel(string text, int fontSize, Color? color, bool bold)
{
var label = new Label(text ?? "");
label.style.whiteSpace = WhiteSpace.Normal;
label.style.unityTextAlign = TextAnchor.UpperLeft;
label.style.fontSize = fontSize;
if (bold) label.style.unityFontStyleAndWeight = FontStyle.Bold;
if (color.HasValue) label.style.color = color.Value;
return label;
}
private Label CreateTitleLabel(string text)
{
return CreateLineLabel(text, 14, new Color(0.95f, 0.95f, 0.95f), true);
}
private Label CreatePrimaryLabel(string text)
{
return CreateLineLabel(text, 12, new Color(0.85f, 0.85f, 0.85f), true);
}
private Label CreateMutedLabel(string text)
{
return CreateLineLabel(text, 11, new Color(0.7f, 0.7f, 0.7f), false);
}
private VisualElement CreateSpriteThumb(string label, Sprite sprite)
{
var container = new VisualElement();
container.style.flexDirection = FlexDirection.Column;
container.style.width = 100;
container.style.marginRight = 6;
container.style.marginBottom = 6;
var imageBox = new VisualElement();
imageBox.style.width = 92;
imageBox.style.height = 64;
imageBox.style.borderTopWidth = 1;
imageBox.style.borderBottomWidth = 1;
imageBox.style.borderLeftWidth = 1;
imageBox.style.borderRightWidth = 1;
imageBox.style.borderTopColor = new Color(0.2f, 0.2f, 0.2f);
imageBox.style.borderBottomColor = new Color(0.2f, 0.2f, 0.2f);
imageBox.style.borderLeftColor = new Color(0.2f, 0.2f, 0.2f);
imageBox.style.borderRightColor = new Color(0.2f, 0.2f, 0.2f);
var img = new Image();
img.image = sprite != null ? sprite.texture : null;
img.scaleMode = ScaleMode.ScaleToFit;
img.style.width = 92;
img.style.height = 64;
imageBox.Add(img);
var nameLabel = new Label(string.IsNullOrEmpty(label) ? GetSpriteName(sprite) : $"{label}\n{GetSpriteName(sprite)}");
nameLabel.style.whiteSpace = WhiteSpace.Normal;
nameLabel.style.fontSize = 9;
nameLabel.style.unityTextAlign = TextAnchor.UpperCenter;
container.Add(imageBox);
container.Add(nameLabel);
return container;
}
private string GetSpriteName(Sprite sprite)
{
return sprite != null ? sprite.name : "(无)";
}
private string WrapText(string text, int maxCharsPerLine)
{
if (string.IsNullOrEmpty(text) || maxCharsPerLine <= 0) return text;
var sb = new StringBuilder();
var lines = text.Split('\n');
for (int i = 0; i < lines.Length; i++)
{
var line = lines[i];
int count = 0;
for (int c = 0; c < line.Length; c++)
{
sb.Append(line[c]);
count++;
if (count >= maxCharsPerLine && c < line.Length - 1)
{
sb.Append('\n');
count = 0;
}
}
if (i < lines.Length - 1) sb.Append('\n');
}
return sb.ToString();
}
private string Safe(string s)
{
return string.IsNullOrEmpty(s) ? "-" : s;
}
private string GetObjName(UnityEngine.Object obj)
{
return obj != null ? obj.name : "(无)";
}
private string FormatDateTime(DateTime dt)
{
if (dt == default) return "-";
return dt.ToString("yyyy-MM-dd HH:mm");
}
private string CountDict<TKey, TValue>(System.Collections.Generic.Dictionary<TKey, TValue> dict)
{
return dict == null ? "0" : dict.Count.ToString();
}
}
class SongDataNode : Node
{
public Port input;
public Port output;
}
#endif
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 48642eab80a548c488d1a743efff1792