how to use Nani command in C# script

Posted: 23 Oct 2022 15:35
by TuTlo

Hi,

I would like to use @showUI myUI in a C# script, is there any reference on how to use Nani command in C# script? could not find it

Thanks!


Re: how to use Nani command in C# script

Posted: 23 Oct 2022 17:48
by Elringus

There is nothing special here: create instance of the command and invoke ExecuteAsync method on it.

It's mentioned in the integration guide: https://naninovel.com/guide/integration ... hing-modes

Here are the sources: https://github.com/Naninovel/Integratio ... cs#L14-L15


Re: how to use Nani command in C# script

Posted: 23 Oct 2022 17:54
by Elringus

That said, I'd recommend against using commands like this; instead access Naninovel APIs directly. Eg, instead of creating an instance of show UI command and invoking execute method on it, inspect the command implementation and invoke the required APIs directly. For example, to show a UI get IUIManager service, use GetUI method to get reference to the desired UI and invoke Show method on it. Here is the guide on engine services: https://naninovel.com/guide/engine-services