public BossLootPatternWindow(Boss boss, BossLootPattern pattern) { InitializeComponent(); _boss = boss; _pattern = pattern; RefreshWindowControls(); }
private void CreateDynamicValueButton_Click(object sender, RoutedEventArgs e) { var newBossLootPattern = new BossLootPattern { Frequencies = new List <double> { 0, 0, 0, 0, 0, 0 } }; _bossLootPatterns.Add(newBossLootPattern); var tempButton = new Button { Tag = newBossLootPattern }; EditDynamicValue_Click(tempButton, null); }
private Grid CreateDynamicValueGrid(BossLootPattern pattern) { var grid = new Grid(); var idBlock = new TextBlock { FontSize = 18, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(10, 0, 0, 0), FontStyle = FontStyles.Italic, Text = $"[{pattern.BossLootId}]" }; var itemTypeBlock = new TextBlock { FontSize = 18, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(80, 0, 0, 0), Text = pattern.BossLootType.ToString() }; var nameBlock = new TextBlock { FontSize = 18, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(180, 0, 0, 0) }; switch (pattern.BossLootType) { case RewardType.Material: nameBlock.Text = GameAssets.Materials.FirstOrDefault(x => x.Id == pattern.BossLootId).Name; break; case RewardType.Recipe: nameBlock.Text = GameAssets.Recipes.FirstOrDefault(x => x.Id == pattern.BossLootId).Name; break; case RewardType.Artifact: nameBlock.Text = GameAssets.Artifacts.FirstOrDefault(x => x.Id == pattern.BossLootId).Name; break; case RewardType.Blessing: nameBlock.Text = GameAssets.Blessings.FirstOrDefault(x => x.Id == pattern.BossLootId).Name; break; case RewardType.Ingot: nameBlock.Text = GameAssets.Ingots.FirstOrDefault(x => x.Id == pattern.BossLootId).Name; break; } var frequenciesBlock = new TextBlock { FontSize = 18, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(460, 0, 0, 0), Text = string.Join(' ', pattern.Frequencies.Select(x => x.ToString())) }; var editButton = new Button { Width = 30, Height = 30, Margin = new Thickness(5, 0, 60, 0), Padding = new Thickness(0), HorizontalAlignment = HorizontalAlignment.Right, Tag = pattern }; var editIcon = new PackIcon { Width = 20, Height = 20, Kind = PackIconKind.Edit, Foreground = (SolidColorBrush)FindResource("BrushGray2") }; editButton.Content = editIcon; editButton.Click += EditDynamicValue_Click; var deleteButton = new Button { Width = 30, Height = 30, Margin = new Thickness(5, 0, 20, 0), Tag = pattern, Padding = new Thickness(0), HorizontalAlignment = HorizontalAlignment.Right }; var deleteIcon = new PackIcon { Width = 20, Height = 20, Kind = PackIconKind.DeleteForever, Foreground = (SolidColorBrush)FindResource("BrushGray2") }; deleteButton.Content = deleteIcon; deleteButton.Click += DeleteDynamicValue_Click; grid.Children.Add(idBlock); grid.Children.Add(itemTypeBlock); grid.Children.Add(nameBlock); grid.Children.Add(frequenciesBlock); grid.Children.Add(editButton); grid.Children.Add(deleteButton); return(grid); }