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:
parent
5bc267d23b
commit
ba48e32a22
8
Scripts/Editor/Internal.meta
Normal file
8
Scripts/Editor/Internal.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a6a1bbc054e282346a02e7bbddde3206
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
20
Scripts/Editor/Internal/RerouteReference.cs
Normal file
20
Scripts/Editor/Internal/RerouteReference.cs
Normal 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]; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Scripts/Editor/Internal/RerouteReference.cs.meta
Normal file
11
Scripts/Editor/Internal/RerouteReference.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 399f3c5fb717b2c458c3e9746f8959a3
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -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;
|
||||||
|
|||||||
@ -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>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user