mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 09:16:01 +08:00
Moved IsMac to NodeEditorUtilities
This commit is contained in:
parent
891ecebc3f
commit
bb847a3044
@ -299,7 +299,7 @@ namespace XNodeEditor {
|
||||
case EventType.KeyDown:
|
||||
if (EditorGUIUtility.editingTextField) break;
|
||||
else if (e.keyCode == KeyCode.F) Home();
|
||||
if (IsMac()) {
|
||||
if (NodeEditorUtilities.IsMac()) {
|
||||
if (e.keyCode == KeyCode.Return) RenameSelectedNode();
|
||||
} else {
|
||||
if (e.keyCode == KeyCode.F2) RenameSelectedNode();
|
||||
@ -310,7 +310,7 @@ namespace XNodeEditor {
|
||||
if (e.commandName == "SoftDelete") {
|
||||
if (e.type == EventType.ExecuteCommand) RemoveSelectedNodes();
|
||||
e.Use();
|
||||
} else if (IsMac() && e.commandName == "Delete") {
|
||||
} else if (NodeEditorUtilities.IsMac() && e.commandName == "Delete") {
|
||||
if (e.type == EventType.ExecuteCommand) RemoveSelectedNodes();
|
||||
e.Use();
|
||||
} else if (e.commandName == "Duplicate") {
|
||||
@ -335,14 +335,6 @@ namespace XNodeEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsMac() {
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
return SystemInfo.operatingSystemFamily == OperatingSystemFamily.MacOSX;
|
||||
#else
|
||||
return SystemInfo.operatingSystem.StartsWith("Mac");
|
||||
#endif
|
||||
}
|
||||
|
||||
private void RecalculateDragOffsets(Event current) {
|
||||
dragOffset = new Vector2[Selection.objects.Length + selectedReroutes.Count];
|
||||
// Selected nodes
|
||||
|
||||
@ -9,7 +9,7 @@ using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace XNodeEditor {
|
||||
/// <summary> A set of editor-only utilities and extensions for UnityNodeEditorBase </summary>
|
||||
/// <summary> A set of editor-only utilities and extensions for xNode </summary>
|
||||
public static class NodeEditorUtilities {
|
||||
|
||||
/// <summary>C#'s Script Icon [The one MonoBhevaiour Scripts have].</summary>
|
||||
@ -25,7 +25,7 @@ namespace XNodeEditor {
|
||||
|
||||
public static bool GetAttrib<T>(object[] attribs, out T attribOut) where T : Attribute {
|
||||
for (int i = 0; i < attribs.Length; i++) {
|
||||
if (attribs[i] is T){
|
||||
if (attribs[i] is T) {
|
||||
attribOut = attribs[i] as T;
|
||||
return true;
|
||||
}
|
||||
@ -84,6 +84,14 @@ namespace XNodeEditor {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsMac() {
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
return SystemInfo.operatingSystemFamily == OperatingSystemFamily.MacOSX;
|
||||
#else
|
||||
return SystemInfo.operatingSystem.StartsWith("Mac");
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary> Returns true if this can be casted to <see cref="Type"/></summary>
|
||||
public static bool IsCastableTo(this Type from, Type to) {
|
||||
if (to.IsAssignableFrom(from)) return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user