Ejemplo n.º 1
0
 public void RemoveSprite(string name)
 {
     if (Sprites.ContainsKey(name))
     {
         Sprites.Remove(name);
     }
 }
Ejemplo n.º 2
0
 public void Add(string name, Sprite sprite)
 {
     if (!Sprites.ContainsKey(name))
     {
         Sprites.Add(name, sprite);
     }
 }
Ejemplo n.º 3
0
    public static Sprite Get(string name)
    {
        if (Sprites.ContainsKey(name))
        {
            return(Sprites[name]);
        }

        return(new Sprite());
    }
Ejemplo n.º 4
0
 public static void LoadSprite(string name)
 {
     if (!Sprites.ContainsKey(name))
     {
         Sprite sprite = Sprite.Load(name);
         if (sprite != null)
         {
             Sprites.Add(name, sprite);
         }
     }
 }
Ejemplo n.º 5
0
 public void HandleMana(ManaType t)
 {
     if (Sprites.TryGetValue(t, out var s))
     {
         sr.sprite = s;
     }
     else
     {
         Logger.LogError($"Sprites Contains {t} Key? {Sprites.ContainsKey(t)}");
     }
 }
Ejemplo n.º 6
0
        protected virtual void SetCurrentToLastUploadedIcon()
        {
            useEncounterImageToggle.SetIsOnWithoutNotify(false);
            CurrentIcon = LastUploadedIcon;
            Sprite sprite;
            var    reference = LastUploadedIcon?.Reference;

            sprite = reference != null && Sprites.ContainsKey(reference) ? Sprites[reference] : null;
            customIconToggle.SetIcon(CurrentIcon, sprite);
            customIconToggle.Select();
        }
Ejemplo n.º 7
0
 public Sprite GetSprite(string name)
 {
     if (Sprites.ContainsKey(name))
     {
         return(Sprites[name]);
     }
     if (Sprites.Count > 0)
     {
         return(Sprites.First().Value);
     }
     return(null);
 }
Ejemplo n.º 8
0
        public static Sprite GetSprite(string tileSet, string tileName)
        {
            if (Sprites.ContainsKey(tileSet))
            {
                if (Sprites[tileSet].Any(x => x.First.Equals(tileName)))
                {
                    return(Sprites[tileSet].First(x => x.First.Equals(tileName)).Second);
                }
            }

            return(Sprites["DEFAULT"][0].Second);
        }
Ejemplo n.º 9
0
            public void HandleMana(ManaType t, bool highlight = false)
            {
                var dict = highlight ? SpritesHighlight : Sprites;

                if (dict.TryGetValue(t, out var s))
                {
                    sr.sprite = s;
                }
                else
                {
                    Logger.LogError($"Sprites Contains {t} Key? {Sprites.ContainsKey(t)}");
                }
                MType = t;
            }
Ejemplo n.º 10
0
 public void SetText(string spriteName, string text)
 {
     if (usePlaceHolders)
     {
         return;
     }
     if (Sprites.ContainsKey(spriteName))
     {
         var sprite = Sprites[spriteName];
         if (sprite is IseText)
         {
             (sprite as IseText).Text = text;
             (sprite as IseText).Update();
         }
     }
 }
        /// <summary>
        ///  Returns a sprite surface for the given sprite key.
        /// </summary>
        internal TerrariumSpriteSurface this[string key]
        {
            get
            {
                if (string.IsNullOrEmpty(key))
                {
                    return(null);
                }

                if (!Sprites.ContainsKey(key))
                {
                    Add(key, 10, 40); // This is adding a default sprite
                }

                return((TerrariumSpriteSurface)Sprites[key]);
            }
        }
Ejemplo n.º 12
0
        public static List <Sprite> GetSprites(string tileSet, string tileName)
        {
            List <Sprite> sprites = new List <Sprite>();

            if (Sprites.ContainsKey(tileSet))
            {
                List <Tuple <string, Sprite> > find = Sprites[tileSet].FindAll(x => x.First.Contains(tileName));
                foreach (Tuple <string, Sprite> found in find)
                {
                    sprites.Add(found.Second);
                }
            }

            if (sprites.Count == 0)
            {
                List <Sprite> defaultSprite = new List <Sprite>();
                defaultSprite.Add(Sprites["DEFAULT"][0].Second);
                return(defaultSprite);
            }

            return(sprites);
        }
        /// <summary>
        ///  Returns an optimally sized sprite surface for a given sprite
        ///  key, a given ideal size, and whether or not the type of sprite
        ///  is that of a creature or plant.
        /// </summary>
        internal TerrariumSpriteSurface this[string key, int size, bool animal]
        {
            get
            {
                if (string.IsNullOrEmpty(key))
                {
                    return(null);
                }

                if (!Sprites.ContainsKey(key))
                {
                    if (animal)
                    {
                        AddSizedSurface(key, 10, 40); // This is adding a default sprite
                    }
                    else
                    {
                        AddSizedSurface(key, 1, 1); // This is adding a default sprite
                    }
                }

                return((TerrariumSpriteSurface)Sprites[key]);
            }
        }