Page 1 of 1
How to not default select a response
Posted: Mon Aug 15, 2022 11:39 pm
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.
Re: How to not default select a response
Posted: Tue Aug 16, 2022 10:18 am
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.
Re: How to not default select a response
Posted: Tue Aug 23, 2022 7:19 am
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.
Re: How to not default select a response
Posted: Tue Aug 23, 2022 8:29 am
by Tony Li
Thanks for sharing your solution!