Inheritance: System.Windows.Forms.Form
コード例 #1
0
        private void buttonAddTags_Click(object sender, EventArgs e)
        {
            if (MainForm.Instance.CurrentTool != ToolObject.Instance)
            {
                MessageBox.Show("The object tool must be active to perform this action.");
                return;
            }
            EditorObjectSelection selection = ToolObject.Instance.Selection;

            if (!selection.IsValid || selection.Count == 0)
            {
                MessageBox.Show("Must select one or more objects in the map to perform this action.");
                return;
            }
            using (PromptForm promptForm = new PromptForm("List of tags to add to selection"))
            {
                if (promptForm.ShowDialog() == DialogResult.OK)
                {
                    string[] array = promptForm.Input.Split(new char[]
                    {
                        ','
                    }, StringSplitOptions.RemoveEmptyEntries);
                    if (!string.IsNullOrEmpty(promptForm.Input))
                    {
                        foreach (EditorObject current in selection.GetObjects())
                        {
                            ObjectInventory.Entry entry = current.Entry;
                            List <string>         list  = new List <string>(entry.Tags.Split(new char[]
                            {
                                ','
                            }, StringSplitOptions.RemoveEmptyEntries));
                            string[] array2 = array;
                            for (int i = 0; i < array2.Length; i++)
                            {
                                string item = array2[i];
                                if (!list.Contains(item))
                                {
                                    list.Add(item);
                                }
                            }
                            list.Sort();
                            entry.Tags = string.Join(",", list.ToArray());
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: Azerothian/fc3editor
 private void cameraSpeedItem_Click(object sender, EventArgs e)
 {
     object tag = ((ToolStripItem)sender).Tag;
     float speed;
     if (tag != null)
     {
         speed = (float)tag;
     }
     else
     {
         using (PromptForm promptForm = new PromptForm(Localizer.Localize("EDITOR_CAMERA_SPEED_PROMPT"), Localizer.Localize("EDITOR_CAMERA_SPEED_PROMPT_TITLE")))
         {
             promptForm.Validation = PromptForm.GetFloatValidation(0.001f, 50f);
             if (promptForm.ShowDialog(this) != DialogResult.OK)
             {
                 return;
             }
             speed = float.Parse(promptForm.Input);
         }
     }
     Camera.Speed = speed;
     this.UpdateCameraSpeed();
 }
コード例 #3
0
ファイル: ObjectAdmin.cs プロジェクト: Azerothian/fc3editor
 private void buttonAddTags_Click(object sender, EventArgs e)
 {
     if (MainForm.Instance.CurrentTool != ToolObject.Instance)
     {
         MessageBox.Show("The object tool must be active to perform this action.");
         return;
     }
     EditorObjectSelection selection = ToolObject.Instance.Selection;
     if (!selection.IsValid || selection.Count == 0)
     {
         MessageBox.Show("Must select one or more objects in the map to perform this action.");
         return;
     }
     using (PromptForm promptForm = new PromptForm("List of tags to add to selection"))
     {
         if (promptForm.ShowDialog() == DialogResult.OK)
         {
             string[] array = promptForm.Input.Split(new char[]
             {
                 ','
             }, StringSplitOptions.RemoveEmptyEntries);
             if (!string.IsNullOrEmpty(promptForm.Input))
             {
                 foreach (EditorObject current in selection.GetObjects())
                 {
                     ObjectInventory.Entry entry = current.Entry;
                     List<string> list = new List<string>(entry.Tags.Split(new char[]
                     {
                         ','
                     }, StringSplitOptions.RemoveEmptyEntries));
                     string[] array2 = array;
                     for (int i = 0; i < array2.Length; i++)
                     {
                         string item = array2[i];
                         if (!list.Contains(item))
                         {
                             list.Add(item);
                         }
                     }
                     list.Sort();
                     entry.Tags = string.Join(",", list.ToArray());
                 }
             }
         }
     }
 }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: Azerothian/fc3editor
 private bool SaveMap(bool saveAs, bool silent, EditorDocument.SaveCompletedCallback callback)
 {
     if (!EditorDocument.Validate() && LocalizedMessageBox.Show(Localizer.Localize("ERROR_VALIDATION_FAILED"), Localizer.Localize("ERROR"), Localizer.Localize("Generic", "GENERIC_YES"), Localizer.Localize("Generic", "GENERIC_NO"), null, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1) == DialogResult.No)
     {
         return false;
     }
     string text = this.m_documentPath;
     if (saveAs || this.m_documentPath == null)
     {
         this.saveMapDialog.FileName = text;
         if (this.saveMapDialog.ShowDialog(this) != DialogResult.OK)
         {
             return false;
         }
         text = this.saveMapDialog.FileName;
     }
     if (EditorDocument.MapName == EditorDocument.DefaultMapName)
     {
         using (PromptForm promptForm = new PromptForm(Localizer.LocalizeCommon("VKEYBOARD_TITLE_MAPNAME")))
         {
             promptForm.Text = Localizer.LocalizeCommon("VKEYBOARD_DESC_MAPNAME");
             promptForm.Input = Path.GetFileNameWithoutExtension(text);
             promptForm.MaxLength = 20;
             if (promptForm.ShowDialog(this) != DialogResult.OK)
             {
                 bool result = false;
                 return result;
             }
             EditorDocument.MapName = promptForm.Input;
         }
     }
     string text2 = null;
     if (string.IsNullOrEmpty(EditorDocument.CreatorName))
     {
         using (PromptForm promptForm2 = new PromptForm(Localizer.Localize("PROMPT_CREATOR_TEXT")))
         {
             promptForm2.Text = Localizer.Localize("PROMPT_CREATOR_TITLE");
             promptForm2.Input = EditorDocument.AuthorName;
             promptForm2.MaxLength = 20;
             if (promptForm2.ShowDialog(this) != DialogResult.OK)
             {
                 bool result = false;
                 return result;
             }
             text2 = promptForm2.Input;
         }
     }
     if (saveAs)
     {
         EditorDocument.MapId = Guid.NewGuid();
     }
     if (text2 != null)
     {
         EditorDocument.CreatorName = text2;
     }
     this.m_documentPath = text;
     EditorDocument.Save(this.m_documentPath, callback);
     this.UpdateTitleBar();
     return true;
 }