public static MonsterTheme FindTheme(Guid theme_id, SearchType search_type) { if ((search_type == SearchType.External) || (search_type == SearchType.Global)) { foreach (Library lib in Libraries) { MonsterTheme theme = lib.FindTheme(theme_id); if (theme != null) { return(theme); } } } if ((search_type == SearchType.Project) || (search_type == SearchType.Global)) { if (Project != null) { MonsterTheme theme = Project.Library.FindTheme(theme_id); if (theme != null) { return(theme); } } } return(null); }
public static Library FindLibrary(MonsterTheme mt) { Library library; if (mt == null) { return(null); } foreach (Library library1 in Session.Libraries) { foreach (MonsterTheme theme in library1.Themes) { if (theme == null || !(theme.ID == mt.ID)) { continue; } library = library1; return(library); } } if (Session.fProject != null) { foreach (MonsterTheme monsterTheme in Session.fProject.Library.Themes) { if (monsterTheme == null || !(monsterTheme.ID == mt.ID)) { continue; } library = Session.fProject.Library; return(library); } } return(null); }
public ThemeForm(EncounterCard card) { InitializeComponent(); Application.Idle += new EventHandler(Application_Idle); Browser.DocumentText = ""; fCard = card.Copy(); if (fCard.ThemeID != Guid.Empty) { MonsterTheme mt = Session.FindTheme(fCard.ThemeID, SearchType.Global); update_selected_theme(mt, false); ThemePowerData attack = mt.FindPower(fCard.ThemeAttackPowerID); AttackBox.SelectedItem = attack; ThemePowerData utility = mt.FindPower(fCard.ThemeUtilityPowerID); UtilityBox.SelectedItem = utility; } else { update_selected_theme(null, true); } }
public MonsterThemeForm(MonsterTheme theme) { InitializeComponent(); Application.Idle += new EventHandler(Application_Idle); fTheme = theme.Copy(); foreach (string skill_name in Skills.GetSkillNames()) { ListViewItem lvi = SkillList.Items.Add(skill_name); bool present = false; foreach (Pair <string, int> pair in fTheme.SkillBonuses) { if (pair.First == skill_name) { present = true; } } lvi.Checked = present; } NameBox.Text = fTheme.Name; update_powers(); }
private void CreateThemeBtn_Click(object sender, EventArgs e) { MonsterTheme mt = new MonsterTheme(); mt.Name = "New Theme"; MonsterThemeForm dlg = new MonsterThemeForm(mt); if (dlg.ShowDialog() == DialogResult.OK) { Session.Project.Library.Themes.Add(dlg.Theme); Session.Modified = true; update_selected_theme(dlg.Theme, true); } }
public static MonsterTheme FindTheme(Guid theme_id, SearchType search_type) { MonsterTheme monsterTheme; MonsterTheme monsterTheme1; if (search_type == SearchType.External || search_type == SearchType.Global) { List <Library> .Enumerator enumerator = Session.Libraries.GetEnumerator(); try { while (enumerator.MoveNext()) { MonsterTheme monsterTheme2 = enumerator.Current.FindTheme(theme_id); if (monsterTheme2 == null) { continue; } monsterTheme1 = monsterTheme2; return(monsterTheme1); } if ((search_type == SearchType.Project || search_type == SearchType.Global) && Session.Project != null) { monsterTheme = Session.Project.Library.FindTheme(theme_id); if (monsterTheme != null) { return(monsterTheme); } } return(null); } finally { ((IDisposable)enumerator).Dispose(); } } if ((search_type == SearchType.Project || search_type == SearchType.Global) && Session.Project != null) { monsterTheme = Session.Project.Library.FindTheme(theme_id); if (monsterTheme != null) { return(monsterTheme); } } return(null); }
void update_selected_theme(MonsterTheme theme, bool reset_powers) { if (theme != null) { ThemeNameLbl.Text = theme.Name; fCard.ThemeID = theme.ID; } else { ThemeNameLbl.Text = "None"; fCard.ThemeID = Guid.Empty; } AttackBox.Items.Clear(); AttackBox.Items.Add("(no attack power)"); UtilityBox.Items.Clear(); UtilityBox.Items.Add("(no utility power)"); if (theme != null) { List <ThemePowerData> attacks = theme.ListPowers(fCard.Roles, PowerType.Attack); foreach (ThemePowerData tpd in attacks) { AttackBox.Items.Add(tpd); } List <ThemePowerData> utilities = theme.ListPowers(fCard.Roles, PowerType.Utility); foreach (ThemePowerData tpd in utilities) { UtilityBox.Items.Add(tpd); } } if (reset_powers) { AttackBox.SelectedIndex = 0; UtilityBox.SelectedIndex = 0; } AttackBox.Enabled = (AttackBox.Items.Count > 1); UtilityBox.Enabled = (UtilityBox.Items.Count > 1); update_browser(); }
public static Library FindLibrary(MonsterTheme mt) { if (mt == null) { return(null); } foreach (Library lib in Libraries) { foreach (MonsterTheme item in lib.Themes) { if (item == null) { continue; } if (item.ID == mt.ID) { return(lib); } } } if (fProject != null) { foreach (MonsterTheme item in fProject.Library.Themes) { if (item == null) { continue; } if (item.ID == mt.ID) { return(fProject.Library); } } } return(null); }
public ThemeForm(EncounterCard card) { this.InitializeComponent(); Application.Idle += new EventHandler(this.Application_Idle); this.Browser.DocumentText = ""; this.fCard = card.Copy(); if (this.fCard.ThemeID == Guid.Empty) { this.update_selected_theme(null, true); return; } MonsterTheme monsterTheme = Session.FindTheme(this.fCard.ThemeID, SearchType.Global); this.update_selected_theme(monsterTheme, false); ThemePowerData themePowerDatum = monsterTheme.FindPower(this.fCard.ThemeAttackPowerID); this.AttackBox.SelectedItem = themePowerDatum; ThemePowerData themePowerDatum1 = monsterTheme.FindPower(this.fCard.ThemeUtilityPowerID); this.UtilityBox.SelectedItem = themePowerDatum1; }
public MonsterThemeForm(MonsterTheme theme) { this.InitializeComponent(); Application.Idle += new EventHandler(this.Application_Idle); this.fTheme = theme.Copy(); foreach (string skillName in Skills.GetSkillNames()) { ListViewItem listViewItem = this.SkillList.Items.Add(skillName); bool flag = false; foreach (Pair <string, int> skillBonuse in this.fTheme.SkillBonuses) { if (skillBonuse.First != skillName) { continue; } flag = true; } listViewItem.Checked = flag; } this.NameBox.Text = this.fTheme.Name; this.update_powers(); }
private void update_selected_theme(MonsterTheme theme, bool reset_powers) { if (theme == null) { this.ThemeNameLbl.Text = "None"; this.fCard.ThemeID = Guid.Empty; } else { this.ThemeNameLbl.Text = theme.Name; this.fCard.ThemeID = theme.ID; } this.AttackBox.Items.Clear(); this.AttackBox.Items.Add("(no attack power)"); this.UtilityBox.Items.Clear(); this.UtilityBox.Items.Add("(no utility power)"); if (theme != null) { foreach (ThemePowerData themePowerDatum in theme.ListPowers(this.fCard.Roles, PowerType.Attack)) { this.AttackBox.Items.Add(themePowerDatum); } foreach (ThemePowerData themePowerDatum1 in theme.ListPowers(this.fCard.Roles, PowerType.Utility)) { this.UtilityBox.Items.Add(themePowerDatum1); } } if (reset_powers) { this.AttackBox.SelectedIndex = 0; this.UtilityBox.SelectedIndex = 0; } this.AttackBox.Enabled = this.AttackBox.Items.Count > 1; this.UtilityBox.Enabled = this.UtilityBox.Items.Count > 1; this.update_browser(); }