Skip to content

Commit

Permalink
Merge pull request #13 from Studio-23-xyz/dev
Browse files Browse the repository at this point in the history
Make base eventnode type and fix event firing
  • Loading branch information
BDeshiDev authored Jan 26, 2024
2 parents c37290c + 621a242 commit 0acf68b
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 74 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using Studio23.SS2.DialogueSystem.Utility;
using UnityEngine;
using UnityEngine.Localization;
using UnityEngine.Serialization;
Expand All @@ -20,7 +21,7 @@ public abstract class DialogueLineNodeBase : DialogueNodeBase

private bool _canAdvanceDialogue;

[Output(dynamicPortList =true)]
[Output()]
public int Events;

public override void HandleDialogueAdvance()
Expand All @@ -36,9 +37,8 @@ public virtual void InvokePostPlayEvents()
var eventNodeConnection = eventNodePort.GetConnection(i);
if (eventNodeConnection != null)
{
if (eventNodeConnection.node is EventNode eventNode)
if (eventNodeConnection.node is EventNodeBase eventNode)
{
Debug.Log($"Invoke event {eventNode} on {this}", this);
eventNode.Invoke();
}
else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Serialization;
using XNode;

namespace Studio23.SS2.DialogueSystem.Data
{
[NodeTint(200,50,50), NodeWidth(500)]
public class EventNode : DialogueGraphNodeBase
[NodeTint(200,50,50), NodeWidth(500), CreateNodeMenu("Unity Event Node")]
public class EventNode : EventNodeBase
{
[Input]
public int Entry;
public UnityEvent Event;

[SerializeField] UnityEvent Event;

public void Invoke()
public override void Invoke()
{
Event.Invoke();
}
public override void Initialize()
{
//do nothing
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Studio23.SS2.DialogueSystem.Data
{
public abstract class EventNodeBase : DialogueGraphNodeBase
{
[Input]
public int Entry;

public abstract void Invoke();

public override void Initialize()
{
//do nothing
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
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: 846559197231ca24c8ee20e824e62423, type: 3}
m_Name: SubtitleSettings
m_EditorClassIdentifier:
SubtitleColor: {r: 0, g: 0, b: 0, a: 1}
SubtitleFontSize: 25
DropShadow: 0
EnableCharacterColor: 1
ShowBackground: 0
BackGroundColor: {r: 1, g: 1, b: 1, a: 1}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ private void NukeButtons()
{
for (int i = 0; i < _spawnedButtons.Count; i++)
{
Debug.Log(_spawnedButtons[i].gameObject);
Destroy(_spawnedButtons[i].gameObject);
}
_spawnedButtons.Clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ MonoBehaviour:
m_GameObject: {fileID: 710383144915376259}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0d7ad9dc974fe9f47a9f4913e7ed1959, type: 3}
m_Script: {fileID: 11500000, guid: 7e40592e2649edc4a9608e4bcedd13b6, type: 3}
m_Name:
m_EditorClassIdentifier:
tmpTarget: {fileID: 2068565476251727824}
localizer: {fileID: 2515288861120483222}
_tmpTarget: {fileID: 2068565476251727824}
_localizer: {fileID: 2515288861120483222}
--- !u!1 &1051075638931329264
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -247,7 +247,7 @@ MonoBehaviour:
m_GameObject: {fileID: 1051075638931329264}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3653584ea3e848548b1e9b4ccec48038, type: 3}
m_Script: {fileID: 11500000, guid: caff724c412515940af59af3cd166437, type: 3}
m_Name:
m_EditorClassIdentifier:
_button: {fileID: 855239014452063087}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,4 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 266137c0ba2af9d4aa901f763389f2dd, type: 3}
m_Name: CharacterTable
m_EditorClassIdentifier:
characterList:
- {fileID: 11400000, guid: 4f969d28d1c102a4bacf435c205ed56b, type: 2}
- {fileID: 11400000, guid: 5d86b03e6edb37644bab0698454ad100, type: 2}
- {fileID: 11400000, guid: 017db39c22263f4449b8084d117b6f77, type: 2}
- {fileID: 11400000, guid: 2d478784f5507e24598d112f29849808, type: 2}
characterList: []
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ MonoBehaviour:
keys:
- Entry
- Exit
- Events 0
- Events
values:
- _fieldName: Entry
Expand All @@ -332,6 +333,15 @@ MonoBehaviour:
_connectionType: 0
_typeConstraint: 0
_dynamic: 0
- _fieldName: Events 0
_node: {fileID: -2976715106930901999}
_typeQualifiedName: System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
connections: []
_direction: 1
_connectionType: 0
_typeConstraint: 0
_dynamic: 1
- _fieldName: Events
_node: {fileID: -2976715106930901999}
_typeQualifiedName: System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral,
Expand Down Expand Up @@ -376,8 +386,8 @@ MonoBehaviour:
ports:
keys:
- Exit
- Events
- Events 0
- Events
values:
- _fieldName: Exit
_node: {fileID: -1822135301059774123}
Expand All @@ -391,27 +401,24 @@ MonoBehaviour:
_connectionType: 0
_typeConstraint: 0
_dynamic: 0
- _fieldName: Events
- _fieldName: Events 0
_node: {fileID: -1822135301059774123}
_typeQualifiedName: System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
connections: []
_direction: 1
_connectionType: 0
_typeConstraint: 0
_dynamic: 0
- _fieldName: Events 0
_dynamic: 1
- _fieldName: Events
_node: {fileID: -1822135301059774123}
_typeQualifiedName: System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
connections:
- fieldName: Entry
node: {fileID: 5592580153945411639}
reroutePoints: []
connections: []
_direction: 1
_connectionType: 0
_typeConstraint: 0
_dynamic: 1
_dynamic: 0
DialogueLocalizedString:
m_TableReference:
m_TableCollectionName: GUID:2fefaa175576a0e48bf5b28cb5260137
Expand Down Expand Up @@ -453,7 +460,7 @@ MonoBehaviour:
- {fileID: 1247732052999767825}
- {fileID: 7322660833987517088}
- {fileID: -2988117806070830359}
- {fileID: 5592580153945411639}
- {fileID: 401710227361937087}
SkippableDialogue: 0
_startNode: {fileID: -1822135301059774123}
_conditions: []
Expand Down Expand Up @@ -618,40 +625,6 @@ MonoBehaviour:
references:
version: 2
RefIds: []
--- !u!114 &5592580153945411639
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: 15f374202db79ae42ac267b0047a95ef, type: 3}
m_Name: Event
m_EditorClassIdentifier:
graph: {fileID: 11400000}
position: {x: -1960, y: 440}
ports:
keys:
- Entry
values:
- _fieldName: Entry
_node: {fileID: 5592580153945411639}
_typeQualifiedName: System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
connections:
- fieldName: Events 0
node: {fileID: -1822135301059774123}
reroutePoints: []
_direction: 0
_connectionType: 0
_typeConstraint: 0
_dynamic: 0
Entry: 0
Event:
m_PersistentCalls:
m_Calls: []
--- !u!114 &7322660833987517088
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ Camera:
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0}
m_BackGroundColor: {r: 0.4811321, g: 0.4811321, b: 0.4811321, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
Expand Down Expand Up @@ -983,9 +983,13 @@ MonoBehaviour:
m_GameObject: {fileID: 1344663831}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c008de1dc3854a46936dcfdfb971d6e8, type: 3}
m_Script: {fileID: 11500000, guid: de5cbd887ed5dbc4781a4aaa98b90fe9, type: 3}
m_Name:
m_EditorClassIdentifier:
_sortedChoices: []
_buttonContainer: {fileID: 1126433870}
_buttonPrefab: {fileID: 8035196018851654212, guid: af9bf8cc40254224d85a2c9c750ce48a, type: 3}
_spawnedButtons: []
--- !u!1 &1456424668
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1043,9 +1047,15 @@ MonoBehaviour:
m_GameObject: {fileID: 1456424668}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fc09cb0cd50138a4797efe998aeea794, type: 3}
m_Script: {fileID: 11500000, guid: 39891d0bfdc636f4b9a2c7baa8b8f148, type: 3}
m_Name:
m_EditorClassIdentifier:
DialogueTMP: {fileID: 1838186516}
TextLocalizer: {fileID: 1838186517}
BackgroundImage: {fileID: 381729576}
UIRoot: {fileID: 1456424668}
CharacterTable: {fileID: 11400000, guid: d475c9e2546e17e4bb37441da01467e0, type: 2}
_config: {fileID: 11400000, guid: 2984fcedb51c3614cbb95f385ebe07b7, type: 2}
--- !u!1 &1813981465
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1259,9 +1269,11 @@ MonoBehaviour:
m_GameObject: {fileID: 1838186513}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0d7ad9dc974fe9f47a9f4913e7ed1959, type: 3}
m_Script: {fileID: 11500000, guid: 7e40592e2649edc4a9608e4bcedd13b6, type: 3}
m_Name:
m_EditorClassIdentifier:
_tmpTarget: {fileID: 1838186516}
_localizer: {fileID: 1838186518}
--- !u!114 &1838186518
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.studio23.ss2.dialoguesystem",
"version": "0.3.5",
"version": "0.3.6",
"displayName": "Dialogue System",
"description": "Dialogue system is an authoring tool for developers to integrate dialogue from scriptwriters inside unity.",
"unity": "2022.3",
Expand Down
2 changes: 1 addition & 1 deletion ProjectSettings/EditorSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ EditorSettings:
m_EnableEditorAsyncCPUTextureLoading: 0
m_AsyncShaderCompilation: 1
m_PrefabModeAllowAutoSave: 1
m_EnterPlayModeOptionsEnabled: 1
m_EnterPlayModeOptionsEnabled: 0
m_EnterPlayModeOptions: 3
m_GameObjectNamingDigits: 1
m_GameObjectNamingScheme: 0
Expand Down

0 comments on commit 0acf68b

Please sign in to comment.