Skip to content

Commit

Permalink
Making Tidy Some Stuffs & Fix Build Problem
Browse files Browse the repository at this point in the history
  • Loading branch information
recepilhanli committed Jun 27, 2024
1 parent 89e583f commit ed588ee
Show file tree
Hide file tree
Showing 10 changed files with 259 additions and 130 deletions.
8 changes: 8 additions & 0 deletions Assets/DialogSystem.meta

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

3 changes: 1 addition & 2 deletions Assets/DialogSystem/DialogGraphs/DialogSwitchGraph.asset
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ MonoBehaviour:
Event:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: -8642161715027127687, guid: ddf806041374b3d47b5f4b11f9505ced,
type: 3}
- m_Target: {fileID: -8642161715027127687, guid: ddf806041374b3d47b5f4b11f9505ced, type: 3}
m_TargetAssemblyTypeName: EventTesting, Assembly-CSharp
m_MethodName: TestEvent
m_Mode: 1
Expand Down
49 changes: 47 additions & 2 deletions Assets/DialogSystem/Scenes/DialogTest.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.18028352, g: 0.22571376, b: 0.3069224, a: 1}
m_IndirectSpecularColor: {r: 0.44657874, g: 0.49641275, b: 0.5748171, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -1285,7 +1285,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
dialogGraph: {fileID: 11400000, guid: 10a808161346eca49aa716fcd5fe4f97, type: 2}
currentNode: {fileID: 0}
_DialogCanvas: {fileID: 1394771758}
_dialogCanvas: {fileID: 1394771758}
headlineTMP: {fileID: 2076104245}
descriptionTMP: {fileID: 1270832993}
option1TMP: {fileID: 891606019}
Expand Down Expand Up @@ -1928,6 +1928,7 @@ GameObject:
- component: {fileID: 2124641954}
- component: {fileID: 2124641953}
- component: {fileID: 2124641952}
- component: {fileID: 2124641955}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
Expand Down Expand Up @@ -2009,6 +2010,50 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2124641955
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2124641951}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_RenderShadows: 1
m_RequiresDepthTextureOption: 2
m_RequiresOpaqueTextureOption: 2
m_CameraType: 0
m_Cameras: []
m_RendererIndex: -1
m_VolumeLayerMask:
serializedVersion: 2
m_Bits: 1
m_VolumeTrigger: {fileID: 0}
m_VolumeFrameworkUpdateModeOption: 2
m_RenderPostProcessing: 0
m_Antialiasing: 0
m_AntialiasingQuality: 2
m_StopNaN: 0
m_Dithering: 0
m_ClearDepth: 1
m_AllowXRRendering: 1
m_AllowHDROutput: 1
m_UseScreenCoordOverride: 0
m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0}
m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0}
m_RequiresDepthTexture: 0
m_RequiresColorTexture: 0
m_Version: 2
m_TaaSettings:
quality: 3
frameInfluence: 0.1
jitterScale: 1
mipBias: 0
varianceClampScale: 0.9
contrastAdaptiveSharpening: 0
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
Expand Down
69 changes: 43 additions & 26 deletions Assets/DialogSystem/Scripts/DialogEvent.cs
Original file line number Diff line number Diff line change
@@ -1,36 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine;
using UnityEngine.Events;
using XNode;
using XNodeEditor;

namespace DialogSystem
{
/// <summary>
///
/// </summary>

[NodeWidth(350), NodeTint("#ff7f50")]
public class DialogEvent : Node
{
[Input] public Node Input;

[Output] public Node Output;

public UnityEvent Event = new UnityEvent();

public void InvokeEvent()
{
Event?.Invoke();
}



}

#region Editor
#if UNITY_EDITOR
using UnityEditor;
using XNodeEditor;

//Dialogue Event Node Editor
[CustomNodeEditor(typeof(DialogEvent))]
public class DialogEventEditor : NodeEditor
{
Expand Down Expand Up @@ -58,4 +38,41 @@ public override void OnBodyGUI()
serializedObject.ApplyModifiedProperties();
}
}
#endif
#endregion


/// <summary>
/// This node is used to invoke a UnityEvent
/// </summary>
[NodeWidth(350), NodeTint("#ff7f50")]
public class DialogEvent : Node
{
/// <summary>
/// The input node
/// </summary>
[Input] public Node Input;

/// <summary>
/// The output node
/// </summary>
[Output] public Node Output;

/// <summary>
/// The event that will be invoked
/// </summary>
public UnityEvent Event = new UnityEvent();

/// <summary>
/// This method is used to invoke the event
/// </summary>
public void InvokeEvent()
{
Event?.Invoke();
}



}

}
12 changes: 7 additions & 5 deletions Assets/DialogSystem/Scripts/DialogGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@

namespace DialogSystem
{
/// <summary>
/// This class is used to create a dialog graph
/// </summary>
[CreateAssetMenu(fileName = "New Dialog Graph", menuName = "Dialog/Dialog Graph")]
public class DialogGraph : NodeGraph
{

/// <summary>
/// The nodes of the graph
/// </summary>
/// <returns> The first node of the graph </returns>
public Node GetFirstNode()
{
Node FirstNode = null;
Expand All @@ -23,12 +29,8 @@ public Node GetFirstNode()
FirstNode = node;
}
}

return FirstNode;
}




}
}
111 changes: 62 additions & 49 deletions Assets/DialogSystem/Scripts/DialogNode.cs
Original file line number Diff line number Diff line change
@@ -1,53 +1,17 @@
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XNode;
using XNodeEditor;
using static XNode.Node;

namespace DialogSystem
{
/// <summary>
/// This node is used to create a dialog sequence
/// </summary>
[NodeWidth(300), NodeTint("#506f7f")]
public class DialogNode : Node
{

[Input] public Node Input;

public string Headline;
public string Description;

public string Option1;
[Output] public Node Option1Output;

public string Option2;
[Output] public Node Option2Output;

public string Option3;
[Output] public Node Option3Output;

public string Option4;
[Output] public Node Option4Output;

public bool Hide = false;

protected override void Init()
{
base.Init();

name = "Dialog Node";

}


}



namespace DialogSystem
{

#region Editor
#if UNITY_EDITOR
using XNode;
using XNodeEditor;
//Dialogue Node Editor
[CustomNodeEditor(typeof(DialogNode))]
public class DialogNodeEditor : NodeEditor
{
Expand Down Expand Up @@ -109,10 +73,10 @@ public override void OnBodyGUI()
node.Hide = true;
}

var dgraph = node.graph as DialogGraph;
if (dgraph != null)
var dGraph = node.graph as DialogGraph;
if (dGraph != null)
{
var firstNode = dgraph.GetFirstNode();
var firstNode = dGraph.GetFirstNode();
if (firstNode == node)
{
GUI.color = Color.red;
Expand All @@ -135,10 +99,10 @@ public override void OnBodyGUI()
node.Hide = false;
}

var dgraph = node.graph as DialogGraph;
if (dgraph != null)
var dGraph = node.graph as DialogGraph;
if (dGraph != null)
{
var firstNode = dgraph.GetFirstNode();
var firstNode = dGraph.GetFirstNode();
if (firstNode == node)
{
GUI.color = Color.yellow;
Expand All @@ -154,6 +118,55 @@ public override void OnBodyGUI()


}
#endif
#endregion

/// <summary>
/// This node is used to create a dialog sequence
/// </summary>
[NodeWidth(300), NodeTint("#506f7f")]
public class DialogNode : Node
{

[Input] public Node Input; // The input node

public string Headline; // The headline of the dialog
public string Description; // The description of the dialog

#region Options
public string Option1;
[Output] public Node Option1Output;

public string Option2;
[Output] public Node Option2Output;

public string Option3;
[Output] public Node Option3Output;

public string Option4;
[Output] public Node Option4Output;
#endregion

public bool Hide = false; // Hide the options

/// <summary>
/// Initialize the node
/// </summary>
protected override void Init()
{
base.Init();

name = "Dialog Node";

}


}







}
Loading

0 comments on commit ed588ee

Please sign in to comment.