Ejemplo n.º 1
0
        public MultiSetter(List <Creature> creatureList, List <bool> appliedSettings, List <Creature>[] parents, List <string> tagList, List <string> speciesList)
        {
            InitializeComponent();
            Disposed += MultiSetter_Disposed;

            colors      = new int[6];
            tagControls = new List <MultiSetterTag>();

            this.creatureList            = creatureList;
            parentComboBoxMother.naLabel = " - Mother n/a";
            parentComboBoxFather.naLabel = " - Father n/a";
            if (parents == null)
            {
                // disable parents, probably multiple species selected
                checkBoxMother.Enabled       = false;
                checkBoxFather.Enabled       = false;
                parentComboBoxMother.Enabled = false;
                parentComboBoxFather.Enabled = false;
                uniqueSpecies = false;
            }
            else
            {
                parentComboBoxMother.ParentList = parents[0];
                parentComboBoxFather.ParentList = parents[1];
                uniqueSpecies = true;
            }
            checkBoxMother.Checked = false;
            checkBoxFather.Checked = false;
            creatureStatus         = CreatureStatus.Available;
            creatureSex            = Sex.Unknown;

            ParentsChanged = false;
            TagsChanged    = false;
            SpeciesChanged = false;

            pictureBox1.Image = CreatureColored.getColoredCreature(colors, uniqueSpecies ? creatureList[0].species : "",
                                                                   new[] { true, true, true, true, true, true });

            // tags
            int i = 0;

            foreach (string t in tagList)
            {
                MultiSetterTag mst = new MultiSetterTag(t)
                {
                    Location = new Point(3, 3 + i * 29 - panelTags.VerticalScroll.Value)
                };
                panelTags.Controls.Add(mst);
                tagControls.Add(mst);
                i++;
            }

            foreach (string s in speciesList)
            {
                cbbSpecies.Items.Add(s);
            }

            tt.SetToolTip(lbTagSettingInfo, "The left checkbox indicates if the setting of that tag is applied, " +
                          "the right checkbox indicates if the tag is added or removed from the selected creatures.");
        }
Ejemplo n.º 2
0
 private void chooseColor(int region, Button sender)
 {
     if (creatureList[0] != null && !cp.isShown)
     {
         cp.SetColors(colors, region, "Region " + region);
         if (cp.ShowDialog() == DialogResult.OK)
         {
             // color was chosen
             setColorButton(sender, species.CreatureColors.creatureColor(colors[region]));
             pictureBox1.Image = CreatureColored.getColoredCreature(colors, uniqueSpecies ? creatureList[0].species : "",
                                                                    new[] { true, true, true, true, true, true });
         }
     }
 }
Ejemplo n.º 3
0
        public MultiSetter(List <Creature> creatureList, List <bool> appliedSettings, List <Creature>[] parents, List <string> tagList, List <string> speciesList, string[] ownerList, string[] serverList)
        {
            InitializeComponent();
            Disposed += MultiSetter_Disposed;

            SuspendLayout();
            colors      = new int[6];
            tagControls = new List <MultiSetterTag>();

            this.creatureList            = creatureList;
            parentComboBoxMother.naLabel = " - Mother n/a";
            parentComboBoxFather.naLabel = " - Father n/a";
            if (parents == null)
            {
                // disable parents, probably multiple species selected
                checkBoxMother.Enabled       = false;
                checkBoxFather.Enabled       = false;
                parentComboBoxMother.Enabled = false;
                parentComboBoxFather.Enabled = false;
                uniqueSpecies = false;
            }
            else
            {
                parentComboBoxMother.ParentList = parents[0];
                parentComboBoxFather.ParentList = parents[1];
                uniqueSpecies = true;
            }
            checkBoxMother.Checked = false;
            checkBoxFather.Checked = false;
            creatureStatus         = CreatureStatus.Available;
            creatureSex            = Sex.Unknown;

            ParentsChanged = false;
            TagsChanged    = false;
            SpeciesChanged = false;

            pictureBox1.Image = CreatureColored.getColoredCreature(colors, uniqueSpecies ? creatureList[0].species : "",
                                                                   new[] { true, true, true, true, true, true });

            // tags
            foreach (string t in tagList)
            {
                MultiSetterTag mst = new MultiSetterTag(t);
                flowLayoutPanelTags.SetFlowBreak(mst, true);
                flowLayoutPanelTags.Controls.Add(mst);
                tagControls.Add(mst);
                mst.TagCheckState = CheckState.Indeterminate;
                foreach (var c in creatureList)
                {
                    if (c.tags.Contains(t))
                    {
                        if (mst.TagCheckState == CheckState.Indeterminate)
                        {
                            mst.TagCheckState = CheckState.Checked;
                        }
                        else if (mst.TagCheckState == CheckState.Unchecked)
                        {
                            mst.TagCheckState = CheckState.Indeterminate;
                            break;
                        }
                    }
                    else
                    {
                        if (mst.TagCheckState == CheckState.Indeterminate)
                        {
                            mst.TagCheckState = CheckState.Unchecked;
                        }
                        else if (mst.TagCheckState == CheckState.Checked)
                        {
                            mst.TagCheckState = CheckState.Indeterminate;
                            break;
                        }
                    }
                }
                mst.Considered = false;
            }

            foreach (string s in speciesList)
            {
                cbbSpecies.Items.Add(s);
            }

            // owner combobox
            var l = new AutoCompleteStringCollection();

            l.AddRange(ownerList);
            cbbOwner.AutoCompleteCustomSource = l;
            foreach (string s in ownerList)
            {
                cbbOwner.Items.Add(s);
            }

            // server combobox
            l = new AutoCompleteStringCollection();
            l.AddRange(serverList);
            cbbServer.AutoCompleteCustomSource = l;
            foreach (string s in serverList)
            {
                cbbServer.Items.Add(s);
            }

            tt.SetToolTip(lbTagSettingInfo, "The left checkbox indicates if the setting of that tag is applied, " +
                          "the right checkbox indicates if the tag is added or removed from the selected creatures.");

            ResumeLayout();
        }