I want to use Naninovell function in C#.
Posted: 19 Jan 2023 06:00
by booksuny
I'm trying to use the @processInput,
command in C# while I'm creating the game.
Here's how it works.
- Call the menu with the right mouse key.
- Click an item to view the item information.
- Press the right mouse key to turn off the item information.
- Press the right mouse key again to close the menu.
I solved up to number 2, but it's stuck in number 3. The right mouse key is assigned to the Call UI Input, which closes the menu.
I want to use the @processInput command in C#.
Is this possible?
Re: I want to use Naninovell function in C#.
Posted: 19 Jan 2023 15:24
by idaot
Yes, each command has their own C# script with the operation executed under ExecuteAsync, in the case of processInput it's ProcessInput.cs. You can also instantiate any command in C#, an example can be found in the Integration Options guide (https://naninovel.com/guide/integration ... hing-modes) however we recommend doing to former in most cases for performance reasons.
Re: I want to use Naninovell function in C#.
Posted: 20 Jan 2023 02:59
by booksuny
idaot wrote: ↑19 Jan 2023 15:24
Yes, each command has their own C# script with the operation executed under ExecuteAsync, in the case of processInput it's ProcessInput.cs. You can also instantiate any command in C#, an example can be found in the Integration Options guide (https://naninovel.com/guide/integration ... hing-modes) however we recommend doing to former in most cases for performance reasons.
Thank you for your response.
I was confused when I was building a function that worked '@processInput ' based on 'processInput.cs'
I am entering the following code.
Code: Select all
using UnityEngine;
using Naninovel;
public class ItemClickAndInputoff : MonoBehaviour
{
public void itemClickAndInputoff(bool InputEnabled, string Name)
{
var inputManager = Engine.GetService<IInputManager>();
inputManager.ProcessInput = InputEnabled;
var sampler = inputManager.GetSampler(Name);
sampler.Enabled = kv.NamedValue;
}
}
This code is not working yet, and it is being viewed and written at processInput.cs.
Run inputManager.ProcessInput with boolInputEnabled.
In the string name, I will write the name of the sampler I want.
What I'm curious about is what 'kv.NamedValue' does.
I tried to interpret the role of kv.NamedValue in the processInput.cs code, but it didn't work out.
Can you give me a direction?
Re: I want to use Naninovell function in C#.
Posted: 20 Jan 2023 10:45
by idaot
NamedValue is the value parameter of a NamedString. If you're struggling to understand the parameters then I suggest just instantiating processInput as per the guide I gave a link to, that way you can enter parameters as you would when calling @processInput in naniscript.