internal override void BuildFromGraph(NodeGraphObj m_targetGraph) { if (m_targetGraph is BridgeUI.Graph.UIGraph) { StoreInfoOfUIGraph(m_targetGraph as BridgeUI.Graph.UIGraph); } }
protected override void BuildFromGraph(NodeGraphObj m_targetGraph) { if (Selection.activeGameObject != null) { var panelGroup = Selection.activeGameObject.GetComponent <PanelGroup>(); if (panelGroup != null) { StoreInfoOfPanelGroup(panelGroup); } } if (Selection.activeObject != null && Selection.activeObject is PanelGroupObj) { var groupObj = Selection.activeObject as PanelGroupObj; if (groupObj != null) { StoreInfoOfPanelGroup(groupObj); } } if (Selection.activeGameObject != null) { var runtimePanelGroup = Selection.activeGameObject.GetComponent <RuntimePanelGroup>(); if (runtimePanelGroup != null && !string.IsNullOrEmpty(runtimePanelGroup.groupGuid)) { var path = AssetDatabase.GUIDToAssetPath(runtimePanelGroup.groupGuid); if (!string.IsNullOrEmpty(path)) { var groupObj = AssetDatabase.LoadAssetAtPath <PanelGroupObj>(path); StoreInfoOfPanelGroup(groupObj); } } } UpdateScriptOfPanelNames(m_targetGraph.Nodes.FindAll(x => x.Object is PanelNodeBase).ConvertAll <string>(x => x.Name)); }
protected override void JudgeNodeExceptions(NodeGraphObj m_targetGraph, List <NodeException> m_nodeExceptions) { bool haveError = false; var lockList = new List <string>(); foreach (var item in TargetGraph.Nodes) { if (item.Object is IPanelInfoHolder) { var nodeItem = item.Object as IPanelInfoHolder; if (string.IsNullOrEmpty(nodeItem.Info.guid) || LoadPrefabFromGUID(nodeItem.Info.guid) == null) { m_nodeExceptions.Add(new NodeException("prefab is null", item.Id)); haveError = true; } else { if (lockList.Contains(nodeItem.Info.guid)) { m_nodeExceptions.Add(new NodeException("node repeated", item.Id)); haveError = true; } else { lockList.Add(nodeItem.Info.guid); } } } } if (!haveError) { BuildFromGraph(m_targetGraph); } }
public override void SaveGraph(List <NodeData> nodes, List <ConnectionData> connections, bool resetAll = false) { //base.SaveGraph(nodes, connections, resetAll); UnityEngine.Assertions.Assert.IsNotNull(this); TargetGraph.ApplyGraph(nodes, connections); NodeGraphObj obj = TargetGraph; var allAssets = AllNeededAssets(); SetSubAssets(allAssets, obj); UnityEditor.EditorUtility.SetDirty(obj); }
protected override void BuildFromGraph(NodeGraphObj m_targetGraph) { if (Selection.activeGameObject != null) { var panelGroup = Selection.activeGameObject.GetComponent <PanelGroup>(); if (panelGroup != null) { StoreInfoOfPanel(panelGroup); } } UpdateScriptOfPanelNames(m_targetGraph.Nodes.FindAll(x => x.Object is PanelNodeBase).ConvertAll <string>(x => x.Name)); }
protected override void JudgeNodeExceptions(NodeGraphObj m_targetGraph, List <NodeException> m_nodeExceptions) { foreach (var item in TargetGraph.Nodes) { if (item.Object is IPanelInfoHolder) { var nodeItem = item.Object as IPanelInfoHolder; if (nodeItem.Info.prefab == null) { m_nodeExceptions.Add(new NodeException("prefab is null", item.Id)); } } } }
protected override void JudgeNodeExceptions(NodeGraphObj m_targetGraph, List <NodeException> m_nodeExceptions) { foreach (var item in TargetGraph.Nodes) { if (item.Object is IPanelInfoHolder) { var nodeItem = item.Object as IPanelInfoHolder; var guid = nodeItem.Info.prefabGuid; if (string.IsNullOrEmpty(guid) || string.IsNullOrEmpty(AssetDatabase.GUIDToAssetPath(guid))) { m_nodeExceptions.Add(new NodeException("prefab is null", item.Id)); } } } }
public override void OnInspectorGUI() { if (canvas == null) { canvas = (NodeGraphObj)target; } if (canvas == null) { return; } if (titleStyle == null) { titleStyle = new GUIStyle(GUI.skin.label); titleStyle.fontStyle = FontStyle.Bold; titleStyle.alignment = TextAnchor.MiddleCenter; titleStyle.fontSize = 16; } if (subTitleStyle == null) { subTitleStyle = new GUIStyle(GUI.skin.label); subTitleStyle.fontStyle = FontStyle.Bold; subTitleStyle.alignment = TextAnchor.MiddleCenter; subTitleStyle.fontSize = 12; } if (boldLabelStyle == null) { boldLabelStyle = new GUIStyle(GUI.skin.label); boldLabelStyle.fontStyle = FontStyle.Bold; } EditorGUI.BeginChangeCheck(); GUILayout.Space(10); GUILayout.Label(new GUIContent(canvas.ControllerType, "自己定义控制器类型"), titleStyle); GUILayout.Label(canvas.LastModified.ToString("yyyy-MM-dd hh:mm:ss"), subTitleStyle); GUILayout.Space(10); if (GUILayout.Button("Open", EditorStyles.toolbarButton)) { var window = EditorWindow.GetWindow <NodeGraphWindow>(); window.OpenGraph(canvas); } using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label("Description", GUILayout.Width(100f)); string newdesc = EditorGUILayout.TextArea(canvas.Descrption, GUILayout.MaxHeight(100f)); if (newdesc != canvas.Descrption) { canvas.Descrption = newdesc; } } GUILayout.Space(10); if (canvas.Nodes.Count > 0) { GUILayout.Label("[Nodes]", boldLabelStyle); foreach (NodeData node in canvas.Nodes) { string label = node.Name; var type = node.Object == null ? typeof(Node) : node.Object.GetType(); node.Object = EditorGUILayout.ObjectField(label, node.Object, type, false) as Node; } GUILayout.Space(10); } if (canvas.Connections.Count > 0) { GUILayout.Label("[Connections]", boldLabelStyle); foreach (var connection in canvas.Connections) { string label = connection.ConnectionType; var type = connection.Object == null ? typeof(Connection) : connection.Object.GetType(); EditorGUILayout.ObjectField(label, connection.Object, type, false); } GUILayout.Space(10); } if (EditorGUI.EndChangeCheck()) { } }
public void OnEnable() { canvas = (NodeGraphObj)target; }
protected override void BuildFromGraph(NodeGraphObj m_targetGraph) { base.BuildFromGraph(m_targetGraph); }
protected override void JudgeNodeExceptions(NodeGraphObj m_targetGraph, List <NodeException> m_nodeExceptions) { base.JudgeNodeExceptions(m_targetGraph, m_nodeExceptions); }
public void OnEnable() { canvas = (NodeGraphObj)target; canvas.Validate(); }