_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