tutorial
cocos2d-x
with
easy

Easy and comfortable Game Tutorial with Cocos2d-x

基本的な概念はTutorialから起きることをスクリプト化してスタックに入れておいて一つずつポップする方法です。

XXXTutorial.mm



#define DEBUG_TOUCHAREA 0



/*=====================
Tutorial コマンド ガイド



 [Tutorial 終了]

 TCMD_FINISHTUTORIAL



 [コマンド ホールド] *時間の遅延と一緒に使えない

 TCMD_HOLDCOMMAND



 [時間遅延] *コマンド ホールドと一緒に使えない

 TCMD_DELAYTIME(秒)



 [페이드 배경 오버레이 ON/OFF]ペイド背景オーバーレイ On/Oっf

 TCMD_DRAWFADEOVERLAY_ON

 TCMD_DRAWFADEOVERLAY_OFF



 [게임 PAUSE/RESUME]

 TCMD_PAUSEGAME

 TCMD_RESUMEGAME



 [스킵버튼 추가]

 TCMD_ADDSKIPBUTTON



 [이미지 추가]

 - 기본(정지이미지)

 TCMD_ADDSPRITE(이미지파일이름, 식별ID, eObjectMotion_None, 기준좌표-Point(X,Y), Point(0, 0), 회전각도, 0, 좌우반전(예:true/아니오:false), 상하반전(예:true/아니오:false), XY스케일(기본값:Point(1.0, 1.0)), 중심점(기본값:Point(0.5, 0.5)))

 - 왔다갔다

 TCMD_ADDSPRITE(이미지파일이름, 식별ID, eObjectMotion_GoAndBack, 기준좌표-Point(X,Y), 이동좌표-Point(X,Y), 회전각도, 이동시간(초), 좌우반전(예:true/아니오:false), 상하반전(예:true/아니오:false), XY스케일(기본값:Point(1.0, 1.0)), 중심점(기본값:Point(0.5, 0.5)))

 - 텔레포트

 TCMD_ADDSPRITE(이미지파일이름, 식별ID, eObjectMotion_Teleport, 기준좌표-Point(X,Y), 이동좌표-Point(X,Y), 회전각도, 이동시간(초), 좌우반전(예:true/아니오:false), 상하반전(예:true/아니오:false), XY스케일(기본값:Point(1.0, 1.0)), 중심점(기본값:Point(0.5, 0.5)))

 - 이동

 TCMD_ADDSPRITE(이미지파일이름, 식별ID, eObjectMotion_Move, 기준좌표-Point(X,Y), 이동좌표-Point(X,Y), 회전각도, 이동시간(초), 좌우반전(예:true/아니오:false), 상하반전(예:true/아니오:false), XY스케일(기본값:Point(1.0, 1.0)), 중심점(기본값:Point(0.5, 0.5)))



 [이미지 삭제]

 - 개별삭제

 TCMD_REMOVESPRITE(식별ID)

 - 전체삭제

 TCMD_REMOVESPRITE(0)



 [말풍선 추가/삭제]

 - 추가

 TCMD_ADDTEXTFIELD(텍스트(따움표로 묶고 줄바꿈은\n), 기준좌표-Point(X,Y), 좌우위치(기본값:우측:false, 좌:true), 상하위치(기본값:상:false, 하:true), 버튼여부(기본값:없음:false, 있음:true))

 - 삭제

 TCMD_REMOVETEXTFIELD





 [터치영역 추가/삭제]

 - 추가

 TCMD_ADDTOUCHAREA(식별자, 좌표-Point(X,Y), XY스케일(기본값:Point(1.0, 1.0))

 - 개별삭제

 TCMD_REMOVETOUCHAREA(식별자)

 - 전체삭제

 TCMD_REMOVETOUCHAREA(0)



 [마스킹 추가/삭제]

 - 추가

 TCMD_ADDMASK_CIRCLE(식별자, 좌표-Point(X,Y), XY스케일(기본값:Point(1.0, 1.0))

 TCMD_ADDMASK_RECT(식별자, 좌표-Point(X,Y), XY스케일(기본값:Point(1.0, 1.0))

 - 개별삭제

 TCMD_REMOVEMASK(식별자)

 - 전체삭제

 TCMD_REMOVEMASK(0)



 [모든 요소 삭제]

 TCMD_REMOVEALL 

 : 아래 명령어를 모두 통합한 명령어

 TCMD_REMOVETOUCHAREA(0) TCMD_REMOVETEXTFIELD TCMD_REMOVEMASK(0) TCMD_REMOVESPRITE(0)





===============================================================================================================================================*/





#define SIZE_BASICAREA Size(100, 100)

#define SCALE_BASICTILE Point(0.55, 0.68)





#define TCMD_DELAYTIME(__DELAY__) l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_DelayTime, false, "", "", eObjectMotion_None, Rect(0, 0, 0, 0), Point(0, 0), Point(0, 0), 0, __DELAY__));

#define TCMD_DRAWFADEOVERLAY_ON  l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_DrawFadeOverlay));

#define TCMD_DRAWFADEOVERLAY_OFF  l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_DrawFadeOverlay, true));

#define TCMD_PAUSEGAME   l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_PauseGame));

#define TCMD_RESUMEGAME   l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_PauseGame, true));

#define TCMD_ADDSKIPBUTTON   l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_AddSkipButton));

#define TCMD_FINISHTUTORIAL   l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_FinishTutorial));



#define TCMD_ADDSPRITE(__FILEPATH__, _TAG_, _MOTIONTYPE_, _PT1_, _PT2_, _ROTATION_, _DELAY_, _FLIPX_, _FLIPY_, _SCALE_, _ANCHOR_) l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_AddSprite, false, __FILEPATH__, "", _MOTIONTYPE_, Rect(0, 0, 0, 0), _PT1_, _PT2_, _ROTATION_, _DELAY_, _FLIPX_, _FLIPY_, false, _TAG_, _SCALE_, _ANCHOR_));

#define TCMD_REMOVESPRITE(_TAG_) l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_AddSprite, true, "", "", eObjectMotion_None, Rect(0, 0, 0, 0), Point(0, 0), Point(0, 0), 0, 0, false, false, false, _TAG_, Point(1.0, 1.0), Point(0.5, 0.5)));



#define TCMD_HOLDCOMMAND l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_HoldCommand));



#define TCMD_ADDTEXTFIELD(_TEXT_, _POS_, _FLIPX_, _FLIPY_, _OKBTN_, _TYPE_) l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_AddTextField, false, "", _TEXT_, eObjectMotion_None, Rect(0, 0, 0, 0), _POS_, Point(0, 0), 0, 0, _FLIPX_, _FLIPY_, _OKBTN_, _TYPE_, Point(1.0, 1.0), Point(0.5, 0.5)));

#define TCMD_REMOVETEXTFIELD l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_AddTextField, true));



#define TCMD_ADDTOUCHAREA(_TAG_, _POS_, _XYSCALE_) l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_AddTouchableArea, false, "", "", eObjectMotion_None, Rect(0, 0, 0, 0), _POS_, Point(0, 0), 0, 0, false, false, false, _TAG_, _XYSCALE_));

#define TCMD_REMOVETOUCHAREA(_TAG_) l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_AddTouchableArea, true, "", "", eObjectMotion_None, Rect(0, 0, 0, 0), Point(0, 0), Point(0, 0), 0, 0, false, false, false, _TAG_));

#define TCMD_CUSTOM(_TAG_) l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_Custom, false, "", "", eObjectMotion_None, Rect(0, 0, 0, 0), Point(0, 0), Point(0, 0), 0, 0, false, false, false, _TAG_));

#define TCMD_ADDMASK_CIRCLE(_TAG_, _POS_, _XYSCALE_) l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_AddMask, false, "", "", (eObjectMotion)eMaskType_Circle, Rect(0, 0, 0, 0), _POS_, Point(0, 0), 0, 0, false, false, false, _TAG_, _XYSCALE_));

#define TCMD_ADDMASK_RECT(_TAG_, _POS_, _XYSCALE_) l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_AddMask, false, "", "", (eObjectMotion)eMaskType_RoundRect, Rect(0, 0, 0, 0), _POS_, Point(0, 0), 0, 0, false, false, false, _TAG_, _XYSCALE_));

#define TCMD_REMOVEMASK(_TAG_) l_TutorialCmd.push_back(TutorialCmdObject(eTutorialCMD_AddMask, true, "", "", (eObjectMotion)0, Rect(0, 0, 0, 0), Point(0, 0), Point(0, 0), 0, 0, false, false, false, _TAG_, Point(1, 1)));



#define TCMD_REMOVEALL TCMD_REMOVETOUCHAREA(0) TCMD_REMOVETEXTFIELD TCMD_REMOVEMASK(0) TCMD_REMOVESPRITE(0)













#define BLOCKPOS(_X_,_Y_) (GStageLayer->GetPositionByPos(IntPoint(_X_, _Y_), 0) + Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(-9, 10))

#define BLOCKPOS_BETWEEN(_X1_,_Y1_,_X2_,_Y2_) (BLOCKPOS(_X1_,_Y1_) + (BLOCKPOS(_X2_,_Y2_) - BLOCKPOS(_X1_,_Y1_))*0.5)

#define FINGERPOS(_X_,_Y_) (BLOCKPOS(_X_,_Y_) + Point(0, -100))





void AMTutorialLayer::StartTutorial(eTutorialType TutorialType)

{

    l_TutorialCmd.clear();



    cur_TutorialType = TutorialType;



    switch(TutorialType)

    {

        case eTutorialType_InGame_BasicRule:

        {

            TCMD_DELAYTIME(0.1)



            TCMD_ADDSKIPBUTTON

            TCMD_DRAWFADEOVERLAY_ON

            TCMD_PAUSEGAME



            TCMD_ADDMASK_CIRCLE(1, BLOCKPOS(8, -1), Point(1.5, 1.5))

            TCMD_ADDSPRITE("worldimg_ui_stageui_arrow.png", 1, eObjectMotion_GoAndBack, Point(DESIGN_WIDTH/2, DESIGN_HEIGHT - 130), Point(DESIGN_WIDTH/2, DESIGN_HEIGHT - 120), 0, 0.3, false, true, Point(1.5, 1.5), Point(0.5, 0.5));



            TCMD_ADDTEXTFIELD("You need to pop all blocks\nbefore the time runs out.", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 100), false, false, true, eTextFieldCharacter_Cat)



            TCMD_HOLDCOMMAND



            TCMD_REMOVEMASK(0)

            TCMD_REMOVESPRITE(0)

            TCMD_ADDTEXTFIELD("Try tapping a pair of same blocks!", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 100), false, false, false, eTextFieldCharacter_Cat)

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_Teleport, FINGERPOS(11, 3), FINGERPOS(12, 5), 0, 0.5, false, false, Point(1.0, 1.0), Point(0.5, 0.5));

            TCMD_ADDTOUCHAREA(1, BLOCKPOS(11, 3), SCALE_BASICTILE)

            TCMD_ADDTOUCHAREA(2, BLOCKPOS(12, 5), SCALE_BASICTILE)

            TCMD_ADDMASK_CIRCLE(1, BLOCKPOS(11, 3), Point(1.2, 1.2))

            TCMD_ADDMASK_CIRCLE(2, BLOCKPOS(12, 5), Point(1.2, 1.2))



            TCMD_HOLDCOMMAND



            TCMD_REMOVEMASK(0)

            TCMD_REMOVETOUCHAREA(0)

            TCMD_REMOVESPRITE(0)

            TCMD_ADDMASK_RECT(1, BLOCKPOS_BETWEEN(12, 5, 11, 3) + Point(5, -5), Point(SCALE_BASICTILE.x*3.1, SCALE_BASICTILE.y*4.1))

            TCMD_ADDTEXTFIELD("They will POP!\nIf they are connected with\nthree or less straight lines!", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 140), false, false, true, eTextFieldCharacter_Cat)



            TCMD_HOLDCOMMAND



            TCMD_REMOVETEXTFIELD

            TCMD_CUSTOM(0) //연결선 지우기



            TCMD_DELAYTIME(0.6)



            TCMD_REMOVEMASK(0)

            TCMD_ADDTEXTFIELD("Good job!\n Let's try popping these blocks as well!", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 140), false, false, false, eTextFieldCharacter_Cat)

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_Teleport, FINGERPOS(8, 4), FINGERPOS(10, 3), 0, 0.5, false, false, Point(1.0, 1.0), Point(0.5, 0.5));

            TCMD_ADDTOUCHAREA(1, BLOCKPOS(10, 3), SCALE_BASICTILE)

            TCMD_ADDTOUCHAREA(2, BLOCKPOS(8, 4), SCALE_BASICTILE)

            TCMD_ADDMASK_CIRCLE(1, BLOCKPOS(10, 3), Point(1.2, 1.2))

            TCMD_ADDMASK_CIRCLE(2, BLOCKPOS(8, 4), Point(1.2, 1.2))



            TCMD_HOLDCOMMAND



            TCMD_CUSTOM(1) //깜빡깜빡

            TCMD_REMOVEMASK(0)

            TCMD_REMOVETOUCHAREA(0)

            TCMD_REMOVESPRITE(0)

            TCMD_ADDMASK_RECT(1, BLOCKPOS_BETWEEN(10, 4, 8, 3), Point(SCALE_BASICTILE.x*4.2, SCALE_BASICTILE.y*3))

            TCMD_ADDTEXTFIELD("Remember!\n If something is in the way, you cannot pop!", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 140), false, false, true, eTextFieldCharacter_Cat)



            TCMD_HOLDCOMMAND



            TCMD_CUSTOM(2) //깜빡깜빡 끝

            TCMD_FINISHTUTORIAL

        }

            break;

        case eTutorialType_IngameItem_Shuffle:

        {

            TCMD_DELAYTIME(0.1)



            TCMD_ADDSKIPBUTTON

            TCMD_DRAWFADEOVERLAY_ON

            TCMD_PAUSEGAME



            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 1, eObjectMotion_GoAndBack, Point(DESIGN_WIDTH/2 + 457, 120), Point(DESIGN_WIDTH/2 + 457, 130), 0, 0.3, false, true, Point(1.0, 1.0), Point(0.5, 0.5));

            TCMD_ADDMASK_CIRCLE(2, Point(DESIGN_WIDTH/2 + 457, 40), Point(1.6, 0.9))

            TCMD_ADDTEXTFIELD("Use the Shuffle item to shuffle all blocks.",  Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 100), false, false, false, eTextFieldCharacter_Cat)

            TCMD_ADDTOUCHAREA(1, Point(DESIGN_WIDTH/2 + 457, 30), Point(1.2, 0.6))



            TCMD_HOLDCOMMAND



            TCMD_FINISHTUTORIAL

        }

            break;

        case eTutorialType_IngameItem_Hint:

        {

            TCMD_DELAYTIME(0.1)



            TCMD_ADDSKIPBUTTON

            TCMD_DRAWFADEOVERLAY_ON

            TCMD_PAUSEGAME



            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 1, eObjectMotion_GoAndBack, Point(DESIGN_WIDTH/2 + 312, 120), Point(DESIGN_WIDTH/2 + 312, 130), 0, 0.3, false, true, Point(1.0, 1.0), Point(0.5, 0.5));

            TCMD_ADDMASK_CIRCLE(2, Point(DESIGN_WIDTH/2 + 312, 40), Point(1.6, 0.9))

            TCMD_ADDTEXTFIELD("Use the Hint item to instantly find \n a pair of matching blocks that you can pop.",  Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 100), false, false, false, eTextFieldCharacter_Cat)

            TCMD_ADDTOUCHAREA(1, Point(DESIGN_WIDTH/2 + 312, 30), Point(1.2, 0.6))



            TCMD_HOLDCOMMAND



            TCMD_FINISHTUTORIAL

        }

            break;

        case eTutorialType_IngameItem_Claw:

        {

            TCMD_DELAYTIME(0.1)



            TCMD_ADDSKIPBUTTON

            TCMD_DRAWFADEOVERLAY_ON

            TCMD_PAUSEGAME



            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 1, eObjectMotion_GoAndBack, Point(DESIGN_WIDTH/2 + 167, 120), Point(DESIGN_WIDTH/2 + 167, 130), 0, 0.3, false, true, Point(1.0, 1.0), Point(0.5, 0.5));

            TCMD_ADDMASK_CIRCLE(2, Point(DESIGN_WIDTH/2 + 167, 40), Point(1.6, 0.9))

            TCMD_ADDTEXTFIELD("Use the Paw item to instantly pop \n any one pair of your choice.",  Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 100), false, false, false, eTextFieldCharacter_Cat)

            TCMD_ADDTOUCHAREA(1, Point(DESIGN_WIDTH/2 + 167, 30), Point(1.2, 0.6))



            TCMD_HOLDCOMMAND



            TCMD_REMOVESPRITE(0)

            TCMD_REMOVEMASK(0)

            TCMD_REMOVETOUCHAREA(0)

            TCMD_REMOVETEXTFIELD



            TCMD_DRAWFADEOVERLAY_OFF

            TCMD_DELAYTIME(0.6)

            TCMD_DRAWFADEOVERLAY_ON



            TCMD_ADDTEXTFIELD("Try popping any block now!",  Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 100), false, false, true, eTextFieldCharacter_Cat)



            TCMD_HOLDCOMMAND



            TCMD_REMOVETEXTFIELD

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_GoAndBack, FINGERPOS(10, 2), FINGERPOS(10, 2) + Point(0, 10), 0, 0.3, false, false, Point(1.0, 1.0), Point(0.5, 0.5));

            TCMD_ADDMASK_CIRCLE(2, BLOCKPOS(10, 2), Point(1.2, 1.2))

            TCMD_ADDTOUCHAREA(1, BLOCKPOS(10, 2), SCALE_BASICTILE)



            TCMD_HOLDCOMMAND



            TCMD_FINISHTUTORIAL

        }

            break;

        case eTutorialType_GameMode_Speed:

        {

            TCMD_DELAYTIME(0.1)



            TCMD_ADDSKIPBUTTON

            TCMD_DRAWFADEOVERLAY_ON

            TCMD_PAUSEGAME



            TCMD_ADDSPRITE("worldimg_ui_stageui_arrow.png", 1, eObjectMotion_GoAndBack, Point(DESIGN_WIDTH/2 - 163, 100), Point(DESIGN_WIDTH/2 - 163, 110), 0, 0.3, false, false, Point(1.5, 1.5), Point(0.5, 0.5));

            TCMD_ADDMASK_RECT(2, Point(DESIGN_WIDTH/2 - 318, 33), Point(3.9, 0.64))

            TCMD_ADDTEXTFIELD("There are multiple phases in this speed mode.\nClear all three phases in this stage. Enjoy!",  Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 100), true, false, true, eTextFieldCharacter_Cat)



            TCMD_HOLDCOMMAND



            TCMD_FINISHTUTORIAL



        }

            break;

        case eTutorialType_GameMode_Wall:

        {

            TCMD_DELAYTIME(0.1)



            TCMD_ADDSKIPBUTTON

            TCMD_DRAWFADEOVERLAY_ON

            TCMD_PAUSEGAME



            TCMD_ADDSPRITE("worldimg_ui_stageui_arrow.png", 1, eObjectMotion_GoAndBack, BLOCKPOS(8, 3) + Point(0, -100), BLOCKPOS(8, 3) + Point(0, -110), 0, 0.3, false, true, Point(1.5, 1.5), Point(0.5, 0.5));

            TCMD_ADDMASK_CIRCLE(2, BLOCKPOS(0, 3), Point(1.2, 1.2))

            TCMD_ADDMASK_CIRCLE(2, BLOCKPOS(2, 3), Point(1.2, 1.2))

            TCMD_ADDMASK_CIRCLE(2, BLOCKPOS(4, 3), Point(1.2, 1.2))

            TCMD_ADDMASK_CIRCLE(2, BLOCKPOS(6, 3), Point(1.2, 1.2))

            TCMD_ADDMASK_CIRCLE(2, BLOCKPOS(8, 3), Point(1.2, 1.2))

            TCMD_ADDMASK_CIRCLE(2, BLOCKPOS(10, 3), Point(1.2, 1.2))

            TCMD_ADDMASK_CIRCLE(2, BLOCKPOS(12, 3), Point(1.2, 1.2))

            TCMD_ADDMASK_CIRCLE(2, BLOCKPOS(14, 3), Point(1.2, 1.2))

            TCMD_ADDMASK_CIRCLE(2, BLOCKPOS(16, 3), Point(1.2, 1.2))

            TCMD_ADDTEXTFIELD("These are indestructable Stone Blocks.\nTry to pop around them!",  Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 160), false, false, true, eTextFieldCharacter_Cat)



            TCMD_HOLDCOMMAND



            TCMD_FINISHTUTORIAL



        }

            break;

        case eTutorialType_GameMode_Bomb:

        {

            TCMD_DELAYTIME(0.1)



            TCMD_ADDSKIPBUTTON

            TCMD_DRAWFADEOVERLAY_ON

            TCMD_PAUSEGAME



            TCMD_ADDMASK_CIRCLE(1, BLOCKPOS_BETWEEN(15, 0, 16, 0), Point(2.4, 1.2))

            TCMD_ADDMASK_CIRCLE(2, BLOCKPOS(10, 0), Point(2.4, 1.2))

            TCMD_ADDTEXTFIELD("Popping same colored Bomb Blocks \n destroys same colored Stone Blocks! \nTry the Red Bomb Blocks first!",  Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 100), false, false, false, eTextFieldCharacter_Cat)

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_Teleport, FINGERPOS(15, 0), FINGERPOS(16, 0), 0, 0.5, false, false, Point(1.0, 1.0), Point(0.5, 0.5));

            TCMD_ADDTOUCHAREA(1, BLOCKPOS(15, 0), SCALE_BASICTILE)

            TCMD_ADDTOUCHAREA(2, BLOCKPOS(16, 0), SCALE_BASICTILE)



            TCMD_HOLDCOMMAND



            TCMD_FINISHTUTORIAL



        }

            break;

        case eTutorialType_GameMode_Heart:

        {

            TCMD_DELAYTIME(1)



            TCMD_ADDSKIPBUTTON

            TCMD_DRAWFADEOVERLAY_ON

            TCMD_PAUSEGAME



            TCMD_ADDMASK_RECT(1, BLOCKPOS(8, 4), Point(SCALE_BASICTILE.x*4, SCALE_BASICTILE.y*4))

            TCMD_ADDTEXTFIELD("Red Card Heart Soldier has appeared!\nUse your finger to wipe the soldier's paint off!",  Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 160), true, false, false, eTextFieldCharacter_Cat)

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_Move, BLOCKPOS(10, 3), BLOCKPOS_BETWEEN(6, 7, 7, 6), 0, 1.1, false, false, Point(1.0, 1.0), Point(0.5, 0.5));

            TCMD_ADDTOUCHAREA(2, BLOCKPOS(8, 4), Point(SCALE_BASICTILE.x*6, SCALE_BASICTILE.y*6))



            TCMD_HOLDCOMMAND



            TCMD_REMOVETOUCHAREA(0)

            TCMD_REMOVESPRITE(0)

            TCMD_REMOVEMASK(0)



            TCMD_ADDSPRITE("worldimg_ui_stageui_arrow.png", 1, eObjectMotion_GoAndBack, Point(DESIGN_WIDTH/2 - 170, 120), Point(DESIGN_WIDTH/2 - 170, 130), 0, 0.3, false, false, Point(1.5, 1.5), Point(0.5, 0.5));

            TCMD_ADDMASK_RECT(2, Point(DESIGN_WIDTH/2 - 318, 33), Point(3.9, 0.64))

            TCMD_ADDTEXTFIELD("Whenever the bar at the bottom is filled up,\nHeart Soldier is punished with crushing hammer.\nThe bar fills up quicker if you pop blocks quickly.",  Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 130), true, false, true, eTextFieldCharacter_Cat)



            TCMD_HOLDCOMMAND



            TCMD_FINISHTUTORIAL

        }

            break;

        case eTutorialType_InGame_RepeatFailRule:

        {

            TCMD_ADDSKIPBUTTON

            TCMD_DRAWFADEOVERLAY_ON

            TCMD_PAUSEGAME



            float scale = 1.0;

            Point pivot = Point(320, 170);



            TCMD_ADDSPRITE("howtoplay0.png", 1, eObjectMotion_None, Point(DESIGN_WIDTH/2 - pivot.x, DESIGN_HEIGHT/2 + pivot.y), Point(0, 0), 0, 0, false, false, Point(scale, scale), Point(0.5, 0.5));

            TCMD_ADDSPRITE("howtoplay1.png", 1, eObjectMotion_None, Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2 + pivot.y), Point(0, 0), 0, 0, false, false, Point(scale, scale), Point(0.5, 0.5));

            TCMD_ADDSPRITE("howtoplay2.png", 1, eObjectMotion_None, Point(DESIGN_WIDTH/2 + pivot.x, DESIGN_HEIGHT/2 + pivot.y), Point(0, 0), 0, 0, false, false, Point(scale, scale), Point(0.5, 0.5));

            TCMD_ADDTEXTFIELD("Remember! You can only pop blocks that are connected \nby three or less straight lines!",  Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, -55), false, false, true, eTextFieldCharacter_Cat)



            TCMD_HOLDCOMMAND



            TCMD_FINISHTUTORIAL

        }

            break;

        case eTutorialType_InGame_OnCombo:

        {

            TCMD_ADDSKIPBUTTON

            TCMD_DRAWFADEOVERLAY_ON

            TCMD_PAUSEGAME



            TCMD_ADDTEXTFIELD("You just earned a special combo effect \n after quickly popping 5 pairs!",  Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 100), false, false, true, eTextFieldCharacter_Cat)



            TCMD_HOLDCOMMAND



            TCMD_REMOVETEXTFIELD

            IntPoint pos;

            Vector<AMBlock*> arr = GStageLayer->GetBlocks(AREA_STAGE, 0, eNormalBlockType_AllNormalType);

            pos = ((AMBlock*)arr.at(rand()%arr.size()))->pos;

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_GoAndBack, FINGERPOS(pos.x, pos.y), FINGERPOS(pos.x, pos.y) + Point(0, 10), 0, 0.3, false, false, Point(1.0, 1.0), Point(0.5, 0.5));

            TCMD_ADDMASK_CIRCLE(2, BLOCKPOS(pos.x, pos.y), Point(1.2, 1.2))

            TCMD_ADDTOUCHAREA(1, BLOCKPOS(pos.x, pos.y), SCALE_BASICTILE)



            TCMD_HOLDCOMMAND



            TCMD_REMOVESPRITE(0)

            TCMD_REMOVEMASK(0)

            TCMD_REMOVETOUCHAREA(0)

            TCMD_DRAWFADEOVERLAY_OFF



            if(GStageLayer->GetBlocks(AREA_STAGE, 0, eNormalBlockType_AllNormalType).size() > 2)

            {

                TCMD_DELAYTIME(0.9)



                TCMD_DRAWFADEOVERLAY_ON



                TCMD_ADDTEXTFIELD("Earn a special combo effect \nfor every 5 combos made in a row!\nPop blocks even faster!",  Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 100), false, false, true, eTextFieldCharacter_Cat)



                TCMD_HOLDCOMMAND

            }



            TCMD_FINISHTUTORIAL

        }

            break;

        case eTutorialType_Booster_10Sec:

        {

            TCMD_DELAYTIME(0.5)



            TCMD_ADDSKIPBUTTON

            TCMD_DRAWFADEOVERLAY_ON



            Point pt_booster = Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(53, 93);

            TCMD_ADDTEXTFIELD("Rabbit's Watch Booster will increase\ntime limit by 10 seconds. Try it out!", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, -50), true, false, false, eTextFieldCharacter_Cat)

            TCMD_ADDMASK_CIRCLE(2, pt_booster, Point(1.5, 1.5))

            TCMD_ADDTOUCHAREA(1, pt_booster, Point(1, 1))

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_GoAndBack, pt_booster + Point(0, 100), pt_booster + Point(0, 100) + Point(0, 10), 0, 0.3, false, true, Point(1.0, 1.0), Point(0.5, 0.5));



            TCMD_HOLDCOMMAND



            TCMD_REMOVETEXTFIELD

            TCMD_REMOVETOUCHAREA(0)

            TCMD_REMOVESPRITE(0)

            TCMD_REMOVEMASK(0)



            Point pt_booster2 = Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(-291, 85);

            Point pt_boosterdesc = Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(-192, -62);

            TCMD_ADDMASK_CIRCLE(1, pt_booster2, Point(1.5, 1.5))

            TCMD_ADDMASK_RECT(2, pt_boosterdesc, Point(3.35, 1.7))

            TCMD_DELAYTIME(1.5)



            TCMD_REMOVEMASK(0)

            TCMD_ADDTEXTFIELD("Hooray! You've got your booster! \n Now let's play the stage!", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 100), true, false, false, eTextFieldCharacter_Cat)

            Point pt_startbtn = Point(DESIGN_WIDTH/2, 133);

            TCMD_ADDMASK_CIRCLE(1, pt_startbtn, Point(3, 1.2))

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_GoAndBack, pt_startbtn + Point(-160, 0), pt_startbtn + Point(-160, 0) + Point(10, 0), 90, 0.3, false, false, Point(1.0, 1.0), Point(0.5, 0.5));

            TCMD_ADDTOUCHAREA(1, pt_startbtn, Point(3, 1));



            TCMD_HOLDCOMMAND



            TCMD_FINISHTUTORIAL

        }

            break;

        case eTutorialType_Booster_EasyCombo:

        {

            TCMD_DELAYTIME(0.5)



            TCMD_ADDSKIPBUTTON

            TCMD_DRAWFADEOVERLAY_ON



            Point pt_booster = Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(173, 93);

            TCMD_ADDTEXTFIELD("Combo Drink Booster will increase time\nallowed between each combo. Try it out!", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, -50), true, false, false, eTextFieldCharacter_Cat)

            TCMD_ADDMASK_CIRCLE(2, pt_booster, Point(1.5, 1.5))

            TCMD_ADDTOUCHAREA(1, pt_booster, Point(1, 1))

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_GoAndBack, pt_booster + Point(0, 100), pt_booster + Point(0, 100) + Point(0, 10), 0, 0.3, false, true, Point(1.0, 1.0), Point(0.5, 0.5));



            TCMD_HOLDCOMMAND



            TCMD_REMOVETEXTFIELD

            TCMD_REMOVETOUCHAREA(0)

            TCMD_REMOVESPRITE(0)

            TCMD_REMOVEMASK(0)



            Point pt_booster2 = Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(-291, 85);

            Point pt_boosterdesc = Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(-192, -62);

            TCMD_ADDMASK_CIRCLE(1, pt_booster2, Point(1.5, 1.5))

            TCMD_ADDMASK_RECT(2, pt_boosterdesc, Point(3.35, 1.7))

            TCMD_DELAYTIME(1.5)



            TCMD_REMOVEMASK(0)

            TCMD_ADDTEXTFIELD("Hooray! You've got your booster! \n Now let's play the stage!", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 100), true, false, false, eTextFieldCharacter_Cat)

            Point pt_startbtn = Point(DESIGN_WIDTH/2, 133);

            TCMD_ADDMASK_CIRCLE(1, pt_startbtn, Point(3, 1.2))

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_GoAndBack, pt_startbtn + Point(-160, 0), pt_startbtn + Point(-160, 0) + Point(10, 0), 90, 0.3, false, false, Point(1.0, 1.0), Point(0.5, 0.5));

            TCMD_ADDTOUCHAREA(1, pt_startbtn, Point(3, 1));



            TCMD_HOLDCOMMAND



            TCMD_FINISHTUTORIAL



        }

            break;

        case eTutorialType_Booster_MoreCouple:

        {

            TCMD_DELAYTIME(0.5)



            TCMD_ADDSKIPBUTTON

            TCMD_DRAWFADEOVERLAY_ON



            Point pt_booster = Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(293, 93);

            TCMD_ADDTEXTFIELD("Combo Party Booster will make\nmatching blocks easier. Try it out!", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, -50), true, false, false, eTextFieldCharacter_Cat)

            TCMD_ADDMASK_CIRCLE(2, pt_booster, Point(1.5, 1.5))

            TCMD_ADDTOUCHAREA(1, pt_booster, Point(1, 1))

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_GoAndBack, pt_booster + Point(0, 100), pt_booster + Point(0, 100) + Point(0, 10), 0, 0.3, false, true, Point(1.0, 1.0), Point(0.5, 0.5));



            TCMD_HOLDCOMMAND



            TCMD_REMOVETEXTFIELD

            TCMD_REMOVETOUCHAREA(0)

            TCMD_REMOVESPRITE(0)

            TCMD_REMOVEMASK(0)



            Point pt_booster2 = Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(-291, 85);

            Point pt_boosterdesc = Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(-192, -62);

            TCMD_ADDMASK_CIRCLE(1, pt_booster2, Point(1.5, 1.5))

            TCMD_ADDMASK_RECT(2, pt_boosterdesc, Point(3.35, 1.7))

            TCMD_DELAYTIME(1.5)



            TCMD_REMOVEMASK(0)

            TCMD_ADDTEXTFIELD("Hooray! You've got your booster! \n Now let's play the stage!", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 100), true, false, false, eTextFieldCharacter_Cat)

            Point pt_startbtn = Point(DESIGN_WIDTH/2, 133);

            TCMD_ADDMASK_CIRCLE(1, pt_startbtn, Point(3, 1.2))

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_GoAndBack, pt_startbtn + Point(-160, 0), pt_startbtn + Point(-160, 0) + Point(10, 0), 90, 0.3, false, false, Point(1.0, 1.0), Point(0.5, 0.5));

            TCMD_ADDTOUCHAREA(1, pt_startbtn, Point(3, 1));



            TCMD_HOLDCOMMAND



            TCMD_FINISHTUTORIAL



        }

            break;

        case eTutorialType_EpisodeUnlock:

        {

            TCMD_DELAYTIME(0.7)



            TCMD_DRAWFADEOVERLAY_ON



            TCMD_ADDTEXTFIELD("In order to advance to the next episode,\nyou need 3 keys! You can either ask your\nfriends for them or buy with your Crystals.", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 220), true, false, true, eTextFieldCharacter_Cat)

            TCMD_ADDMASK_RECT(1, Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 41), Point(4.5, 1.5))

            TCMD_ADDMASK_CIRCLE(2, Point(DESIGN_WIDTH/2 - 116, 90), Point(2.1, 1.2))

            TCMD_ADDMASK_CIRCLE(3, Point(DESIGN_WIDTH/2 + 116, 90), Point(2.1, 1.2))



            TCMD_HOLDCOMMAND



            TCMD_REMOVEMASK(0)

            TCMD_REMOVETEXTFIELD

            TCMD_CUSTOM(0) //열쇠 메세지주고 에피소드팝업창닫기

            TCMD_DELAYTIME(0.6)



            Point pt_menubtn = Point(1160 - SCREENGAP_WIDTH, 80);

            TCMD_ADDTEXTFIELD("We've prepared 3 keys for you!\nFirst, tap on the menu.", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 100), false, false, false, eTextFieldCharacter_Cat)

            TCMD_ADDMASK_CIRCLE(1, pt_menubtn, Point(1.8, 1.8))

            TCMD_ADDTOUCHAREA(1, pt_menubtn + Point(50, -23), Point(1.6, 0.9))

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_GoAndBack, pt_menubtn + Point(0, 100), pt_menubtn + Point(0, 110), 0, 0.3, false, true, Point(1.0, 1.0), Point(0.5, 0.5));



            TCMD_HOLDCOMMAND



            TCMD_REMOVEALL

            TCMD_DELAYTIME(0.6)



            Point pt_msgboxbtn = Point(811 - SCREENGAP_WIDTH, 57);

            TCMD_ADDTEXTFIELD("Then, tap on the message box.\nCheck your messages here!", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 100), false, false, false, eTextFieldCharacter_Cat)

            TCMD_ADDMASK_CIRCLE(1, pt_msgboxbtn + Point(0, 15), Point(1.5, 1.5))

            TCMD_ADDTOUCHAREA(1, pt_msgboxbtn, Point(0.7, 0.7))

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_GoAndBack, pt_msgboxbtn + Point(0, 100), pt_msgboxbtn + Point(0, 110), 0, 0.3, false, true, Point(1.0, 1.0), Point(0.5, 0.5));



            TCMD_HOLDCOMMAND

            TCMD_REMOVEALL



            TCMD_DELAYTIME(0.7)

            TCMD_ADDTEXTFIELD("Get your 3 keys now!", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, -50), true, false, false, eTextFieldCharacter_Cat)

            TCMD_ADDMASK_RECT(1, Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(2, 77), Point(7.5, 2.9))

            TCMD_ADDMASK_CIRCLE(2, Point(DESIGN_WIDTH/2 - 254, 90), Point(2.5, 1.3))

            TCMD_ADDTOUCHAREA(1, Point(DESIGN_WIDTH/2 - 254, 90), Point(2.2, 0.5))

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_GoAndBack, Point(DESIGN_WIDTH/2 - 254, 90) + Point(160, 0), Point(DESIGN_WIDTH/2 - 254, 90) + Point(170, 0), -90, 0.3, false, false, Point(1.0, 1.0), Point(0.5, 0.5));



            TCMD_HOLDCOMMAND



            TCMD_REMOVEMASK(2)

            TCMD_REMOVESPRITE(0)

            TCMD_REMOVETOUCHAREA(0)

            TCMD_REMOVETEXTFIELD

            TCMD_ADDMASK_CIRCLE(3, Point(DESIGN_WIDTH/2 + 280, 90), Point(2.0, 1.3))

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_GoAndBack, Point(DESIGN_WIDTH/2 + 280, 90) + Point(140, 0), Point(DESIGN_WIDTH/2 + 280, 90) + Point(150, 0), -90, 0.3, false, false, Point(1.0, 1.0), Point(0.5, 0.5));

            TCMD_ADDTOUCHAREA(1, Point(DESIGN_WIDTH/2 + 280, 90), Point(1.6, 0.5))



            TCMD_HOLDCOMMAND



            TCMD_REMOVEALL



            TCMD_DELAYTIME(0.6)



            CCLOG("GCommon->scene_world->sv->getContentOffset().y : %f", GCommon->scene_world->sv->getContentOffset().y);

            CCLOG("GCommon->scene_world->btn_gate->getPosition().y : %f", GCommon->scene_world->btn_gate->getPosition().y);

            Point pt_gateholl = Point(DESIGN_WIDTH/2, 0) + Point(0, GCommon->scene_world->sv->getContentOffset().y + GCommon->scene_world->btn_gate->getPosition().y);



            TCMD_CUSTOM(1) //월드맵 스크롤 정지

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_GoAndBack, pt_gateholl + Point(0, -150), pt_gateholl + Point(0, -160), 0, 0.3, false, false, Point(1.0, 1.0), Point(0.5, 0.5));

            TCMD_ADDTOUCHAREA(1, pt_gateholl, Point(2, 2))

            TCMD_ADDMASK_CIRCLE(3, pt_gateholl, Point(3, 3))

            TCMD_ADDTEXTFIELD("Meow! \nYou have just unlocked the next episode! \nEnjoy your Tip Tap Pop!", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 150), true, false, false, eTextFieldCharacter_Cat)



            TCMD_HOLDCOMMAND



            TCMD_CUSTOM(2) //월드맵 스크롤 정지 재개

            TCMD_FINISHTUTORIAL

        }

            break;

        case eTutorialType_WorldScene_Intro:

        {

            TCMD_CUSTOM(0) //월드맵 스크롤 높이고 떨어지는 스크롤 시작



            Point pt_alice = Point(420, 200);



            TCMD_ADDSPRITE("common_alice_falling.png", 0, eObjectMotion_Tramble, pt_alice, Point(0, 0), 10, 0.2, false, false, Point(1.2, 1.2), Point(0.5, 0.5));



            TCMD_DELAYTIME(DELAY_ALICEFALLING_TUTORIAL)



            TCMD_REMOVESPRITE(0)

            TCMD_CUSTOM(1) //화면떨림

            TCMD_ADDSPRITE("common_alice_fallen.png", 0, eObjectMotion_None, pt_alice, Point(0, 0), 0, 0, false, false, Point(1.2, 1.2), Point(0.5, 0.5));

            TCMD_DELAYTIME(0.7)

            TCMD_REMOVESPRITE(0)

            TCMD_ADDSPRITE("common_alice_fallen2.png", 0, eObjectMotion_Tramble, pt_alice, Point(0, 0), 6, 0.1, false, false, Point(1.2, 1.2), Point(0.5, 0.5));

            TCMD_DELAYTIME(1.0)



            TCMD_REMOVESPRITE(0)

            TCMD_DRAWFADEOVERLAY_ON

            TCMD_ADDSKIPBUTTON



            TCMD_ADDTEXTFIELD("Where… Where am I?\nI want to go home!", Point(DESIGN_WIDTH/2 - 21, DESIGN_HEIGHT/2 + 44), false, false, true, eTextFieldCharacter_AliceCryAni)



            TCMD_HOLDCOMMAND



            TCMD_ADDSPRITE("commonui_bmpopup_sp_alice2.png", 0, eObjectMotion_None, pt_alice + Point(-6, 21), Point(0, 0), 0, 0, true, false, Point(1, 1), Point(0.5, 0.5));

            TCMD_ADDTEXTFIELD("Welcome to my Tip Tap Wonderland!\nIf you wish to go home, you must\ndefeat me, the Queen of Hearts!", Point(DESIGN_WIDTH/2 - 30, DESIGN_HEIGHT/2 + 109), true, false, true, eTextFieldCharacter_QueenNormalAni)



            TCMD_HOLDCOMMAND



            TCMD_ADDTEXTFIELD("Come and defeat me if you can!", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2 + 137), true, false, false, eTextFieldCharacter_QueenWink)



            TCMD_CUSTOM(2) //숨겼던 오브젝트들 보여주기

            TCMD_CUSTOM(3) //월드맵 스크롤 정지



            Point pt_stage0 = Point(DESIGN_WIDTH/2 - 16, 364);

            TCMD_ADDSPRITE("commonui_tutorial_sp_finger.png", 2, eObjectMotion_GoAndBack, pt_stage0 + Point(0, -150), pt_stage0 + Point(0, -160), 0, 0.3, false, false, Point(1.0, 1.0), Point(0.5, 0.5));

            TCMD_ADDTOUCHAREA(1, pt_stage0, Point(2, 2))

            TCMD_ADDMASK_CIRCLE(3, pt_stage0, Point(3, 3))



            TCMD_HOLDCOMMAND



            TCMD_CUSTOM(4) //월드맵 스크롤 정지 재개



            TCMD_FINISHTUTORIAL

        }

            break;

        case eTutorialType_WorldScene_FreeFullHeart:

        {

            TCMD_DRAWFADEOVERLAY_ON



            string text = "";

            if(GameSetting::GetCustomIntValue(LB_GAMESETTING_COUNTWORLDTUTORIAL_FREEHEARTFULL) == 0)

            {

                text = " I will give you Full Lives until you get to\nStage 30! Get through challenges easily!";

                GameSetting::SetCustomIntValue(LB_GAMESETTING_COUNTWORLDTUTORIAL_FREEHEARTFULL, GameSetting::GetCustomIntValue(LB_GAMESETTING_COUNTWORLDTUTORIAL_FREEHEARTFULL) + 1);

            }

            else if(GameSetting::GetCustomIntValue(LB_GAMESETTING_COUNTWORLDTUTORIAL_FREEHEARTFULL) == 1)

            {

                text = "Here’s another gift of Full Lives\nfor you to continue! Good luck!";

                GameSetting::SetCustomIntValue(LB_GAMESETTING_COUNTWORLDTUTORIAL_FREEHEARTFULL, GameSetting::GetCustomIntValue(LB_GAMESETTING_COUNTWORLDTUTORIAL_FREEHEARTFULL) + 1);

            }

            else if(GameSetting::GetCustomIntValue(LB_GAMESETTING_COUNTWORLDTUTORIAL_FREEHEARTFULL) == 2)

            {

                text = "Having fun? You're doing great!\nHere is another Full Lives to help you!";

                GameSetting::SetCustomIntValue(LB_GAMESETTING_COUNTWORLDTUTORIAL_FREEHEARTFULL, GameSetting::GetCustomIntValue(LB_GAMESETTING_COUNTWORLDTUTORIAL_FREEHEARTFULL) + 1);

            }

            else

            {

                text = "It’s a bit hard, isn’t it?\nBut no worries, here is your Full Lives!";

            }



            TCMD_ADDTEXTFIELD(text.c_str(), Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 100), false, false, true, eTextFieldCharacter_Cat)



            TCMD_HOLDCOMMAND

            TCMD_CUSTOM(0) //하트 주고 하트를 준것으로 저장

            TCMD_DELAYTIME(0.9)



            TCMD_FINISHTUTORIAL

        }

            break;

        case eTutorialType_FirstBeginQueenStage:

        {

            TCMD_DELAYTIME(0.1)



            TCMD_PAUSEGAME

            TCMD_DRAWFADEOVERLAY_ON



            TCMD_ADDSKIPBUTTON

            TCMD_ADDTEXTFIELD("I see you made it this far. But this stage\nmight be super hard for you. Only I, the\nQueen of Hearts, have ever beat it!", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(0, 130), false, false, true, eTextFieldCharacter_QueenWink)



            TCMD_HOLDCOMMAND



            TCMD_FINISHTUTORIAL

        }

            break;

        default:

        {



        }

            break;

    }



    DoTutorialCmd();

}













AMTutorialLayer::AMTutorialLayer():cur_TutorialCmdObject(TutorialCmdObject(eTutorialCMD_None))

{

    NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(AMTutorialLayer::DoTutorialCmdAfterDelay), AM_NOTI_TUTORIAL_DOCOMMANDAFTERDELAY, NULL);



    auto listener1 = EventListenerTouchOneByOne::create();

    listener1->setSwallowTouches(true);



    listener1->onTouchBegan = CC_CALLBACK_2(AMTutorialLayer::onTouchBegan, this);

    listener1->onTouchMoved = CC_CALLBACK_2(AMTutorialLayer::onTouchMoved, this);

    listener1->onTouchEnded = CC_CALLBACK_2(AMTutorialLayer::onTouchEnded, this);



    getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener1, this);



    rendertextrue = RenderTexture::create(DESIGN_WIDTH, DESIGN_HEIGHT, Texture2D::PixelFormat::RGBA8888);

    rendertextrue->setPosition(Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2));

    addChild(rendertextrue, 0);

    bOverlayShown = false;



    node_fortextfield = Node::create();

    addChild(node_fortextfield, 1);

//    node_forarrow = Node::create();

//    addChild(node_forarrow, 2);

    node_forsprite = Node::create();

    addChild(node_forsprite, 3);

//    node_forfinger = Node::create();

    //    addChild(node_forfinger, 4);

    node_forskipbutton = Node::create();

    addChild(node_forskipbutton, 5);

    node_fortoucharea_debug = Node::create();

    addChild(node_fortoucharea_debug, 6);



    arr_mask = Array::create();

    arr_mask->retain();

    arr_toucharea = Array::create();

    arr_toucharea->retain();



    cur_TutorialType = eTutorialType_None;

}



AMTutorialLayer::~AMTutorialLayer()

{

    NotificationCenter::getInstance()->removeAllObservers(this);



    l_TutorialCmd.clear();



    arr_mask->release();

    arr_mask = nullptr;

    arr_toucharea->release();

    arr_toucharea = nullptr;



    rendertextrue = nullptr;

    node_fortextfield = nullptr;

//    node_forarrow = nullptr;

    node_forsprite = nullptr;

//    node_forfinger = nullptr;

    node_forskipbutton = nullptr;

    node_fortoucharea_debug = nullptr;

}





bool AMTutorialLayer::onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *event)

{

    Point touchpos = touch->getLocation();





    CCLOG("touch (%f, %f)", touchpos.x, touchpos.y);



    touchpos = touchpos + Point(SCREENGAP_WIDTH, 0);

    for(int i = 0 ; i < arr_toucharea->count() ; i++)

    {

        LayerAreaRectObject *laro = (LayerAreaRectObject*)arr_toucharea->getObjectAtIndex(i);

        CCLOG("laro (%f, %f)", laro->pos.x, laro->pos.y);



        if(touchpos.x > laro->pos.x - SIZE_BASICAREA.width*laro->scale.x*0.5

           && touchpos.x < laro->pos.x + SIZE_BASICAREA.width*laro->scale.x*0.5

           && touchpos.y > laro->pos.y - SIZE_BASICAREA.height*laro->scale.y*0.5

           && touchpos.y < laro->pos.y + SIZE_BASICAREA.height*laro->scale.y*0.5)

        {

//            distance_add = 0;

            return false;

        }

    }



    return true;

}





void AMTutorialLayer::onTouchMoved(cocos2d::Touch *touch, cocos2d::Event *event)

{

    /*

    CCLOG("2222");



    Point start = touch->getLocation();

    Point end = touch->getPreviousLocation();



    float distance = start.getDistance(end);

    distance_add += distance;



    if(cur_TutorialType == eTutorialType_GameMode_Heart && distance_add > 700)

    {

        DoTutorialCmd();

    }*/

}





void AMTutorialLayer::onTouchEnded(cocos2d::Touch *touch, cocos2d::Event *event)

{

}







void AMTutorialLayer::DoTutorialCmdAfterDelay(Ref *o)

{

    runAction(Sequence::create(DelayTime::create(((Node*)o)->getTag()/100.0), CallFuncN::create(CC_CALLBACK_0(AMTutorialLayer::DoTutorialCmd, this)), NULL));

}

void AMTutorialLayer::DoTutorialCmdAfterDelay(float delay)

{

    runAction(Sequence::create(DelayTime::create(delay), CallFuncN::create(CC_CALLBACK_0(AMTutorialLayer::DoTutorialCmd, this)), NULL));

}



void AMTutorialLayer::RefreshOverlay()

{

    rendertextrue->clear(0, 0, 0, 0);

    rendertextrue->begin();

    Sprite *fade = GCommon->CreateSpriteWithSpriteFrameName("commonui_tutorial_mask_roundrect.png", Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2), Point(0.5, 0.5), 15);

    fade->setColor(Color3B(0, 0, 0));

    fade->setOpacity(180);

    bOverlayShown = true;

    fade->visit();



    for(int i = 0 ; i < arr_mask->count() ; i++)

    {

        BlendFunc b;

        b.src = GL_ZERO;

        b.dst = GL_ONE_MINUS_SRC_ALPHA;



        LayerAreaRectObject *laro = (LayerAreaRectObject*)arr_mask->getObjectAtIndex(i);

        string imgfile = "";

        switch(laro->MaskType)

        {

            case eMaskType_Circle:

            {

                imgfile = "commonui_tutorial_mask_circle.png";

                Sprite *sp_circle = GCommon->CreateSpriteWithSpriteFrameName(imgfile, laro->pos);

                sp_circle->setScale(laro->scale.x, laro->scale.y);

                sp_circle->setBlendFunc(b);

                sp_circle->visit();

            }

                break;

            case eMaskType_RoundRect:

            {

                if(0) //old version (3.0alpha style)

                {

                    imgfile = "commonui_tutorial_mask_roundrect.png";

                    Scale9Sprite *sp_rect = Scale9Sprite::createWithSpriteFrameName(imgfile.c_str(), Rect(30, 30, 30, 30));

                    sp_rect->setPosition(laro->pos);

                    sp_rect->setAnchorPoint(Point(0.5, 0.5));

                    sp_rect->setPreferredSize(Size(SIZE_BASICAREA.width*laro->scale.x, SIZE_BASICAREA.height*laro->scale.y));

                    //check30

                    if(sp_rect && sp_rect->getChildrenCount())

                        ((SpriteBatchNode*)sp_rect->getChildren().at(sp_rect->getChildrenCount()-1))->setBlendFunc(b);

                    sp_rect->cocos2d::Node::visit();

                    //check30

                }

                else //temp solution

                {

                    imgfile = "commonui_tutorial_mask_roundrect.png";

                    Sprite *sp_circle = GCommon->CreateSpriteWithSpriteFrameName(imgfile, laro->pos);

                    sp_circle->setAnchorPoint(Point(0.5, 0.5));

                    sp_circle->setScale(laro->scale.x, laro->scale.y);

                    sp_circle->setBlendFunc(b);

                    sp_circle->visit();

                }

            }

                break;

        }

    }



    rendertextrue->end();

}



void AMTutorialLayer::DoTutorialCmd()

{

    if(l_TutorialCmd.size() == 0)

        return;



    cur_TutorialCmdObject = *(l_TutorialCmd.begin());

    l_TutorialCmd.pop_front();



//    if(cur_TutorialType == eTutorialType_InGame_BasicRule && l_TutorialCmd.size() == 9)

//    {

//    }



    CCLOG("[-------DoTutorialCmd : %d] list size : %d", cur_TutorialCmdObject.CMD, (int)l_TutorialCmd.size());



    switch(cur_TutorialCmdObject.CMD)

    {

        case eTutorialCMD_None:

        {



        }

            break;

        case eTutorialCMD_PauseGame:

        {

            if(GCommon->SceneType == eScene_Game)

            {

                if(!cur_TutorialCmdObject.bReverse)

                    GPopupLayer->PauseGame();

                else

                    GPopupLayer->ResumeGame();

            }

            DoTutorialCmd();

        }

            break;

//        case eTutorialCMD_SetLayerVisible:

//        {

//            DoTutorialCmd();

//            

//        }

//            break;

        case eTutorialCMD_DelayTime:

        {

            DoTutorialCmdAfterDelay(cur_TutorialCmdObject.delay);

        }

            break;

        case eTutorialCMD_DrawFadeOverlay:

        {

            if(!cur_TutorialCmdObject.bReverse)

            {

                RefreshOverlay();

            }

            else

            {

                rendertextrue->clear(0, 0, 0, 0);

            }

            DoTutorialCmd();

        }

            break;

        case eTutorialCMD_AddMask:

        {

            if(!cur_TutorialCmdObject.bReverse)

            {

                LayerAreaRectObject *laro = new LayerAreaRectObject;

                laro->autorelease();



                laro->tag = cur_TutorialCmdObject.tag;

                laro->pos = cur_TutorialCmdObject.pt1;

                laro->scale = cur_TutorialCmdObject.scale;

                laro->MaskType = (eMaskType)cur_TutorialCmdObject.ObjectMotion;

                arr_mask->addObject(laro);



                if(bOverlayShown)

                    RefreshOverlay();

                else

                    rendertextrue->clear(0, 0, 0, 0);

            }

            else

            {

                if(cur_TutorialCmdObject.tag == 0)

                {

                    arr_mask->removeAllObjects();

                }

                else

                {

                    for(int i = 0 ; i < arr_mask->count() ; i++)

                    {

                        LayerAreaRectObject *laro = (LayerAreaRectObject*)arr_mask->getObjectAtIndex(i);

                        if(cur_TutorialCmdObject.tag == laro->tag)

                        {

                            arr_mask->removeObject(laro);

                            break;

                        }

                    }

                }



                RefreshOverlay();

            }



            DoTutorialCmd();



        }

            break;

        case eTutorialCMD_AddTouchableArea:

        {

            if(!cur_TutorialCmdObject.bReverse)

            {

                LayerAreaRectObject *laro = new LayerAreaRectObject;

                laro->autorelease();



                laro->tag = cur_TutorialCmdObject.tag;

                laro->pos = cur_TutorialCmdObject.pt1;

                laro->scale = cur_TutorialCmdObject.scale;

                arr_toucharea->addObject(laro);



                Sprite *sp = GCommon->CreateSpriteWithSpriteFrameName("commonui_tutorial_touchtest.png", cur_TutorialCmdObject.pt1);

                sp->setScale(cur_TutorialCmdObject.scale.x, cur_TutorialCmdObject.scale.y);

                sp->setTag(cur_TutorialCmdObject.tag);

                node_fortoucharea_debug->addChild(sp);

#if DEBUG_TOUCHAREA == 0

                sp->setOpacity(0);

#endif

            }

            else

            {

                if(cur_TutorialCmdObject.tag == 0)

                {

                    arr_toucharea->removeAllObjects();

                    node_fortoucharea_debug->removeAllChildren();

                }

                else

                {

                    for(int i = 0 ; i < arr_toucharea->count() ; i++)

                    {

                        LayerAreaRectObject *laro = (LayerAreaRectObject*)arr_toucharea->getObjectAtIndex(i);

                        if(cur_TutorialCmdObject.tag == laro->tag)

                        {

                            arr_toucharea->removeObject(laro);

                            break;

                        }

                    }



                    Sprite *sp = (Sprite*)node_fortoucharea_debug->getChildByTag(cur_TutorialCmdObject.tag);

                    if(sp)

                        sp->removeFromParent();

                }

            }



            DoTutorialCmd();

        }

            break;

        case eTutorialCMD_AddTextField:

        {

            if(!cur_TutorialCmdObject.bReverse)

            {

                node_fortextfield->removeFromParent();

                node_fortextfield = Node::create();

                addChild(node_fortextfield, 1);



                IntPoint pivot = IntPoint(1, 1);

                if(cur_TutorialCmdObject.bFlipedX)

                    pivot.x = -1;

                if(cur_TutorialCmdObject.bFlipedY)

                    pivot.y = -1;



                Sprite *character = nullptr;



                Point pt_character = Point(0, 0);



                if(cur_TutorialCmdObject.text.compare("") != 0)

                {

                    Label *lb_text = GCommon->CreateLabel(cur_TutorialCmdObject.text, FONT_GOTHICBOLD, 30, cur_TutorialCmdObject.pt1, Point(0.5, 0.5), Color3B(77, 46, 6));

                    node_fortextfield->addChild(lb_text, 3);

//                    lb_text->setPosition(adjust_custom + lb_text->getPosition() + Point((lb_text->getContentSize().width/2 + 50)*pivot.x, (lb_text->getContentSize().height/2 + 150)*pivot.y));



                    pt_character = cur_TutorialCmdObject.pt1 - Point((lb_text->getContentSize().width/2 + 50) * pivot.x, (lb_text->getContentSize().height/2 + 150) * pivot.y);



                    Scale9Sprite *sp_tile = Scale9Sprite::createWithSpriteFrameName("commonui_tutorial_sp_textfield.png", Rect(20, 20, 20, 20));

                    sp_tile->setPreferredSize(lb_text->getContentSize() + Size(100, 50));

                    sp_tile->setAnchorPoint(Point(0.5, 0.5));

                    sp_tile->setPosition(cur_TutorialCmdObject.pt1);

                    sp_tile->setPosition(lb_text->getPosition());

                    node_fortextfield->addChild(sp_tile, 1);



                    Sprite *sp_tile_tag = GCommon->CreateSpriteWithSpriteFrameName("commonui_tutorial_sp_textfield_tag.png", Point(0, 0));

                    if(cur_TutorialCmdObject.bFlipedX)

                        sp_tile_tag->setPosition(Point(sp_tile->getContentSize().width, 0));

                    sp_tile_tag->setPosition(sp_tile_tag->getPosition() + Point(140*pivot.x, -11));

                    sp_tile_tag->setFlippedX(cur_TutorialCmdObject.bFlipedX);

                    sp_tile->addChild(sp_tile_tag, 1000);



                    if(cur_TutorialCmdObject.bOKBtn)

                    {

                        AMControlButton *btn_skip = AMControlButton::CreateWithScale9Sprite(Scale9Sprite::createWithSpriteFrameName("common_ui_sidepopup_btn_yellow.png", Rect(15, 12, 83, 12)), GCommon->CreateLabel("OK", FONT_MAIN, 34, Point(0, 0), Point(0, 0), Color3B(107, 60, 0)), true);

                        btn_skip->setPreferredSize(Size(150, 50));

                        btn_skip->setAnchorPoint(Point(0.5, 0.5));



                        btn_skip->addTargetWithActionForControlEvents(this, cccontrol_selector(AMTutorialLayer::OnBtn_OK), Control::EventType::TOUCH_UP_INSIDE);

                        sp_tile->addChild(btn_skip);



                        if(!cur_TutorialCmdObject.bFlipedX)

                            btn_skip->setPosition(Point(sp_tile->getContentSize().width, 0));

                        btn_skip->setPosition(btn_skip->getPosition() + Point(-80*pivot.x, -27));

                    }

                }



                switch(cur_TutorialCmdObject.tag)

                {

                    case eTextFieldCharacter_Cat:

                    {

                        character = GCommon->CreateSpriteWithSpriteFrameName("commonui_tutorial_sp_cat.png", pt_character);

                        node_fortextfield->addChild(character);

                        character->runAction(AMMoveByUpDown(0.4, character->getPosition(), Point(0, 5)));

                    }

                        break;

                    case eTextFieldCharacter_AliceCryAni:

                    {

                        character = Sprite::createWithSpriteFrameName("gameblock_0empty.png");

                        character->setPosition(pt_character);

                        character->setFlippedX(true);

                        node_fortextfield->addChild(character);



                        Animation *ani = Animation::create();



                        ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("commonui_bmpopup_sp_alice1.png"));

                        ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("commonui_bmpopup_sp_alice2.png"));



                        float delay_cut = 0.4f;

                        ani->setDelayPerUnit(delay_cut);

                        ani->setLoops(kRepeatForever);

                        character->runAction(Animate::create(ani));

                    }

                        break;

                    case eTextFieldCharacter_QueenNormalAni:

                    {

                        character = Sprite::createWithSpriteFrameName("gameblock_0empty.png");

                        character->setPosition(pt_character);

                        node_fortextfield->addChild(character);



                        Animation *ani = Animation::create();



                        ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("common_balice_normal1.png"));

                        ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("common_balice_normal2.png"));



                        float delay_cut = 0.6f;

                        ani->setDelayPerUnit(delay_cut);

                        ani->setLoops(kRepeatForever);

                        character->runAction(Animate::create(ani));

                    }

                        break;

                    case eTextFieldCharacter_QueenWink:

                    {

                        character = GCommon->CreateSpriteWithSpriteFrameName("common_balice_wink.png", pt_character);

                        node_fortextfield->addChild(character);

                        if(cur_TutorialType == eTutorialType_WorldScene_Intro)

                            character->setPosition(character->getPosition() + Point(0, -60));

                    }

                        break;

                }

            }

            else

            {

                node_fortextfield->removeFromParent();

                node_fortextfield = Node::create();

                addChild(node_fortextfield, 1);

            }





            DoTutorialCmd();

        }

            break;

        case eTutorialCMD_AddSprite:

        {

            if(!cur_TutorialCmdObject.bReverse)

            {

                Sprite *sp = nullptr;

                if(SpriteFrameCache::getInstance()->getSpriteFrameByName(cur_TutorialCmdObject.filepath))

                {

                    sp = Sprite::createWithSpriteFrameName(cur_TutorialCmdObject.filepath);

                }

                else

                {

                    sp = Sprite::create(cur_TutorialCmdObject.filepath);

                }

                sp->setPosition(cur_TutorialCmdObject.pt1);

                sp->setTag(cur_TutorialCmdObject.tag);

                sp->setFlippedX(cur_TutorialCmdObject.bFlipedX);

                sp->setFlippedY(cur_TutorialCmdObject.bFlipedY);

                sp->setRotation(cur_TutorialCmdObject.rotation);

                sp->setScale(cur_TutorialCmdObject.scale.x, cur_TutorialCmdObject.scale.y);

                sp->setAnchorPoint(cur_TutorialCmdObject.anchor);

                node_forsprite->addChild(sp);



                switch(cur_TutorialCmdObject.ObjectMotion)

                {

                    case eObjectMotion_None:

                    {



                    }

                        break;

                    case eObjectMotion_GoAndBack:

                    {

                        sp->runAction(AMMoveByUpDown(cur_TutorialCmdObject.delay, sp->getPosition(), cur_TutorialCmdObject.pt1 - cur_TutorialCmdObject.pt2));

                    }

                        break;

                    case eObjectMotion_Teleport:

                    {

                        sp->runAction(Repeat::create(Sequence::create(DelayTime::create(cur_TutorialCmdObject.delay), CallFuncN::create(CC_CALLBACK_1(AMTutorialLayer::SetSpritePos, this, cur_TutorialCmdObject.pt2)), DelayTime::create(cur_TutorialCmdObject.delay), CallFuncN::create(CC_CALLBACK_1(AMTutorialLayer::SetSpritePos, this, cur_TutorialCmdObject.pt1)), NULL), kRepeatForever));

                    }

                        break;

                    case eObjectMotion_Move:

                    {

                        sp->runAction(Repeat::create(Sequence::create(MoveTo::create(cur_TutorialCmdObject.delay, cur_TutorialCmdObject.pt2), CallFuncN::create(CC_CALLBACK_1(AMTutorialLayer::SetSpritePos, this, cur_TutorialCmdObject.pt1)), NULL), kRepeatForever));

                    }

                        break;

                    case eObjectMotion_Tramble:

                    {

                        sp->setRotation(cur_TutorialCmdObject.rotation * 0.5);

                        sp->runAction(Repeat::create(Sequence::create(RotateBy::create(cur_TutorialCmdObject.delay, -cur_TutorialCmdObject.rotation), RotateBy::create(cur_TutorialCmdObject.delay, cur_TutorialCmdObject.rotation), NULL), kRepeatForever));

                    }

                        break;



                }

            }

            else

            {

                if(cur_TutorialCmdObject.tag == 0)

                {

                    node_forsprite->removeAllChildren();

                }

                else

                {

                    Sprite *sp = (Sprite*)node_forsprite->getChildByTag(cur_TutorialCmdObject.tag);

                    if(sp)

                        sp->removeFromParent();

                }

            }

            DoTutorialCmd();

        }

            break;

        case eTutorialCMD_AddSkipButton:

        {

            AMControlButton *btn_skip = AMControlButton::CreateWithScale9Sprite(Scale9Sprite::createWithSpriteFrameName("common_ui_sidepopup_btn_pupple.png", Rect(15, 12, 83, 12)), GCommon->CreateLabel("SKIP", FONT_MAIN, 34, Point(0, 0), Point(0, 0), Color3B(90, 68, 83)), true);

            btn_skip->setPreferredSize(Size(150, 50));



            btn_skip->addTargetWithActionForControlEvents(this, cccontrol_selector(AMTutorialLayer::OnBtn_Skip), Control::EventType::TOUCH_UP_INSIDE);

            node_forskipbutton->addChild(btn_skip);



            btn_skip->setPosition(Point(SCREENGAP_WIDTH + 100, DESIGN_HEIGHT - 50));



            DoTutorialCmd();

        }

            break;

        case eTutorialCMD_HoldCommand:

        {

            //do nothing

        }

            break;

        case eTutorialCMD_Custom:

        {

            switch(cur_TutorialType)

            {

                case eTutorialType_InGame_BasicRule:

                {

                    switch(cur_TutorialCmdObject.tag)

                    {

                        case 0:

                        {

                            for(int i = 0 ; i < GStageLayer->getChildren().size() ; i++)

                            {

                                Node *node = (Node*)GStageLayer->getChildren().at(i);

                                node->resume();

                            }



                            NotificationCenter::getInstance()->postNotification(AM_NOTI_TUTORIAL_RESETBLOCKMATCHLINE);

                        }

                            break;

                        case 1:

                        {

                            AMBlock *block = GStageLayer->GetBlockByPos(IntPoint(9, 3));

                            block->sp_block->runAction(Repeat::create(Sequence::create(FadeOut::create(0.35), FadeIn::create(0.35), NULL), kRepeatForever));

                        }

                            break;

                        case 2:

                        {



                            AMBlock *block = GStageLayer->GetBlockByPos(IntPoint(9, 3));

                            block->sp_block->stopAllActions();

                            block->sp_block->setOpacity(255);

                        }

                            break;

                    }



                }

                    break;

                case eTutorialType_EpisodeUnlock:

                {

                    switch(cur_TutorialCmdObject.tag)

                    {

                        case 0:

                            DBManager::sharedManager()->AddMessage(SYSTEM_MESSAGE, "", eCashesUIType_TutorialKey + 2, 1, "Alice sent you a Key!");

                            DBManager::sharedManager()->AddMessage(SYSTEM_MESSAGE, "", eCashesUIType_TutorialKey + 1, 1, "Queen of Heart sent you a Key!");

                            DBManager::sharedManager()->AddMessage(SYSTEM_MESSAGE, "", eCashesUIType_TutorialKey, 1, "Cheshire Cat sent you a Key!");



                            NotificationCenter::getInstance()->postNotification(AM_NOTI_UPDATEWORLDUIPOPMENULABEL);

                            NotificationCenter::getInstance()->postNotification(AM_NOTI_TUTORIAL_CLOSEEPISODEPOPUP);

                            break;

                        case 1:

                            GCommon->scene_world->sv->setTouchEnabled(false);

                            break;

                        case 2:

                            GCommon->scene_world->sv->setTouchEnabled(true);

                            break;

                    }

                }

                    break;

                case eTutorialType_WorldScene_Intro:

                {

                    switch(cur_TutorialCmdObject.tag)

                    {

                        case 0:

                        {

                            NotificationCenter::getInstance()->postNotification(AM_NOTI_TUTORIAL_SETSCROLLUPANDALICEFALLDOWN);



                        }

                            break;

                        case 1:

                        {

                            GCommon->BounceLayer(GCommon->scene_world, 0);

                            GCommon->BounceLayer(GCommon->scene_world, 0.15);

                            GCommon->BounceLayer(GCommon->scene_world, 0.26);

                            GCommon->BounceLayer(GCommon->scene_world, 0.40);

                        }

                            break;

                        case 2:

                        {

                            NotificationCenter::getInstance()->postNotification(AM_NOTI_TUTORIAL_SETVISIBLEONSPRITESONCEHIDE);

                        }

                            break;

                        case 3:

                            GCommon->scene_world->sv->setTouchEnabled(false);

                            break;

                        case 4:

                            GCommon->scene_world->sv->setTouchEnabled(true);

                            break;

                    }



                }

                    break;

                    /*

                case eTutorialType_WorldScene_Clear1Stage: case eTutorialType_WorldScene_Begin14Stage:

                {

                    switch(cur_TutorialCmdObject.tag)

                    {

                        case 0:

                        {

                            if(cur_TutorialType == eTutorialType_WorldScene_Clear1Stage)

                                GameSetting::SetCustomIntValue(LB_GAMESETTING_ISDIDWORLDTUTORIAL_CLEAR1, 1);

                            else if(cur_TutorialType == eTutorialType_WorldScene_Begin14Stage)

                                GameSetting::SetCustomIntValue(LB_GAMESETTING_ISDIDWORLDTUTORIAL_CLEAR14, 1);





                            if(cur_TutorialType == eTutorialType_WorldScene_Begin14Stage)

                                GCommon->scene_world->layer_Cashes_Life->AddCashesWithAnimation(eCashesUIType_Life, Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(225, 0), NUM_FREEHEART_TUTORIAL14, false, 50, 0);

                            else

                                GCommon->scene_world->layer_Cashes_Life->AddCashesWithAnimation(eCashesUIType_Life, Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(290, 0), NUM_FREEHEART_TUTORIAL1, false, 50, 0);



                        }

                            break;

                    }



                }

                    break;

                     */



                case eTutorialType_WorldScene_FreeFullHeart:

                {

                    switch(cur_TutorialCmdObject.tag)

                    {

                        case 0:

                        {

                            GCommon->scene_world->layer_Cashes_Life->AddCashesWithAnimation(eCashesUIType_Life, Point(DESIGN_WIDTH/2, DESIGN_HEIGHT/2) + Point(225, 0), GameSetting::CurrentMaxLife(), false, 50, 0);

                        }

                            break;

                    }



                }

                    break;

                default:

                {



                }

                    break;

            }



            DoTutorialCmd();

        }

            break;

        case eTutorialCMD_FinishTutorial:

        {

            if(GCommon->SceneType == eScene_Game)

            {

                GPopupLayer->ResumeGame();

            }





            GTutorialLayer = nullptr;



            switch(cur_TutorialType)

            {

                case eTutorialType_InGame_BasicRule:

                {

                    for(int i = 0 ; i < GStageLayer->getChildren().size() ; i++)

                    {

                        Node *node = (Node*)GStageLayer->getChildren().at(i);

                        node->resume();

                    }

                    NotificationCenter::getInstance()->postNotification(AM_NOTI_TUTORIAL_RESETBLOCKMATCHLINE);

                }

                    break;

                case eTutorialType_WorldScene_Intro:

                {

                    NotificationCenter::getInstance()->postNotification(AM_NOTI_TUTORIAL_SETVISIBLEONSPRITESONCEHIDE);

                    NotificationCenter::getInstance()->postNotification(AM_NOTI_TUTORIAL_INTROEND);

                }

                    break;

                    /*

                     case eTutorialType_WorldScene_Clear1Stage: case eTutorialType_WorldScene_Begin14Stage:

                     {

                     NotificationCenter::getInstance()->postNotification(AM_NOTI_TUTORIAL_INTROEND);

                     }

                     break;*/

                case eTutorialType_WorldScene_FreeFullHeart:

                {

                    NotificationCenter::getInstance()->postNotification(AM_NOTI_TUTORIAL_INTROEND);

                }

                    break;

                default:

                {



                }

                    break;

            }



            cur_TutorialType = eTutorialType_None;



            this->removeFromParent();

        }

            break;

    }

}



void AMTutorialLayer::OnBtn_Skip(Ref *o, Control::EventType e)

{

    GSound->playEffect(SOUND_EFFECT_UIBUTTONNORMAL_FILE, SOUND_EFFECT_UIBUTTONNORMAL_GAIN);



    while(l_TutorialCmd.size() > 1)

    {

        l_TutorialCmd.pop_front();

    }



    DoTutorialCmd();

}



void AMTutorialLayer::OnBtn_OK(Ref *o, Control::EventType e)

{

    AMControlButton *btn = (AMControlButton*)o;



    btn->setVisible(false);



    GSound->playEffect(SOUND_EFFECT_UIBUTTONNORMAL_FILE, SOUND_EFFECT_UIBUTTONNORMAL_GAIN);



    DoTutorialCmd();

}







void AMTutorialLayer::SetSpritePos(Node *node, Point pos)

{

    Sprite *sp = (Sprite*)node;

    sp->setPosition(pos);

}