Skip to content

Commit bda4613

Browse files
dogboydogdogboydog
andauthored
v0.3.20 - YarnSpinner libraries v3.2.0 , YSLS JSON generation, new Typewriter API (#118)
* WIP update to yarnspinner 3.2.0 libs * workaround for dialogue hanging in YS 3.1+: wait a frame at the end of commands * porting source generator changes * remove references to UNITY_EDITOR * remove unused unity addressables code * fix some references to unity * YSLS source generation working! * commit generated ysls * remove temp code * revise pending version number to 0.3.20 * Register `CustomMarker` and `BasicMarker` as custom types for better editor integration (fix #119) * updated ysls json * settings.json * remove duplicate emission of onDialogueComplete signal * update changelog.md * - Add dialogueRunner.allowOptionFallthrough which allows dialogue to proceed when no dialogue options were chosen https://yarnspinner.dev/blog/yarn-spinner-3-1-release/#dialogue-option-fallthrough * port relative path changes for ysls from unity update * add typewriter changes ported from YS-Unity * consider no options to have been selected if no options are visible in OptionsPresenter * reorder comment * revert change to how paths are made relative which seems to have broken YSLS generation * - To disable generation of the YSLS file, add the define symbol . Example in your `.csproj` file: `<DefineConstants>$(DefineConstants);YARN_SOURCE_GENERATION_DISABLE_YSLS</DefineConstants>` - You can now also disable source generation entirely if desired with the symbol `YARN_SOURCE_GENERATION_DISABLE_ALL`. This will prevent you from using the `[YarnCommand]` and `[YarnFunction]` attributes and require manual command and function registration to each dialogue runner. * fix #121 - showCharacterNameInLineView logic * update changelog.md --------- Co-authored-by: dogboydog <6483507-dogboydog@users.noreply.gitlab.com>
1 parent 6b6d136 commit bda4613

44 files changed

Lines changed: 2020 additions & 1761 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/continuous_build_check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- uses: chickensoft-games/setup-godot@v1
4444
name: 🤖 Setup Godot
4545
with:
46-
version: 4.6.0
46+
version: 4.6.2
4747
# Use .NET-enabled version of Godot (the default is also true).
4848
use-dotnet: true
4949
include-templates: true

.vscode/settings.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"cSpell.enableFiletypes": [
3+
"yarnspinner"
4+
],
5+
"cSpell.languageSettings": [
6+
{
7+
"languageId": "yarnspinner",
8+
"patterns": [
9+
{
10+
"name": "yarn-commands",
11+
"pattern": "/<<[^>]*>>/g"
12+
},
13+
{
14+
"name": "yarn-expressions",
15+
"pattern": "/\\{[^}]*\\}/g"
16+
},
17+
{
18+
"name": "yarn-variables",
19+
"pattern": "/\\$[a-zA-Z_][a-zA-Z0-9_]*/g"
20+
},
21+
{
22+
"name": "yarn-markup",
23+
"pattern": "/\\[[^\\]]*\\]/g"
24+
},
25+
{
26+
"name": "yarn-hashtags",
27+
"pattern": "/#[a-zA-Z_][a-zA-Z0-9_:-]*/g"
28+
},
29+
{
30+
"name": "yarn-node-markers",
31+
"pattern": "/^(---|===)$/gm"
32+
},
33+
{
34+
"name": "yarn-headers",
35+
"pattern": "/^(title|tags|position|color|colorID|tracking|custom|style):.*/gm"
36+
},
37+
{
38+
"name": "yarn-character-names",
39+
"pattern": "/^\\s*[A-Za-z_][A-Za-z0-9_]*(?=:)/gm"
40+
},
41+
{
42+
"name": "yarn-comments",
43+
"pattern": "/\\/\\/.*$/gm"
44+
}
45+
],
46+
"ignoreRegExpList": [
47+
"yarn-commands",
48+
"yarn-expressions",
49+
"yarn-variables",
50+
"yarn-markup",
51+
"yarn-hashtags",
52+
"yarn-node-markers",
53+
"yarn-headers",
54+
"yarn-character-names",
55+
"yarn-comments"
56+
]
57+
}
58+
]
59+
}

CHANGELOG.md

Lines changed: 186 additions & 168 deletions
Large diffs are not rendered by default.

Samples/Markup/ImageMarkupProcessor.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,26 @@ public override void _Ready()
4040
LineProvider.RegisterMarkerProcessor("img", this);
4141
}
4242

43-
public override List<LineParser.MarkupDiagnostic> ProcessReplacementMarker(MarkupAttribute marker,
44-
StringBuilder childBuilder, List<MarkupAttribute> childAttributes,
45-
string localeCode)
43+
public override ReplacementMarkerResult ProcessReplacementMarker(MarkupAttribute marker,
44+
StringBuilder childBuilder, List<MarkupAttribute> childAttributes,
45+
string localeCode)
4646
{
4747
if (_aliasToSpritePath.TryGetValue(marker.Name, out var value))
4848
{
4949
// replace with <image tag>
5050
childBuilder.Insert(0, value);
51-
return [];
51+
return new ReplacementMarkerResult(value.Length);
5252
}
5353

5454
if (marker.Name == "img")
5555
{
5656
if (!marker.TryGetProperty("path", out MarkupValue imagePath))
5757
{
58-
return [new("No path attribute specified for img markup tag.")];
58+
var error = new List<LineParser.MarkupDiagnostic>
59+
{
60+
new LineParser.MarkupDiagnostic("No path attribute specified for img markup tag.")
61+
};
62+
return new ReplacementMarkerResult(error, 0);
5963
}
6064

6165
var widthString = "";
@@ -74,10 +78,11 @@ public override void _Ready()
7478

7579
// generic image markup
7680
childBuilder.Insert(0, $"[img{argsString}]res://Samples/Markup/images/{imagePath.StringValue}[/img]");
77-
78-
return NoDiagnostics;
81+
var finalString = $"[img{argsString}]res://Samples/Markup/images/{imagePath.StringValue}[/img]";
82+
childBuilder.Insert(0, finalString);
83+
return new ReplacementMarkerResult(finalString.Length);
7984
}
8085

81-
return [];
86+
return new ReplacementMarkerResult();
8287
}
8388
}

Samples/Markup/Markup.yarnproject

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"projectFileVersion": 3,
3-
"sourceFiles": [
4-
"**/*.yarn"
5-
],
6-
"excludeFiles": [],
7-
"localisation": {},
8-
"baseLanguage": "en",
9-
"compilerOptions": {}
2+
"projectFileVersion": 3,
3+
"sourceFiles": [
4+
"**/*.yarn"
5+
],
6+
"excludeFiles": [],
7+
"localisation": {},
8+
"baseLanguage": "en",
9+
"compilerOptions": {}
1010
}

Samples/Markup/example_markup_palette.tres

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_resource type="Resource" script_class="MarkupPalette" load_steps=10 format=3 uid="uid://c631us202ijmk"]
1+
[gd_resource type="Resource" script_class="MarkupPalette" format=3 uid="uid://c631us202ijmk"]
22

33
[ext_resource type="Script" uid="uid://b3q2v7wyxccs0" path="res://addons/YarnSpinner-Godot/Runtime/BasicMarker.cs" id="1_n23v5"]
44
[ext_resource type="Script" uid="uid://lvtve3yjd8v7" path="res://addons/YarnSpinner-Godot/Runtime/CustomMarker.cs" id="2_1n8i4"]

Samples/SampleEntryPoint.tscn

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
[gd_scene load_steps=5 format=3 uid="uid://dnyy064638ly1"]
1+
[gd_scene format=3 uid="uid://dnyy064638ly1"]
22

33
[ext_resource type="Script" uid="uid://0y1x11g66ue4" path="res://Samples/SampleEntryPoint.cs" id="1"]
44
[ext_resource type="Theme" uid="uid://b2mp0b1wvnu8s" path="res://Samples/sample_default_theme.tres" id="2"]
55
[ext_resource type="Script" uid="uid://c3xcfucrfxoia" path="res://Samples/SampleVersionNumberLabel.cs" id="2_shsu2"]
66
[ext_resource type="Texture2D" uid="uid://pbrr5yyepbx8" path="res://addons/YarnSpinner-Godot/Editor/Icons/YarnSpinnerLogo.png" id="3_bcudv"]
77

8-
[node name="SampleEntryPoint" type="CanvasLayer" node_paths=PackedStringArray("_spaceButton", "_visualNovelButton", "_markupPaletteButton", "_pausingTypewriterButton", "_roundedViewsButton", "_sqliteButton", "_gdscriptButton")]
8+
[node name="SampleEntryPoint" type="CanvasLayer" unique_id=501891245 node_paths=PackedStringArray("_spaceButton", "_visualNovelButton", "_markupPaletteButton", "_pausingTypewriterButton", "_roundedViewsButton", "_sqliteButton", "_gdscriptButton")]
99
script = ExtResource("1")
1010
_spaceButton = NodePath("HBoxContainer/VBoxContainer/Space")
1111
_visualNovelButton = NodePath("HBoxContainer/VBoxContainer2/Visual Novel")
@@ -15,13 +15,13 @@ _roundedViewsButton = NodePath("HBoxContainer/VBoxContainer5/RoundedUI")
1515
_sqliteButton = NodePath("HBoxContainer/VBoxContainer6/SQLite")
1616
_gdscriptButton = NodePath("HBoxContainer/VBoxContainer7/GDScriptIntegration")
1717

18-
[node name="ColorRect" type="ColorRect" parent="."]
18+
[node name="ColorRect" type="ColorRect" parent="." unique_id=1478326336]
1919
anchors_preset = 15
2020
anchor_right = 1.0
2121
anchor_bottom = 1.0
2222
color = Color(0.0431373, 0.0901961, 0.0470588, 1)
2323

24-
[node name="Title" type="RichTextLabel" parent="."]
24+
[node name="Title" type="RichTextLabel" parent="." unique_id=193252348]
2525
clip_contents = false
2626
anchors_preset = 5
2727
anchor_left = 0.5
@@ -37,7 +37,7 @@ theme_override_font_sizes/normal_font_size = 48
3737
bbcode_enabled = true
3838
text = "[u]YarnSpinner Samples[/u]"
3939

40-
[node name="PluginVersionLabel" type="RichTextLabel" parent="."]
40+
[node name="PluginVersionLabel" type="RichTextLabel" parent="." unique_id=2132340201]
4141
clip_contents = false
4242
anchors_preset = 5
4343
anchor_left = 0.5
@@ -53,7 +53,7 @@ theme_override_font_sizes/normal_font_size = 28
5353
bbcode_enabled = true
5454
text = "Plugin Version"
5555

56-
[node name="PluginVersionValue" type="RichTextLabel" parent="."]
56+
[node name="PluginVersionValue" type="RichTextLabel" parent="." unique_id=1112540167]
5757
clip_contents = false
5858
anchors_preset = 5
5959
anchor_left = 0.5
@@ -67,18 +67,18 @@ size_flags_horizontal = 3
6767
size_flags_vertical = 3
6868
theme_override_font_sizes/normal_font_size = 28
6969
bbcode_enabled = true
70-
text = "0.3.11"
70+
text = "0.3.20"
7171
script = ExtResource("2_shsu2")
7272

73-
[node name="Logo" type="TextureRect" parent="."]
73+
[node name="Logo" type="TextureRect" parent="." unique_id=1051631919]
7474
offset_left = 76.0
7575
offset_top = 55.0
7676
offset_right = 314.0
7777
offset_bottom = 269.0
7878
texture = ExtResource("3_bcudv")
7979
expand_mode = 1
8080

81-
[node name="HBoxContainer" type="HBoxContainer" parent="."]
81+
[node name="HBoxContainer" type="HBoxContainer" parent="." unique_id=1279368332]
8282
anchors_preset = 8
8383
anchor_left = 0.5
8484
anchor_top = 0.5
@@ -93,11 +93,11 @@ grow_vertical = 2
9393
size_flags_vertical = 8
9494
alignment = 1
9595

96-
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"]
96+
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer" unique_id=731109250]
9797
layout_mode = 2
9898
size_flags_horizontal = 3
9999

100-
[node name="Space" type="Button" parent="HBoxContainer/VBoxContainer"]
100+
[node name="Space" type="Button" parent="HBoxContainer/VBoxContainer" unique_id=888743355]
101101
custom_minimum_size = Vector2(180, 100)
102102
layout_mode = 2
103103
theme = ExtResource("2")
@@ -106,7 +106,7 @@ theme_override_constants/outline_size = 5
106106
theme_override_font_sizes/font_size = 27
107107
text = "Space"
108108

109-
[node name="features" type="RichTextLabel" parent="HBoxContainer/VBoxContainer"]
109+
[node name="features" type="RichTextLabel" parent="HBoxContainer/VBoxContainer" unique_id=1785441193]
110110
layout_mode = 2
111111
size_flags_vertical = 3
112112
theme_override_font_sizes/normal_font_size = 28
@@ -118,11 +118,11 @@ Node Groups
118118
Shadow lines"
119119
scroll_active = false
120120

121-
[node name="VBoxContainer2" type="VBoxContainer" parent="HBoxContainer"]
121+
[node name="VBoxContainer2" type="VBoxContainer" parent="HBoxContainer" unique_id=1923299801]
122122
layout_mode = 2
123123
size_flags_horizontal = 3
124124

125-
[node name="Visual Novel" type="Button" parent="HBoxContainer/VBoxContainer2"]
125+
[node name="Visual Novel" type="Button" parent="HBoxContainer/VBoxContainer2" unique_id=1218198861]
126126
custom_minimum_size = Vector2(180, 100)
127127
layout_mode = 2
128128
theme = ExtResource("2")
@@ -132,7 +132,7 @@ theme_override_font_sizes/font_size = 27
132132
text = "Visual
133133
Novel"
134134

135-
[node name="features" type="RichTextLabel" parent="HBoxContainer/VBoxContainer2"]
135+
[node name="features" type="RichTextLabel" parent="HBoxContainer/VBoxContainer2" unique_id=1497739487]
136136
layout_mode = 2
137137
size_flags_vertical = 3
138138
theme_override_font_sizes/normal_font_size = 28
@@ -142,11 +142,11 @@ Effect/ Animation Commands
142142
"
143143
scroll_active = false
144144

145-
[node name="VBoxContainer3" type="VBoxContainer" parent="HBoxContainer"]
145+
[node name="VBoxContainer3" type="VBoxContainer" parent="HBoxContainer" unique_id=1934888055]
146146
layout_mode = 2
147147
size_flags_horizontal = 3
148148

149-
[node name="MarkupPalette" type="Button" parent="HBoxContainer/VBoxContainer3"]
149+
[node name="MarkupPalette" type="Button" parent="HBoxContainer/VBoxContainer3" unique_id=303366632]
150150
custom_minimum_size = Vector2(180, 100)
151151
layout_mode = 2
152152
theme = ExtResource("2")
@@ -155,7 +155,7 @@ theme_override_constants/outline_size = 5
155155
theme_override_font_sizes/font_size = 27
156156
text = "Markup "
157157

158-
[node name="features" type="RichTextLabel" parent="HBoxContainer/VBoxContainer3"]
158+
[node name="features" type="RichTextLabel" parent="HBoxContainer/VBoxContainer3" unique_id=1189343168]
159159
layout_mode = 2
160160
size_flags_vertical = 3
161161
theme_override_font_sizes/normal_font_size = 28
@@ -167,11 +167,11 @@ text = "* Action markup
167167
"
168168
scroll_active = false
169169

170-
[node name="VBoxContainer4" type="VBoxContainer" parent="HBoxContainer"]
170+
[node name="VBoxContainer4" type="VBoxContainer" parent="HBoxContainer" unique_id=1573324798]
171171
layout_mode = 2
172172
size_flags_horizontal = 3
173173

174-
[node name="PausingTypewriter" type="Button" parent="HBoxContainer/VBoxContainer4"]
174+
[node name="PausingTypewriter" type="Button" parent="HBoxContainer/VBoxContainer4" unique_id=445553658]
175175
custom_minimum_size = Vector2(180, 100)
176176
layout_mode = 2
177177
theme = ExtResource("2")
@@ -181,19 +181,19 @@ theme_override_font_sizes/font_size = 27
181181
text = "Pausing
182182
Typewriter"
183183

184-
[node name="features" type="RichTextLabel" parent="HBoxContainer/VBoxContainer4"]
184+
[node name="features" type="RichTextLabel" parent="HBoxContainer/VBoxContainer4" unique_id=1885744326]
185185
layout_mode = 2
186186
size_flags_vertical = 3
187187
theme_override_font_sizes/normal_font_size = 28
188188
bbcode_enabled = true
189189
text = "Pausing at specific points while revealing your dialogue text"
190190
scroll_active = false
191191

192-
[node name="VBoxContainer5" type="VBoxContainer" parent="HBoxContainer"]
192+
[node name="VBoxContainer5" type="VBoxContainer" parent="HBoxContainer" unique_id=696498125]
193193
layout_mode = 2
194194
size_flags_horizontal = 3
195195

196-
[node name="RoundedUI" type="Button" parent="HBoxContainer/VBoxContainer5"]
196+
[node name="RoundedUI" type="Button" parent="HBoxContainer/VBoxContainer5" unique_id=2083224762]
197197
custom_minimum_size = Vector2(180, 100)
198198
layout_mode = 2
199199
theme = ExtResource("2")
@@ -202,19 +202,19 @@ theme_override_constants/outline_size = 5
202202
theme_override_font_sizes/font_size = 27
203203
text = "Rounded UI"
204204

205-
[node name="features" type="RichTextLabel" parent="HBoxContainer/VBoxContainer5"]
205+
[node name="features" type="RichTextLabel" parent="HBoxContainer/VBoxContainer5" unique_id=942446904]
206206
layout_mode = 2
207207
size_flags_vertical = 3
208208
theme_override_font_sizes/normal_font_size = 28
209209
bbcode_enabled = true
210210
text = "Alternate dialogue UI style"
211211
scroll_active = false
212212

213-
[node name="VBoxContainer6" type="VBoxContainer" parent="HBoxContainer"]
213+
[node name="VBoxContainer6" type="VBoxContainer" parent="HBoxContainer" unique_id=829188392]
214214
layout_mode = 2
215215
size_flags_horizontal = 3
216216

217-
[node name="SQLite" type="Button" parent="HBoxContainer/VBoxContainer6"]
217+
[node name="SQLite" type="Button" parent="HBoxContainer/VBoxContainer6" unique_id=87729081]
218218
custom_minimum_size = Vector2(180, 100)
219219
layout_mode = 2
220220
theme = ExtResource("2")
@@ -225,19 +225,19 @@ text = "SQLite
225225
Variable
226226
Storage"
227227

228-
[node name="features" type="RichTextLabel" parent="HBoxContainer/VBoxContainer6"]
228+
[node name="features" type="RichTextLabel" parent="HBoxContainer/VBoxContainer6" unique_id=158977072]
229229
layout_mode = 2
230230
size_flags_vertical = 3
231231
theme_override_font_sizes/normal_font_size = 28
232232
bbcode_enabled = true
233233
text = "Custom variable storage script storing variables in a SQLite database"
234234
scroll_active = false
235235

236-
[node name="VBoxContainer7" type="VBoxContainer" parent="HBoxContainer"]
236+
[node name="VBoxContainer7" type="VBoxContainer" parent="HBoxContainer" unique_id=324955247]
237237
layout_mode = 2
238238
size_flags_horizontal = 3
239239

240-
[node name="GDScriptIntegration" type="Button" parent="HBoxContainer/VBoxContainer7"]
240+
[node name="GDScriptIntegration" type="Button" parent="HBoxContainer/VBoxContainer7" unique_id=257084300]
241241
custom_minimum_size = Vector2(180, 100)
242242
layout_mode = 2
243243
theme = ExtResource("2")
@@ -246,7 +246,7 @@ theme_override_constants/outline_size = 5
246246
theme_override_font_sizes/font_size = 27
247247
text = "GDScript"
248248

249-
[node name="features" type="RichTextLabel" parent="HBoxContainer/VBoxContainer7"]
249+
[node name="features" type="RichTextLabel" parent="HBoxContainer/VBoxContainer7" unique_id=116614317]
250250
layout_mode = 2
251251
size_flags_vertical = 3
252252
theme_override_font_sizes/normal_font_size = 28

Samples/Space/Dialogue/SpaceYarnVariables.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using YarnSpinnerGodot;
22

3-
[System.CodeDom.Compiler.GeneratedCode("YarnSpinner", "0.3.0")]
3+
[System.CodeDom.Compiler.GeneratedCode("YarnSpinner", "0.3.20")]
44
public partial class SpaceYarnVariables : YarnSpinnerGodot.InMemoryVariableStorage, YarnSpinnerGodot.IGeneratedVariableStorage {
55
// Accessor for Number $times_talked_sally_before_ship
66
public float TimesTalkedSallyBeforeShip {

Samples/Space/Scripts/SpaceSample.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ public override void _Ready()
1717
_instance = this;
1818
dialogueRunner.onDialogueComplete += OnDialogueComplete;
1919
}
20-
21-
public static void Test(global::YarnSpinnerGodot.IActionRegistration target)
22-
{
23-
target.AddCommandHandler<string, string>("test", SetSprite);
24-
}
2520

2621
[YarnCommand("setsprite")]
2722
public static void SetSprite(string character, string spriteName)

0 commit comments

Comments
 (0)