2020-08-04 13:15:02 +08:00
|
|
|
#include "Window2.h"
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
USING_NS_AX;
|
2020-08-04 13:15:02 +08:00
|
|
|
|
|
|
|
void Window2::onInit()
|
|
|
|
{
|
|
|
|
setContentPane(UIPackage::createObject("Basics", "WindowB")->as<GComponent>());
|
|
|
|
center();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window2::doShowAnimation()
|
|
|
|
{
|
|
|
|
setScale(0.1f, 0.1f);
|
|
|
|
setPivot(0.5f, 0.5f);
|
|
|
|
|
2022-07-15 19:44:31 +08:00
|
|
|
GTween::to(getScale(), Vec2::ONE, 0.3f)->setTarget(this, TweenPropType::Scale)->onComplete(CC_CALLBACK_0(Window2::onShown, this));
|
2020-08-04 13:15:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Window2::doHideAnimation()
|
|
|
|
{
|
2022-07-15 19:44:31 +08:00
|
|
|
GTween::to(getScale(), Vec2(0.1f, 0.1f), 0.3f)->setTarget(this, TweenPropType::Scale)->onComplete(CC_CALLBACK_0(Window2::hideImmediately, this));
|
2020-08-04 13:15:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Window2::onShown()
|
|
|
|
{
|
|
|
|
_contentPane->getTransition("t1")->play();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window2::onHide()
|
|
|
|
{
|
|
|
|
_contentPane->getTransition("t1")->stop();
|
|
|
|
}
|