private void StoreEventResults(ref StructCollection.Rule rule) { foreach (EventResultControl result in ResultsLayout.Controls) { ((StructCollection.Events)rule.results).StoreResult(result.GetData()); } }
public void DisplayRuleRoll(string rule_name) { StructCollection.Rule rule = Secretary.GetRule(rule_name); OpenDisplay(); results_display.AddRollDisplay(new RollDisplay(DiceTower.RollDice(rule.dice), DiceTower.SumModifiers(rule.modifiers), rule)); this.Focus(); }
private void LoadFunctionalities(StructCollection.Rule rule) { StructCollection.Damage result = (StructCollection.Damage)rule.results; criticalSuccessToolStripMenuItem.Checked = result.crit_success; CriticalSuccessThresholdTextbox.Text = result.crit_success_threshold.ToString(); criticalFailureToolStripMenuItem.Checked = result.crit_fail; CriticalFailThresholdTextbox.Text = result.crit_fail_threshold.ToString(); }
private void StoreModifiers(ref StructCollection.Rule rule) { rule.modifiers.Clear(); foreach (Modifier modifier in ModifierLayout.Controls) { rule.modifiers.Add(modifier.GetMod()); } }
protected virtual void LoadModifiers(StructCollection.Rule rule) { ModifierLayout.Controls.Clear(); foreach (StructCollection.Mod mod in rule.modifiers) { ModifierLayout.Controls.Add(new Modifier(this, mod.magnitude, mod.reason)); } }
private void StoreDice(ref StructCollection.Rule rule) { rule.dice = new List <StructCollection.Die>(); foreach (DieControl die in DiceLayout.Controls) { rule.dice.Add(die.GetDie()); } }
public static void DeleteRule(StructCollection.Rule rule) { foreach (StructCollection.Profile profile in profiles) { profile.rule_names.Remove(rule.rule_name); } rules.Remove(rule); }
private void LoadDice(StructCollection.Rule rule) { DiceLayout.Controls.Clear(); foreach (StructCollection.Die die in rule.dice) { DiceLayout.Controls.Add(new DieControl(this, die.count, die.faces)); } }
private void StoreFunctionalities(ref StructCollection.Rule rule) { StructCollection.Damage result = (StructCollection.Damage)rule.results; result.crit_success = criticalSuccessToolStripMenuItem.Checked; result.crit_success_threshold = Convert.ToInt16(CriticalSuccessThresholdTextbox.Text); result.crit_fail = criticalFailureToolStripMenuItem.Checked; result.crit_fail_threshold = Convert.ToInt16(CriticalFailThresholdTextbox.Text); }
private void ShowEditAttackRule(StructCollection.Rule rule) { RuleEditor new_rule_editor = new EditAttackRule(rule); this.Enabled = false; new_rule_editor.ShowDialog(); this.Enabled = true; RefreshRuleButtons(); }
private void LoadRule(StructCollection.Rule rule) { loading = true; current_rule = rule; colourbtn.BackColor = current_rule.colour; LoadTextboxes(rule); LoadDice(rule); LoadModifiers(rule); RefreshResults(); }
private void LoadTextboxes(StructCollection.Rule rule) { SetTextboxPrompts(); starting_rule_name = rule.rule_name; if (starting_rule_name != "") { NameTextbox.Text = rule.rule_name; NameTextbox.ForeColor = Color.Black; } }
public void EditRule(string rule_name) { StructCollection.Rule rule = Secretary.GetRule(rule_name); if (rule.results.type == StructCollection.ResultCollection.Type.Event) { ShowEditEventRule(rule); } else if (rule.results.type == StructCollection.ResultCollection.Type.Damage) { ShowEditAttackRule(rule); } }
private void LoadModifiers(StructCollection.Rule rule) { ModifierLayout.Controls.Clear(); foreach (StructCollection.Mod mod in rule.modifiers) { ModifierLayout.Controls.Add(new Modifier(this, mod.magnitude, mod.reason)); } DamageModifiersLayout.Controls.Clear(); foreach (StructCollection.Mod mod in ((StructCollection.Damage)rule.results).modifiers) { DamageModifiersLayout.Controls.Add(new Modifier(this, mod.magnitude, mod.reason)); } }
private void StoreModifiers(ref StructCollection.Rule rule) { rule.modifiers.Clear(); foreach (Modifier modifier in ModifierLayout.Controls) { rule.modifiers.Add(modifier.GetMod()); } // Store damage modifiers ((StructCollection.Damage)current_rule.results).modifiers = new List <StructCollection.Mod>(); foreach (Modifier modifier in DamageModifiersLayout.Controls) { ((StructCollection.Damage)current_rule.results).modifiers.Add(modifier.GetMod()); } }
private void StoreDice(ref StructCollection.Rule rule) { rule.dice = new List <StructCollection.Die>(); foreach (DieControl die in DiceLayout.Controls) { rule.dice.Add(die.GetDie()); } // Store damage dice ((StructCollection.Damage)current_rule.results).dice = new List <StructCollection.Die>(); foreach (DieControl die in DamageDiceLayout.Controls) { ((StructCollection.Damage)current_rule.results).dice.Add(die.GetDie()); } }
private void LoadTextboxes(StructCollection.Rule rule) { SetTextboxPrompts(); starting_rule_name = rule.rule_name; if (starting_rule_name != "") { NameTextbox.Text = rule.rule_name; NameTextbox.ForeColor = Color.Black; } if (((StructCollection.Damage)rule.results).damage_type != "") { DamageTypeTextbox.Text = ((StructCollection.Damage)rule.results).damage_type; DamageTypeTextbox.ForeColor = Color.Black; } }
public static void AddRuleToProfile(StructCollection.Rule rule, string profile_name) { EnsureFileLoaded(); int profile_index = profiles.FindIndex(x => x.profile_name == profile_name); if (profile_index < 0) { return; } StructCollection.Profile updated_profile = profiles[profile_index]; updated_profile.rule_names.Insert(0, rule.rule_name); profiles[profile_index] = updated_profile; if (profile_name != "Default") { AddRuleToProfile(rule, "Default"); } }
private void LoadDice(StructCollection.Rule rule) { DiceLayout.Controls.Clear(); if (IsNewRule()) { DiceLayout.Controls.Add(new DieControl(this, 1, 20)); DamageDiceLayout.Controls.Add(new DieControl(this, 1, 6)); return; } foreach (StructCollection.Die die in rule.dice) { DiceLayout.Controls.Add(new DieControl(this, die.count, die.faces)); } DamageDiceLayout.Controls.Clear(); foreach (StructCollection.Die die in ((StructCollection.Damage)rule.results).dice) { DamageDiceLayout.Controls.Add(new DieControl(this, die.count, die.faces)); } }
public RollDisplay(int roll_number = 0, int roll_modifier = 0, StructCollection.Rule rule = new StructCollection.Rule()) { InitializeComponent(); RuleNameLabel.Text = rule.rule_name; if (rule.results != null) { (string roll, string result, Color colour)display = rule.results.Display(roll_number, roll_modifier, rule.colour); RollNumberLabel.Text = display.roll; ResultTextLabel.Text = display.result; flash_colour = display.colour; } else { RollNumberLabel.Text = ""; ResultTextLabel.Text = ""; } }
public static void SaveRule(string previous_name, StructCollection.Rule rule) { EnsureFileLoaded(); int outdated_rule_index = rules.FindIndex(x => x.rule_name == previous_name); if (outdated_rule_index < 0) { rules.Insert(0, rule); } else { rules[outdated_rule_index] = rule; if (active_profile != "Default") { RemoveRuleFromProfile(active_profile, previous_name); } RemoveRuleFromProfile("Default", previous_name); } AddRuleToProfile(rule, active_profile); }
public static void SaveRule(StructCollection.Rule rule) { SaveRule(rule.rule_name, rule); }
private static void LoadXMLFile(string file) { rules = new List <StructCollection.Rule>(); profiles = new List <StructCollection.Profile>(); active_profile = "Default"; if (!File.Exists(file)) { return; } XmlReader xml = XmlReader.Create(new FileStream(file, FileMode.Open), new XmlReaderSettings() { CloseInput = true }); try { while (xml != null) { if (xml.IsStartElement()) { if (xml.Name == "rules") { xml.Read(); while (true) { if (xml.IsStartElement()) { if (xml.Name == "rule") { StructCollection.Rule rule = new StructCollection.Rule("", new StructCollection.ResultCollection(), -1, -1, new List <StructCollection.Mod>(), new List <StructCollection.Die>(), Color.LightGray); rule.LoadXML(ref xml); rules.Add(rule); continue; } else { break; } } if (!xml.Read()) { break; } } continue; } else if (xml.Name == "profiles") { active_profile = xml["active_profile"]; xml.Read(); while (true) { if (xml.IsStartElement()) { if (xml.Name == "profile") { StructCollection.Profile new_profile = new StructCollection.Profile(); new_profile.LoadXML(ref xml); profiles.Add(new_profile); continue; } else { break; } } if (!xml.Read()) { break; } } continue; } } if (!xml.Read()) { break; } } } catch { xml.Close(); return; } xml.Close(); }
public EditEventRule(StructCollection.Rule rule) { InitializeComponent(); LoadRule(rule); }