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."); }
private void bAddTag_Click(object sender, EventArgs e) { MultiSetterTag mst = new MultiSetterTag(tbNewTag.Text); flowLayoutPanelTags.SetFlowBreak(mst, true); flowLayoutPanelTags.Controls.Add(mst); tagControls.Add(mst); mst.TagCheckState = CheckState.Checked; }
private void bAddTag_Click(object sender, EventArgs e) { MultiSetterTag mst = new MultiSetterTag(tbNewTag.Text) { Location = new Point(3, 3 + panelTags.Controls.Count * 29 - panelTags.VerticalScroll.Value) }; panelTags.Controls.Add(mst); tagControls.Add(mst); mst.TagChecked = true; }
private void bAddTag_Click(object sender, EventArgs e) { var tagName = tbNewTag.Text.Trim(); if (string.IsNullOrEmpty(tagName)) { return; } if (_tagControls.Any(t => t.TagName == tagName)) { return; } MultiSetterTag mst = new MultiSetterTag(tagName); flowLayoutPanelTags.SetFlowBreak(mst, true); flowLayoutPanelTags.Controls.Add(mst); _tagControls.Add(mst); mst.TagCheckState = CheckState.Checked; }
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(); }
public MultiSetter(List <Creature> creatureList, List <Creature>[] parents, List <string> tagList, List <Species> speciesList, string[] ownerList, string[] tribeList, string[] serverList) { InitializeComponent(); Disposed += MultiSetter_Disposed; SuspendLayout(); _colors = new byte[Species.ColorRegionCount]; _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.SetImageAndDisposeOld(CreatureColored.GetColoredCreature(_colors, _uniqueSpecies ? creatureList[0].Species : null, 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; } } } } cbbSpecies.Items.AddRange(speciesList.ToArray()); // owner combobox var l = new AutoCompleteStringCollection(); l.AddRange(ownerList); cbbOwner.AutoCompleteCustomSource = l; foreach (string s in ownerList) { cbbOwner.Items.Add(s); } // tribe combobox l = new AutoCompleteStringCollection(); l.AddRange(tribeList); cbbTribe.AutoCompleteCustomSource = l; foreach (string s in tribeList) { cbbTribe.Items.Add(s); } // server combobox l = new AutoCompleteStringCollection(); l.AddRange(serverList); cbbServer.AutoCompleteCustomSource = l; foreach (string s in serverList) { cbbServer.Items.Add(s); } SetLocalizations(); ResumeLayout(); }