Skip to content

Commit

Permalink
Fixed graph reset function
Browse files Browse the repository at this point in the history
  • Loading branch information
dipokDipu committed Jan 30, 2025
1 parent 4705d08 commit 5bffef6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Assets/Packages/com.studio23.ss2.dialoguesystem/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## [0.4.34]
1. Added functionality for clearning all graphs when game quits

## [0.4.33]
1. Added functionality for cancelling full graph or single line

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Threading;
using Cysharp.Threading.Tasks;
using Studio23.SS2.DialogueSystem.Data;
Expand Down Expand Up @@ -49,6 +50,8 @@ public class DialogueSystem : MonoBehaviour

private CancellationTokenSource _dialogueCancelTokenSource;

private List<DialogueGraph> _playedGraphs;

void Awake()
{
if (Instance != null)
Expand All @@ -58,6 +61,7 @@ void Awake()
else
{
Instance = this;
_playedGraphs = new List<DialogueGraph>();
}
}

Expand Down Expand Up @@ -109,6 +113,7 @@ public async UniTask PlayDialogue(DialogueNodeBase startNode)

public async UniTask PlayDialogue(DialogueGraph graph, DialogueNodeBase startNode)
{
_playedGraphs.Add(graph);
_currentGraph = graph;
_curNode = startNode;
_currentGraph.HandleDialogueStarted(startNode);
Expand Down Expand Up @@ -220,10 +225,8 @@ public void OnDialogueCancelled()

private void OnDestroy()
{
if (_currentGraph != null)
{
_currentGraph.Cleanup();
}
foreach(var graph in _playedGraphs)
graph.Cleanup();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.studio23.ss2.dialoguesystem",
"version": "0.4.33",
"version": "0.4.34",
"displayName": "Dialogue System",
"description": "Dialogue system is an authoring tool for developers to integrate dialogue from scriptwriters inside unity.",
"unity": "2022.3",
Expand Down

0 comments on commit 5bffef6

Please sign in to comment.