Skip to content

Commit

Permalink
Add startnode parameter to graph play events
Browse files Browse the repository at this point in the history
  • Loading branch information
BDeshiDev committed Jul 11, 2024
1 parent 22d2cab commit 2a95f44
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public class DialogueSystem : MonoBehaviour
public bool IsSkipActive => _isSkipActive;
public bool ShouldShowLineWhenSkipped => _shouldShowLineWhenSkipped;
public float ShowLineDurationWhenSkipping => _showLineDurationWhenSkipping;
public event Action<bool> OnSkipToggled;

public event Action<DialogueGraph> OnDialogueStarted;
public event Action<DialogueGraph> OnDialogueEnded;
public event Action<bool> OnSkipToggled;
public delegate void DialoguePlayEvent(DialogueGraph graph, DialogueNodeBase startNode);
public event DialoguePlayEvent OnDialogueStarted;
public event DialoguePlayEvent OnDialogueEnded;

public event Action<DialogueChoicesNode> OnDialogueChoiceStarted;
public event Action<DialogueChoicesNode> OnDialogueChoiceEnded;
Expand Down Expand Up @@ -102,7 +102,7 @@ public async UniTask PlayDialogue(DialogueGraph graph, DialogueNodeBase startNod
_currentGraph.HandleDialogueStarted();
_isSkipActive = false;

OnDialogueStarted?.Invoke(_currentGraph);
OnDialogueStarted?.Invoke(_currentGraph, startNode);
while (_curNode != null)
{
Debug.Log("Play = " + _curNode, _curNode);
Expand All @@ -112,7 +112,7 @@ public async UniTask PlayDialogue(DialogueGraph graph, DialogueNodeBase startNod
}

_currentGraph.HandleDialogueEnded();
OnDialogueEnded?.Invoke(_currentGraph);
OnDialogueEnded?.Invoke(_currentGraph, startNode);
}

public void AdvanceDialogue()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private void UnRegisterEvents()
}
}

private void ShowUI(DialogueGraph obj) => ShowUI();
private void ShowUI(DialogueGraph obj, DialogueNodeBase startNode) => ShowUI();
private void ShowUI(DialogueChoicesNode obj) => ShowUI();

public override void ShowUI()
Expand All @@ -77,7 +77,7 @@ protected override void HandleDialogueLineCompleted(DialogueLineNodeBase dialogu
DialogueBox.HideUI();
}

private void HideUI(DialogueGraph obj) => HideUI();
private void HideUI(DialogueGraph graph, DialogueNodeBase startnode) => HideUI();

protected override void HandleDialogueLineStarted(DialogueLineNodeBase dialogueLineNodeBase)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,6 @@ MonoBehaviour:
- {fileID: -6051422413199044520}
- {fileID: -5885707281620676963}
- {fileID: 2428574908935260580}
- {fileID: 805789522290095862}
SkippableDialogue: 0
_startNode: {fileID: -1822135301059774123}
_conditions: []
Expand All @@ -599,81 +598,6 @@ MonoBehaviour:
keys: []
values: []
IsTrue: 0
--- !u!114 &805789522290095862
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0e5e901d523a4dce81016208dff46900, type: 3}
m_Name: Dialogue Choice
m_EditorClassIdentifier:
graph: {fileID: 11400000}
position: {x: -536, y: 1528}
ports:
keys:
- ParentChoice
- Exit
- Events
values:
- _fieldName: ParentChoice
_node: {fileID: 805789522290095862}
_typeQualifiedName: Studio23.SS2.DialogueSystem.Data.DialogueChoicesNode, com.studio23.ss2.dialoguesystem,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
connections:
- fieldName: ForceExitChoice
node: {fileID: 8927815714544073783}
reroutePoints: []
_direction: 0
_connectionType: 0
_typeConstraint: 0
_dynamic: 0
- _fieldName: Exit
_node: {fileID: 805789522290095862}
_typeQualifiedName: Studio23.SS2.DialogueSystem.Data.DialogueLineNodeBase,
com.studio23.ss2.dialoguesystem, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
connections: []
_direction: 1
_connectionType: 1
_typeConstraint: 2
_dynamic: 0
- _fieldName: Events
_node: {fileID: 805789522290095862}
_typeQualifiedName: Studio23.SS2.DialogueSystem.Data.EventNodeBase, com.studio23.ss2.dialoguesystem,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
connections: []
_direction: 1
_connectionType: 0
_typeConstraint: 3
_dynamic: 0
DialogueLocalizedString:
m_TableReference:
m_TableCollectionName: GUID:2fefaa175576a0e48bf5b28cb5260137
m_TableEntryReference:
m_KeyId: 60536405610639360
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
SpeakerData:
Character: {fileID: 0}
Expression: {fileID: 0}
FMODEvent:
Exit: {fileID: 0}
Events: {fileID: 0}
ParentChoice: {fileID: 0}
_conditions:
- rid: 4806151239593623552
references:
version: 2
RefIds:
- rid: 4806151239593623552
type: {class: TestBoolNodeInteraction, ns: , asm: Assembly-CSharp}
data:
BoolNode: {fileID: 401710227361937087}
--- !u!114 &1247732052999767825
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1204,10 +1128,7 @@ MonoBehaviour:
_node: {fileID: 8927815714544073783}
_typeQualifiedName: Studio23.SS2.DialogueSystem.Data.DialogueChoicesNode, com.studio23.ss2.dialoguesystem,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
connections:
- fieldName: ParentChoice
node: {fileID: 805789522290095862}
reroutePoints: []
connections: []
_direction: 1
_connectionType: 0
_typeConstraint: 0
Expand Down

0 comments on commit 2a95f44

Please sign in to comment.