2012-04-19 14:35:52 +08:00
|
|
|
/****************************************************************************
|
2012-09-24 21:22:20 +08:00
|
|
|
Copyright (c) 2010-2012 cocos2d-x.org
|
2012-04-19 14:35:52 +08:00
|
|
|
Copyright (c) 2008-2010 Ricardo Quesada
|
|
|
|
Copyright (c) 2011 Zynga Inc.
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "CCTransition.h"
|
|
|
|
#include "CCCamera.h"
|
2012-06-19 16:20:46 +08:00
|
|
|
#include "support/CCPointExtension.h"
|
2012-04-19 14:35:52 +08:00
|
|
|
#include "CCDirector.h"
|
2012-06-19 16:20:46 +08:00
|
|
|
#include "touch_dispatcher/CCTouchDispatcher.h"
|
|
|
|
#include "actions/CCActionInterval.h"
|
|
|
|
#include "actions/CCActionInstant.h"
|
|
|
|
#include "actions/CCActionEase.h"
|
|
|
|
#include "actions/CCActionCamera.h"
|
|
|
|
#include "actions/CCActionTiledGrid.h"
|
|
|
|
#include "actions/CCActionGrid.h"
|
2012-04-19 14:35:52 +08:00
|
|
|
#include "CCLayer.h"
|
2012-06-19 16:20:46 +08:00
|
|
|
#include "misc_nodes/CCRenderTexture.h"
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
NS_CC_BEGIN
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2011-07-08 15:38:32 +08:00
|
|
|
const unsigned int kSceneFade = 0xFADEFADE;
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionScene::TransitionScene()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionScene::~TransitionScene()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->release();
|
|
|
|
_outScene->release();
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionScene * TransitionScene::create(float t, Scene *scene)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionScene * pScene = new TransitionScene();
|
2012-04-19 14:35:52 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t,scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
bool TransitionScene::initWithDuration(float t, Scene *scene)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCAssert( scene != NULL, "Argument scene must be non-nil");
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
if (Scene::init())
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_duration = t;
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// retain
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene = scene;
|
|
|
|
_inScene->retain();
|
2013-06-20 14:13:12 +08:00
|
|
|
_outScene = Director::sharedDirector()->getRunningScene();
|
2013-06-15 14:03:30 +08:00
|
|
|
if (_outScene == NULL)
|
2012-06-01 15:54:17 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
_outScene = Scene::create();
|
2013-06-15 14:03:30 +08:00
|
|
|
_outScene->init();
|
2012-06-01 15:54:17 +08:00
|
|
|
}
|
2013-06-15 14:03:30 +08:00
|
|
|
_outScene->retain();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
CCAssert( _inScene != _outScene, "Incoming scene must be different from the outgoing scene" );
|
2013-03-01 15:30:40 +08:00
|
|
|
|
|
|
|
sceneOrder();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionScene::sceneOrder()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_isInSceneOnTop = true;
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionScene::draw()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Scene::draw();
|
2011-07-12 11:20:41 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
if( _isInSceneOnTop ) {
|
|
|
|
_outScene->visit();
|
|
|
|
_inScene->visit();
|
2012-04-19 14:35:52 +08:00
|
|
|
} else {
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->visit();
|
|
|
|
_outScene->visit();
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionScene::finish()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
// clean up
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setVisible(true);
|
|
|
|
_inScene->setPosition(ccp(0,0));
|
|
|
|
_inScene->setScale(1.0f);
|
|
|
|
_inScene->setRotation(0.0f);
|
|
|
|
_inScene->getCamera()->restore();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_outScene->setVisible(false);
|
|
|
|
_outScene->setPosition(ccp(0,0));
|
|
|
|
_outScene->setScale(1.0f);
|
|
|
|
_outScene->setRotation(0.0f);
|
|
|
|
_outScene->getCamera()->restore();
|
2010-07-21 11:13:32 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
//[self schedule:@selector(setNewScene:) interval:0];
|
2013-06-20 14:13:12 +08:00
|
|
|
this->schedule(schedule_selector(TransitionScene::setNewScene), 0);
|
2010-07-14 16:30:25 +08:00
|
|
|
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionScene::setNewScene(float dt)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2011-06-10 17:51:37 +08:00
|
|
|
CC_UNUSED_PARAM(dt);
|
2013-02-26 17:12:57 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
this->unschedule(schedule_selector(TransitionScene::setNewScene));
|
2013-02-26 17:12:57 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// Before replacing, save the "send cleanup to scene"
|
2013-06-20 14:13:12 +08:00
|
|
|
Director *director = Director::sharedDirector();
|
2013-06-15 14:03:30 +08:00
|
|
|
_isSendCleanupToScene = director->isSendCleanupToScene();
|
2013-02-26 17:12:57 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
director->replaceScene(_inScene);
|
2013-02-26 17:12:57 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// issue #267
|
2013-06-15 14:03:30 +08:00
|
|
|
_outScene->setVisible(true);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionScene::hideOutShowIn()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setVisible(true);
|
|
|
|
_outScene->setVisible(false);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// custom onEnter
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionScene::onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Scene::onEnter();
|
2013-02-26 17:12:57 +08:00
|
|
|
|
|
|
|
// disable events while transitions
|
2013-06-20 14:13:12 +08:00
|
|
|
Director::sharedDirector()->getTouchDispatcher()->setDispatchEvents(false);
|
2013-02-26 17:12:57 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// outScene should not receive the onEnter callback
|
2013-02-26 17:12:57 +08:00
|
|
|
// only the onExitTransitionDidStart
|
2013-06-15 14:03:30 +08:00
|
|
|
_outScene->onExitTransitionDidStart();
|
2013-02-26 17:12:57 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->onEnter();
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// custom onExit
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionScene::onExit()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Scene::onExit();
|
2013-02-26 17:12:57 +08:00
|
|
|
|
|
|
|
// enable events while transitions
|
2013-06-20 14:13:12 +08:00
|
|
|
Director::sharedDirector()->getTouchDispatcher()->setDispatchEvents(true);
|
2013-02-26 17:12:57 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_outScene->onExit();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
// _inScene should not receive the onEnter callback
|
2012-04-19 14:35:52 +08:00
|
|
|
// only the onEnterTransitionDidFinish
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->onEnterTransitionDidFinish();
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// custom cleanup
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionScene::cleanup()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Scene::cleanup();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
if( _isSendCleanupToScene )
|
|
|
|
_outScene->cleanup();
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Oriented Transition
|
|
|
|
//
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSceneOriented::TransitionSceneOriented()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSceneOriented::~TransitionSceneOriented()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSceneOriented * TransitionSceneOriented::create(float t, Scene *scene, tOrientation orientation)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSceneOriented * pScene = new TransitionSceneOriented();
|
2012-04-19 14:35:52 +08:00
|
|
|
pScene->initWithDuration(t,scene,orientation);
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
bool TransitionSceneOriented::initWithDuration(float t, Scene *scene, tOrientation orientation)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
if ( TransitionScene::initWithDuration(t, scene) )
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_orientation = orientation;
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
return true;
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// RotoZoom
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionRotoZoom::TransitionRotoZoom()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionRotoZoom* TransitionRotoZoom::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionRotoZoom* pScene = new TransitionRotoZoom();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionRotoZoom::~TransitionRotoZoom()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionRotoZoom:: onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionScene::onEnter();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setScale(0.001f);
|
|
|
|
_outScene->setScale(1.0f);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setAnchorPoint(ccp(0.5f, 0.5f));
|
|
|
|
_outScene->setAnchorPoint(ccp(0.5f, 0.5f));
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval *rotozoom = (ActionInterval*)(Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
Spawn::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
ScaleBy::create(_duration/2, 0.001f),
|
|
|
|
RotateBy::create(_duration/2, 360 * 2),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
),
|
2013-06-20 14:13:12 +08:00
|
|
|
DelayTime::create(_duration/2),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
));
|
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_outScene->runAction(rotozoom);
|
|
|
|
_inScene->runAction
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
|
|
|
rotozoom->reverse(),
|
2013-06-20 14:13:12 +08:00
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::finish)),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
)
|
|
|
|
);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// JumpZoom
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionJumpZoom::TransitionJumpZoom()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionJumpZoom::~TransitionJumpZoom()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionJumpZoom* TransitionJumpZoom::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionJumpZoom* pScene = new TransitionJumpZoom();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionJumpZoom::onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionScene::onEnter();
|
|
|
|
Size s = Director::sharedDirector()->getWinSize();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setScale(0.5f);
|
|
|
|
_inScene->setPosition(ccp(s.width, 0));
|
|
|
|
_inScene->setAnchorPoint(ccp(0.5f, 0.5f));
|
|
|
|
_outScene->setAnchorPoint(ccp(0.5f, 0.5f));
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval *jump = JumpBy::create(_duration/4, ccp(-s.width,0), s.width/4, 2);
|
|
|
|
ActionInterval *scaleIn = ScaleTo::create(_duration/4, 1.0f);
|
|
|
|
ActionInterval *scaleOut = ScaleTo::create(_duration/4, 0.5f);
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval *jumpZoomOut = (ActionInterval*)(Sequence::create(scaleOut, jump, NULL));
|
|
|
|
ActionInterval *jumpZoomIn = (ActionInterval*)(Sequence::create(jump, scaleIn, NULL));
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval *delay = DelayTime::create(_duration/2);
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_outScene->runAction(jumpZoomOut);
|
|
|
|
_inScene->runAction
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
|
|
|
delay,
|
|
|
|
jumpZoomIn,
|
2013-06-20 14:13:12 +08:00
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::finish)),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
)
|
|
|
|
);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// MoveInL
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionMoveInL::TransitionMoveInL()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionMoveInL::~TransitionMoveInL()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionMoveInL* TransitionMoveInL::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionMoveInL* pScene = new TransitionMoveInL();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionMoveInL::onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionScene::onEnter();
|
2012-04-19 14:35:52 +08:00
|
|
|
this->initScenes();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval *a = this->action();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->runAction
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
|
|
|
this->easeActionWithAction(a),
|
2013-06-20 14:13:12 +08:00
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::finish)),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
)
|
|
|
|
);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionMoveInL::action()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return MoveTo::create(_duration, ccp(0,0));
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionMoveInL::easeActionWithAction(ActionInterval* action)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return EaseOut::create(action, 2.0f);
|
2012-04-19 14:35:52 +08:00
|
|
|
// return [EaseElasticOut actionWithAction:action period:0.4f];
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionMoveInL::initScenes()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Size s = Director::sharedDirector()->getWinSize();
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setPosition(ccp(-s.width,0));
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// MoveInR
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionMoveInR::TransitionMoveInR()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionMoveInR::~TransitionMoveInR()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionMoveInR* TransitionMoveInR::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionMoveInR* pScene = new TransitionMoveInR();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionMoveInR::initScenes()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Size s = Director::sharedDirector()->getWinSize();
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setPosition( ccp(s.width,0) );
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// MoveInT
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionMoveInT::TransitionMoveInT()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionMoveInT::~TransitionMoveInT()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionMoveInT* TransitionMoveInT::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionMoveInT* pScene = new TransitionMoveInT();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionMoveInT::initScenes()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Size s = Director::sharedDirector()->getWinSize();
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setPosition( ccp(0,s.height) );
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// MoveInB
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionMoveInB::TransitionMoveInB()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionMoveInB::~TransitionMoveInB()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionMoveInB* TransitionMoveInB::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionMoveInB* pScene = new TransitionMoveInB();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionMoveInB::initScenes()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Size s = Director::sharedDirector()->getWinSize();
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setPosition( ccp(0,-s.height) );
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// SlideInL
|
|
|
|
//
|
|
|
|
|
|
|
|
// The adjust factor is needed to prevent issue #442
|
|
|
|
// One solution is to use DONT_RENDER_IN_SUBPIXELS images, but NO
|
|
|
|
// The other issue is that in some transitions (and I don't know why)
|
|
|
|
// the order should be reversed (In in top of Out or vice-versa).
|
|
|
|
#define ADJUST_FACTOR 0.5f
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSlideInL::TransitionSlideInL()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2012-11-01 22:12:13 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSlideInL::~TransitionSlideInL()
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionSlideInL::onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionScene::onEnter();
|
2012-04-19 14:35:52 +08:00
|
|
|
this->initScenes();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval *in = this->action();
|
|
|
|
ActionInterval *out = this->action();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* inAction = easeActionWithAction(in);
|
|
|
|
ActionInterval* outAction = (ActionInterval*)Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
|
|
|
easeActionWithAction(out),
|
2013-06-20 14:13:12 +08:00
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::finish)),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
);
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->runAction(inAction);
|
|
|
|
_outScene->runAction(outAction);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionSlideInL::sceneOrder()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_isInSceneOnTop = false;
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionSlideInL:: initScenes()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Size s = Director::sharedDirector()->getWinSize();
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setPosition( ccp(-(s.width-ADJUST_FACTOR),0) );
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionSlideInL::action()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Size s = Director::sharedDirector()->getWinSize();
|
|
|
|
return MoveBy::create(_duration, ccp(s.width-ADJUST_FACTOR,0));
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionSlideInL::easeActionWithAction(ActionInterval* action)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return EaseOut::create(action, 2.0f);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSlideInL* TransitionSlideInL::create(float t, Scene* scene)
|
2012-12-06 18:51:33 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSlideInL* pScene = new TransitionSlideInL();
|
2012-12-06 18:51:33 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-07-12 17:56:06 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// SlideInR
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSlideInR::TransitionSlideInR()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSlideInR::~TransitionSlideInR()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSlideInR* TransitionSlideInR::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSlideInR* pScene = new TransitionSlideInR();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionSlideInR::sceneOrder()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_isInSceneOnTop = true;
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionSlideInR::initScenes()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Size s = Director::sharedDirector()->getWinSize();
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setPosition( ccp(s.width-ADJUST_FACTOR,0) );
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionSlideInR:: action()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Size s = Director::sharedDirector()->getWinSize();
|
|
|
|
return MoveBy::create(_duration, ccp(-(s.width-ADJUST_FACTOR),0));
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// SlideInT
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSlideInT::TransitionSlideInT()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSlideInT::~TransitionSlideInT()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSlideInT* TransitionSlideInT::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSlideInT* pScene = new TransitionSlideInT();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionSlideInT::sceneOrder()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_isInSceneOnTop = false;
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionSlideInT::initScenes()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Size s = Director::sharedDirector()->getWinSize();
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setPosition( ccp(0,s.height-ADJUST_FACTOR) );
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionSlideInT::action()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Size s = Director::sharedDirector()->getWinSize();
|
|
|
|
return MoveBy::create(_duration, ccp(0,-(s.height-ADJUST_FACTOR)));
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// SlideInB
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSlideInB::TransitionSlideInB()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSlideInB::~TransitionSlideInB()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSlideInB* TransitionSlideInB::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSlideInB* pScene = new TransitionSlideInB();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionSlideInB::sceneOrder()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_isInSceneOnTop = true;
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionSlideInB:: initScenes()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Size s = Director::sharedDirector()->getWinSize();
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setPosition( ccp(0,-(s.height-ADJUST_FACTOR)) );
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionSlideInB:: action()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Size s = Director::sharedDirector()->getWinSize();
|
|
|
|
return MoveBy::create(_duration, ccp(0,s.height-ADJUST_FACTOR));
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// ShrinkGrow Transition
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionShrinkGrow::TransitionShrinkGrow()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionShrinkGrow::~TransitionShrinkGrow()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionShrinkGrow* TransitionShrinkGrow::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionShrinkGrow* pScene = new TransitionShrinkGrow();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionShrinkGrow::onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionScene::onEnter();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setScale(0.001f);
|
|
|
|
_outScene->setScale(1.0f);
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setAnchorPoint(ccp(2/3.0f,0.5f));
|
|
|
|
_outScene->setAnchorPoint(ccp(1/3.0f,0.5f));
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* scaleOut = ScaleTo::create(_duration, 0.01f);
|
|
|
|
ActionInterval* scaleIn = ScaleTo::create(_duration, 1.0f);
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->runAction(this->easeActionWithAction(scaleIn));
|
|
|
|
_outScene->runAction
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
|
|
|
this->easeActionWithAction(scaleOut),
|
2013-06-20 14:13:12 +08:00
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::finish)),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
)
|
|
|
|
);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionShrinkGrow:: easeActionWithAction(ActionInterval* action)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return EaseOut::create(action, 2.0f);
|
2012-04-19 14:35:52 +08:00
|
|
|
// return [EaseElasticOut actionWithAction:action period:0.3f];
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// FlipX Transition
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFlipX::TransitionFlipX()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFlipX::~TransitionFlipX()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionFlipX::onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSceneOriented::onEnter();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval *inA, *outA;
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setVisible(false);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
float inDeltaZ, inAngleZ;
|
|
|
|
float outDeltaZ, outAngleZ;
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
if( _orientation == kTransitionOrientationRightOver )
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
inDeltaZ = 90;
|
|
|
|
inAngleZ = 270;
|
|
|
|
outDeltaZ = 90;
|
|
|
|
outAngleZ = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
inDeltaZ = -90;
|
|
|
|
inAngleZ = 90;
|
|
|
|
outDeltaZ = -90;
|
|
|
|
outAngleZ = 0;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
inA = (ActionInterval*)Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
DelayTime::create(_duration/2),
|
|
|
|
Show::create(),
|
|
|
|
OrbitCamera::create(_duration/2, 1, 0, inAngleZ, inDeltaZ, 0, 0),
|
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::finish)),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
);
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
outA = (ActionInterval *)Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
OrbitCamera::create(_duration/2, 1, 0, outAngleZ, outDeltaZ, 0, 0),
|
|
|
|
Hide::create(),
|
|
|
|
DelayTime::create(_duration/2),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
);
|
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->runAction(inA);
|
|
|
|
_outScene->runAction(outA);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFlipX* TransitionFlipX::create(float t, Scene* s, tOrientation o)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFlipX* pScene = new TransitionFlipX();
|
2010-08-20 14:35:37 +08:00
|
|
|
pScene->initWithDuration(t, s, o);
|
|
|
|
pScene->autorelease();
|
|
|
|
|
|
|
|
return pScene;
|
|
|
|
}
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFlipX* TransitionFlipX::create(float t, Scene* s)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return TransitionFlipX::create(t, s, kTransitionOrientationRightOver);
|
2012-11-01 22:12:13 +08:00
|
|
|
}
|
|
|
|
|
2010-07-12 17:56:06 +08:00
|
|
|
//
|
|
|
|
// FlipY Transition
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFlipY::TransitionFlipY()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFlipY::~TransitionFlipY()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionFlipY::onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSceneOriented::onEnter();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval *inA, *outA;
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setVisible(false);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
float inDeltaZ, inAngleZ;
|
|
|
|
float outDeltaZ, outAngleZ;
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
if( _orientation == kTransitionOrientationUpOver )
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
inDeltaZ = 90;
|
|
|
|
inAngleZ = 270;
|
|
|
|
outDeltaZ = 90;
|
|
|
|
outAngleZ = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
inDeltaZ = -90;
|
|
|
|
inAngleZ = 90;
|
|
|
|
outDeltaZ = -90;
|
|
|
|
outAngleZ = 0;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
inA = (ActionInterval*)Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
DelayTime::create(_duration/2),
|
|
|
|
Show::create(),
|
|
|
|
OrbitCamera::create(_duration/2, 1, 0, inAngleZ, inDeltaZ, 90, 0),
|
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::finish)),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
);
|
2013-06-20 14:13:12 +08:00
|
|
|
outA = (ActionInterval*)Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
OrbitCamera::create(_duration/2, 1, 0, outAngleZ, outDeltaZ, 90, 0),
|
|
|
|
Hide::create(),
|
|
|
|
DelayTime::create(_duration/2),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
);
|
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->runAction(inA);
|
|
|
|
_outScene->runAction(outA);
|
2010-08-18 11:06:48 +08:00
|
|
|
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFlipY* TransitionFlipY::create(float t, Scene* s, tOrientation o)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFlipY* pScene = new TransitionFlipY();
|
2010-08-20 14:35:37 +08:00
|
|
|
pScene->initWithDuration(t, s, o);
|
|
|
|
pScene->autorelease();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2010-08-20 14:35:37 +08:00
|
|
|
return pScene;
|
|
|
|
}
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFlipY* TransitionFlipY::create(float t, Scene* s)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return TransitionFlipY::create(t, s, kTransitionOrientationUpOver);
|
2012-11-01 22:12:13 +08:00
|
|
|
}
|
|
|
|
|
2010-07-12 17:56:06 +08:00
|
|
|
//
|
|
|
|
// FlipAngular Transition
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFlipAngular::TransitionFlipAngular()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFlipAngular::~TransitionFlipAngular()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionFlipAngular::onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSceneOriented::onEnter();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval *inA, *outA;
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setVisible(false);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
float inDeltaZ, inAngleZ;
|
|
|
|
float outDeltaZ, outAngleZ;
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
if( _orientation == kTransitionOrientationRightOver )
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
inDeltaZ = 90;
|
|
|
|
inAngleZ = 270;
|
|
|
|
outDeltaZ = 90;
|
|
|
|
outAngleZ = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
inDeltaZ = -90;
|
|
|
|
inAngleZ = 90;
|
|
|
|
outDeltaZ = -90;
|
|
|
|
outAngleZ = 0;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
inA = (ActionInterval *)Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
DelayTime::create(_duration/2),
|
|
|
|
Show::create(),
|
|
|
|
OrbitCamera::create(_duration/2, 1, 0, inAngleZ, inDeltaZ, -45, 0),
|
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::finish)),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
);
|
2013-06-20 14:13:12 +08:00
|
|
|
outA = (ActionInterval *)Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
OrbitCamera::create(_duration/2, 1, 0, outAngleZ, outDeltaZ, 45, 0),
|
|
|
|
Hide::create(),
|
|
|
|
DelayTime::create(_duration/2),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
);
|
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->runAction(inA);
|
|
|
|
_outScene->runAction(outA);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFlipAngular* TransitionFlipAngular::create(float t, Scene* s, tOrientation o)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFlipAngular* pScene = new TransitionFlipAngular();
|
2010-08-20 14:35:37 +08:00
|
|
|
pScene->initWithDuration(t, s, o);
|
|
|
|
pScene->autorelease();
|
|
|
|
|
|
|
|
return pScene;
|
|
|
|
}
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFlipAngular* TransitionFlipAngular::create(float t, Scene* s)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return TransitionFlipAngular::create(t, s, kTransitionOrientationRightOver);
|
2012-11-01 22:12:13 +08:00
|
|
|
}
|
|
|
|
|
2010-07-12 17:56:06 +08:00
|
|
|
//
|
|
|
|
// ZoomFlipX Transition
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionZoomFlipX::TransitionZoomFlipX()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionZoomFlipX::~TransitionZoomFlipX()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionZoomFlipX::onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSceneOriented::onEnter();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval *inA, *outA;
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setVisible(false);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
float inDeltaZ, inAngleZ;
|
|
|
|
float outDeltaZ, outAngleZ;
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
if( _orientation == kTransitionOrientationRightOver ) {
|
2012-04-19 14:35:52 +08:00
|
|
|
inDeltaZ = 90;
|
|
|
|
inAngleZ = 270;
|
|
|
|
outDeltaZ = 90;
|
|
|
|
outAngleZ = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
inDeltaZ = -90;
|
|
|
|
inAngleZ = 90;
|
|
|
|
outDeltaZ = -90;
|
|
|
|
outAngleZ = 0;
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
inA = (ActionInterval *)Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
DelayTime::create(_duration/2),
|
|
|
|
Spawn::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
OrbitCamera::create(_duration/2, 1, 0, inAngleZ, inDeltaZ, 0, 0),
|
|
|
|
ScaleTo::create(_duration/2, 1),
|
|
|
|
Show::create(),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
),
|
2013-06-20 14:13:12 +08:00
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::finish)),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
);
|
2013-06-20 14:13:12 +08:00
|
|
|
outA = (ActionInterval *)Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
Spawn::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
OrbitCamera::create(_duration/2, 1, 0, outAngleZ, outDeltaZ, 0, 0),
|
|
|
|
ScaleTo::create(_duration/2, 0.5f),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
),
|
2013-06-20 14:13:12 +08:00
|
|
|
Hide::create(),
|
|
|
|
DelayTime::create(_duration/2),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
);
|
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setScale(0.5f);
|
|
|
|
_inScene->runAction(inA);
|
|
|
|
_outScene->runAction(outA);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionZoomFlipX* TransitionZoomFlipX::create(float t, Scene* s, tOrientation o)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionZoomFlipX* pScene = new TransitionZoomFlipX();
|
2010-08-20 14:35:37 +08:00
|
|
|
pScene->initWithDuration(t, s, o);
|
|
|
|
pScene->autorelease();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2010-08-20 14:35:37 +08:00
|
|
|
return pScene;
|
|
|
|
}
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionZoomFlipX* TransitionZoomFlipX::create(float t, Scene* s)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return TransitionZoomFlipX::create(t, s, kTransitionOrientationRightOver);
|
2012-11-01 22:12:13 +08:00
|
|
|
}
|
|
|
|
|
2010-07-12 17:56:06 +08:00
|
|
|
//
|
|
|
|
// ZoomFlipY Transition
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionZoomFlipY::TransitionZoomFlipY()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionZoomFlipY::~TransitionZoomFlipY()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionZoomFlipY::onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSceneOriented::onEnter();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval *inA, *outA;
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setVisible(false);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
float inDeltaZ, inAngleZ;
|
|
|
|
float outDeltaZ, outAngleZ;
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
if( _orientation== kTransitionOrientationUpOver ) {
|
2012-04-19 14:35:52 +08:00
|
|
|
inDeltaZ = 90;
|
|
|
|
inAngleZ = 270;
|
|
|
|
outDeltaZ = 90;
|
|
|
|
outAngleZ = 0;
|
|
|
|
} else {
|
|
|
|
inDeltaZ = -90;
|
|
|
|
inAngleZ = 90;
|
|
|
|
outDeltaZ = -90;
|
|
|
|
outAngleZ = 0;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
inA = (ActionInterval *)Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
DelayTime::create(_duration/2),
|
|
|
|
Spawn::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
OrbitCamera::create(_duration/2, 1, 0, inAngleZ, inDeltaZ, 90, 0),
|
|
|
|
ScaleTo::create(_duration/2, 1),
|
|
|
|
Show::create(),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
),
|
2013-06-20 14:13:12 +08:00
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::finish)),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
);
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
outA = (ActionInterval *)Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
Spawn::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
OrbitCamera::create(_duration/2, 1, 0, outAngleZ, outDeltaZ, 90, 0),
|
|
|
|
ScaleTo::create(_duration/2, 0.5f),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
),
|
2013-06-20 14:13:12 +08:00
|
|
|
Hide::create(),
|
|
|
|
DelayTime::create(_duration/2),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
);
|
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setScale(0.5f);
|
|
|
|
_inScene->runAction(inA);
|
|
|
|
_outScene->runAction(outA);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionZoomFlipY* TransitionZoomFlipY::create(float t, Scene* s, tOrientation o)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionZoomFlipY* pScene = new TransitionZoomFlipY();
|
2010-08-20 14:35:37 +08:00
|
|
|
pScene->initWithDuration(t, s, o);
|
|
|
|
pScene->autorelease();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2010-08-20 14:35:37 +08:00
|
|
|
return pScene;
|
|
|
|
}
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionZoomFlipY* TransitionZoomFlipY::create(float t, Scene* s)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return TransitionZoomFlipY::create(t, s, kTransitionOrientationUpOver);
|
2012-11-01 22:12:13 +08:00
|
|
|
}
|
|
|
|
|
2010-07-12 17:56:06 +08:00
|
|
|
//
|
|
|
|
// ZoomFlipAngular Transition
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionZoomFlipAngular::TransitionZoomFlipAngular()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionZoomFlipAngular::~TransitionZoomFlipAngular()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionZoomFlipAngular::onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSceneOriented::onEnter();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval *inA, *outA;
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setVisible(false);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
float inDeltaZ, inAngleZ;
|
|
|
|
float outDeltaZ, outAngleZ;
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
if( _orientation == kTransitionOrientationRightOver ) {
|
2012-04-19 14:35:52 +08:00
|
|
|
inDeltaZ = 90;
|
|
|
|
inAngleZ = 270;
|
|
|
|
outDeltaZ = 90;
|
|
|
|
outAngleZ = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
inDeltaZ = -90;
|
|
|
|
inAngleZ = 90;
|
|
|
|
outDeltaZ = -90;
|
|
|
|
outAngleZ = 0;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
inA = (ActionInterval *)Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
DelayTime::create(_duration/2),
|
|
|
|
Spawn::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
OrbitCamera::create(_duration/2, 1, 0, inAngleZ, inDeltaZ, -45, 0),
|
|
|
|
ScaleTo::create(_duration/2, 1),
|
|
|
|
Show::create(),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
),
|
2013-06-20 14:13:12 +08:00
|
|
|
Show::create(),
|
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::finish)),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
);
|
2013-06-20 14:13:12 +08:00
|
|
|
outA = (ActionInterval *)Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
Spawn::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
OrbitCamera::create(_duration/2, 1, 0 , outAngleZ, outDeltaZ, 45, 0),
|
|
|
|
ScaleTo::create(_duration/2, 0.5f),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
),
|
2013-06-20 14:13:12 +08:00
|
|
|
Hide::create(),
|
|
|
|
DelayTime::create(_duration/2),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
);
|
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setScale(0.5f);
|
|
|
|
_inScene->runAction(inA);
|
|
|
|
_outScene->runAction(outA);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionZoomFlipAngular* TransitionZoomFlipAngular::create(float t, Scene* s, tOrientation o)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionZoomFlipAngular* pScene = new TransitionZoomFlipAngular();
|
2010-08-20 14:35:37 +08:00
|
|
|
pScene->initWithDuration(t, s, o);
|
|
|
|
pScene->autorelease();
|
|
|
|
|
|
|
|
return pScene;
|
|
|
|
}
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionZoomFlipAngular* TransitionZoomFlipAngular::create(float t, Scene* s)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return TransitionZoomFlipAngular::create(t, s, kTransitionOrientationRightOver);
|
2012-11-01 22:12:13 +08:00
|
|
|
}
|
|
|
|
|
2010-07-12 17:56:06 +08:00
|
|
|
//
|
|
|
|
// Fade Transition
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFade::TransitionFade()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFade::~TransitionFade()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-05 16:49:22 +08:00
|
|
|
TransitionFade * TransitionFade::create(float duration, Scene *scene, const Color3B& color)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFade * pTransition = new TransitionFade();
|
2012-04-19 14:35:52 +08:00
|
|
|
pTransition->initWithDuration(duration, scene, color);
|
|
|
|
pTransition->autorelease();
|
|
|
|
return pTransition;
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFade* TransitionFade::create(float duration,Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-07-08 18:11:32 +08:00
|
|
|
return TransitionFade::create(duration, scene, Color3B::BLACK);
|
2012-11-01 22:12:13 +08:00
|
|
|
}
|
|
|
|
|
2013-07-05 16:49:22 +08:00
|
|
|
bool TransitionFade::initWithDuration(float duration, Scene *scene, const Color3B& color)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
if (TransitionScene::initWithDuration(duration, scene))
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_color.r = color.r;
|
|
|
|
_color.g = color.g;
|
|
|
|
_color.b = color.b;
|
|
|
|
_color.a = 0;
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
return true;
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
bool TransitionFade::initWithDuration(float t, Scene *scene)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-07-08 18:11:32 +08:00
|
|
|
this->initWithDuration(t, scene, Color3B::BLACK);
|
2012-04-19 14:35:52 +08:00
|
|
|
return true;
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionFade :: onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionScene::onEnter();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
LayerColor* l = LayerColor::create(_color);
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setVisible(false);
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(l, 2, kSceneFade);
|
2013-06-20 14:13:12 +08:00
|
|
|
Node* f = getChildByTag(kSceneFade);
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* a = (ActionInterval *)Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
FadeIn::create(_duration/2),
|
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::hideOutShowIn)),//CCCallFunc::create:self selector:@selector(hideOutShowIn)],
|
|
|
|
FadeOut::create(_duration/2),
|
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::finish)), //:self selector:@selector(finish)],
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
);
|
|
|
|
f->runAction(a);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionFade::onExit()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionScene::onExit();
|
2012-04-19 14:35:52 +08:00
|
|
|
this->removeChildByTag(kSceneFade, false);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Cross Fade Transition
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionCrossFade::TransitionCrossFade()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionCrossFade::~TransitionCrossFade()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionCrossFade* TransitionCrossFade::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionCrossFade* pScene = new TransitionCrossFade();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionCrossFade:: draw()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
// override draw since both scenes (textures) are rendered in 1 scene
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionCrossFade::onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionScene::onEnter();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// create a transparent color layer
|
|
|
|
// in which we are going to add our rendertextures
|
2013-07-07 21:08:14 +08:00
|
|
|
Color4B color(0,0,0,0);
|
2013-06-20 14:13:12 +08:00
|
|
|
Size size = Director::sharedDirector()->getWinSize();
|
|
|
|
LayerColor* layer = LayerColor::create(color);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// create the first render texture for inScene
|
2013-06-20 14:13:12 +08:00
|
|
|
RenderTexture* inTexture = RenderTexture::create((int)size.width, (int)size.height);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
if (NULL == inTexture)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
inTexture->getSprite()->setAnchorPoint( ccp(0.5f,0.5f) );
|
|
|
|
inTexture->setPosition( ccp(size.width/2, size.height/2) );
|
|
|
|
inTexture->setAnchorPoint( ccp(0.5f,0.5f) );
|
|
|
|
|
|
|
|
// render inScene to its texturebuffer
|
|
|
|
inTexture->begin();
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->visit();
|
2012-04-19 14:35:52 +08:00
|
|
|
inTexture->end();
|
|
|
|
|
|
|
|
// create the second render texture for outScene
|
2013-06-20 14:13:12 +08:00
|
|
|
RenderTexture* outTexture = RenderTexture::create((int)size.width, (int)size.height);
|
2012-04-19 14:35:52 +08:00
|
|
|
outTexture->getSprite()->setAnchorPoint( ccp(0.5f,0.5f) );
|
|
|
|
outTexture->setPosition( ccp(size.width/2, size.height/2) );
|
|
|
|
outTexture->setAnchorPoint( ccp(0.5f,0.5f) );
|
|
|
|
|
|
|
|
// render outScene to its texturebuffer
|
|
|
|
outTexture->begin();
|
2013-06-15 14:03:30 +08:00
|
|
|
_outScene->visit();
|
2012-04-19 14:35:52 +08:00
|
|
|
outTexture->end();
|
|
|
|
|
|
|
|
// create blend functions
|
|
|
|
|
2013-07-05 16:49:22 +08:00
|
|
|
BlendFunc blend1 = {GL_ONE, GL_ONE}; // inScene will lay on background and will not be used with alpha
|
|
|
|
BlendFunc blend2 = {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA}; // we are going to blend outScene via alpha
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// set blendfunctions
|
|
|
|
inTexture->getSprite()->setBlendFunc(blend1);
|
|
|
|
outTexture->getSprite()->setBlendFunc(blend2);
|
|
|
|
|
|
|
|
// add render textures to the layer
|
|
|
|
layer->addChild(inTexture);
|
|
|
|
layer->addChild(outTexture);
|
|
|
|
|
|
|
|
// initial opacity:
|
|
|
|
inTexture->getSprite()->setOpacity(255);
|
|
|
|
outTexture->getSprite()->setOpacity(255);
|
|
|
|
|
|
|
|
// create the blend action
|
2013-06-20 14:13:12 +08:00
|
|
|
Action* layerAction = Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
FadeTo::create(_duration, 0),
|
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::hideOutShowIn)),
|
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::finish)),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// run the blend action
|
|
|
|
outTexture->getSprite()->runAction( layerAction );
|
|
|
|
|
|
|
|
// add the layer (which contains our two rendertextures) to the scene
|
|
|
|
addChild(layer, 2, kSceneFade);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// clean up on exit
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionCrossFade::onExit()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
// remove our layer and release all containing objects
|
|
|
|
this->removeChildByTag(kSceneFade, false);
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionScene::onExit();
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// TurnOffTilesTransition
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionTurnOffTiles::TransitionTurnOffTiles()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionTurnOffTiles::~TransitionTurnOffTiles()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionTurnOffTiles* TransitionTurnOffTiles::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionTurnOffTiles* pScene = new TransitionTurnOffTiles();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-07-12 17:56:06 +08:00
|
|
|
// override addScenes, and change the order
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionTurnOffTiles::sceneOrder()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_isInSceneOnTop = false;
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionTurnOffTiles::onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionScene::onEnter();
|
|
|
|
Size s = Director::sharedDirector()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
float aspect = s.width / s.height;
|
|
|
|
int x = (int)(12 * aspect);
|
|
|
|
int y = 12;
|
2010-08-18 11:06:48 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TurnOffTiles* toff = TurnOffTiles::create(_duration, CCSizeMake(x,y));
|
|
|
|
ActionInterval* action = easeActionWithAction(toff);
|
2013-06-15 14:03:30 +08:00
|
|
|
_outScene->runAction
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
|
|
|
action,
|
2013-06-20 14:13:12 +08:00
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::finish)),
|
|
|
|
StopGrid::create(),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
)
|
|
|
|
);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionTurnOffTiles:: easeActionWithAction(ActionInterval* action)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return action;
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// SplitCols Transition
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSplitCols::TransitionSplitCols()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSplitCols::~TransitionSplitCols()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSplitCols* TransitionSplitCols::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSplitCols* pScene = new TransitionSplitCols();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionSplitCols::onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionScene::onEnter();
|
2013-06-15 14:03:30 +08:00
|
|
|
_inScene->setVisible(false);
|
2010-08-18 11:06:48 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* split = action();
|
|
|
|
ActionInterval* seq = (ActionInterval*)Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
|
|
|
split,
|
2013-06-20 14:13:12 +08:00
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::hideOutShowIn)),
|
2012-04-19 14:35:52 +08:00
|
|
|
split->reverse(),
|
|
|
|
NULL
|
|
|
|
);
|
2010-08-18 11:06:48 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
this->runAction
|
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
|
|
|
easeActionWithAction(seq),
|
2013-06-20 14:13:12 +08:00
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::finish)),
|
|
|
|
StopGrid::create(),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
)
|
|
|
|
);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionSplitCols:: action()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return SplitCols::create(_duration/2.0f, 3);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionSplitCols::easeActionWithAction(ActionInterval * action)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return EaseInOut::create(action, 3.0f);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// SplitRows Transition
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSplitRows::TransitionSplitRows()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2012-12-06 18:51:33 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSplitRows::~TransitionSplitRows()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionSplitRows::action()
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return SplitRows::create(_duration/2.0f, 3);
|
2012-11-01 22:12:13 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSplitRows* TransitionSplitRows::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionSplitRows* pScene = new TransitionSplitRows();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-07-12 17:56:06 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// FadeTR Transition
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFadeTR::TransitionFadeTR()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFadeTR::~TransitionFadeTR()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFadeTR* TransitionFadeTR::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFadeTR* pScene = new TransitionFadeTR();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionFadeTR::sceneOrder()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_isInSceneOnTop = false;
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
void TransitionFadeTR::onEnter()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionScene::onEnter();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
Size s = Director::sharedDirector()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
float aspect = s.width / s.height;
|
|
|
|
int x = (int)(12 * aspect);
|
|
|
|
int y = 12;
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* action = actionWithSize(CCSizeMake(x,y));
|
2010-08-18 11:06:48 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_outScene->runAction
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
2013-06-20 14:13:12 +08:00
|
|
|
Sequence::create
|
2012-04-19 14:35:52 +08:00
|
|
|
(
|
|
|
|
easeActionWithAction(action),
|
2013-06-20 14:13:12 +08:00
|
|
|
CallFunc::create(this, callfunc_selector(TransitionScene::finish)),
|
|
|
|
StopGrid::create(),
|
2012-04-19 14:35:52 +08:00
|
|
|
NULL
|
|
|
|
)
|
|
|
|
);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionFadeTR::actionWithSize(const Size& size)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return FadeOutTRTiles::create(_duration, size);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionFadeTR:: easeActionWithAction(ActionInterval* action)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return action;
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// FadeBL Transition
|
|
|
|
//
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFadeBL::TransitionFadeBL()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFadeBL::~TransitionFadeBL()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFadeBL* TransitionFadeBL::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFadeBL* pScene = new TransitionFadeBL();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionFadeBL::actionWithSize(const Size& size)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return FadeOutBLTiles::create(_duration, size);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// FadeUp Transition
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFadeUp::TransitionFadeUp()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2012-12-06 18:51:33 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFadeUp::~TransitionFadeUp()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFadeUp* TransitionFadeUp::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFadeUp* pScene = new TransitionFadeUp();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionFadeUp::actionWithSize(const Size& size)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return FadeOutUpTiles::create(_duration, size);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// FadeDown Transition
|
|
|
|
//
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFadeDown::TransitionFadeDown()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFadeDown::~TransitionFadeDown()
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFadeDown* TransitionFadeDown::create(float t, Scene* scene)
|
2012-11-01 22:12:13 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
TransitionFadeDown* pScene = new TransitionFadeDown();
|
2012-11-01 22:12:13 +08:00
|
|
|
if(pScene && pScene->initWithDuration(t, scene))
|
|
|
|
{
|
|
|
|
pScene->autorelease();
|
|
|
|
return pScene;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pScene);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval* TransitionFadeDown::actionWithSize(const Size& size)
|
2010-07-12 17:56:06 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
return FadeOutDownTiles::create(_duration, size);
|
2010-07-12 17:56:06 +08:00
|
|
|
}
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
NS_CC_END
|