1- using System ;
2- using System . Collections . Generic ;
3- using System . IO ;
1+ using System . Collections . Generic ;
42using System . Linq ;
5- using System . Text ;
63using UnityEngine ;
74using UnityEngine . EventSystems ;
85
@@ -13,11 +10,6 @@ public class NodeGraph : MonoBehaviour
1310 public RectTransform GraphContainer => _graphContainer ;
1411 public GraphPointerListener GraphPointerListener => pointerListener ;
1512
16- public INodeEvents NodeEvents => _signalSystem ;
17- public ISocketEvents SocketEventListener => _signalSystem ;
18- public IConnectionEvents ConnectionEvents => _signalSystem ;
19- public IContextMenuEvents ContextMenuListener => _signalSystem ;
20-
2113 // scene references
2214 public RectTransform contextMenuContainer ;
2315 public RectTransform nodeContainer ;
@@ -59,16 +51,10 @@ public void Init(SignalSystem signalSystem, float minZoom, float maxZoom)
5951
6052 public void Create ( string prefabPath )
6153 {
62- var mousePosition = Vector2 . zero ;
63- #if ENABLE_LEGACY_INPUT_MANAGER
64- mousePosition = Input . mousePosition ;
65- #endif
66- #if ENABLE_INPUT_SYSTEM
67- mousePosition = UnityEngine . InputSystem . Mouse . current . position . ReadValue ( ) ;
68- #endif
54+ var mousePosition = Utility . GetMousePosition ( ) ;
6955 var pos = Utility . GetLocalPointIn ( nodeContainer , mousePosition ) ;
7056 var node = Utility . CreateNodePrefab < Node > ( prefabPath , nodeContainer ) ;
71- node . Init ( _signalSystem , pos , NewId ( ) , prefabPath ) ;
57+ node . Init ( _signalSystem , _signalSystem , pos , NewId ( ) , prefabPath ) ;
7258 node . Setup ( ) ;
7359 nodes . Add ( node ) ;
7460 HandleSocketRegister ( node ) ;
@@ -77,7 +63,7 @@ public void Create(string prefabPath)
7763 public void Create ( string prefabPath , Vector2 pos )
7864 {
7965 var node = Utility . CreateNodePrefab < Node > ( prefabPath , nodeContainer ) ;
80- node . Init ( _signalSystem , pos , NewId ( ) , prefabPath ) ;
66+ node . Init ( _signalSystem , _signalSystem , pos , NewId ( ) , prefabPath ) ;
8167 node . Setup ( ) ;
8268 nodes . Add ( node ) ;
8369 HandleSocketRegister ( node ) ;
@@ -248,7 +234,6 @@ public void Clear()
248234
249235 public void OnUpdate ( )
250236 {
251- pointerListener . OnUpdate ( ) ;
252237 drawer . UpdateDraw ( ) ;
253238 }
254239
@@ -398,7 +383,8 @@ private void HandleSocketRegister(Node node)
398383 private void LoadNode ( NodeData data )
399384 {
400385 var node = Utility . CreateNodePrefab < Node > ( data . path , nodeContainer ) ;
401- node . Init ( _signalSystem , new Vector2 ( data . posX , data . posY ) , data . id , data . path ) ;
386+ var pos = new Vector2 ( data . posX , data . posY ) ;
387+ node . Init ( _signalSystem , _signalSystem , pos , data . id , data . path ) ;
402388 node . Setup ( ) ;
403389 nodes . Add ( node ) ;
404390
0 commit comments