1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-21 01:36:03 +08:00

Moved RerouteReference to own script

This commit is contained in:
Thor Brigsted 2019-08-04 22:25:51 +02:00
parent 5bc267d23b
commit ba48e32a22
5 changed files with 41 additions and 17 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a6a1bbc054e282346a02e7bbddde3206
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,20 @@
using UnityEngine;
namespace XNodeEditor.Internal {
public struct RerouteReference {
public XNode.NodePort port;
public int connectionIndex;
public int pointIndex;
public RerouteReference(XNode.NodePort port, int connectionIndex, int pointIndex) {
this.port = port;
this.connectionIndex = connectionIndex;
this.pointIndex = pointIndex;
}
public void InsertPoint(Vector2 pos) { port.GetReroutePoints(connectionIndex).Insert(pointIndex, pos); }
public void SetPoint(Vector2 pos) { port.GetReroutePoints(connectionIndex) [pointIndex] = pos; }
public void RemovePoint() { port.GetReroutePoints(connectionIndex).RemoveAt(pointIndex); }
public Vector2 GetPoint() { return port.GetReroutePoints(connectionIndex) [pointIndex]; }
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 399f3c5fb717b2c458c3e9746f8959a3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using XNodeEditor.Internal;
namespace XNodeEditor { namespace XNodeEditor {
public partial class NodeEditorWindow { public partial class NodeEditorWindow {
@ -31,23 +32,6 @@ namespace XNodeEditor {
private bool isDoubleClick = false; private bool isDoubleClick = false;
private Vector2 lastMousePosition; private Vector2 lastMousePosition;
private struct RerouteReference {
public XNode.NodePort port;
public int connectionIndex;
public int pointIndex;
public RerouteReference(XNode.NodePort port, int connectionIndex, int pointIndex) {
this.port = port;
this.connectionIndex = connectionIndex;
this.pointIndex = pointIndex;
}
public void InsertPoint(Vector2 pos) { port.GetReroutePoints(connectionIndex).Insert(pointIndex, pos); }
public void SetPoint(Vector2 pos) { port.GetReroutePoints(connectionIndex) [pointIndex] = pos; }
public void RemovePoint() { port.GetReroutePoints(connectionIndex).RemoveAt(pointIndex); }
public Vector2 GetPoint() { return port.GetReroutePoints(connectionIndex) [pointIndex]; }
}
public void Controls() { public void Controls() {
wantsMouseMove = true; wantsMouseMove = true;
Event e = Event.current; Event e = Event.current;

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using XNodeEditor.Internal;
namespace XNodeEditor { namespace XNodeEditor {
/// <summary> Contains GUI methods </summary> /// <summary> Contains GUI methods </summary>