예제 #1
0
        public void load(string spriteName)
        {
            if (anim != null)
            {
                anim.stop();
            }

            string path;

            if (upkList.TryGetValue(spriteName, out path))
            {
                if (anim == null)
                {
                    anim = gameObject.AddComponent <ImageAnimation>();
                }
                anim.load(path);
                anim.play(true);
                return;
            }

            Sprite sprite;

            if (spriteList.TryGetValue(spriteName, out sprite))
            {
                image.sprite = sprite;
                return;
            }

            image.sprite = Resources.Load <Sprite>(spriteName);
        }
예제 #2
0
        public virtual void playUpk(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            if (upkAnimation == null)
            {
                Image image = UIUtils.CreateImage("anim", this.skin);
                upkAnimation = image.gameObject.AddComponent <ImageAnimation>();
                upkAnimation.autoNativeSize = true;
            }
            upkAnimation.load(name);
            upkAnimation.play(true);
        }