private string GetNextHardpoint() { HardpointType hptype = (HardpointType)lstHps.SelectedItem; if (hptype == null) { return(""); } int mask = GetMaskType(hptype.Name); int num = 1; string name = MakeHardpointName(hptype.Name, num, mask); string staticpattern = hptype.Name.Substring(0, hptype.Name.Length - mask); foreach (TreeNode fr in fixRevs) { foreach (TreeNode h in fr.Nodes) { if (h.Text.Substring(0, h.Text.Length - mask).Equals(staticpattern, StringComparison.InvariantCultureIgnoreCase)) { name = MakeNextHardpointName(hptype.Name, name, h.Text, num, mask); } } } return(name); }
public override bool Equals(object obj) { if (!(obj is HardpointType)) { return(false); } HardpointType t = (HardpointType)obj; return(t.Revolute == Revolute && t.Name == Name); }
private void MoveSelectedItem(int dist) { if (lstHps.SelectedItem == null) { return; } HardpointType t = (HardpointType)lstHps.SelectedItem; int at = mod(lstHps.SelectedIndex + dist, lstHps.Items.Count); lstHps.Items.Remove(t); lstHps.Items.Insert(at, t); if (t.Revolute) { lstHps.SetItemChecked(at, true); } lstHps.SelectedIndex = at; }
private void btnAddHp_Click(object sender, EventArgs e) { if (comboPresets.SelectedItem == null) { return; } string input = txtAddHp.Text; bool rev = chkRevolute.Checked; if (input.Trim() == "" || !System.Text.RegularExpressions.Regex.IsMatch(input, "^[a-zA-Z0-9#_]*$")) { System.Windows.Forms.MessageBox.Show("Given hardpoint name is invalid. Must only contain alphanumeric characters, # and _.", "Bad Hardpoint Name", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } if (!input.StartsWith("Hp")) { input = "Hp" + input; } Preset p = (Preset)comboPresets.SelectedItem; HardpointType t = new HardpointType(input, rev); foreach (HardpointType t2 in p.HardpointTypes) { if (t2.Equals(t)) { return; } } p.HardpointTypes.Add(t); int at = lstHps.Items.Add(t); if (rev) { lstHps.SetItemChecked(at, true); } lstHps.SelectedIndex = at; btnStart.Enabled = true; }
public virtual bool CanMountToHardpoint(HardpointType type) => false;
public Sprite GetIcon(HardpointType type) => ItemIcons[(int)type];