示例#1
0
        private void buttonChangeMap_Click(object sender, EventArgs e)
        {
            MapComboBoxItem item = (MapComboBoxItem)
                                   comboBoxMap.Items[comboBoxMap.SelectedIndex];

            if (item != null)
            {
                FableMod.TNG.Section section =
                    item.myMap.TNG.get_Sections("NULL");

                if (section == null)
                {
                    section = new Section("NULL");
                    item.myMap.TNG.AddSection(section);
                }

                buttonChangeMap.Enabled = false;
                buttonChangeMap.Update();

                foreach (FableMod.TNG.Thing thing in mySelectedThings)
                {
                    thing.Detach();
                    section.AddThing(thing);
                }

                buttonChangeMap.Enabled = true;
            }
        }
示例#2
0
 private void FillMapComboBox(ComboBox comboBox)
 {
     for (int i = 0; i < myMaps.Count; ++i)
     {
         MapComboBoxItem item = new MapComboBoxItem(myMaps[i]);
         comboBox.Items.Add(item);
     }
 }
示例#3
0
        private void comboBoxEditMap_SelectedIndexChanged(object sender, EventArgs e)
        {
            MapComboBoxItem item =
                (MapComboBoxItem)comboBoxEditMap.SelectedItem;

            myView.EditMap = item.myMap;

            FillEditSectionComboBox(item.myMap);

            myView.Focus();
        }
示例#4
0
        private void UpdateComboBoxes(FableMod.TNG.Thing[] things)
        {
            comboBoxSection.Items.Clear();

            if (things == null)
            {
                comboBoxMap.Enabled         = false;
                comboBoxSection.Enabled     = false;
                buttonChangeMap.Enabled     = false;
                buttonChangeSection.Enabled = false;
            }
            else
            {
                comboBoxMap.Enabled         = true;
                comboBoxSection.Enabled     = true;
                buttonChangeMap.Enabled     = myMaps.Count > 1;
                buttonChangeSection.Enabled = true;

                FableMod.TNG.TNGFile tngFile = null;

                FableMod.TNG.TNGFile tng = things[0].Section.TNGFile;

                for (int i = 1; i < things.Length; ++i)
                {
                    if (tng != things[i].Section.TNGFile)
                    {
                        tng = null;
                    }
                }

                comboBoxMap.SelectedIndex = -1;

                for (int i = 0; i < comboBoxMap.Items.Count; ++i)
                {
                    MapComboBoxItem item =
                        (MapComboBoxItem)comboBoxMap.Items[i];

                    if (item.myMap.TNG == tng)
                    {
                        tngFile = tng;
                        comboBoxMap.SelectedIndex = i;
                        break;
                    }
                }

                comboBoxSection.Items.Clear();

                if (tng != null)
                {
                    FableMod.TNG.Section section = things[0].Section;

                    for (int i = 1; i < things.Length; ++i)
                    {
                        if (section != things[i].Section)
                        {
                            section = null;
                        }
                    }

                    for (int i = 0; i < tng.SectionCount; ++i)
                    {
                        SectionComboBoxItem item = new SectionComboBoxItem(
                            tng.get_Sections(i));

                        int index = comboBoxSection.Items.Add(item);

                        if (item.mySection == section)
                        {
                            comboBoxSection.SelectedIndex = index;
                        }
                    }
                }
            }
        }