Пример #1
0
        private void btn_CreateTemplateFromGameObject_Click(object sender, EventArgs e)
        {
            GameObject gameObject = selectedGameObject.CloneGameObject();

            if (objectTemplates.ContainsKey(gameObject.Name))
            {
                switch (MessageBox.Show("Overwrite " + gameObject.Name + " template?", "Overwrite Template", MessageBoxButtons.YesNoCancel))
                {
                case DialogResult.Yes:
                    break;

                case DialogResult.No:
                    switch (MessageBox.Show("Would you like to select a new name?", "", MessageBoxButtons.YesNo))
                    {
                    case DialogResult.Yes:
                        NewNameWindow newName = new NewNameWindow(objectTemplates.Keys.ToList());
                        switch (newName.ShowDialog())
                        {
                        case DialogResult.OK:
                            gameObject.Name = newName.ReturnName;
                            break;

                        case DialogResult.Cancel:
                            return;
                        }
                        break;

                    case DialogResult.No:
                        return;
                    }

                    break;

                case DialogResult.Cancel:
                    return;
                }
            }
            fileDialog.InitialDirectory = TemplateLoadDirectory;
            switch (fileDialog.SaveFile(gameObject, "got", "Game Object Template", gameObject.Name).ValidData)
            {
            case true:
                objectTemplates.Add(gameObject.Name, gameObject);
                return;

            case false:
                return;
            }
            LoadTemplatesFromFolder();
        }
Пример #2
0
        private void btn_CreateTemplateFromGameObject_Click(object sender, EventArgs e)
        {
            GameObject gameObject = selectedGameObject.CloneGameObject();
            if (objectTemplates.ContainsKey(gameObject.Name))
            {
                switch (MessageBox.Show("Overwrite " + gameObject.Name + " template?", "Overwrite Template",MessageBoxButtons.YesNoCancel))
                {
                    case DialogResult.Yes:
                        break;
                    case DialogResult.No:
                        switch (MessageBox.Show("Would you like to select a new name?", "", MessageBoxButtons.YesNo))
                        {
                            case DialogResult.Yes:
                                NewNameWindow newName = new NewNameWindow(objectTemplates.Keys.ToList());
                                switch (newName.ShowDialog())
                                {
                                    case DialogResult.OK:
                                        gameObject.Name = newName.ReturnName;
                                        break;
                                    case DialogResult.Cancel:
                                        return;
                                }
                                break;
                            case DialogResult.No:
                                return;
                        }

                        break;
                    case DialogResult.Cancel:
                        return;
                }
            }
            fileDialog.InitialDirectory = TemplateLoadDirectory;
            switch (fileDialog.SaveFile(gameObject, "got", "Game Object Template", gameObject.Name).ValidData)
            {
                case true:
                    objectTemplates.Add(gameObject.Name, gameObject);
                    return;
                case false:
                    return;
            }
            LoadTemplatesFromFolder();
        }