/// <summary> /// Construct used when editing an object stat /// </summary> /// <param name="Obj"></param> public ObjectStatForm(TreeNode Node) { InitializeComponent(); this.Node = Node; this.Obj = (ObjectStat)Node.Tag; List <String> Params = Obj.GetParams(); int i = 0; int index = 0; switch (Params[1]) { case "kits": ObjectSelect.SelectedIndex = 0; foreach (KeyValuePair <string, string> D in Bf2Constants.KitTypes) { TypeSelect.Items.Add(new KeyValuePair(D.Key, D.Value)); if (D.Key == Params[3]) { index = i; } i++; } break; case "weapons": ObjectSelect.SelectedIndex = 1; foreach (KeyValuePair <string, string> D in Bf2Constants.WeaponTypes) { TypeSelect.Items.Add(new KeyValuePair(D.Key, D.Value)); if (D.Key == Params[3]) { index = i; } i++; } break; case "vehicles": ObjectSelect.SelectedIndex = 2; foreach (KeyValuePair <string, string> D in Bf2Constants.VehicleTypes) { TypeSelect.Items.Add(new KeyValuePair(D.Key, D.Value)); if (D.Key == Params[3]) { index = i; } i++; } break; } TypeSelect.SelectedIndex = index; // Set the Stat value switch (Params[2]) { case "kills": StatSelect.SelectedIndex = 0; break; case "rtime": StatSelect.SelectedIndex = 1; break; case "roadKills": StatSelect.SelectedIndex = 2; break; case "deployed": StatSelect.SelectedIndex = 3; break; } // Set Condition Return Type if (Params.Count == 5) { ConditionSelect.SelectedIndex = 1; ValueBox.Value = Int32.Parse(Params[4]); ValueBox.Visible = true; } else { ConditionSelect.SelectedIndex = 0; } }
/// <summary> /// Construct used when editing an object stat /// </summary> /// <param name="Obj"></param> public ObjectStatForm(TreeNode Node) { InitializeComponent(); this.Node = Node; this.Obj = (ObjectStat) Node.Tag; List<String> Params = Obj.GetParams(); int i = 0; int index = 0; switch (Params[1]) { case "kits": ObjectSelect.SelectedIndex = 0; foreach (KeyValuePair<string, string> D in Data.KitNames) { TypeSelect.Items.Add(new SelectItem(D.Key, D.Value)); if (D.Key == Params[3]) index = i; i++; } break; case "weapons": ObjectSelect.SelectedIndex = 1; foreach (KeyValuePair<string, string> D in Data.WeaponNames) { TypeSelect.Items.Add(new SelectItem(D.Key, D.Value)); if (D.Key == Params[3]) index = i; i++; } break; case "vehicles": ObjectSelect.SelectedIndex = 2; foreach (KeyValuePair<string, string> D in Data.VehicleNames) { TypeSelect.Items.Add(new SelectItem(D.Key, D.Value)); if (D.Key == Params[3]) index = i; i++; } break; } TypeSelect.SelectedIndex = index; // Set the Stat value switch (Params[2]) { case "kills": StatSelect.SelectedIndex = 0; break; case "rtime": StatSelect.SelectedIndex = 1; break; case "roadKills": StatSelect.SelectedIndex = 2; break; case "deployed": StatSelect.SelectedIndex = 3; break; } // Set Condition Return Type if (Params.Count == 5) { ConditionSelect.SelectedIndex = 1; ValueBox.Value = Int32.Parse(Params[4]); ValueBox.Visible = true; } else { ConditionSelect.SelectedIndex = 0; } }