Itween的基本用法

Hashtable _table = new Hashtable();
_table.Add("position", TableComponentPositionsManager.PokerPositions[_index]);
_table.Add("time", 0.04f);
_table.Add("easetype", iTween.EaseType.linear);
_table.Add("onupdatetarget", _poker);
_table.Add("onupdate", "UpdatePokerAnimation");
_table.Add("oncompletetarget", _poker);
_table.Add("oncomplete", "CompletePokerAnimation");
_table.Add("oncompleteparams", _value);

iTween.MoveTo(_poker, _table);

注意:回调函数不能写在当前的类里面,应该写在oncompletetarget对应的脚本里面,本例子写在_poker挂的TablePokerScript脚本里面 代码如下


public class TablePokerScript : StageBase
{
    public string PokerContent;
    public UISprite Sprite_Poker;

    void Start()
    {
        this.Sprite_Poker = this.gameObject.GetComponent<UISprite>();
    }

    #region 回调-更新透明度
    void UpdatePokerAnimation()
    {
        if(this.Sprite_Poker != null)
        {
            if (this.Sprite_Poker.alpha >= 1.0f)
            {
                return;
            }

            this.Sprite_Poker.alpha += 0.5f;
        }
     
    }
    #endregion

    #region 回调-填充牌
    void CompletePokerAnimation(string _value)
    {
        if(this.Sprite_Poker != null)
        {
            Global.FillPoker(this.Sprite_Poker, _value);
        }
    }
    #endregion


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值