/// <summary>
    /// 添加一个帧动画在GameObject下;
    /// </summary>
    /// <param name="name">动画名</param>
    /// <param name="parent"></param>
    /// <param name="fps">frames per second</param>
    /// <param name="isLoop"></param>
    public UISpriteAnimation AddSpriteAnimation(string name, GameObject parent, int depth = 0, int fps = 30, bool isLoop = true, bool selfDestroy = false)
    {
        if (string.IsNullOrEmpty(name))
        {
            return(null);
        }

        if (parent == null)
        {
            return(null);
        }

        GameObject go = System.Activator.CreateInstance <GameObject>() as GameObject;

        go.SetActive(false);
        go.transform.parent        = parent.transform;
        go.name                    = name;
        go.transform.localPosition = Vector3.zero;
        go.transform.localScale    = Vector3.one;


        UISprite gold = go.AddMissingComponent <UISprite>();

        //gold.atlas = UIAtlasHelper.LoadAtlas("SpriteAnimation/" + name);
        gold.spriteName = "";
        gold.depth      = depth;
        gold.MakePixelPerfect();
        gold.width  = 1;
        gold.height = 1;

        SpriteAniParam param = new SpriteAniParam();

        param.fps           = fps;
        param.isLoop        = isLoop;
        param.isSelfDestroy = selfDestroy;
        param.obj           = go;

        UISpriteAnimation spriteAni = go.AddMissingComponent <UISpriteAnimation>();


        if (!mAniDatas.ContainsKey(name))
        {
            mAniDatas.Add(name, new List <SpriteAniParam>());
            mAniDatas[name].Add(param);

            UIResourceManager.Instance.LoadAnimationRes(name, OnAnimationResLoaded);
        }
        else
        {
            mAniDatas[name].Add(param);
        }

        return(spriteAni);
    }
    private void OnAnimationResLoaded(string aniName)
    {
        if (!mAniDatas.ContainsKey(aniName))
        {
            return;
        }
        List <SpriteAniParam> lst = mAniDatas[aniName];

        for (int i = 0; i < lst.Count; ++i)
        {
            SpriteAniParam param = lst[i];

            GameObject go = param.obj;

            UISprite gold = go.GetComponent <UISprite>();
            gold.atlas = UIAtlasHelper.LoadAtlas(aniName);
            gold.MakePixelPerfect();

            UISpriteAnimation spriteAni = go.GetComponent <UISpriteAnimation>();
            if (spriteAni == null)
            {
                GameDebug.LogError("怎么可能出错了");
                return;
            }

            spriteAni.framesPerSecond = param.fps;
            spriteAni.loop            = param.isLoop;
            if (param.isSelfDestroy)
            {
                spriteAni.onFinished += DestroyObj;
            }

            spriteAni.RebuildSpriteList();
            spriteAni.Reset();
            go.SetActive(true);
        }

        mAniDatas.Remove(aniName);
    }