Exemplo n.º 1
0
    public void SetDaChengPicVisable(int condition)
    {
        for (int i = 0; i < WingDefine.MaxConditonNum; i++)
        {
            if ((condition & (1 << i)) == 0)          //没有达成条件i+1
            {
                if (mDaChengPicList[i].atlas.name == "chibangjiesuoblue")
                {
                    mDaChengPicList[i].transform.localEulerAngles = new Vector3(0, 0, 143);
                    mDaChengPicList[i].transform.localPosition    = new Vector3(2.73f, 1.22f, 0);
                }
                UIAtlasHelper.SetSpriteImage(mDaChengPicList[i],
                                             "chibangjiesuored:jm_chibangjiesuo1_00000");
                UISpriteAnimation sa = mDaChengPicList[i].GetComponent <UISpriteAnimation>();
                sa.RebuildSpriteList();
                sa.Reset();
            }
            else
            {
                if (mDaChengPicList[i].atlas.name == "chibangjiesuored")
                {
                    mDaChengPicList[i].transform.localEulerAngles = Vector3.zero;
                    mDaChengPicList[i].transform.localPosition    = Vector3.zero;
                }
                UIAtlasHelper.SetSpriteImage(mDaChengPicList[i],
                                             "chibangjiesuoblue:jm_chibangjiesuo2_00000");

                UISpriteAnimation sa = mDaChengPicList[i].GetComponent <UISpriteAnimation>();
                sa.RebuildSpriteList();
                sa.Reset();
            }
        }
    }
Exemplo n.º 2
0
    static int RebuildSpriteList(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        UISpriteAnimation obj = (UISpriteAnimation)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UISpriteAnimation");

        obj.RebuildSpriteList();
        return(0);
    }
Exemplo n.º 3
0
 static public int RebuildSpriteList(IntPtr l)
 {
     try {
         UISpriteAnimation self = (UISpriteAnimation)checkSelf(l);
         self.RebuildSpriteList();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 4
0
        protected void RefreshSpriteAnimiate(UISprite sp)
        {
            if (sp == null)
            {
                return;
            }
            UISpriteAnimation ani = sp.GetComponent <UISpriteAnimation>();

            if (ani != null)
            {
                ani.RebuildSpriteList();
            }
        }
Exemplo n.º 5
0
 static int RebuildSpriteList(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UISpriteAnimation obj = (UISpriteAnimation)ToLua.CheckObject <UISpriteAnimation>(L, 1);
         obj.RebuildSpriteList();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 6
0
    private static int RebuildSpriteList(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            UISpriteAnimation uISpriteAnimation = (UISpriteAnimation)ToLua.CheckObject(L, 1, typeof(UISpriteAnimation));
            uISpriteAnimation.RebuildSpriteList();
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Exemplo n.º 7
0
    public void OnLoadAtlas(string name, UnityEngine.Object obj)
    {
        atlas        = (obj as GameObject).GetComponent <UIAtlas>();
        mNormalAtlas = this.atlas;
        if (mNeedSetGray)
        {
            SetGray = true;
        }
        if (needSetMaskName != null)
        {
            SetMask(needSetMaskName);
        }
        UISpriteAnimation ani = GetComponent <UISpriteAnimation>();

        if (ani != null)
        {
            ani.RebuildSpriteList();
        }
    }
Exemplo n.º 8
0
    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);
    }
Exemplo n.º 9
0
    void OnGetAtlas(IUIAtlas cmatlas, object param1, object param2, object param3)
    {
        if (null == cmatlas)
        {
            return;
        }
        UIAtlas atlas = cmatlas.GetAtlas();

        if (null == atlas)
        {
            return;
        }
        if (null != param1 && param1 is UISprite)
        {
            UISprite sprite = (UISprite)param1;
            UIAtlas  atl    = (null != atlas) ? cmatlas.GetAtlas() : null;
            sprite.atlas = atl;
            if (null != param2 && param2 is string)
            {
                sprite.spriteName = (string)param2;
            }
            if (null != param3 && param3 is bool)
            {
                bool makePerfect = (bool)param3;
                if (null != sprite && makePerfect)
                {
                    sprite.MakePixelPerfect();
                }
            }
        }

        if (ani != null)
        {
            ani.RebuildSpriteList();
            ani.Play();
        }
    }
Exemplo n.º 10
0
    public void SetTop(bool top)
    {
        mTop = top;
        UISpriteAnimation ani = mView.mSprite.gameObject.GetComponent <UISpriteAnimation>();

        if (ani == null)
        {
            ani = mView.mSprite.gameObject.AddComponent <UISpriteAnimation>();
        }
        ani.PixelPerfect = false;

        if (top)
        {
            mView.mSprite.centerType = UISprite.AdvancedType.Tiled;
            mView.mSprite.leftType   = UISprite.AdvancedType.Sliced;
            mView.mSprite.rightType  = UISprite.AdvancedType.Sliced;
            mView.mSprite.bottomType = UISprite.AdvancedType.Sliced;
            mView.mSprite.topType    = UISprite.AdvancedType.Sliced;
            UIAtlasHelper.SetSpriteImage(mView.mSprite, "zhushouduihua:01_000");
            ani.enabled = true;
            ani.RebuildSpriteList();
            ani.Reset();
        }
        else
        {
            mView.mSprite.centerType = UISprite.AdvancedType.Sliced;
            mView.mSprite.leftType   = UISprite.AdvancedType.Sliced;
            mView.mSprite.rightType  = UISprite.AdvancedType.Sliced;
            mView.mSprite.bottomType = UISprite.AdvancedType.Sliced;
            mView.mSprite.topType    = UISprite.AdvancedType.Sliced;
            UIAtlasHelper.SetSpriteImage(mView.mSprite, "Chat:paopao");
            ani.enabled = false;
        }

        mView.mLabel.gameObject.transform.localPosition = new Vector3(0.0f, 5.0f, 0.0f);
    }
Exemplo n.º 11
0
    void OnDragEnd()
    {
        endpos = Input.mousePosition;
        float delta = endpos.x - startpos.x;

        if (delta >= 0)
        {
            switch (num)
            {
            case 0:
                spriteAni.resetFrame(24);
                spriteAni.PlayTo(7);

                tweens[2].Play(false);
                tweens[0].Play(true);
                num++;
                break;

            case 1:
                spriteAni.PlayTo(13);

                tweens[0].PlayReverse();
                tweens[1].Play(true);
                num++;
                break;

            case 2:
                spriteAni.PlayTo(19);

                tweens[1].PlayReverse();

                num++;
                break;

            case 3:
                spriteAni.PlayTo(25);

                num++;
                break;

            case 4:
                tweens[2].Play(true);


                spriteAni.resetFrame(8);
                spriteAni.PlayTo(35);
                spriteAni.RebuildSpriteList();
                spriteAni.PlayTo(0);
                num = 0;
                break;
            }
        }
        else if (delta < 0)
        {
            switch (num)
            {
            case 0:
                spriteAni.resetFrame(24);
                spriteAni.PlayTo(7);

                tweens[2].Play(false);
                tweens[0].Play(true);
                num++;
                break;

            case 1:
                spriteAni.PlayToReverse(0);

                tweens[0].PlayReverse();
                num--;
                break;

            case 2:
                spriteAni.PlayToReverse(5);

                tweens[1].PlayReverse();
                tweens[0].Play(true);
                num--;
                break;

            case 3:
                spriteAni.PlayToReverse(11);
                num--;
                break;

            case 4:
                spriteAni.PlayToReverse(17);
                num--;
                break;
            }
        }
    }
Exemplo n.º 12
0
    void OnDragEnd()
    {
        endpos = Input.mousePosition;
        float delta = endpos.x - startpos.x;

        //向右滑
        if (delta > 0)
        {
            switch (num)
            {
            case 0:
                //播放第一个text
                tweens [0].Play(true);
                tweens [10].Play(false);
                spriteAni.resetFrame(24);
                spriteAni.RebuildSpriteList();
                spriteAni.PlayTo(7);

                num++;
                break;

            case 1:
                tweens [0].PlayReverse();
                tweens [1].Play(true);
                spriteAni.PlayTo(13);

                num++;
                break;

            case 2:
                spriteAni.PlayTo(19);
                tweens [1].PlayReverse();
                tweens [2].Play(true);
                EventDelegate.Add(tweens [2].onFinished, addcircle);

                num++;
                break;

            case 3:
                spriteAni.PlayTo(25);
                tweens [2].Play(false);
                tweens [3].Play(false);
                tweens [4].Play(false);
                tweens [8].Play(true);
                EventDelegate.Add(tweens [8].onFinished, addTweens9);
                //case 2 's delete
                ////////////////////////////////////
                EventDelegate.Remove(tweens [2].onFinished, addcircle);
                EventDelegate.Remove(tweens [3].onFinished, addtext);
                PrepareToBtn = false;
                tweenBtn [0].Play(false);
                tweenBtn [1].Play(false);
                tweenBtn [2].Play(false);
                tweens [7].Play(false);
                tweens [5].Play(false);
                tweens [6].Play(false);
                /////////////////////////////////
                num++;
                break;

            case 4:
                EventDelegate.Remove(tweens [8].onFinished, addTweens9);
                tweens [9].PlayReverse();
                tweens [8].PlayReverse();
                spriteAni.resetFrame(8);
                spriteAni.PlayTo(35);
                spriteAni.RebuildSpriteList();
                spriteAni.PlayTo(0);
                tweens [10].Play(true);
                num = 0;
                break;
            }
        }
        //向左滑
        else if (delta < 0)
        {
            for (int i = 0; i < tweens.Count; i++)
            {
                tweens[i].Play(false);
            }


            switch (num)
            {
            case 0:
                tweens[0].Play(true);
                spriteAni.resetFrame(24);
                spriteAni.RebuildSpriteList();
                spriteAni.PlayTo(7);
                num++;
                break;

            case 1:
                spriteAni.PlayToReverse(0);
                num--;
                break;

            case 2:
                spriteAni.PlayToReverse(5);
                tweens[0].Play(true);
                num--;
                break;

            case 3:
                EventDelegate.Remove(tweens[2].onFinished, addcircle);
                EventDelegate.Remove(tweens[3].onFinished, addtext);
                PrepareToBtn = false;
                tweenBtn[0].Play(false);
                tweenBtn[1].Play(false);
                tweenBtn[2].Play(false);

                spriteAni.PlayToReverse(11);
                tweens[1].Play(true);

                num--;
                break;

            case 4:
                spriteAni.PlayToReverse(17);
                EventDelegate.Add(tweens[2].onFinished, addcircle);
                tweens[2].Play(true);
                num--;
                break;
            }
        }
    }