public MonsterLootPatternWindow(Monster monster, MonsterLootPattern pattern)
    {
        InitializeComponent();

        _monster = monster;
        _pattern = pattern;

        RefreshWindowControls();
    }
Exemplo n.º 2
0
    private void CreateDynamicValueButton_Click(object sender, RoutedEventArgs e)
    {
        var newMonsterLootPattern = new MonsterLootPattern();

        _monsterLootPatterns.Add(newMonsterLootPattern);

        var tempButton = new Button
        {
            Tag = newMonsterLootPattern
        };

        EditDynamicValue_Click(tempButton, null);
    }
Exemplo n.º 3
0
    private Grid CreateDynamicValueGrid(MonsterLootPattern 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.MonsterLootId}]"
        };

        var itemTypeBlock = new TextBlock
        {
            FontSize            = 18,
            VerticalAlignment   = VerticalAlignment.Center,
            HorizontalAlignment = HorizontalAlignment.Left,
            Margin = new Thickness(80, 0, 0, 0),
            Text   = pattern.MonsterLootType.ToString()
        };

        var nameBlock = new TextBlock
        {
            FontSize            = 18,
            VerticalAlignment   = VerticalAlignment.Center,
            HorizontalAlignment = HorizontalAlignment.Left,
            Margin = new Thickness(180, 0, 0, 0)
        };

        switch (pattern.MonsterLootType)
        {
        case RewardType.Material:
            nameBlock.Text = GameAssets.Materials.FirstOrDefault(x => x.Id == pattern.MonsterLootId).Name;
            break;

        case RewardType.Recipe:
            nameBlock.Text = GameAssets.Recipes.FirstOrDefault(x => x.Id == pattern.MonsterLootId).Name;
            break;

        case RewardType.Artifact:
            nameBlock.Text = GameAssets.Artifacts.FirstOrDefault(x => x.Id == pattern.MonsterLootId).Name;
            break;

        case RewardType.Blessing:
            nameBlock.Text = GameAssets.Blessings.FirstOrDefault(x => x.Id == pattern.MonsterLootId).Name;
            break;

        case RewardType.Ingot:
            nameBlock.Text = GameAssets.Ingots.FirstOrDefault(x => x.Id == pattern.MonsterLootId).Name;
            break;
        }

        var frequencyBlock = new TextBlock
        {
            FontSize            = 18,
            VerticalAlignment   = VerticalAlignment.Center,
            HorizontalAlignment = HorizontalAlignment.Left,
            Margin = new Thickness(460, 0, 0, 0),
            Text   = pattern.Frequency.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(frequencyBlock);
        grid.Children.Add(editButton);
        grid.Children.Add(deleteButton);

        return(grid);
    }