|
| 1 | +using SkiaSharp; |
| 2 | + |
| 3 | +using ExtensionSkillElements = HoyolabHttpClient.Extensions.SkillElements; |
| 4 | + |
| 5 | +namespace GitcgSkia.Extensions; |
| 6 | + |
| 7 | +public static class SkillElements |
| 8 | +{ |
| 9 | + public static IDictionary<string, SKColor> Colors { get; } |
| 10 | + |
| 11 | + static SkillElements() |
| 12 | + { |
| 13 | + Colors = new Dictionary<string, SKColor> |
| 14 | + { |
| 15 | + [ExtensionSkillElements.Cyro.Value] = ElementColors.Cyro, |
| 16 | + [ExtensionSkillElements.Hydro.Value] = ElementColors.Hydro, |
| 17 | + [ExtensionSkillElements.Pyro.Value] = ElementColors.Pyro, |
| 18 | + [ExtensionSkillElements.Electro.Value] = ElementColors.Electro, |
| 19 | + [ExtensionSkillElements.Anemo.Value] = ElementColors.Anemo, |
| 20 | + [ExtensionSkillElements.Geo.Value] = ElementColors.Geo, |
| 21 | + [ExtensionSkillElements.Dendro.Value] = ElementColors.Dendro, |
| 22 | + [ExtensionSkillElements.Unaligned.Value] = ElementColors.Unaligned, |
| 23 | + [ExtensionSkillElements.Aligned.Value] = ElementColors.Aligned, |
| 24 | + [ExtensionSkillElements.Energy.Value] = ElementColors.Energy, |
| 25 | + [ExtensionSkillElements.ArcaneLegend.Value] = ElementColors.ArcaneLegend |
| 26 | + }; |
| 27 | + } |
| 28 | + |
| 29 | + public static ValueTask<SKBitmap> LoadElementIconAsync(this string value) |
| 30 | + { |
| 31 | + if (value == ExtensionSkillElements.Cyro.Value) |
| 32 | + return SkAssetsUtils.LoadImageFromManifestResourceAsync(SkAssetsUtils.CryoPath); |
| 33 | + if (value == ExtensionSkillElements.Hydro.Value) |
| 34 | + return SkAssetsUtils.LoadImageFromManifestResourceAsync(SkAssetsUtils.HydroPath); |
| 35 | + if (value == ExtensionSkillElements.Pyro.Value) |
| 36 | + return SkAssetsUtils.LoadImageFromManifestResourceAsync(SkAssetsUtils.PyroPath); |
| 37 | + if (value == ExtensionSkillElements.Electro.Value) |
| 38 | + return SkAssetsUtils.LoadImageFromManifestResourceAsync(SkAssetsUtils.ElectroPath); |
| 39 | + if (value == ExtensionSkillElements.Anemo.Value) |
| 40 | + return SkAssetsUtils.LoadImageFromManifestResourceAsync(SkAssetsUtils.AnemoPath); |
| 41 | + if (value == ExtensionSkillElements.Geo.Value) |
| 42 | + return SkAssetsUtils.LoadImageFromManifestResourceAsync(SkAssetsUtils.GeoPath); |
| 43 | + if (value == ExtensionSkillElements.Dendro.Value) |
| 44 | + return SkAssetsUtils.LoadImageFromManifestResourceAsync(SkAssetsUtils.DendroPath); |
| 45 | + |
| 46 | + if (value == ExtensionSkillElements.Unaligned.Value) |
| 47 | + return SkAssetsUtils.LoadImageFromManifestResourceAsync(SkAssetsUtils.TcgActionPointCommonBlackPath); |
| 48 | + if (value == ExtensionSkillElements.Aligned.Value) |
| 49 | + return SkAssetsUtils.LoadImageFromManifestResourceAsync(SkAssetsUtils.TcgActionPointCommonWhitePath); |
| 50 | + |
| 51 | + if (value == ExtensionSkillElements.Energy.Value) |
| 52 | + return SkAssetsUtils.LoadImageFromManifestResourceAsync(SkAssetsUtils.TcgCharacterRechargePointPath); |
| 53 | + |
| 54 | + if (value == ExtensionSkillElements.ArcaneLegend.Value) |
| 55 | + return SkAssetsUtils.LoadImageFromManifestResourceAsync(SkAssetsUtils.CostSecretPath); |
| 56 | + |
| 57 | + throw new ArgumentException("Invalid value", nameof(value)); |
| 58 | + } |
| 59 | +} |
0 commit comments