0

I'm implementing a card-matching game.

The event will be sent after the card is first deployed.

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);
}

Here is the code for receiving the above event.

   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);
    }

I created a temporary function to check that the above code works well. (("onupdate", "test");)

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

But the log can't be verified.

I can't find the cause.

What did you write wrong? And how to solve it?

Your comments are valuable. Please help me.

Seongwon-Choi
  • 459
  • 8
  • 24

1 Answers1

0

I believe you are creating the hashtable assuming that iTween uses the standard one, but it never worked for me. Try calling RotateBy using this instead:

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
));

EDIT: The method Test in the code has no parameters, while here you want to pass data as a param: that will break it.