0

我正在实现一个纸牌匹配游戏。

该事件将在卡首次部署后发送。

public void cardFlipStateUpdate()
{
    foreach (Card card in cardAllInformation[current_pageNumber])
    {
        GameObject card_gameObj = cardAllGameObject[current_pageNumber][card.cardIndex] as GameObject;

        int c_idx = card.cardIndex;
        int c_uidx = card.cardUniqueIndex;

        float delay_s = c_idx * 0.15f;
        float delay_r = 2.5f + c_idx * 0.15f;

        TouchEventManager.Instance.dispatch(c_idx, c_uidx, card_gameObj, card, true, "none", delay_s);
        TouchEventManager.Instance.dispatch(c_idx, c_uidx, card_gameObj, card, true, "cardSelectionCriteria", delay_r);
    }
}

public void onTuchHandler(object obj, EventArgs e)
{
    TouchEventTypes t_evt = e as TouchEventTypes;

    WordReviewUtil.cardFlipAnimation(t_evt.card_idx, t_evt.card_selectNum, t_evt.go, t_evt.card, t_evt.init, t_evt.complete, t_evt.delay);
}

这是接收上述事件的代码。

   public static void cardFlipAnimation(int card_idx, int card_selectNum, GameObject gobj, Card card, bool init = false, string complete = "cardDifferentiate", float delay = 0f)
    {
        Hashtable data = new Hashtable();
    //    Debug.Log("cardFlipAnimation Receive Param >> " + card_idx + " / " + card_selectNum + " / " + gobj + " / ");
    //    Debug.Log("cardFlipAnimation Receive Param >> " + card + " / " + init + " / " + complete + " / " + delay);
    //    Debug.Log("============================================================================================");
        data.Add("gobj", gobj);
        data.Add("card", card);

        Hashtable run_hash = new Hashtable();
        run_hash.Add("y", 0.5);
        run_hash.Add("time", 0.7);
        run_hash.Add("delay", delay);
        run_hash.Add("easetype", iTween.EaseType.easeInOutCubic);
        run_hash.Add("onupdate", "test");
        run_hash.Add("onupdatetarget", gobj);
        run_hash.Add("onupdateparams", data);
        run_hash.Add("oncomplete", complete);
        run_hash.Add("oncompletetarget", gobj);

        //Debug.Log("run_hash >> " + run_hash);

        iTween.RotateBy(gobj, run_hash);
    }

我创建了一个临时函数来检查上述代码是否正常工作。(("onupdate", "test");)

public void test()
{
   Debug.Log("hello Moto~~");
}

但是无法验证日志。

我找不到原因。

你写错了什么?以及如何解决?

您的意见很有价值。请帮我。

4

1 回答 1

0

我相信您正在创建哈希表,假设 iTween 使用标准哈希表,但它从未对我有用。尝试使用此调用 RotateBy :

iTween.RotateBy( gobj, iTween.Hash(
     "y", 0.5,
     "time", 0.7,
     "delay", delay,
     "easetype", iTween.EaseType.easeInOutCubic,
     "onupdate", "test",
     "onupdatetarget", gobj,
     "onupdateparams", data,
     "oncomplete", complete,
     "oncompletetarget", gobj
));

编辑:Test代码中的方法没有参数,而在这里你想data作为参数传递:那会破坏它。

于 2017-11-14T12:15:26.960 回答