private void OnSetCustomClicked(object sender, RoutedEventArgs e) { for (int i = 0; i < 387; i++) { if (i + 1 == 327) { continue; } if (!shinyMode && PokemonDatabase.HasPokemonImageType((ushort)(i + 1), FrontSpriteSelectionTypes.Custom, false)) { PokeManager.Settings.FrontSpriteSelections[0, i] = FrontSpriteSelectionTypes.Custom; } if (shinyMode && PokemonDatabase.HasPokemonImageType((ushort)(i + 1), FrontSpriteSelectionTypes.Custom, true)) { PokeManager.Settings.FrontSpriteSelections[1, i] = FrontSpriteSelectionTypes.Custom; } UpdateGridItem((ushort)(i + 1)); } }
private void UpdateGridItem(ushort dexID) { Grid grid = stackPanelList.Children[dexID - 1] as Grid; StackPanel stackPanel = grid.Children[0] as StackPanel; int shinyID = shinyMode ? 1 : 0; (stackPanel.Children[0] as Grid).Background = ( PokeManager.Settings.FrontSpriteSelections[shinyID, dexID - 1] == FrontSpriteSelectionTypes.RSE ? spriteUnhighlightChecked : spriteUnhighlight ); (stackPanel.Children[1] as Grid).Background = ( PokeManager.Settings.FrontSpriteSelections[shinyID, dexID - 1] == FrontSpriteSelectionTypes.FRLG ? spriteUnhighlightChecked : spriteUnhighlight ); (stackPanel.Children[2] as Grid).Background = ( PokeManager.Settings.FrontSpriteSelections[shinyID, dexID - 1] == FrontSpriteSelectionTypes.Custom ? spriteUnhighlightChecked : spriteUnhighlight ); bool hasFRLG = PokemonDatabase.HasPokemonImageType(dexID, FrontSpriteSelectionTypes.FRLG, shinyMode); bool hasCustom = PokemonDatabase.HasPokemonImageType(dexID, FrontSpriteSelectionTypes.Custom, shinyMode); grid.Visibility = ((!hasFRLG && !hasCustom) ? Visibility.Collapsed : Visibility.Visible); }
private void FillGridItem(ushort dexID) { Grid grid = stackPanelList.Children[dexID - 1] as Grid; grid.Width = double.NaN; grid.HorizontalAlignment = HorizontalAlignment.Stretch; grid.Height = 64 + 18; grid.IsHitTestVisible = true; grid.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255)); grid.Children.Clear(); Label labelName = new Label(); if (dexID == 387) { labelName.Content = "Egg - Pokémon Egg"; } else { labelName.Content = "No" + dexID.ToString("000") + " - " + PokemonDatabase.GetPokemonFromDexID(dexID).Name; } labelName.Padding = new Thickness(5, 1, 5, 1); labelName.FontWeight = FontWeights.Bold; labelName.VerticalAlignment = VerticalAlignment.Top; labelName.IsHitTestVisible = false; StackPanel stackPanel = new StackPanel(); stackPanel.Margin = new Thickness(0, 18, 0, 0); stackPanel.HorizontalAlignment = HorizontalAlignment.Stretch; stackPanel.VerticalAlignment = VerticalAlignment.Stretch; stackPanel.Orientation = Orientation.Horizontal; stackPanel.Height = 64; stackPanel.Width = double.NaN; bool hasFRLG = PokemonDatabase.HasPokemonImageType(dexID, FrontSpriteSelectionTypes.FRLG, shinyMode); bool hasCustom = PokemonDatabase.HasPokemonImageType(dexID, FrontSpriteSelectionTypes.Custom, shinyMode); stackPanel.Children.Add(CreateSpriteSelection(dexID, FrontSpriteSelectionTypes.RSE)); if (hasFRLG) { stackPanel.Children.Add(CreateSpriteSelection(dexID, FrontSpriteSelectionTypes.FRLG)); } else { stackPanel.Children.Add(CreateBlankSpriteSelection(dexID, FrontSpriteSelectionTypes.FRLG)); } if (hasCustom) { stackPanel.Children.Add(CreateSpriteSelection(dexID, FrontSpriteSelectionTypes.Custom)); } else { stackPanel.Children.Add(CreateBlankSpriteSelection(dexID, FrontSpriteSelectionTypes.Custom)); } grid.Children.Add(stackPanel); grid.Children.Add(labelName); grid.Visibility = ((!hasFRLG && !hasCustom) ? Visibility.Collapsed : Visibility.Visible); grid.Tag = dexID; }