How to not default select a response

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Fews
Posts: 5
Joined: Mon Aug 15, 2022 11:32 pm

How to not default select a response

Post by Fews »

Hi,

The game is mainly controlled by gamepad.
How can I make a response selected when only the UI/Move being performed?
I just do not want players do button mashing too much and miss a few selections.
User avatar
Tony Li
Posts: 21957
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to not default select a response

Post by Tony Li »

Hi,

You can set the response menu panel's Block Input Duration. When the response menu appears, the player will not be able to select a response until this duration has elapsed.
Fews
Posts: 5
Joined: Mon Aug 15, 2022 11:32 pm

Re: How to not default select a response

Post by Fews »

Thanks Tony, it is one way to achieve it. I ended up with a inherited StandardUIMenuPanel with a inputsystem to EnableInput()

Code: Select all

public class ButtonUIMenu : StandardUIMenuPanel
{
    ControlMap _Control = null;
    bool isShowed = false;

    public override void Awake()
    {
        base.Awake();
        _Control = new ControlMap();
        _Control.UI.Navigate.performed += _ => ButtonEnableInput();
    }

    protected override void OnEnable()
    {
        base.OnEnable();
        _Control.UI.Navigate.Enable();
    }

    protected override void OnDisable()
    {
        base.OnDisable();
        _Control.UI.Navigate.Disable();
    }

    protected override void ShowResponsesNow(Subtitle subtitle, Response[] responses, Transform target)
    {
        if (response...
        ...
        ...
        // as original
        
        DisableInput();
        isShowed = true;
    }

    public void ButtonEnableInput()
    {
        if (isShowed && s_isInputDisabled)
        {
            EnableInput();
            isShowed = false;
            _Control.UI.Navigate.Disable();
        }
    }

}
Edited: A mistake in the code.
Last edited by Fews on Thu Aug 25, 2022 2:17 am, edited 1 time in total.
User avatar
Tony Li
Posts: 21957
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to not default select a response

Post by Tony Li »

Thanks for sharing your solution!
Post Reply