public Image BildHolen(GoodieWirkung welchesGoodie) { this.GoodieVorladen(welchesGoodie); if (this.goodieKatalog.TryGetValue(welchesGoodie, out Image goodieBild)) { return(goodieBild); } return(new Bitmap(24, 24)); }
private static string GetGoodieDateiName(GoodieWirkung welchesGoodie) { switch (welchesGoodie) { case GoodieWirkung.Chrom_Dreifachschuss: return("chel-cr.png"); case GoodieWirkung.Hohlesherz: case GoodieWirkung.HalbesHerz: case GoodieWirkung.RechtsHerz: case GoodieWirkung.GanzesHerz: return($"{ welchesGoodie.ToString().ToLowerInvariant() }.png"); } return(null); }
private void GoodieVorladen(GoodieWirkung welchesGoodie) { if (!this.goodieKatalog.ContainsKey(welchesGoodie)) { var goodieDateiName = Goodies.GetGoodieDateiName(welchesGoodie); if (goodieDateiName != null) { using (var goodieDatei = Assembly.GetExecutingAssembly().GetManifestResourceStream( typeof(RessourcenKlasse), $@"{ nameof(Goodies) }.{ goodieDateiName }" )) { var goodieBild = Image.FromStream(goodieDatei); this.goodieKatalog.TryAdd(welchesGoodie, goodieBild); } } } }
public Goodie(Control woBinIch, Bitmap woSchaueIch, Goodies goodieSpeicher, GoodieWirkung welchesGoodie) : base(woBinIch, woSchaueIch) { this.goodieSpeicher = goodieSpeicher; this.welchesGoodie = welchesGoodie; }