Exemple #1
0
        public Image BildHolen(GoodieWirkung welchesGoodie)
        {
            this.GoodieVorladen(welchesGoodie);
            if (this.goodieKatalog.TryGetValue(welchesGoodie, out Image goodieBild))
            {
                return(goodieBild);
            }

            return(new Bitmap(24, 24));
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 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);
             }
         }
     }
 }
Exemple #4
0
 public Goodie(Control woBinIch, Bitmap woSchaueIch, Goodies goodieSpeicher, GoodieWirkung welchesGoodie) : base(woBinIch, woSchaueIch)
 {
     this.goodieSpeicher = goodieSpeicher;
     this.welchesGoodie  = welchesGoodie;
 }