コード例 #1
0
ファイル: Form1.cs プロジェクト: nadar71/Krea
        private void mainBackWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            int progress = 100;

            this.workerProgressBar.Value = progress;

            if (this.currentWorkerAction.Equals("ACTION_SAVE") || this.currentWorkerAction.Equals("ACTION_SAVE_LOAD")
                || this.currentWorkerAction.Equals("ACTION_SAVE_CLOSE") || this.currentWorkerAction.Equals("ACTION_SAVE_CLEAN"))
            {
                if (this.imageObjectsPanel1.ShouldBeRefreshed == true)
                {
                    this.imageObjectsPanel1.RefreshCurrentAssetProject();
                    this.imageObjectsPanel1.ShouldBeRefreshed = false;
                }

                this.statusWorkerProgressBar.Text = "Saving success!";

                this.loadRecentProjectPathItems();

                //START LOADING
                this.currentWorkerAction = this.currentWorkerAction.Replace("_SAVE", "");

                if( this.currentWorkerAction.Equals("ACTION_LOAD"))
                    this.clearCurrentProject();

                this.mainBackWorker.RunWorkerAsync(this.currentWorkerAction);

                if (this.currentWorkerAction.Equals("ACTION_CLOSE"))
                {
                    this.clearCurrentProject();
                    //openNewProjectPanel();

                    Application.Exit();
                }
                else if (this.currentWorkerAction.Equals("ACTION_CLEAN"))
                {
                    this.clearCurrentProject();

                }

                GorgonLibrary.Gorgon.Go();

            }
            else if (this.currentWorkerAction.Equals("ACTION_BUILD_SAVE") ||
                this.currentWorkerAction.Equals("ACTION_BUILD_PLAY")||
                this.currentWorkerAction.Equals("ACTION_BUILD_SAVE_LOAD")||
                this.currentWorkerAction.Equals("ACTION_BUILD_SAVE_CLOSE") || this.currentWorkerAction.Equals("ACTION_BUILD_SAVE_CLEAN"))
            {
                this.statusWorkerProgressBar.Text = "Build succeeded!";

                //START SAVING
                if(this.currentWorkerAction.Equals("ACTION_BUILD_PLAY"))
                {
                    this.statusWorkerProgressBar.Text = "Starting simulator...";

                    this.debuggerPanel1.closeDebuggerSession(false);

                    if (this.IsDebugMode == false && this.CurrentWorkspace.Equals("DEBUG"))
                        this.setWorkSpace("GLOBAL");

                    if (Settings1.Default.RemoteControlEnabled == true && IsDebugMode == false)
                    {
                        if (currentRemoteControllerForm == null)
                        {
                            currentRemoteControllerForm = new RemoteControllerForm();
                            currentRemoteControllerForm.Show(this);
                        }
                        else
                        {
                            if (currentRemoteControllerForm.IsDisposed == true)
                            {
                                currentRemoteControllerForm = new RemoteControllerForm();
                                currentRemoteControllerForm.Show(this);

                            }
                        }

                        currentRemoteControllerForm.init();

                    }
                    else if (Settings1.Default.RemoteControlEnabled == true && IsDebugMode == true)
                    {
                        MessageBox.Show("You cannot launch in the same time the visual debugger and the remote controller!","Disabling remote controller", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.remoteModeCmbBx.SelectedIndex = 0;
                    }

                    this.cgEeditor1.startEmulator();

                    this.currentWorkerAction = "ACTION_SAVE";
                    this.mainBackWorker.RunWorkerAsync(this.currentWorkerAction);
                }
                else
                {
                    this.currentWorkerAction = this.currentWorkerAction.Replace("_BUILD", "");
                    this.mainBackWorker.RunWorkerAsync(this.currentWorkerAction);
                }

                GorgonLibrary.Gorgon.Go();

            }
            else if (this.currentWorkerAction.Equals("ACTION_LOAD"))
            {
                if (this.imageObjectsPanel1.ShouldBeRefreshed == true)
                {
                    this.imageObjectsPanel1.RefreshCurrentAssetProject();
                    this.imageObjectsPanel1.ShouldBeRefreshed = false;
                }

                this.statusWorkerProgressBar.Text = "Loading sucess !";
                this.refreshAssetsProjectsBt_Click(null, null);

                //Creer la hierarchie des nodes
                this.gameElementTreeView1.loadProject(this.CurrentProject);

                if (this.CurrentProject != null)
                {
                    this.fileExplorer1.PopulateTreeView();

                    float XRatio = 1;
                    float YRatio = 1;
                    if (this.IsCustomBuild == true)
                    {
                        XRatio = (float)this.currentTargetResolution.Resolution.Width / (float)this.CurrentProject.width;
                        YRatio = (float)this.currentTargetResolution.Resolution.Height / (float)this.CurrentProject.height;

                    }

                    for (int i = 0; i < this.CurrentProject.Scenes.Count; i++)
                    {

                        Scene scene = this.CurrentProject.Scenes[i];
                        if (scene.Camera == null)
                        {
                            scene.Camera = new Corona_Classes.Camera(scene, scene.SurfaceFocus, scene.CameraFollowLimitRectangle);
                            if (scene.objectFocusedByCamera != null)
                                scene.Camera.setObjectFocusedByCamera(scene.objectFocusedByCamera);
                            scene.Camera.isSurfaceFocusVisible = scene.isSurfaceFocusVisible;

                        }

                        this.cgEeditor1.RefreshSceneLuaCode(scene, IsCustomBuild,XRatio,YRatio);
                    }

                    if(this.CurrentProject.Scenes.Count > 0)
                        this.sceneEditorView1.setModeSceneEditor(this.CurrentProject.Scenes[0]);

                    GorgonLibrary.Gorgon.Go();
                }

            }
            else if (this.currentWorkerAction.Equals("ACTION_IMPORTSTAGE")
                 || this.currentWorkerAction.Equals("ACTION_IMPORTLAYER")
                || this.currentWorkerAction.Equals("ACTION_IMPORTENTITY")
                || this.currentWorkerAction.Equals("ACTION_IMPORTOBJECT"))
            {
                if (this.imageObjectsPanel1.ShouldBeRefreshed == true)
                {
                    this.imageObjectsPanel1.RefreshCurrentAssetProject();
                    this.imageObjectsPanel1.ShouldBeRefreshed = false;
                }

                this.statusWorkerProgressBar.Text = "Import has completed successfully!";

                //Creer la hierarchie des nodes
                this.gameElementTreeView1.loadProject(this.CurrentProject);

                if (this.CurrentProject != null)
                {
                    float XRatio = 1;
                    float YRatio = 1;
                    if (this.IsCustomBuild == true)
                    {
                        XRatio = (float)this.currentTargetResolution.Resolution.Width / (float)this.CurrentProject.width;
                        YRatio = (float)this.currentTargetResolution.Resolution.Height / (float)this.CurrentProject.height;

                    }

                    for (int i = 0; i < this.CurrentProject.Scenes.Count; i++)
                    {

                        Scene scene = this.CurrentProject.Scenes[i];

                        if (scene.Camera == null)
                        {
                            scene.Camera = new Corona_Classes.Camera(scene, scene.SurfaceFocus, scene.CameraFollowLimitRectangle);
                            if (scene.objectFocusedByCamera != null)
                                scene.Camera.setObjectFocusedByCamera(scene.objectFocusedByCamera);
                            scene.Camera.isSurfaceFocusVisible = scene.isSurfaceFocusVisible;

                        }

                        this.cgEeditor1.RefreshSceneLuaCode(scene, IsCustomBuild, XRatio, YRatio);
                    }

                    if (this.CurrentProject.Scenes.Count > 0)
                        this.sceneEditorView1.setModeSceneEditor(this.CurrentProject.Scenes[0]);
                }
            }
            else if (this.currentWorkerAction.Equals("ACTION_EXPORTSTAGE")
                || this.currentWorkerAction.Equals("ACTION_EXPORTLAYER")
                || this.currentWorkerAction.Equals("ACTION_EXPORTENTITY")
                || this.currentWorkerAction.Equals("ACTION_EXPORTOBJECT"))
            {
                this.statusWorkerProgressBar.Text = "Export has completed successfully!";
            }

            else
            {
                this.statusWorkerProgressBar.Text = "Ready !";
                this.workerProgressBar.Value = 100;

                //this.Enabled = true;
                this.isFormLocked = false;
                this.fileExplorer1.PopulateTreeView();
            }
        }
コード例 #2
0
ファイル: AppRemoteController.cs プロジェクト: nadar71/Krea
        //---------------------------------------------------
        //-------------------Methods------------------------
        //---------------------------------------------------
        public void initServer(string ip, int port, RemoteControllerForm remoteControllerForm)
        {
            this.remoteControllerForm = remoteControllerForm;
            if (server != null)
            {
                server.Disconnect();
                server.StopListenSocket();
                server = null;

            }

            if (server == null)
            {
                LastCommandReceive = "";
                CurrentCommandSend = "";

                server = new ASyncSocket();
                server.OnAccept += new ASyncSocket.OnAcceptEventHandler(server_OnAccept);
                server.OnReceive += new ASyncSocket.OnReceiveEventHandler(server_OnReceive);
                server.OnSend += new ASyncSocket.OnSendEventHandler(server_OnSend);
                server.OnListen += new ASyncSocket.OnListenEventHandler(server_OnListen);
                server.OnAcceptFailed += new ASyncSocket.OnAcceptFailedEventHandler(server_OnAcceptFailed);
                server.OnListenFailed += new ASyncSocket.OnListenFailedEventHandler(server_OnListenFailed);
                server.OnReceiveFailed += new ASyncSocket.OnReceiveFailedEventHandler(server_OnReceiveFailed);
                server.OnSendFailed += new ASyncSocket.OnSendFailedEventHandler(server_OnSendFailed);

                server.Listen(ip, port);
            }

            currentBuffer = "";

            // config map
            //this.gMapControl1.MapProvider = GMapProviders.GoogleMap;
            //this.gMapControl1.Position = new PointLatLng(54.6961334816182, 25.2985095977783);
            //this.gMapControl1.MinZoom = 0;
            //this.gMapControl1.MaxZoom = 24;
            //this.gMapControl1.Zoom = 9;

            //this.gMapControl1.Overlays.Add(routes);
            //this.gMapControl1.Overlays.Add(markers);
        }