Beispiel #1
0
 public GraphEditorData(GraphEditorData editorData)
 {
     if (editorData == null)
     {
         return;
     }
     gameObject      = editorData.gameObject;
     _graphData      = editorData._graphData;
     _graph          = editorData._graph;
     _selectedRoot   = editorData._selectedRoot;
     _selectedGroup  = editorData._selectedGroup;
     _selectedObject = editorData._selectedObject;
     _selected       = editorData._selected;
     debugAnyScript  = editorData.debugAnyScript;
     debugObject     = editorData.debugObject;
     debugSelf       = editorData.debugSelf;
     selectedNodes   = editorData.selectedNodes;
 }
Beispiel #2
0
 protected void OnChanged(GraphEditorData editorData)
 {
     if (informations != null)
     {
         if (editorData.selected == editorData.selectedNodes && editorData.selectedNodes.Count > 0)
         {
             var ids = editorData.selectedNodes.Select(n => n.GetInstanceID().ToString());
             selectedInfos = informations.Where(info => ids.Contains(info.id)).ToArray();
         }
         else if (editorData.selected is Component comp)
         {
             selectedInfos = informations.Where(info => info.id == comp.GetInstanceID().ToString()).ToArray();
         }
         else if (editorData.selected is VariableData variable)
         {
             selectedInfos = informations.Where(info => info.id == CodeGenerator.KEY_INFORMATION_VARIABLE + variable.Name).ToArray();
         }
         else
         {
             selectedInfos = null;
         }
         Repaint();
     }
 }
Beispiel #3
0
 public static void ShowInspector(GraphEditorData editorData, int limitMultiEdit = 99)
 {
     if (editorData.selected == null)
     {
         if (editorData.currentCanvas != null)
         {
             EditorGUI.DropShadowLabel(uNodeGUIUtility.GetRect(), "Graph");
             EditorGUILayout.Space();
             DrawGraphInspector(editorData.graph, true);
             if (editorData.currentCanvas != editorData.graph)
             {
                 EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
                 EditorGUI.DropShadowLabel(uNodeGUIUtility.GetRect(), "Edited Canvas");
                 EditorGUILayout.Space();
                 DrawUnitObject(editorData.currentCanvas);
             }
         }
         else if (editorData.graphData != null)
         {
             DrawUnitObject(editorData.graphData);
         }
         return;
     }
     EditorGUI.BeginDisabledGroup(
         (!Application.isPlaying || uNodePreference.GetPreference().preventEditingPrefab) &&
         uNodeEditorUtility.IsPrefab(editorData.owner));
     if (editorData.selected is List <NodeComponent> && editorData.selectedNodes.Count > 0 && editorData.graph != null)
     {
         editorData.selectedNodes.RemoveAll(item => item == null);
         int drawCount = 0;
         for (int i = 0; i < editorData.selectedNodes.Count; i++)
         {
             if (i >= editorData.selectedNodes.Count)
             {
                 break;
             }
             NodeComponent selectedNode = editorData.selectedNodes[i];
             if (drawCount >= limitMultiEdit)
             {
                 break;
             }
             if (drawCount > 0)
             {
                 EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
             }
             if (DrawNodeEditor(selectedNode))
             {
                 drawCount++;
             }
         }
         if (drawCount >= limitMultiEdit)
         {
             EditorGUILayout.BeginVertical("Box");
             EditorGUILayout.HelpBox("Multi Editing Limit : " + limitMultiEdit, MessageType.Info);
             EditorGUILayout.EndVertical();
         }
     }
     else if (editorData.selected is TransitionEvent transitionEvent && editorData.graph != null)
     {
         EditorGUILayout.BeginVertical("Box");
         Editor editor = Editor.CreateEditor(transitionEvent);
         if (editor != null && transitionEvent.owner == editorData.graph)
         {
             editor.OnInspectorGUI();
             if (transitionEvent.GetType().GetCustomAttributes(typeof(DescriptionAttribute), false).Length != 0)
             {
                 DescriptionAttribute descriptionEvent = (DescriptionAttribute)transitionEvent.GetType().GetCustomAttributes(typeof(DescriptionAttribute), false)[0];
                 if (descriptionEvent.description != null && descriptionEvent != null)
                 {
                     GUI.backgroundColor = Color.yellow;
                     EditorGUILayout.HelpBox("Description: " + descriptionEvent.description, MessageType.None);
                     GUI.backgroundColor = Color.white;
                 }
             }
         }
         EditorGUILayout.EndVertical();
         if (GUI.changed)
         {
             uNodeEditor.GUIChanged(editorData.selected);
         }
     }