Ejemplo n.º 1
0
        /// <summary>
        /// Tries to create a project with the given information
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void createBtn_Click(object sender, EventArgs e)
        {
            // the pre-requisites are done?
            if (nameTxt.Text.Trim() != string.Empty && pathTxt.Text != string.Empty)
            {
                nameTxt.Text = nameTxt.Text.Trim();
                string path = pathTxt.Text + "\\" + nameTxt.Text;

                // The project already exists?
                if (Directory.Exists(path))
                {
                    KryptonMessageBox.Show("There is already a project with that name, please choose another", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                GibboProject gp = new GibboProject(nameTxt.Text, pathTxt.Text);
                gp.Save();

                //SceneManager.GameProject = new GibboProject(nameTxt.Text, pathTxt.Text);
                //SceneManager.GameProject.Save();

                File.Copy("Project Templates\\Gibbo.Engine.Windows.exe", path + "\\Gibbo.Engine.Windows.exe", true);
                File.Copy("Project Templates\\GameProject.csproj", path + "\\Scripts.csproj", true);
                File.Copy("Project Templates\\settings.ini", path + "\\settings.ini", true);

                // Solution Preparations
                string slnFile = File.ReadAllText("Project Templates\\GameProject.sln");
                slnFile = slnFile.Replace("{%P_NAME%}", nameTxt.Text);

                // Solution Save
                File.WriteAllText(path + "\\Scripts.sln", slnFile);

                File.Copy("Gibbo.Library.dll", path + "\\Gibbo.Library.dll", true);

                GibboHelper.CopyDirectory("Project Templates\\libs", path + "", true);
                GibboHelper.CopyDirectory("Project Templates\\samples", path + "\\samples", true);

                ProjectPath = gp.ProjectFilePath;
                this.DialogResult = System.Windows.Forms.DialogResult.Yes;
                this.Close();
            }
            else
            {
                KryptonMessageBox.Show("Fill all the required fields please.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private static void LoadData(ref GibboProject project)
        {
            string dataPath = project.projectPath + "\\Data";

            //#if WINDOWS
            //            if (!Directory.Exists(dataPath))
            //            {
            //                Directory.CreateDirectory(dataPath);

            //                VisualScriptManager vsManager = new VisualScriptManager();
            //                project.visualScriptManager = vsManager;
            //                project.SaveVisualScripts();
            //            }

            //            // Load Visual Scripts
            //            project.visualScriptManager = VisualScriptManager.Load(dataPath + "\\VisualScripts.data");
            //#endif
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Loads a project and returns it
        /// </summary>
        /// <param name="filepath">The source filepath</param>
        /// <returns>A deserialized gibbo project</returns>
        public static GibboProject Load(string filepath)
        {
#if WINDOWS
            GibboProject project = (GibboProject)GibboHelper.DeserializeObject(filepath);
#elif WINRT
            string       npath   = filepath.Replace(Windows.ApplicationModel.Package.Current.InstalledLocation.Path + "\\", string.Empty);
            GibboProject project = (GibboProject)GibboHelper.DeserializeObject(typeof(GibboProject), npath);
#endif
            // Update the project path:
            project.ProjectPath     = System.IO.Path.GetDirectoryName(filepath);
            project.ProjectFilePath = filepath;

            // Load data files
            LoadData(ref project);

            // Create a virtual settings file:
            project.settings.ReloadPath(project.ProjectPath);

            return(project);
        }
Ejemplo n.º 4
0
        private void ProjectSettings_Load(object sender, EventArgs e)
        {
            gameProject = SceneManager.GameProject;

            UnloadSettings();
        }
Ejemplo n.º 5
0
        private static void LoadData(ref GibboProject project)
        {
            string dataPath = project.projectPath + "\\Data";

            //#if WINDOWS
            //            if (!Directory.Exists(dataPath))
            //            {
            //                Directory.CreateDirectory(dataPath);

            //                VisualScriptManager vsManager = new VisualScriptManager();
            //                project.visualScriptManager = vsManager;
            //                project.SaveVisualScripts();
            //            }

            //            // Load Visual Scripts
            //            project.visualScriptManager = VisualScriptManager.Load(dataPath + "\\VisualScripts.data");
            //#endif
        }