Пример #1
0
 private void OnGroupCommand(string prm)
 {
     if (prm?.ToLower() == "add")
     {
         GroupDialog dlg = new GroupDialog(Unit);
         dlg.ShowDialog();
     }
     else if (prm?.ToLower() == "remove")
     {
         if (SelectedGroep != null)
         {
             Unit.Groepen.Delete(SelectedGroep);
             Unit.Save();
         }
     }
 }
Пример #2
0
        private void NewTagButton_Click(object sender, EventArgs e)
        {
            //Get last
            IndexEntry last = Map.IndexEntries.Last;

            if (last.Root != HaloTags.ugh_)
            {
                return;
            }

            //Prepare
            using (GroupDialog groupDlg = new GroupDialog())
            {
                //Show
                if (groupDlg.ShowDialog() == DialogResult.OK)
                {
                    using (NameDialog nameDialog = new NameDialog())
                        if (nameDialog.ShowDialog() == DialogResult.OK)
                        {
                            //Prepare
                            string tagName  = nameDialog.TagName;
                            Group  tagGroup = TagLookup.CreateTagGroup(groupDlg.SelectedGroup);

                            //Check
                            if (tagGroup != null)
                            {
                                if (groupDlg.SelectedGroup == HaloTags.ltmp || groupDlg.SelectedGroup == HaloTags.sbsp)
                                {
                                    //Ask for which BSP index to build into
                                    using (StructureBspSelectDialog bspSelectDlg = new StructureBspSelectDialog(Map.Scenario))
                                        if (bspSelectDlg.ShowDialog() == DialogResult.OK && bspSelectDlg.SelectedBlockIndex >= 0)
                                        {
                                            //Create tag
                                            ScenarioStructureTag tag = new ScenarioStructureTag(bspSelectDlg.SelectedBlockIndex)
                                            {
                                                TagGroup = tagGroup,
                                                Name     = tagName,
                                                Id       = last.Id,
                                            };

                                            //Add
                                            Map.AddScenarioStructureTags(tag);
                                        }
                                }
                                else
                                {
                                    //Create tag
                                    Tag tag = new Tag()
                                    {
                                        TagGroup = tagGroup,
                                        Name     = tagName,
                                        Id       = last.Id,
                                    };

                                    //Add
                                    Map.AddTags(tag);
                                }
                            }

                            //Reload
                            Host.Request(this, "ReloadMap");
                        }
                }
            }
        }