I want to use Naninovell function in C#.

All about user interface, be it customizing built-in UIs or adding new ones.
Post Reply
booksuny
Posts: 47
Joined: 26 Sep 2022 12:37

I want to use Naninovell function in C#.

Post by booksuny »

I'm trying to use the @processInput,
command in C# while I'm creating the game.

Here's how it works.

  1. Call the menu with the right mouse key.
  2. Click an item to view the item information.
  3. Press the right mouse key to turn off the item information.
  4. 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?

idaot
support
Posts: 262
Joined: 01 Aug 2020 08:25

Re: I want to use Naninovell function in C#.

Post 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.

booksuny
Posts: 47
Joined: 26 Sep 2022 12:37

Re: I want to use Naninovell function in C#.

Post 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?

idaot
support
Posts: 262
Joined: 01 Aug 2020 08:25

Re: I want to use Naninovell function in C#.

Post 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.

Post Reply