Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
67 changes: 38 additions & 29 deletions YarnSpinner-Godot.csproj
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
<Project Sdk="Godot.NET.Sdk/4.6.2">
<PropertyGroup>
<NoWarn>RS2008</NoWarn> <!-- We do not have the AnalyserReleases.*.md files written to satisfy this warning -->
<TargetFramework>net8.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<!--Turn on Nullable so that we can fail the build if there are any incompatible scripts-->
<Nullable>enable</Nullable>
<!-- Include this when debugging source generation -->
<DefineConstants>$(DefineConstants);YARN_SOURCE_GENERATION_DEBUG_LOGGING;YARNSPINNER_DEBUG</DefineConstants>
<PropertyGroup>
<NoWarn>RS2008</NoWarn> <!-- We do not have the AnalyserReleases.*.md files written to satisfy this warning -->
<TargetFramework>net8.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<!--Turn on Nullable so that we can fail the build if there are any incompatible scripts-->
<Nullable>enable</Nullable>
<!-- Include this when debugging source generation -->
<DefineConstants>$(DefineConstants);YARN_SOURCE_GENERATION_DEBUG_LOGGING;YARNSPINNER_DEBUG</DefineConstants>

<!-- Uncomment the following two lines if you want to see the generated
Command/Function C# file on disk for debugging purposes. -->
<!-- <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>-->
<!-- <CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>-->
<!-- Uncomment the following two lines if you want to see the generated
Command/Function C# file on disk for debugging purposes. -->
<!-- <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>-->
<!-- <CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>-->

</PropertyGroup>
<ItemGroup>
</PropertyGroup>
<Choose>
<When Condition=" $(Configuration)=='ExportDebug' Or $(Configuration)=='ExportRelease'">
<!-- Exported game -->
<PropertyGroup>
<!-- To enable AOT compilation in exports -->
<PublishAot>true</PublishAot>
</PropertyGroup>
</When>
</Choose>
<ItemGroup>
<!-- Add some extra files for ease of developing samples -->
<Compile Include="addons\YarnSpinner-Godot\SourceGenerator\YarnSpinnerProjectSettings.cs"/>
<None Include="addons\YarnSpinner-Godot\YarnSpinner-Godot.props"/>
<None Include="addons\YarnSpinner-Godot\plugin.cfg"/>
<None Include="**\*.md"/>
<None Include="**\*.yarn"/>
<None Include="**\*.yarnproject"/>
<None Include="**\*.gd"/>
<Compile Remove="Generated\**"/>
<!-- For SQL variable storage sample -->
<PackageReference Include="sqlite-net-pcl" Version="1.9.172"/>
</ItemGroup>

<!-- Add some extra files for ease of developing samples -->
<Compile Include="addons\YarnSpinner-Godot\SourceGenerator\YarnSpinnerProjectSettings.cs" />
<None Include="addons\YarnSpinner-Godot\YarnSpinner-Godot.props" />
<None Include="addons\YarnSpinner-Godot\plugin.cfg" />
<None Include="**\*.md" />
<None Include="**\*.yarn" />
<None Include="**\*.yarnproject" />
<None Include="**\*.gd" />
<Compile Remove="Generated\**" />
<!-- For SQL variable storage sample -->
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
</ItemGroup>
<!-- How to include the plugin code in your .csproj -->
<Import Project="addons\YarnSpinner-Godot\YarnSpinner-Godot.props"/>

<!-- How to include the plugin code in your .csproj -->
<Import Project="addons\YarnSpinner-Godot\YarnSpinner-Godot.props" />
</Project>
30 changes: 15 additions & 15 deletions addons/YarnSpinner-Godot/Runtime/Async/YarnTask/YarnTask.Task.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,21 @@ public static partial async YarnTask WhenAll(IEnumerable<YarnTask> tasks)
await Task.WhenAll(taskList.ToArray());
}

public static async partial YarnTask<T[]> WhenAll<T>(params YarnTask<T>[] tasks)
{
return await Task.WhenAll(Array.ConvertAll<YarnTask<T>, Task<T>>(tasks, t => t));
}

public static async partial YarnTask<T[]> WhenAll<T>(IEnumerable<YarnTask<T>> tasks)
{
var uniTasks = new List<Task<T>>();
foreach (var task in tasks)
{
uniTasks.Add(task);
}

return await Task.WhenAll(uniTasks);
}
// public static async partial YarnTask<T[]> WhenAll<T>(params YarnTask<T>[] tasks)
Copy link
Copy Markdown
Collaborator Author

@dogboydog dogboydog Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uncommenting these lines causes a compilation failure under AOT, maybe due to using the generic types?

// {
// return await Task.WhenAll(Array.ConvertAll<YarnTask<T>, Task<T>>(tasks, t => t));
// }

// public static async partial YarnTask<T[]> WhenAll<T>(IEnumerable<YarnTask<T>> tasks)
// {
// var uniTasks = new List<Task<T>>();
// foreach (var task in tasks)
// {
// uniTasks.Add(task);
// }
//
// return await Task.WhenAll(uniTasks);
// }

public readonly async partial YarnTask<bool> SuppressCancellationThrow()
{
Expand Down
4 changes: 2 additions & 2 deletions addons/YarnSpinner-Godot/Runtime/Async/YarnTask/YarnTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public partial struct YarnTask

public static partial YarnTask WhenAll(params YarnTask[] tasks);
public static partial YarnTask WhenAll(IEnumerable<YarnTask> tasks);
public static partial YarnTask<T[]> WhenAll<T>(params YarnTask<T>[] tasks);
public static partial YarnTask<T[]> WhenAll<T>(IEnumerable<YarnTask<T>> tasks);
// public static partial YarnTask<T[]> WhenAll<T>(params YarnTask<T>[] tasks);
// public static partial YarnTask<T[]> WhenAll<T>(IEnumerable<YarnTask<T>> tasks);

public readonly partial YarnTask<bool> SuppressCancellationThrow();

Expand Down
11 changes: 5 additions & 6 deletions addons/YarnSpinner-Godot/Runtime/Commands/Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,20 +215,19 @@ public CommandDispatchResult.ParameterParseStatusType TryParseArgs(string[] args
// the method.
var parameterArrayElementType = parameters[i].ParameterType.GetElementType();
var paramIndex = i;
// var paramsArray = new List<object?>();
var paramsArray = Array.CreateInstance(parameterArrayElementType!, argumentCount - i);
var paramsList = new List<object?>();
while (i < argumentCount)
{
arg = args[i];
if (converter == null)
{
paramsArray.SetValue(arg, i);
paramsList.Add(arg);
}
else
{
try
{
paramsArray.SetValue(converter.Invoke(arg, i), i - paramIndex);
paramsList.Add(converter.Invoke(arg, i));
}
catch (Exception e)
{
Expand All @@ -242,7 +241,7 @@ public CommandDispatchResult.ParameterParseStatusType TryParseArgs(string[] args
i += 1;
}

finalArgs[paramIndex] = paramsArray;
finalArgs[paramIndex] = paramsList.ToArray();
}
else
{
Expand Down Expand Up @@ -280,7 +279,7 @@ public CommandDispatchResult.ParameterParseStatusType TryParseArgs(string[] args
{
// If the parameter is a params array, provide an empty
// array of the appropriate type.
finalArgs[i] = Array.CreateInstance(parameter.ParameterType.GetElementType()!, 0);
finalArgs[i] = Array.Empty<object>();
}
else
{
Expand Down
24 changes: 24 additions & 0 deletions addons/YarnSpinner-Godot/SourceGenerator/SourceGenerator.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YarnSpinnerGodotSourceGenerator", "YarnSpinnerGodotSourceGenerator.csproj", "{B4D61F22-D597-964F-0547-2A361A809E8D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B4D61F22-D597-964F-0547-2A361A809E8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4D61F22-D597-964F-0547-2A361A809E8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4D61F22-D597-964F-0547-2A361A809E8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4D61F22-D597-964F-0547-2A361A809E8D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A6B02B91-AA01-48E2-9B49-1D1787C9FF81}
EndGlobalSection
EndGlobal
4 changes: 4 additions & 0 deletions addons/YarnSpinner-Godot/YarnSpinner-Godot.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@
ReferenceOutputAssembly="false"
OutputItemType="analyzer"/>
</ItemGroup>
<ItemGroup>
<TrimmerRootAssembly Include="Google.Protobuf"/>
<TrimmerRootAssembly Include="CsvHelper"/>
</ItemGroup>
</Project>
16 changes: 13 additions & 3 deletions export_presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
name="win64"
platform="Windows Desktop"
runnable=true
advanced_options=false
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter="**/*.cfg"
exclude_filter=""
export_path="build/YarnSpinner-Godot-Samples.exe"
patches=PackedStringArray()
patch_delta_encoding=false
patch_delta_compression_level_zstd=19
patch_delta_min_reduction=0.1
patch_delta_include_filters="*"
patch_delta_exclude_filters=""
encryption_include_filters=""
encryption_exclude_filters=""
seed=0
Expand All @@ -26,6 +30,7 @@ debug/export_console_wrapper=0
binary_format/embed_pck=false
texture_format/s3tc_bptc=true
texture_format/etc2_astc=false
shader_baker/enabled=false
binary_format/architecture="x86_64"
codesign/enable=false
codesign/timestamp=true
Expand Down Expand Up @@ -77,14 +82,18 @@ texture_format/etc2=false
name="linux_amd64"
platform="Linux"
runnable=true
advanced_options=false
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter="**/*.cfg"
exclude_filter=""
export_path="build/YarnSpinner-Godot-Samples-linux_x8664/YarnSpinner-Godot-Samples.x86_64"
export_path="build/linux64/YarnSpinner-Godot-Samples.x86_64"
patches=PackedStringArray()
patch_delta_encoding=false
patch_delta_compression_level_zstd=19
patch_delta_min_reduction=0.1
patch_delta_include_filters="*"
patch_delta_exclude_filters=""
encryption_include_filters=""
encryption_exclude_filters=""
seed=0
Expand All @@ -100,6 +109,7 @@ debug/export_console_wrapper=1
binary_format/embed_pck=false
texture_format/s3tc_bptc=true
texture_format/etc2_astc=false
shader_baker/enabled=false
binary_format/architecture="x86_64"
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
Expand Down
Loading