private void OnMonsterSpawnCallback(object source, MonsterSpawnEventArgs args) { // source will always be a Monster type, so we can cast it to Monster to access other information Monster src = (Monster)source; this.Log($"{args.Name} just spawned!"); }
private void OnMonsterSpawn(object source, MonsterSpawnEventArgs args) { this.Dispatch(() => { this.Visibility = Visibility.Visible; this.MonsterName.Text = args.Name; this.MonsterHPBar.Value = args.CurrentHP; this.MonsterHPBar.Maximum = args.TotalHP; // Set monster crown this.MonsterCrown.Source = args.Crown == null ? null : (ImageSource)FindResource(args.Crown); this.MonsterCrown.Visibility = Visibility.Visible; Weaknesses.Children.Clear(); // Removes every weakness icon foreach (string Weakness in args.Weaknesses.Keys) { Image MonsterWeaknessImg = new Image { Source = this.Resources[Weakness] as ImageSource, Height = 15, Width = 15 }; Weaknesses.Children.Add(MonsterWeaknessImg); } }); }
private void OnMonsterSpawn(object source, MonsterSpawnEventArgs args) => Dispatch(() => { UpdateMonsterInfo(Context); });
private void OnMonsterSpawn(object source, MonsterSpawnEventArgs args) { Monster m = (Monster)source; Dispatch(() => { CustomItem parentItem = new CustomItem { Header = $"{m.MonsterNumber} [{m.Name}]", Data = m, FontWeight = FontWeights.SemiBold, Foreground = Brushes.WhiteSmoke }; TreeViewItem partParent = new TreeViewItem { Header = "Parts", FontWeight = FontWeights.SemiBold, Foreground = Brushes.WhiteSmoke }; TreeViewItem ailmParent = new TreeViewItem { Header = "Ailments", FontWeight = FontWeights.SemiBold, Foreground = Brushes.WhiteSmoke }; foreach (Part part in m.Parts) { CustomItem partItem = new CustomItem { Header = part.Name, Data = part.cMonsterPartData, FontWeight = FontWeights.Normal, Foreground = Brushes.WhiteSmoke }; partParent.Items.Add(partItem); } parentItem.Items.Add(partParent); parentItem.Items.Add(ailmParent); if (m.Ailments.Count > 0) { foreach (Ailment ailment in m.Ailments) { CustomItem ailmItem = new CustomItem { Header = ailment.Name, Data = ailment.cMonsterAilment, FontWeight = FontWeights.Normal, Foreground = Brushes.WhiteSmoke }; ailmParent.Items.Add(ailmItem); } } monsterItem.Items.Add(parentItem); }); }