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); }
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); }