public OperationManagerInstance(UndoListView u)
            : base("OperationManager")
        {
            undoListView = u;

            //Undo list visual update stuff
            registerEvent("addUndoListEvent", undoListView, typeof(UndoListView).GetMethod("addEventString"));
            registerEvent("revertUndoListEvent", undoListView, typeof(UndoListView).GetMethod("revertEvent"));
        }
Example #2
0
        public MainViewBase(Splash splash)
        {
            InitializeComponent();

            cleanupOldRuntimeCompiledDlls();

            nativeInstances = new List<NativeInstance>();

            // First setup UI
            logView = new LogView();
            logView.Show(dockPanel, DockState.DockBottom);

            archiveBrowser = new ArchiveBrowser(this);
            archiveBrowser.Show(dockPanel, DockState.DockRight);

            entityList = new EntityListView(this);
            entityList.Show(dockPanel, DockState.DockLeft);

            undoListView = new UndoListView();
            undoListView.Show(dockPanel, DockState.DockLeftAutoHide);

            //Setup instances
            operationManagerInstance = new OperationManagerInstance(undoListView);

            editorList = new List<EditorTab>();
            entityEditorInstanceList = new List<EntityEditorInstance>();

            //createNewEditor();

            engineThread = new Thread(delegate()
            {
                for(;;)
                {
                    //Loop trough instances
                    int size = editorList.Count;
                    for (int i = 0; i < size; ++i )
                    {
                        operationManagerInstance.flush();

                        if (editorList[i].initDone == false)
                            editorList[i].initInstance();

                        editorList[i].instance.update();
                        editorList[i].instance.flush();
                    }

                    //Loop trough instances
                    //TODO: Move all instances to single loop!
                    for (int i = 0; i < nativeInstances.Count; ++i)
                    {
                        nativeInstances[i].update();
                        nativeInstances[i].flush();

                        if(nativeInstances[i].getShutdownState())
                        {
                            nativeInstances.RemoveAt(i);
                            --i;
                        }
                    }

                    //Loop trough EntityEditors
                    for (int i = 0; i < entityEditorInstanceList.Count; ++i)
                    {
                        entityEditorInstanceList[i].update();
                    }
                }
            });

            toolStripStatus.Text = "Editor started.";

            engineThread.Start();

            /*
            EntityListView elv = new EntityListView();
            elv.Show(dockPanel, DockState.DockLeft);
            */

            /*
            EntityEditorView eev = new EntityEditorView();
            eev.Show(dockPanel, DockState.DockRight);
            */
            //--
            this.FormClosed += OnFormClose;

            createNewEditor();

            // Little background thread to allow the splash screen to go away smoothly
            Thread splashKillerThread = new Thread(delegate()
            {
                Thread.Sleep(200);
                splash.Invoke((MethodInvoker)(() => splash.Close()));
            });

            splashKillerThread.Start();
        }