Add support for images in dialogue windows (#19)

- Extend editor nodes with custom DialogueContent data type that holds either image or text
- Extend the dialogue importer to correctly process the new content into updated RuntimeDialogue content
- Update SpeechBubble to be able to display either text or image
- Add a custom property drawer for the DialogueContent to allow easy switching in graph authoring

Co-authored-by: Michal Pikulski <michal@foolhardyhorizons.com>
Reviewed-on: #19
This commit is contained in:
2025-10-08 09:34:58 +00:00
parent 7b949c5cb8
commit 3807ac652c
19 changed files with 1128 additions and 461 deletions

View File

@@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 9002038557409323574}
- component: {fileID: 4498241824153346754}
- component: {fileID: 3123748273643935430}
- component: {fileID: 8484489322432759371}
m_Layer: 5
m_Name: SpeechBubble
m_TagString: Untagged
@@ -34,11 +35,11 @@ RectTransform:
- {fileID: 1539728007164444029}
m_Father: {fileID: 3484825090253933040}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 50}
m_SizeDelta: {x: 400, y: 0}
m_Pivot: {x: 0.5, y: 1}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 600, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!114 &9002038557409323574
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -99,6 +100,123 @@ MonoBehaviour:
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!114 &8484489322432759371
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1494212192306772670}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cb3605ae81a54d2689504e0cd456ac27, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Dialogue.SpeechBubble
textDisplay: {fileID: 4573570654593171780}
imageDisplay: {fileID: 4814676392695871198}
displayMode: 1
typewriterSpeed: 0.05
typingSoundSource: {fileID: 0}
typingSoundFrequency: 3
useRichText: 1
dialogueDisplayTime: 3
dialoguePromptText: . . .
--- !u!1 &3571537114331005905
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7453431659909988258}
- component: {fileID: 7239040132725875785}
- component: {fileID: 4814676392695871198}
- component: {fileID: 7738447742327076413}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &7453431659909988258
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3571537114331005905}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1539728007164444029}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 300, y: -125}
m_SizeDelta: {x: 200, y: 200}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7239040132725875785
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3571537114331005905}
m_CullTransparentMesh: 1
--- !u!114 &4814676392695871198
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3571537114331005905}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: -9213056636207805707, guid: 00354ded9d8f8d643acc14837a229544, type: 3}
m_Type: 0
m_PreserveAspect: 1
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &7738447742327076413
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3571537114331005905}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: 200
m_PreferredHeight: 200
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &5048280843231724144
GameObject:
m_ObjectHideFlags: 0
@@ -164,7 +282,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Hey there buster!
m_text: Hey there, buster!
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
@@ -191,8 +309,8 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 35
m_fontSizeBase: 35
m_fontSize: 55
m_fontSizeBase: 55
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
@@ -364,18 +482,19 @@ RectTransform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8341977934938436915}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -1}
m_LocalPosition: {x: 0, y: 0, z: -0.9999999}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7704981663008171144}
- {fileID: 7453431659909988258}
m_Father: {fileID: 8307219291215824345}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
m_Pivot: {x: 0, y: 0}
--- !u!222 &2528298462582055986
CanvasRenderer:
m_ObjectHideFlags: 0
@@ -433,7 +552,7 @@ MonoBehaviour:
m_Bottom: 70
m_ChildAlignment: 4
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 1
m_ChildControlHeight: 1