EasyTalk API
Loading...
Searching...
No Matches
EasyTalk.Display.DialogueInputHandler Class Reference

This class implements the logic which handles player input controls for Dialogue Displays. More...

Inherits MonoBehaviour.

Private Member Functions

void Awake ()
 
void Update ()
 The update loop handles user input if using the old input system.
 
void OnDisable ()
 Disables the player input controls on the dialogue display when using the new input system.
 
void OnEnable ()
 Enables the player input controls on the dialogue display when using the new input system.
 
bool SelectOptionFromInputDirection ()
 Checks the value of the x and y axis inputs and attempts to select the option in the corresponding direction.
 
void HandleUserInput ()
 Handles user input controls when using the old input system.
 
void CheckToAllowAxisTriggering (float horizontal, float vertical, float axisActivationThreshold)
 Sets the allowAxisTrigger flag to true if enough time has passed or if the horizontal and vertical axis inputs have moved back down below the activation threshold.
 
void HandleSelectOptionInDirection (float horizontal, float vertical, float axisActivationThreshold)
 When options are being presented to the player, this method attempts to select the option which corresponds to the current input axis direction (horizontal + vertical) if the axis control is allowed to be triggered.
 
void HandleExitConversation ()
 If 'allowQuickExit' is set to true, this method attempts to exit the dialogue conversation immediately whenever the input button mapped to 'quickExitButtonName' is pressed.
 
void HandleChooseOption ()
 When presenting options, this method attempts to finalize and choose the currently selected option whenever the input button mapped to 'chooseSelectedOptionButtonName' is pressed.
 
void HandleSelectPreviousOption (float horizontal, float vertical, float axisActivationThreshold)
 When options are being presented to the player, this method attempts to select the previous option if the player is pressing the axis controls in the configured direction and the control is allowed to be triggered.
 
void HandleSelectNextOption (float horizontal, float vertical, float axisActivationThreshold)
 When options are being presented to the player, this method attempts to select the next option if the player is pressing the axis controls in the configured direction and the control is allowed to be triggered.
 
float GetDPadVerticalValue ()
 Retrieves the vertical axis value from the player's input controls (uses the axis mapped to 'dpadVerticalAxisName'). This is intended for DPAD input, but can be used for any alternative axis.
 
float GetDPadHorizontalValue ()
 Retrieves the horizontal axis value from the player's input controls (uses the axis mapped to 'dpadHorizontalAxisName'). This is intended for DPAD input, but can be used for any alternative axis.
 
float GetVerticalAxisValue ()
 Retrieves the vertical axis value from the player's input controls (uses the axis mapped to 'verticalAxisName').
 
float GetHorizontalAxisValue ()
 Retrieves the horizontal axis value from the player's input controls (uses the axis mapped to 'horizontalAxisName').
 
void HandleContinueButton ()
 Checks to see if the player pressed the continue button. If they did and continuation is allowed, continues to the next part of the conversation.
 

Private Attributes

AbstractDialogueDisplay dialogueDisplay
 The Dialogue Display to control.
 
string continueButtonName = "Submit"
 The name of the input which triggers the dialogue to continue (only applicable when dialogue is being displayed).
 
string chooseSelectedOptionButtonName = "Submit"
 The name of the input which chooses the currently selected option (only applicable when options are being presented).
 
string quickExitButtonName = "Cancel"
 The name of the input which causes the dialogue to exit (only applicable when allowQuickExit is set to true).
 
string horizontalAxisName = "Horizontal"
 The name of the horizontal input axis. This is used to select options when they are being shown.
 
string dpadHorizontalAxisName = "DPAD_Horizontal"
 The name of the horizontal input axis for the DPAD. This is used to select options when they are being shown.
 
string verticalAxisName = "Vertical"
 The name of the vertical input axis. This is used to select options when they are being shown.
 
string dpadVerticalAxisName = "DPAD_Vertical"
 The name of the vertical input axis for the DPAD. This is used to select options when they are being shown.
 
float axisResetTime = 0.3f
 The amount of time which must pass in order for the input axis controls to be usable again after a prior action is triggered (such as selecting an option).
 
bool inputWarningSent = false
 A flag used to keep track of whether warning messages have been made when reading input so that messages aren't resent repeatedly during gameplay.
 
bool allowAxisTrigger = false
 A flag indicating whether the axis controls are ready to be triggered to choose an option based on user input.
 
float lastAxisTriggerTime
 Keeps track of the last time an input axis was triggered.
 

Detailed Description

This class implements the logic which handles player input controls for Dialogue Displays.

Member Function Documentation

◆ Awake()

void EasyTalk.Display.DialogueInputHandler.Awake ( )
private

◆ CheckToAllowAxisTriggering()

void EasyTalk.Display.DialogueInputHandler.CheckToAllowAxisTriggering ( float horizontal,
float vertical,
float axisActivationThreshold )
private

Sets the allowAxisTrigger flag to true if enough time has passed or if the horizontal and vertical axis inputs have moved back down below the activation threshold.

Parameters
horizontalThe horizontal axis input value.
verticalThe vertical axis input value.
axisActivationThresholdThe threshold value which the horizontal or vertical axis values must be below in order for allowAxisTrigger to be set to true (unless enough time has elapsed).

◆ GetDPadHorizontalValue()

float EasyTalk.Display.DialogueInputHandler.GetDPadHorizontalValue ( )
private

Retrieves the horizontal axis value from the player's input controls (uses the axis mapped to 'dpadHorizontalAxisName'). This is intended for DPAD input, but can be used for any alternative axis.

Returns
The horizontal axis value. If there is no axis configured with the proper name, this method returns 0.

◆ GetDPadVerticalValue()

float EasyTalk.Display.DialogueInputHandler.GetDPadVerticalValue ( )
private

Retrieves the vertical axis value from the player's input controls (uses the axis mapped to 'dpadVerticalAxisName'). This is intended for DPAD input, but can be used for any alternative axis.

Returns
The vertical axis value. If there is no axis configured with the proper name, this method returns 0.

◆ GetHorizontalAxisValue()

float EasyTalk.Display.DialogueInputHandler.GetHorizontalAxisValue ( )
private

Retrieves the horizontal axis value from the player's input controls (uses the axis mapped to 'horizontalAxisName').

Returns
The horizontal axis value. If there is no axis configured with the proper name, this method returns 0.

◆ GetVerticalAxisValue()

float EasyTalk.Display.DialogueInputHandler.GetVerticalAxisValue ( )
private

Retrieves the vertical axis value from the player's input controls (uses the axis mapped to 'verticalAxisName').

Returns
The vertical axis value. If there is no axis configured with the proper name, this method returns 0.

◆ HandleChooseOption()

void EasyTalk.Display.DialogueInputHandler.HandleChooseOption ( )
private

When presenting options, this method attempts to finalize and choose the currently selected option whenever the input button mapped to 'chooseSelectedOptionButtonName' is pressed.

◆ HandleContinueButton()

void EasyTalk.Display.DialogueInputHandler.HandleContinueButton ( )
private

Checks to see if the player pressed the continue button. If they did and continuation is allowed, continues to the next part of the conversation.

◆ HandleExitConversation()

void EasyTalk.Display.DialogueInputHandler.HandleExitConversation ( )
private

If 'allowQuickExit' is set to true, this method attempts to exit the dialogue conversation immediately whenever the input button mapped to 'quickExitButtonName' is pressed.

◆ HandleSelectNextOption()

void EasyTalk.Display.DialogueInputHandler.HandleSelectNextOption ( float horizontal,
float vertical,
float axisActivationThreshold )
private

When options are being presented to the player, this method attempts to select the next option if the player is pressing the axis controls in the configured direction and the control is allowed to be triggered.

Parameters
horizontalThe horizontal axis input value.
verticalThe vertical axis input value.
axisActivationThresholdThe threshold value which the horizontal or vertical axis values must exceed in order for the action to be triggered.

◆ HandleSelectOptionInDirection()

void EasyTalk.Display.DialogueInputHandler.HandleSelectOptionInDirection ( float horizontal,
float vertical,
float axisActivationThreshold )
private

When options are being presented to the player, this method attempts to select the option which corresponds to the current input axis direction (horizontal + vertical) if the axis control is allowed to be triggered.

Parameters
horizontalThe horizontal axis input value.
verticalThe vertical axis input value.
axisActivationThresholdThe threshold value which the horizontal or vertical axis values must exceed in order for the action to be triggered.

◆ HandleSelectPreviousOption()

void EasyTalk.Display.DialogueInputHandler.HandleSelectPreviousOption ( float horizontal,
float vertical,
float axisActivationThreshold )
private

When options are being presented to the player, this method attempts to select the previous option if the player is pressing the axis controls in the configured direction and the control is allowed to be triggered.

Parameters
horizontalThe horizontal axis input value.
verticalThe vertical axis input value.
axisActivationThresholdThe threshold value which the horizontal or vertical axis values must exceed in order for the action to be triggered.

◆ HandleUserInput()

void EasyTalk.Display.DialogueInputHandler.HandleUserInput ( )
private

Handles user input controls when using the old input system.

◆ OnDisable()

void EasyTalk.Display.DialogueInputHandler.OnDisable ( )
private

Disables the player input controls on the dialogue display when using the new input system.

◆ OnEnable()

void EasyTalk.Display.DialogueInputHandler.OnEnable ( )
private

Enables the player input controls on the dialogue display when using the new input system.

◆ SelectOptionFromInputDirection()

bool EasyTalk.Display.DialogueInputHandler.SelectOptionFromInputDirection ( )
private

Checks the value of the x and y axis inputs and attempts to select the option in the corresponding direction.

Returns
Returns true if an option was selected; false otherwise.

◆ Update()

void EasyTalk.Display.DialogueInputHandler.Update ( )
private

The update loop handles user input if using the old input system.

Member Data Documentation

◆ allowAxisTrigger

bool EasyTalk.Display.DialogueInputHandler.allowAxisTrigger = false
private

A flag indicating whether the axis controls are ready to be triggered to choose an option based on user input.

◆ axisResetTime

float EasyTalk.Display.DialogueInputHandler.axisResetTime = 0.3f
private

The amount of time which must pass in order for the input axis controls to be usable again after a prior action is triggered (such as selecting an option).

◆ chooseSelectedOptionButtonName

string EasyTalk.Display.DialogueInputHandler.chooseSelectedOptionButtonName = "Submit"
private

The name of the input which chooses the currently selected option (only applicable when options are being presented).

◆ continueButtonName

string EasyTalk.Display.DialogueInputHandler.continueButtonName = "Submit"
private

The name of the input which triggers the dialogue to continue (only applicable when dialogue is being displayed).

◆ dialogueDisplay

AbstractDialogueDisplay EasyTalk.Display.DialogueInputHandler.dialogueDisplay
private

The Dialogue Display to control.

◆ dpadHorizontalAxisName

string EasyTalk.Display.DialogueInputHandler.dpadHorizontalAxisName = "DPAD_Horizontal"
private

The name of the horizontal input axis for the DPAD. This is used to select options when they are being shown.

◆ dpadVerticalAxisName

string EasyTalk.Display.DialogueInputHandler.dpadVerticalAxisName = "DPAD_Vertical"
private

The name of the vertical input axis for the DPAD. This is used to select options when they are being shown.

◆ horizontalAxisName

string EasyTalk.Display.DialogueInputHandler.horizontalAxisName = "Horizontal"
private

The name of the horizontal input axis. This is used to select options when they are being shown.

◆ inputWarningSent

bool EasyTalk.Display.DialogueInputHandler.inputWarningSent = false
private

A flag used to keep track of whether warning messages have been made when reading input so that messages aren't resent repeatedly during gameplay.

◆ lastAxisTriggerTime

float EasyTalk.Display.DialogueInputHandler.lastAxisTriggerTime
private

Keeps track of the last time an input axis was triggered.

◆ quickExitButtonName

string EasyTalk.Display.DialogueInputHandler.quickExitButtonName = "Cancel"
private

The name of the input which causes the dialogue to exit (only applicable when allowQuickExit is set to true).

◆ verticalAxisName

string EasyTalk.Display.DialogueInputHandler.verticalAxisName = "Vertical"
private

The name of the vertical input axis. This is used to select options when they are being shown.