Skip to content

Commit

Permalink
feat(UI): Expose run action from dialogue system
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Aug 24, 2024
1 parent fb3f3c7 commit 90ca193
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 36 deletions.
64 changes: 32 additions & 32 deletions Assets/JCSUnity/Scripts/UI/Dialogue/JCS_DialogueSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,38 @@ public void ToggleVisiblity()
Show();
}

/// <summary>
/// Run the script once.
/// </summary>
public void RunAction()
{
if (!mActive)
return;

/*
* NOTE(jenchieh): If there is selections occurs
* in last status, then we make sure the hover working
* for selecting the selection.
*
* If I hover the selection 5, then selection should
* be 5 even I did notclick on selection five. Next
* button should just know the selection should be
* five for next 'RunAction'.
*/
MakeHoverSelections();

// initialize every run (before running the script)
ResetStats();

// run the script
mDialogueScript.Action(Mode, Type, Selection);

// reset mode,type,selection before next action
Mode = 0;
Type = -1;
Selection = -1;
}

/// <summary>
/// Start the dialogue, in other word same as start a conversation.
/// </summary>
Expand Down Expand Up @@ -1196,38 +1228,6 @@ private void InitBtnsSet()
}
}

/// <summary>
/// Run the script once.
/// </summary>
private void RunAction()
{
if (!mActive)
return;

/*
* NOTE(jenchieh): If there is selections occurs
* in last status, then we make sure the hover working
* for selecting the selection.
*
* If I hover the selection 5, then selection should
* be 5 even I did notclick on selection five. Next
* button should just know the selection should be
* five for next 'RunAction'.
*/
MakeHoverSelections();

// initialize every run (before running the script)
ResetStats();

// run the script
mDialogueScript.Action(Mode, Type, Selection);

// reset mode,type,selection before next action
Mode = 0;
Type = -1;
Selection = -1;
}

/// <summary>
/// If a selection is hover make sure the selection is been
/// chosen for next status.
Expand Down
9 changes: 5 additions & 4 deletions docs/ScriptReference/UI/Dialogue/JCS_DialogueSystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ Dialogue system core implementation.

| Name | Description |
|:------------------|:----------------------------------------------------------------|
| IsVisible | Return true if the dialgoue system is visible. |
| Show | Show the dialogue. |
| Hide | Hide the dialogue. |
| ToggleVisiblity | Toggle between show and hide. |
| ActiveDialogue | Start the dialogue, in other word same as start a conversation. |
| RunAction | Run the script once. |
| SendChoice | Send a choice to current status. |
| SendNext | Next button is the only option for current status. |
| SendNextPrev | Current status will be next and prev control/options. |
Expand All @@ -50,3 +47,7 @@ Dialogue system core implementation.
| NextOrDispose | Continue with default condition. |
| IsScrolling | Return true if the dialogue system is still animating the text. |
| SkipToEnd | Skip the current text scroll. |
| IsVisible | Return true if the dialgoue system is visible. |
| Show | Show the dialogue. |
| Hide | Hide the dialogue. |
| ToggleVisiblity | Toggle between show and hide. |

0 comments on commit 90ca193

Please sign in to comment.