Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.3.0 - Yarn language v3 features #75

Open
wants to merge 31 commits into
base: v3_beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
15d2c07
update yarnspinner dlls to development/v3. need to fix script errors
dogboydog Nov 29, 2024
c030695
fix compilation errors porting yarnspinner v3 beta to Godot, fixes st…
dogboydog Dec 1, 2024
e23d57f
yarnspinner v3 sample compiling (plugin updates still remain)
dogboydog Dec 2, 2024
e78c444
fix some references to Start() to be _Ready()
dogboydog Dec 2, 2024
8595073
fix some missing exports. fix hanging async tasks
dogboydog Dec 5, 2024
40311c8
Start porting command/function C# source generator. Not working yet
dogboydog Dec 6, 2024
009494f
command/function registration source generation partially working
dogboydog Dec 6, 2024
0c2cf77
Fix some references to unity
dogboydog Dec 7, 2024
d7f94b0
semi-working updated space sample with line groups and <<once>> exam…
dogboydog Dec 7, 2024
fc1f68b
source generation is actually registering yarn commands and functions…
dogboydog Dec 7, 2024
333db52
upgrade visual novel and SQL samples to yarn 3. fix character layout …
dogboydog Dec 8, 2024
500f736
shadow lines and smart variables tested working in space sample
dogboydog Dec 8, 2024
a6b234a
add UI confirm with controller
dogboydog Dec 8, 2024
fc624c4
start to port code for variable storage code generation
dogboydog Dec 8, 2024
17a0c4a
Update space sample to use detour and node groups
dogboydog Dec 9, 2024
722918e
variable storage source generation from yarn project inspector working
dogboydog Dec 9, 2024
0f5c090
Add AddCommandHandlerCallable back to DialogueRunner
dogboydog Dec 9, 2024
3fa1a7d
fix backwards compatibility with v0.2 views by making AsyncDialogueVi…
dogboydog Dec 9, 2024
5b49c07
Add some more support for directly using GDScript nodes as views
dogboydog Dec 9, 2024
48d2a63
Add enum example, add enum support to project inspector
dogboydog Dec 10, 2024
a79e06d
example of int enum
dogboydog Dec 10, 2024
12dbdff
Updated MarkUpPalette / PaletteMarkerProcessor.cs tested working, upd…
dogboydog Dec 10, 2024
cef0d5b
fix namespace for generated command/function class, allows it to use …
dogboydog Dec 11, 2024
eae4d85
Merge branch 'develop' of github.com:YarnSpinnerTool/YarnSpinner-Godo…
dogboydog Dec 11, 2024
245fe6e
reference generated functions/commands in compilation to prevent 'ca…
dogboydog Dec 11, 2024
9c75f93
add auto generated SpaceYarnVariables
dogboydog Dec 12, 2024
721004a
Merge remote-tracking branch 'origin/development-v3' into development-v3
dogboydog Dec 12, 2024
7a64e3f
fix all warnings. Use yarncommand and yarnfunction attributes in Visu…
dogboydog Dec 12, 2024
4cb2f0c
Fix missing using statement if YARNSPINNER_DEBUG symbol is defined. a…
dogboydog Dec 12, 2024
7e6c50a
update CHANGELOG.md for 0.3.0
dogboydog Dec 14, 2024
2b5fc1f
use nuget for yarnspinner DLLs!
dogboydog Dec 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

Generated/
## VisualStudio

.vs/
Expand Down
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [0.3.0] Pending

* Updated YarnSpinner DLLs to support version 3 of the Yarn Language, which supports many new features, similar to the feature set described for the Unity plugin here:
* https://www.yarnspinner.dev/blog/yarn-spinner-3-beta-1
* The samples have been updated to demonstrate these features, including enums, node groups, line groups, smart variables, shadow lines, generated variable storage code, `<<detour>>` and `<<once>>`.
* `[YarnCommand`] and `[YarnFunction]` have been updated to generate a class called `YarnSpinnerGodot.Generated.ActionRegistration`. This class will register all of your commands and functions without relying on reflection, which was the cause of some performance hiccups when starting a scene with a DialogueRunner in v0.2.* of the plugin
* To enable new features for an existing .yarnproject, edit the .yarnproject file to change the projectFileVersion to 3.
* If you keep your .yarnproject at projectFileVersion 2, you will have to re-compile the scripts in your yarn project to work with this version of the plugin.
* Update views to be async Task based, like the Unity plugin version 3.
* The existing `DialogueViewBase` interface is deprecated in favor of `AsyncDialogueViewBased`. Updated example views are provided.
* GDScript nodes that have methods that are the `snake_case` version of methods on `AsyncDialogueViewBase` can be added directly in `YarnProject.dialogueViews`
without requiring GDScriptViewAdapter. Supported methods: `on_dialogue_start_async() -> void`, `on_dialogue_complete_async() -> void`, `run_line_async(line: Dictionary) -> void`, `run_options_async(options: Array, on_option_selected: Callable) -> void`. You can still use `await` statements in your GDScript view methods. `AddCommandHandlerCallable` on `DialogueRunner` has been re-tested to ensure that commands can still be registered from GDScript. Also, the GDScriptIntegration sample has been updated with these changes.
* ⚠ Breaking change: LineProviderBehaviour has changed to require different methods and fields. If you have a custom line provider, please see the updated TextLineProvider as an * example of how to implement the updated class. Also notice that you must now set the yarn project on `TextLineProvider` instances, either via script or in the inspector.
* ⚠ Breaking change: Use DialogueRunner.VariableStorage, not DialogueRunner.variableStorage, nor DialogueRunner.SetDialogueViews (removed) to get/set the variable storage associated with a DialogueRunner. Previously there were two properties with different case that were both publicly accessible.
* ⚠ Breaking change: MarkupPalette renamed ColourMarkers to FormatMarkers, supporting new functionality like bold, underline, italics, as a way to demonstrate the updated formatting
* ⚠ Breaking change: the field DialogueRunner.verboseLogging has been removed.
* New functionality on YarnProject - optionally generate a C# variable storage class which has getters and setters for each variable declared in your yarn scripts. You can control the class that the generated file inherits from, the namespace it will be in, and the name of the class and file.



## [0.2.14] 2024-11-02
* GDScript: Add GDScriptViewAdapter, a C# Script which allows you to write custom dialogue views in GDScript. See GDScriptViewAdapter.cs for more details.
* GDScript: Add new method AddCommandHandlerCallable to DialogueRunner, allowing commands to be registered from GDScript. GDScript command handlers that use asynchronous `await` functionality are also supported as blocking YarnSpinner commands, similar to using `async Task` commands in C#.
Expand All @@ -30,7 +50,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [0.2.9] 2024-06-30

* Set LineView's MouseFilter to 'ignore' to avoid interfering with clicks.
* Fix an issue where 'use fade effect' would cause the ConvertBBCodeToHTML feature to stop working while the text was fading out.
* Fix an issue where 'use fade effect' would cause the ConvertHTMLToBBCode feature to stop working while the text was fading out.
* Set the LineView to Visible=False when marking its alpha as 0.

## [0.2.8] 2024-05-24
Expand Down
93 changes: 93 additions & 0 deletions Samples/Characters/Dialogue/CharacterSample.yarn
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
title: Barry
when: once
---
// This node can only ever be run once, and this is the only content for this
// character. The game won't show the 'interactable' indicator if the character
// has no content available.
Barry: Hi, I'm Barry! You can only talk to me this one time!
===
title: Larry
---
<<once>>
// Greet the player the first time.
Larry: Hi, I'm Larry! You can talk to me several times!
<<endonce>>

/// The number of times we have turned the switch on or off.
<<declare $times_interacted_with_switch = 0 as number>>

/// Whether the switch is currently turned on or off.
<<declare $switch_on = false as bool>>

<<if $switch_on>>
<<once>>
// Directly thank the player the first time
Larry: Hey, thanks for turning that switch on for me!
<<else>>
// Run general 'you did it' barks in other circumstances.
=> Larry: Sure is nice having that switch on!
=> Larry: Being on is a great thing for a switch to be!
=> Larry: Wow! Never knew how good a switch being turned on was.
<<endonce>>
<<elseif $times_interacted_with_switch > 0 and not $switch_on>>
// We've turned the switch on in the past, but it's not on now. Complain
// about it.
=> Larry: Don't be a jerk! Turn that switch back on!
=> Larry: Hey! Can you turn that switch back on?
=> Larry: Aw, I loved it when the switch was on.
<<else>>
// The switch isn't on.
<<once if $times_interacted_with_switch == 0>>
// We haven't turned the switch on before, so be really direct about it
Larry: Hey, can you turn that switch on for me?
<<else>>
// Be a bit more passive-aggressive about it the rest of the time.
=> Larry: Sure wish someone would turn that switch on.
=> Larry: Man, how amazing would it be for that switch to be on...
=> Larry: My only dream is for the switch to be on...
<<endonce>>
<<endif>>
===
title: Switch
---
// Toggle the switch on or off.
<<set $switch_on = !$switch_on>>

// Increment the number of times we've interacted with it.
<<set $times_interacted_with_switch += 1>>

// Play an animation that shows the switch turning on or off.
<<if $switch_on>>
<<turn_on Switch>>
<<else>>
<<turn_off Switch>>
<<endif>>
===
title: Garry
---


Garry: Emotions test!

<<face Garry smile>>
Garry: Smiling!

<<face Garry frown>>
Garry: Frowning!

<<face Garry neutral>>
Garry: Neutral!

Garry: Let's try animating it!

<<face Garry smile 0.2>>
Garry: Smiling!

<<face Garry frown 0.2>>
Garry: Frowning!

<<face Garry neutral 0.2>>
Garry: Neutral!


===
14 changes: 14 additions & 0 deletions Samples/Characters/Dialogue/CharacterSample.yarn.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[remap]

importer="yarnscript"
type="Resource"
uid="uid://bvucc8lvq2xbc"
path="res://.godot/imported/CharacterSample.yarn-ed78dc65c09d526de320ad4d21190854.tres"

[deps]

source_file="res://Samples/Characters/Dialogue/CharacterSample.yarn"
dest_files=["res://.godot/imported/CharacterSample.yarn-ed78dc65c09d526de320ad4d21190854.tres"]

[params]

11 changes: 11 additions & 0 deletions Samples/Characters/Dialogue/CharacterSample.yarnproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"projectFileVersion": 3,
"sourceFiles": [
"**/*.yarn"
],
"excludeFiles": [
"**/*~/*"
],
"localisation": {},
"baseLanguage": "en"
}
14 changes: 14 additions & 0 deletions Samples/Characters/Dialogue/CharacterSample.yarnproject.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[remap]

importer="yarnproject"
type="Resource"
uid="uid://b3qu6dw2x8nls"
path="res://.godot/imported/CharacterSample.yarnproject-c10833699b5605472ed6a79ae0501e1a.tres"

[deps]

source_file="res://Samples/Characters/Dialogue/CharacterSample.yarnproject"
dest_files=["res://.godot/imported/CharacterSample.yarnproject-c10833699b5605472ed6a79ae0501e1a.tres"]

[params]

25 changes: 25 additions & 0 deletions Samples/Characters/Dialogue/YarnVariables.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace MyGame;

using YarnSpinnerGodot;

[System.CodeDom.Compiler.GeneratedCode("YarnSpinner", "3.0.0.0")]
public partial class YarnVariables : YarnSpinnerGodot.InMemoryVariableStorage, YarnSpinnerGodot.IGeneratedVariableStorage {
// Accessor for Number $times_interacted_with_switch
/// <summary>
/// The number of times we have turned the switch on or off.
/// </summary>
public float TimesInteractedWithSwitch {
get => this.GetValueOrDefault<float>("$times_interacted_with_switch");
set => this.SetValue<float>("$times_interacted_with_switch", value);
}

// Accessor for Bool $switch_on
/// <summary>
/// Whether the switch is currently turned on or off.
/// </summary>
public bool SwitchOn {
get => this.GetValueOrDefault<bool>("$switch_on");
set => this.SetValue<bool>("$switch_on", value);
}

}
3 changes: 2 additions & 1 deletion Samples/GDScriptIntegration/CrossLanguageScriptingExample.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
extends Control
@export var dialogue_runner: Node
@export var logo: Control
@export var yarn_project: YarnProject
@export var yarn_project: Resource

func _ready() -> void:
dialogue_runner.AddCommandHandlerCallable("show_logo", show_logo)
dialogue_runner.onDialogueComplete.connect(on_dialogue_complete)
Expand Down
17 changes: 11 additions & 6 deletions Samples/GDScriptIntegration/Dialogue/GDScriptIntegration.yarn
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,23 @@ tags:
Gary: So, can I use [fx type="wave"]GDScript[/fx] with YarnSpinner? #my_metadata #line:02fa0cd
Derrick: Many features can be used with GDScript. For example, you can make a custom view like the one in this scene. #line:09c1c2c
Derrick: You can also interact with DialogueRunner and variable storage nodes with cross-language scripting. #line:0b086af
Derrick: And you can also write commands in GDScript by using AddCommandHandlerCallable. Your GDScript commands can even use 'await'. Look: #line:0c22e97
Derrick: And you can also write commands in GDScript by using AddCommandHandlerCallable. Your GDScript commands can even use 'await'. Look! #line:0c22e97
<<show_logo "res://addons/YarnSpinner-Godot/Editor/Icons/YarnSpinnerLogo.png">>
Derrick: Do you know about options, too? You can make an "OptionsListView" with GDScript, too.
-> Yes
Derrick: Nice.
Derrick: Do you know about options, too? You can make an "OptionsListView" with GDScript, too. #line:0cc7452
-> Yes #line:0cd81c1
Derrick: Nice. #line:0b3ca20
<<jump GDScriptIntegrationFinish>>
-> No
Derrick: Well, you can prompt the player to pick an option.
-> No #line:0f03ac3
Derrick: Well, you can prompt the player to pick an option. #line:01e20f4
<<jump GDScriptIntegrationFinish>>
===

title: GDScriptIntegrationFinish
---
Gary: {$myVariableSetFromGDScript} That's cool. I will look at the GDScriptIntegration sample code to learn about this. #line:020bb2b
Derrick: Awesome. Which language do you think you will end up using YarnSpinner for Godot with? #line:0166369
-> GDScript #line:07cc6d2
Derrick: That's cool. #line:0862705
-> C\# #line:0eb6bfe
Derrick: That's cool. #shadow:0862705
===
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[remap]

importer="yarnproject"
type="Resource"
uid="uid://c0qdj0h48fu6a"
path="res://.godot/imported/GDScriptIntegration.yarnproject-3447483eda8ff87e2d80c8bc61bf66c1.tres"

[deps]

source_file="res://Samples/GDScriptIntegration/Dialogue/GDScriptIntegration.yarnproject"
dest_files=["res://.godot/imported/GDScriptIntegration.yarnproject-3447483eda8ff87e2d80c8bc61bf66c1.tres"]

[params]

14 changes: 0 additions & 14 deletions Samples/GDScriptIntegration/GDScriptIntegration.yarnproject.import

This file was deleted.

Loading
Loading