Ejemplo n.º 1
0
        private void SaveCurrent()
        {
            if (propertyGrid.Tag == null)
            {
                return;
            }

            switch (propertyGrid.Tag.ToString())
            {
            case "gibbo_general":
                Properties.Settings.Default.LoadLastProject   = (propertyGrid.SelectedObject as GibboGeneralSettingsDynamic).AutomaticProjectLoad;
                Properties.Settings.Default.StartOnFullScreen = (propertyGrid.SelectedObject as GibboGeneralSettingsDynamic).StartOnFullScreen;
                Properties.Settings.Default.ShowDebugView     = (propertyGrid.SelectedObject as GibboGeneralSettingsDynamic).ShowDebugView;
                Properties.Settings.Default.ReduceConsumption = (propertyGrid.SelectedObject as GibboGeneralSettingsDynamic).ReduceConsumption;
                string appName = (propertyGrid.SelectedObject as GibboGeneralSettingsDynamic).ScriptEditors.ToString();

                // colocar no startup do gibbo
                EditorUtils.StoreInstalledApplications();

                //bool isInstalled = false;
                //foreach (string name in EditorUtils.InstalledApps.Keys)
                //{
                //    if (name.Replace(" ", "").ToLower().Contains(appName.ToLower()))
                //    {
                //        isInstalled = true;
                //        MessageBox.Show("Found::::" + EditorUtils.InstalledApps[name]);
                //        //break;
                //    }
                //}

                //C:\Program Files (x86)\SharpDevelop\4.3\bin\SharpDevelop.exe
                // C:\Program Files (x86)\Xamarin Studio\bin\XamarinStudio.exe

                //Process ide;
                //    ProcessStartInfo pinfo = new ProcessStartInfo();
                //    pinfo.FileName = "SharpDevelop.exe";
                //    pinfo.WorkingDirectory = SceneManager.GameProject.ProjectPath;
                //    pinfo.UseShellExecute = true;
                //    ide = Process.Start(pinfo);

                if (appName.ToLower().Equals("lime"))
                {
                    Properties.Settings.Default.DefaultScriptEditor = (propertyGrid.SelectedObject as GibboGeneralSettingsDynamic).ScriptEditors.ToString();
                }

                if ((propertyGrid.SelectedObject as GibboGeneralSettingsDynamic).ScriptEditors.ToString().ToLower() != "lime")
                {
                    if (EditorUtils.CheckVisualStudioExistance((propertyGrid.SelectedObject as GibboGeneralSettingsDynamic).ScriptEditors.ToString()))
                    {
                        Properties.Settings.Default.DefaultScriptEditor = (propertyGrid.SelectedObject as GibboGeneralSettingsDynamic).ScriptEditors.ToString();
                    }
                    else
                    {
                        MessageBox.Show("You don't have the selected visual studio IDE");
                    }
                }
                else
                {
                    Properties.Settings.Default.DefaultScriptEditor = (propertyGrid.SelectedObject as GibboGeneralSettingsDynamic).ScriptEditors.ToString();
                }


                Properties.Settings.Default.Save();
                break;

            case "gibbo_tileset":
                Properties.Settings.Default.HighlightActiveTileset = (propertyGrid.SelectedObject as GibboTilesetSettingsDynamic).HighlightActiveTileset;
                break;

            case "game_general":
                SceneManager.GameProject.ProjectName = (propertyGrid.SelectedObject as GameGeneralSettingsDynamic).ProjectName;
                break;

            case "game_grid":
                SceneManager.GameProject.EditorSettings.GridSpacing       = (propertyGrid.SelectedObject as GameGridSettingsDynamic).GridSpacing;
                SceneManager.GameProject.EditorSettings.GridThickness     = (propertyGrid.SelectedObject as GameGridSettingsDynamic).GridThickness;
                SceneManager.GameProject.EditorSettings.GridColor         = (propertyGrid.SelectedObject as GameGridSettingsDynamic).GridColor;
                SceneManager.GameProject.EditorSettings.GridNumberOfLines = (propertyGrid.SelectedObject as GameGridSettingsDynamic).DisplayLines;
                break;

            case "game_debug":
                iniSettings.IniWriteValue("Console", "Visible", (propertyGrid.SelectedObject as GameDebugDynamic).ShowConsole.ToString());
                Properties.Settings.Default.AttachVisualStudio = (propertyGrid.SelectedObject as GameDebugDynamic).Attach;
                Properties.Settings.Default.Save();
                SceneManager.GameProject.Debug = (propertyGrid.SelectedObject as GameDebugDynamic).DebugMode == GameDebugDynamic.DebugModes.Debug ? true : false;
                break;

            case "game_screen":
                iniSettings.IniWriteValue("Mouse", "Visible", (propertyGrid.SelectedObject as GameScreenDynamic).MouseVisible.ToString());
                iniSettings.IniWriteValue("Window", "StartFullScreen", (propertyGrid.SelectedObject as GameScreenDynamic).StartOnFullScreen.ToString());
                SceneManager.GameProject.Settings.ScreenWidth  = (propertyGrid.SelectedObject as GameScreenDynamic).ScreenWidth;
                SceneManager.GameProject.Settings.ScreenHeight = (propertyGrid.SelectedObject as GameScreenDynamic).ScreenHeight;
                //SceneManager.GameProject.ProjectSettings.VSyncEnabled = (propertyGrid.SelectedObject as GameScreenDynamic).VSync;
                break;
            }
        }