Esempio n. 1
0
    public void Init(string spineId, SkeletonGraphic skg, string animationName)
    {
        _skg           = skg;
        _animationName = animationName;

        SkeletonDataAsset skData = SpineUtil.BuildSkeletonDataAsset(spineId, skg);

        skg.skeletonDataAsset = skData;
        skg.Initialize(true);
        skg.AnimationState.SetAnimation(0, animationName, true);

        _rect            = skg.GetComponent <RectTransform>();
        _rect.pivot      = new Vector2(0.5f, 0f);
        _rect.anchorMin  = new Vector2(0.5f, 0.5f);
        _rect.anchorMax  = new Vector2(0.5f, 0.5f);
        _rect.sizeDelta  = new Vector2(300, 500);
        _rect.localScale = new Vector3(0.5f, 0.5f, 1);
        CurDerection     = 0;
    }
Esempio n. 2
0
    IEnumerator skeletonani_(int idx)
    {
        gain_ani.Play("gain_ani");


        SkeletonGraphic skg;

        skg = sk.GetComponent <SkeletonGraphic>();
        skg.skeletonDataAsset = Resources.Load("building/" + ivt.idb.items[idx].Spine) as SkeletonDataAsset;

        switch (ivt.idb.items[idx].width)
        {
        case 1:
            skg.rectTransform.anchoredPosition = new Vector2(-64, -210);
            break;

        case 2:
            skg.rectTransform.anchoredPosition = new Vector2(-61, -210);
            break;

        case 3:
            skg.rectTransform.anchoredPosition = new Vector2(-194, -210);
            break;

        case 4:
            skg.rectTransform.anchoredPosition = new Vector2(-128, -210);
            break;

        case 5:
            skg.rectTransform.anchoredPosition = new Vector2(-148, -210);
            break;

        default:
            break;
        }


        skg.startingLoop = true;
        skg.timeScale    = 1f;
        skg.Initialize(true);
        #region
        float  anitime = 0.2f;
        string basic   = "b_v1_l2_";

        sk.AnimationState.SetAnimation(0, basic + 'o', true);
        yield return(new WaitForSeconds(anitime));

        sk.AnimationState.SetAnimation(0, basic + 'c', true);
        yield return(new WaitForSeconds(anitime));

        sk.AnimationState.SetAnimation(0, basic + 'b', true);
        yield return(new WaitForSeconds(anitime));

        sk.AnimationState.SetAnimation(0, basic + 'y', true);
        yield return(new WaitForSeconds(anitime));

        basic = "b_v2_l2_";
        sk.AnimationState.SetAnimation(0, basic + 'o', true);
        yield return(new WaitForSeconds(anitime));

        sk.AnimationState.SetAnimation(0, basic + 'c', true);
        yield return(new WaitForSeconds(anitime));

        sk.AnimationState.SetAnimation(0, basic + 'b', true);
        yield return(new WaitForSeconds(anitime));

        sk.AnimationState.SetAnimation(0, basic + 'y', true);
        yield return(new WaitForSeconds(anitime));

        basic = "b_v3_l2_";
        sk.AnimationState.SetAnimation(0, basic + 'o', true);
        yield return(new WaitForSeconds(anitime));

        sk.AnimationState.SetAnimation(0, basic + 'c', true);
        yield return(new WaitForSeconds(anitime));

        sk.AnimationState.SetAnimation(0, basic + 'b', true);
        yield return(new WaitForSeconds(anitime));

        sk.AnimationState.SetAnimation(0, basic + 'y', true);
        yield return(new WaitForSeconds(anitime));

        basic = "r_v3_l2_";
        sk.AnimationState.SetAnimation(1, basic + 'o', true);
        yield return(new WaitForSeconds(anitime));

        sk.AnimationState.SetAnimation(1, basic + 'c', true);
        yield return(new WaitForSeconds(anitime));

        sk.AnimationState.SetAnimation(1, basic + 'b', true);
        yield return(new WaitForSeconds(anitime));

        sk.AnimationState.SetAnimation(1, basic + 'y', true);
        yield return(new WaitForSeconds(anitime));

        #endregion


        ivt.gain(idx);
        gain_ani.Play("gain_reverse");
    }