Konado .NET API
This feature is still experimental and may have some issues.
Introduction
Konado.NET is a C# API extension for the Konado dialogue system. Using Konado.NET, developers can easily create, manage and execute dialogue content in C# projects.
Usage
Enabling the Plugin
First enable the Konado plugin, then enable the Konado .NET API plugin.
Your scene must contain a DialogueManager node for the Konado .NET API to work correctly.
When first enabling Konado.NET, you may encounter the following error:
Unable to load addon script from path: 'res://addons/konadotnet/Konadotnet.cs': The script may have code errors.
Disabling addon at 'res://addons/konadotnet/plugin.cfg' to prevent further errors.Unable to load addon script from path: 'res://addons/konadotnet/Konadotnet.cs'.This is normal. Recompile Konado.NET in Godot, then reopen the project to resolve the issue.
If you are unable to enable the plugin and there are no errors in MSBuild, try closing the project, deleting the .godot/ folder in the project root, then regenerating the project.
API Reference
KonadoAPI
Core API class providing access to the Konado system.
Properties
bool IsApiReady: Indicates whether the API is readyKonadoAPI API: Static instance providing access to the Konado APIDialogueManagerAPI DialogueManagerApi: Dialogue manager API instance
DialogueManagerAPI
Dialogue manager API for controlling dialogue execution.
Methods
InitDialogue(): Initialise dialogueStartDialogue(): Start dialogueStopDialogue(): Stop dialogue
Events
ShotStart: Emitted when a dialogue scene startsShotEnd: Emitted when a dialogue scene endsDialogueLineStart(int line): Emitted when a dialogue line startsDialogueLineEnd(int line): Emitted when a dialogue line ends
ActingInterface
Performance interface defining background transition effect types.
Enum
BackgroundTransitionEffectsType: Background transition effect typesNoneEffect: No effectEraseEffect: Erase effectBlindsEffect: Blinds effectWaveEffect: Wave effectAlphaFadeEffect: Alpha fade effectVortexSwapEffect: Vortex swap effectWindmillEffect: Windmill effectCyberGlitchEffect: Cyber glitch effect
Wrapper Classes
Wrapper classes provide C# wrappers for GDScript objects, allowing developers to manipulate various Konado data structures in C#. Note that these classes are not yet fully implemented and only provide some properties and methods, pending further development.
Dialogue
Dialogue object wrapper representing a single dialogue element.
Properties
Type DialogueType: Dialogue type (enum)string BranchId: Branch IDArray<Dialogue> BranchDialogue: Branch dialoguebool IsBranchLoaded: Whether the branch is loadedstring CharacterId: Character IDstring DialogueContent: Dialogue contentDialogueActor ShowActor: Actor to showstring ExitActor: Actor to exitstring ChangeStateActor: Actor changing statestring TargetMoveChara: Target character to moveVector2 TargetMovePos: Target move positionArray<DialogueChoice> Choices: Dialogue choicesstring BgmName: Background music namestring VoiceId: Voice IDstring SoundeffectName: Sound effect namestring BackgroundImageName: Background image nameBackgroundTransitionEffectsType BackgroundToggleEffects: Background transition effectstring JumpShotId: Jump shot IDstring LabelNotes: Label notesDictionary ActorSnapshots: Actor snapshots
Dialogue Type Enum
Start: StartOrdinaryDialog: Ordinary dialogueDisplayActor: Display actorActorChangeState: Actor state changeMoveActor: Move actorSwitchBackground: Switch backgroundExitActor: Exit actorPlayBgm: Play background musicStopBgm: Stop background musicPlaySoundEffect: Play sound effectShowChoice: Show choiceBranch: BranchJumpTag: Jump tagJumpShot: Jump shotTheEnd: The endLabel: Label
DialogueActor
Dialogue actor wrapper representing an actor object in dialogue.
Properties
string CharacterName: Character namestring CharacterState: Character stateVector2 ActorPosition: Actor positionVector2 ActorScale: Actor scalebool ActorMirror: Actor mirror
DialogueChoice
Dialogue choice wrapper representing a choice object in dialogue.
Properties
string ChoiceText: Choice textstring JumpTag: Jump tag
KndData
Konado KND_Data base data class wrapper.
Properties
string Type: Data typebool Love: Whether it is a favouritestring Tip: Tip information
KndShot
Konado KND_Shot shot wrapper, inheriting from KndData.
Properties
string Name: Scene namestring ShotId: Shot IDstring SourceStory: Source storyArray<Dictionary> DialoguesSourceData: Dialogue source dataDictionary Branches: BranchesDictionary<string, Dictionary> SourceBranches: Source branchesDictionary<string, int> ActorCharacterMap: Actor character map
KonadoScriptsInterpreter
KonadoScriptsInterpreter script interpreter wrapper for parsing Konado script files.
Methods
KndShot ProcessScriptsToData(string path): Process a script file into dataDialogue ParseSingleLine(string line, long lineNumber, string path): Parse a single script line
Example Code
Dialogue Management
using Konado.Runtime.API;
// Get the Konado API instance
var konadoAPI = KonadoAPI.API;
var dialogueManager = KonadoAPI.DialogueManagerApi;
// Check if the API is ready
if (dialogueManager.IsReady)
{
// Initialise dialogue
dialogueManager.InitDialogue();
// Start dialogue
dialogueManager.StartDialogue();
// Stop dialogue
dialogueManager.StopDialogue();
}Dialogue Event Listening
// Listen for dialogue start event
dialogueManager.ShotStart += () => {
GD.Print("Dialogue scene started");
};
// Listen for dialogue end event
dialogueManager.ShotEnd += () => {
GD.Print("Dialogue scene ended");
};
// Listen for dialogue line start event
dialogueManager.DialogueLineStart += (int line) => {
GD.Print($"Dialogue line {line} started");
};
// Listen for dialogue line end event
dialogueManager.DialogueLineEnd += (int line) => {
GD.Print($"Dialogue line {line} ended");
};Parsing Konado Scripts
using Konado.Wrapper;
// Create a script interpreter
var flags = new Godot.Collections.Dictionary<string, Variant>();
var interpreter = new KonadoScriptsInterpreter(flags);
// Parse an entire script file
var shot = interpreter.ProcessScriptsToData("res://dialogues/example.ks");