代码拉取完成,页面将自动刷新
#include "xcocos_utils.h"
#include "xtransition_game_info.h"
#include <xscene_manager.h>
namespace zdh
{
//--------------------------------------------------------------------------------------
CCTransitionScene * utils::createTransition(int paramTransitionID, float paramDur, CCScene* paramDestScene)
{
switch (paramTransitionID)
{
case ETID_FADE_WHITE_TRANSITION:
return CCTransitionFade::create(paramDur, paramDestScene, ccWHITE);// XFadeWhiteTransition::create(paramDur, paramDestScene);
case ETID_FLIP_X_LEFT_OVER:
return CCTransitionFlipX::create(paramDur, paramDestScene, kCCTransitionOrientationLeftOver);
case ETID_FLIP_X_RIGHT_OVER:
return CCTransitionFlipX::create(paramDur, paramDestScene, kCCTransitionOrientationRightOver);
case ETID_FLIP_Y_UP_OVER:
return CCTransitionFlipY::create(paramDur, paramDestScene, kCCTransitionOrientationUpOver);
case ETID_FLIP_Y_DOWN_OVER:
return CCTransitionFlipY::create(paramDur, paramDestScene, kCCTransitionOrientationDownOver);
case ETID_FLIP_ANGULAR_LEFT_OVER:
return CCTransitionFlipAngular::create(paramDur, paramDestScene, kCCTransitionOrientationLeftOver);
case ETID_FLIP_ANGULAR_RIGHT_OVER:
return CCTransitionFlipAngular::create(paramDur, paramDestScene, kCCTransitionOrientationRightOver);
case ETID_CUSTOM_GAME_INFO:
return XTransitionGameInfo::create(paramDur, paramDestScene);
default:
return nullptr;
}
}
namespace utils
{
//--------------------------------------------------------------------------------------
CCSprite * createSprite(const char * paramFileName, float paramX /*= 0.0f*/, float paramY /*= 0.0f*/)
{
CCSprite * pRet = CCSprite::create(paramFileName);
pRet->setPosition(paramX, paramY);
pRet->setAnchorPoint(0, 0);
return pRet;
}
//--------------------------------------------------------------------------------------
CCSprite * createSpriteByFrameCache(const char * paramFrameName, float paramX /*= 0.0f*/, float paramY /*= 0.0f*/)
{
CCSprite * pRet = CCSprite::createWithSpriteFrameName(paramFrameName);
pRet->setPosition(paramX, paramY);
pRet->setAnchorPoint(0, 0);
return pRet;
}
//--------------------------------------------------------------------------------------
void TransitionScene(int paramTransitionID, float paramDur, int paramSceneID)
{
CCScene * pScene = SCENE_MGR->GetScene(paramSceneID);
CCTransitionScene * pTran = createTransition(paramTransitionID, paramDur, pScene);
CCDirector::sharedDirector()->replaceScene(pTran);
}
//--------------------------------------------------------------------------------------
CCAnimate * createAnimate(const char * paramFileNameFormat, XInt paramStartCode, XInt paramEndCode, float paramDur)
{
CCArray stList;
XAnsiString strTemp;
for (XInt i = paramStartCode; i <= paramEndCode; i++)
{
strTemp.printf(paramFileNameFormat, i);
CCSpriteFrame * p = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(strTemp.c_str());
stList.addObject(p);
}
CCAnimation * pAni = CCAnimation::createWithSpriteFrames(&stList, paramDur / (paramEndCode - paramStartCode + 1));
//pAni->setLoops(1);
CCAnimate * pRet = CCAnimate::create(pAni);
return pRet;
}
//--------------------------------------------------------------------------------------
void ExitGame()
{
STREAM_INFO << "OnExit";
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
CCMessageBox("You pressed the close button. Windows Store Apps do not implement a close button.", "Alert");
#else
CCDirector::sharedDirector()->end();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
exit(0);
#endif
#endif
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。