2017-10-20 00:59:26 +08:00
|
|
|
|
#include "..\etransitions.h"
|
|
|
|
|
|
#include "..\eactions.h"
|
2017-10-26 17:17:30 +08:00
|
|
|
|
#include "..\emanagers.h"
|
2017-10-20 00:59:26 +08:00
|
|
|
|
|
|
|
|
|
|
e2d::ETransitionFade::ETransitionFade(float fadeOutDuration, float fadeInDuration)
|
|
|
|
|
|
: m_fFadeOutDuration(fadeOutDuration)
|
|
|
|
|
|
, m_fFadeInDuration(fadeInDuration)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-10-21 19:09:31 +08:00
|
|
|
|
void e2d::ETransitionFade::_setTarget(EScene * prev, EScene * next, bool & transitional)
|
2017-10-20 00:59:26 +08:00
|
|
|
|
{
|
2017-10-21 19:09:31 +08:00
|
|
|
|
// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
next->getRoot()->setOpacity(0);
|
|
|
|
|
|
|
2017-10-20 00:59:26 +08:00
|
|
|
|
// <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
auto action1 = new EActionFadeOut(m_fFadeOutDuration);
|
|
|
|
|
|
if (prev)
|
|
|
|
|
|
{
|
|
|
|
|
|
action1->setTarget(prev->getRoot());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2017-10-21 19:09:31 +08:00
|
|
|
|
auto action2 = new EActionFadeIn(m_fFadeInDuration);
|
|
|
|
|
|
action2->setTarget(next->getRoot());
|
2017-10-20 00:59:26 +08:00
|
|
|
|
|
|
|
|
|
|
// <20><>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2017-10-21 19:09:31 +08:00
|
|
|
|
auto action3 = new EActionCallback([&, prev, next] {
|
2017-10-20 00:59:26 +08:00
|
|
|
|
transitional = false;
|
2017-10-21 19:09:31 +08:00
|
|
|
|
// <20><>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD>״̬
|
|
|
|
|
|
if (prev)
|
|
|
|
|
|
{
|
|
|
|
|
|
prev->getRoot()->setOpacity(1);
|
|
|
|
|
|
}
|
|
|
|
|
|
next->getRoot()->setOpacity(1);
|
2017-10-20 00:59:26 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2017-10-21 19:09:31 +08:00
|
|
|
|
EActionManager::addAction(new EActionSequence(3, action1, action2, action3));
|
2017-10-20 00:59:26 +08:00
|
|
|
|
}
|