Пример #1
0
        static void Main()
        {
            //Clear old dll's for the runtime.
            /*
            System.Diagnostics.Process process = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
            startInfo.FileName = "cmd.exe";
            startInfo.Arguments = "/C call \"../windows/dlldel.bat\"";
            startInfo.UseShellExecute = true;
            process.StartInfo = startInfo;
              //  process.Start();
            */

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Splash splash = new Splash();
            splash.Show();

            Application.Run(new MainViewBase(splash));
        }
Пример #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();
        }