public void SetSelectors(OBJD objd, IffChunk active, OBJDSelector[] selectors) { Active = active; Definition = objd; SelectButton.Dock = DockStyle.Fill; SelectCombo.Dock = DockStyle.Fill; SelectButton.Visible = selectors.Length == 1; SelectCombo.Visible = selectors.Length > 1; Selectors = selectors; if (selectors.Length > 1) { SelectCombo.Items.Clear(); SelectCombo.Items.Add("-- Not Selected --"); int i = 1; OwnChange = true; SelectCombo.SelectedIndex = 0; foreach (var sel in selectors) { SelectCombo.Items.Add(sel); if (sel.FieldName != null && objd.GetPropertyByName<ushort>(sel.FieldName) == active.ChunkID) SelectCombo.SelectedIndex = i; i++; } OwnChange = false; } else if (selectors.Length > 0) { var sel = selectors[0]; if (sel.FieldName != null && objd.GetPropertyByName<ushort>(sel.FieldName) == active.ChunkID) { SelectButton.Text = "Selected as " + sel.Name; SelectButton.Enabled = false; } else { SelectButton.Text = "Select as " + sel.Name; SelectButton.Enabled = true; } } else { Enabled = false; Visible = false; } }
public void Init(Type[] cTypes, string[] cNames, OBJDSelector[][] selectors) { ChunkTypes = cTypes; TypeNames = cNames; OBJDSelectors = selectors; Init(); }