private void menuItem_newCppCustomAsset_Click(object sender, EventArgs e)
        {
            MainForm mainForm = FindForm() as MainForm;

            if (mainForm == null || mainForm.ProjectModel == null)
            {
                return;
            }

            FolderBrowserDialog dialog = new FolderBrowserDialog();

            dialog.ShowNewFolderButton = true;
            dialog.SelectedPath        = mainForm.ProjectModel.WorkingDirectory;
            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                MetroPromptBox prompt = new MetroPromptBox();
                prompt.Title = "Enter asset name:";
                prompt.Value = "UserAsset";
                result       = prompt.ShowDialog();
                if (result == DialogResult.OK)
                {
                    CreateNewAsset(dialog.SelectedPath, prompt.Value);
                }
            }
        }
        private void menuItem_rename_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menuItem = sender as ToolStripMenuItem;

            if (menuItem == null || !(menuItem.Tag is string))
            {
                return;
            }

            string path = menuItem.Tag as string;

            if (Directory.Exists(path))
            {
                DirectoryInfo info = new DirectoryInfo(path);
                if (!info.Exists)
                {
                    return;
                }

                MetroPromptBox dialog = new MetroPromptBox();
                dialog.Title   = "Rename Directory";
                dialog.Message = "Type new directory name:";
                dialog.Value   = info.Name;
                DialogResult result = dialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    info.MoveTo(info.Parent.FullName + @"\" + dialog.Value);
                }
            }
            else if (File.Exists(path))
            {
                FileInfo info = new FileInfo(path);
                if (!info.Exists)
                {
                    return;
                }

                MetroPromptBox dialog = new MetroPromptBox();
                dialog.Title   = "Rename File";
                dialog.Message = "Type new file name:";
                dialog.Value   = info.Name;
                DialogResult result = dialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    info.MoveTo(info.Directory.FullName + @"\" + dialog.Value);
                }
            }
        }
Beispiel #3
0
        private void m_generalNewProjectTile_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();

            dialog.ShowNewFolderButton = true;
            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                MetroPromptBox prompt = new MetroPromptBox();
                prompt.Title = "Enter project name:";
                prompt.Value = "Project";
                result       = prompt.ShowDialog();
                if (result == DialogResult.OK)
                {
                    CreateNewProject(dialog.SelectedPath, prompt.Value);
                }
            }
        }
        private void AddNewGameObject(bool isPrefab, int parent, string prefabSource = "")
        {
            if (string.IsNullOrEmpty(m_scenePath))
            {
                return;
            }

            MetroPromptBox prompt = new MetroPromptBox();

            prompt.Title   = "New Game Object";
            prompt.Message = "Enter new Game Object id:";
            DialogResult result = prompt.ShowDialog();

            if (result == DialogResult.OK && !string.IsNullOrEmpty(prompt.Value))
            {
                int handle = SceneViewPlugin.CreateGameObject(isPrefab, parent, prefabSource, prompt.Value);
                if (handle != 0)
                {
                    RebuildSceneTree();
                    RefreshSceneView();
                }
            }
        }