64 lines
2.0 KiB
C#
64 lines
2.0 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Portfolio.Domain.Features.Pokemon;
|
|
|
|
namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components
|
|
{
|
|
public partial class PokemonBackground
|
|
{
|
|
|
|
private class PokemonImage
|
|
{
|
|
public string Url { get; set; } = "";
|
|
public int Left { get; set; }
|
|
public int Top { get; set; }
|
|
public int Size { get; set; }
|
|
public int Rotation { get; set; }
|
|
}
|
|
|
|
|
|
[Parameter]
|
|
public List<string> PokemonImages { get; set; }
|
|
[Parameter]
|
|
public List<string> ShinyPokemonImages { get; set; }
|
|
|
|
private List<PokemonImage> _pokemonImages = new List<PokemonImage>();
|
|
private List<PokemonImage> _shinyPokemonImages = new List<PokemonImage>();
|
|
private Random random = new Random();
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await LoadPokemonBackgrounds();
|
|
}
|
|
|
|
private async Task LoadPokemonBackgrounds()
|
|
{
|
|
|
|
foreach (var pokemonimgurl in PokemonImages)
|
|
{
|
|
Console.WriteLine(pokemonimgurl);
|
|
_pokemonImages.Add(new PokemonImage
|
|
{
|
|
Url = pokemonimgurl, // URL retrieved from the database
|
|
Left = random.Next(0, 100),
|
|
Top = random.Next(0, 100),
|
|
Size = random.Next(50, 130),
|
|
Rotation = random.Next(0, 360)
|
|
});
|
|
}
|
|
foreach (var pokemonimgurl in ShinyPokemonImages)
|
|
{
|
|
_shinyPokemonImages.Add(new PokemonImage
|
|
{
|
|
Url = pokemonimgurl, // URL retrieved from the database
|
|
Left = random.Next(0, 100),
|
|
Top = random.Next(0, 100),
|
|
Size = random.Next(50, 130),
|
|
Rotation = random.Next(0, 360)
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|