public override void OnInspectorGUI()
        {
            conditionsListProperty.serializedObject.Update();

            // For some reason re-ordering the conditions won't work without
            // this line. I'm not sure if there is some weird caching that's occuring
            // somewhere or what. Feels hackish, but leaving for now
            if (Event.current.type == EventType.Layout)
            {
                ClearEditors();
            }

            EditorGUILayout.BeginVertical();

            EditorGUI.BeginChangeCheck();

            conditionList.DoLayoutList();

            RenderSelectedEditor();

            if (EditorGUI.EndChangeCheck())
            {
                SceneManagerEditorWindow activeWindow = SceneManagerEditorWindow.TryGetExistingWindow();
                activeWindow.RefreshStatuses();

                conditionsListProperty.serializedObject.ApplyModifiedProperties();
            }

            EditorGUILayout.EndVertical();
        }
Exemple #2
0
        public void Initialize(SerializedSceneManager serializedManager,
                               SceneManagerEditorWindow editorWindow)
        {
            SerializedManager = serializedManager;
            this.editorWindow = editorWindow;

            NodeEditor.ClearAll();
            NodeEditor.ClearInputModes();

            NodeEditor.CanDeleteNode = CanDeleteNode;

            NodeEditor.OnNodeRemoved      += NodeEditor_OnNodeRemoved;
            NodeEditor.OnConnectorRemoved += NodeEditor_OnConnectorRemoved;

            NodeEditor.OnSelectionChanged += NodeEditor_OnSelectionChanged;

            new DefaultInputModeConfig().ApplyToNodeEditor(NodeEditor);

            ConnectNodeInputMode nodeConnectorMode = NodeEditor.GetInputMode <ConnectNodeInputMode>();

            nodeConnectorMode.ConnectorFactory        = TransitionConnector.TransitionConnectorFactory;
            nodeConnectorMode.OnConnectionsFinalized += NodeConnectorMode_OnConnectionsFinalized;

            InitializeContextMenus();

            PopulateNodes(nodeContextMenu);
            PopulateConnections(connectorContextMenu);

            NodeEditor.RaiseSelectionChanged();
            NodeEditor.SetPanOffset(SerializedManager.SceneNodes.PanOffset);
        }
Exemple #3
0
        private void ManagerWindow_OnRefresh(object sender, EventArgs e)
        {
            SceneManagerEditorWindow managerWindow = sender as SceneManagerEditorWindow;

            managerWindow.NodeEditor.NodeEditor.OnSelectionChanged -= NodeEditor_OnSelectionChanged;
            managerWindow.NodeEditor.NodeEditor.OnSelectionChanged += NodeEditor_OnSelectionChanged;

            serializedManager = managerWindow.SerializedSceneManager;
        }
        public static SceneManagerEditorWindow RefreshOpenSceneManagementWindow()
        {
            SceneManagerEditorWindow managerEditor = TryGetExistingWindow();

            if (managerEditor == null)
            {
                return(null);
            }

            managerEditor.FlagRefresh();
            return(managerEditor);
        }
Exemple #5
0
        private void Initialize()
        {
            SceneManagerEditorWindow editor = RefreshManager();

            if (editor != null)
            {
                NodeEditor_OnSelectionChanged(editor.NodeEditor.NodeEditor, null);
            }

            scenePathDragReceiver = new DragReceiver(IsValidDrag, DragAndDropVisualMode.Link);
            scenePathDragReceiver.OnDragComplete += ScenePathDragReceiver_OnDragComplete;
        }
Exemple #6
0
        private SceneManagerEditorWindow RefreshManager()
        {
            SceneManagerEditorWindow managerWindow =
                SceneManagerEditorWindow.RefreshOpenSceneManagementWindow();

            if (managerWindow == null)
            {
                return(null);
            }

            serializedManager = managerWindow.SerializedSceneManager;

            managerWindow.OnRefresh -= ManagerWindow_OnRefresh;
            managerWindow.OnRefresh += ManagerWindow_OnRefresh;

            return(managerWindow);
        }
Exemple #7
0
        private void DrawIdentificationInfo(bool isAnyScene)
        {
            EditorGUI.BeginDisabledGroup(isAnyScene);

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.PropertyField(serializedScene.SceneNameProp);

            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.TextField("Scene Path: ", serializedScene.AssetPathProp.stringValue);

            Rect scenePathRect = GUILayoutUtility.GetLastRect();

            scenePathDragReceiver.ReceiverBox = scenePathRect.WithPosition(
                GUIUtility.GUIToScreenPoint(scenePathRect.position));

            if (GUILayout.Button("Ping", GUILayout.MaxWidth(40f)))
            {
                UnityEngine.Object asset = AssetDatabase.LoadMainAssetAtPath(
                    serializedScene.AssetPathProp.stringValue);
                EditorGUIUtility.PingObject(asset);
            }

            EditorGUILayout.EndHorizontal();

            scenePathDragReceiver.Update();
            EditorGUILayout.PropertyField(serializedScene.UseAnySceneTransProp);

            if (EditorGUI.EndChangeCheck())
            {
                serializedScene.SerializedObject.ApplyModifiedProperties();

                SceneManagerEditorWindow nodeEditor = SceneManagerEditorWindow.TryGetExistingWindow();

                if (nodeEditor != null)
                {
                    nodeEditor.Repaint();
                }
            }

            EditorGUI.EndDisabledGroup();
        }
        public static bool OpenSceneManagerWindow(int instanceId, int line)
        {
            SceneManagerController manager = EditorUtility.InstanceIDToObject(instanceId) as SceneManagerController;

            if (manager == null)
            {
                return(false);
            }

            SceneManagerEditorWindow window = GetWindow <SceneManagerEditorWindow>(title: "Scene Manager", focus: true);

            if (window.sceneManager == manager)
            {
                return(false);
            }

            window.sceneManager = manager;
            window.FlagRefresh();

            return(true);
        }