-
-
Notifications
You must be signed in to change notification settings - Fork 274
Description
Is your feature request related to a problem? Please describe.
I want to be able to use 'game data' or godot resources to inform my autoload calls.
Describe the solution you'd like
Allow a user to select 'resource' from the argument editor in a dialogic timeline like so:
We can simply allow the user to select any resource. Or we can enforce a base type that a resource needs to inherit to see it in the dropdown (cleaner ui). If we use a base type this should be a project setting specifically so c# users like myself can adjust it to a different class:
Describe alternatives you've considered
In my specific use case I want to be able to use enumerations that I defined in c# to inform my autoloads. So in this sense the alternative is to hardcode magic numbers or add enumeration support in dialogic timeline editor but this idea is more flexible.
And in this case I want to be able to define a resource that represents my enumeration:
For example:
namespace Tavern.Enums;
[GlobalClass]
public partial class EmoteValueResource : DialogicResourceArgumentSharp
{
[Export]
public Emotes Value { get; set; } = Emotes.None;
public override string ToString()
{
return $"{Value}";
}
}
Allows me to create a resource file per enumeration value and then use that value strongly typed in my autoload like so:
/// <summary>
/// Sets the emote to be displayed after the cutscene ends
/// </summary>
/// <param name="emote"></param>
public void SetPostCutsceneEmote(EmoteValueResource resource)
{
// I get to use resource.value to have my strongly typed Emote enum in my autoload instead of having to cast a number
CutsceneManager.Instance.CutsceneAdditionalData.Add(CutsceneManager.PostCutsceneEmoteCutsceneKey, Variant.From(resource.Value));
}
Additional context
I've already coded a prototype up and it seemingly works and works well (the screenshots above are me editing field_flex_value.gd
alone). Happy to submit a PR if it is something that would be wanted by people. I'm using it in my game would love it to be apart of the native plugin