2014-03-07 15:36:45 +08:00
|
|
|
//
|
|
|
|
// CustomParticleWidgetTest.cpp
|
|
|
|
// CustomUI
|
|
|
|
//
|
|
|
|
// Created by cai wenzhi on 14-3-7.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "CustomParticleWidgetTest.h"
|
|
|
|
#include "../../CustomGUIScene.h"
|
|
|
|
#include "../../CustomWidget/CustomParticleWidget.h"
|
|
|
|
#include "../../CustomWidget/CustomParticleWidgetReader.h"
|
|
|
|
#include "cocostudio/CCSGUIReader.h"
|
|
|
|
|
|
|
|
|
|
|
|
USING_NS_CC;
|
|
|
|
USING_NS_CC_EXT;
|
|
|
|
using namespace ui;
|
|
|
|
using namespace cocostudio;
|
|
|
|
|
2014-03-26 14:54:50 +08:00
|
|
|
|
|
|
|
// CustomParticleWidgetLayer
|
|
|
|
|
2014-03-07 15:36:45 +08:00
|
|
|
|
|
|
|
void CustomParticleWidgetLayer::onEnter()
|
|
|
|
{
|
|
|
|
CCLayer::onEnter();
|
|
|
|
|
|
|
|
GUIReader* guiReader = GUIReader::getInstance();
|
|
|
|
guiReader->registerTypeAndCallBack("CustomParticleWidget",
|
|
|
|
&CustomParticleWidget::createInstance,
|
|
|
|
CustomParticleWidgetReader::getInstance(),
|
|
|
|
parseselector(CustomParticleWidgetReader::setProperties));
|
|
|
|
|
|
|
|
CustomParticleWidget* custom = CustomParticleWidget::create();
|
|
|
|
custom->setParticlePlist("Particles/BoilingFoam.plist");
|
|
|
|
|
|
|
|
addChild(custom, 10, -1);
|
|
|
|
}
|
|
|
|
|
2014-03-26 14:54:50 +08:00
|
|
|
|
|
|
|
// CustomImageScene
|
|
|
|
|
2014-03-07 15:36:45 +08:00
|
|
|
|
|
|
|
void CustomParticleWidgetScene::onEnter()
|
|
|
|
{
|
|
|
|
CCScene::onEnter();
|
|
|
|
|
|
|
|
Layer* pLayer = new CustomParticleWidgetLayer();
|
|
|
|
addChild(pLayer);
|
|
|
|
pLayer->release();
|
|
|
|
|
2014-04-09 23:31:05 +08:00
|
|
|
auto label = Label::createWithTTF("Back", "fonts/arial.ttf", 20);
|
2014-03-07 15:36:45 +08:00
|
|
|
//#endif
|
|
|
|
MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CustomParticleWidgetScene::BackCallback, this));
|
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
Menu* pMenu = Menu::create(pMenuItem, nullptr);
|
2014-03-07 15:36:45 +08:00
|
|
|
|
2014-05-15 01:07:09 +08:00
|
|
|
pMenu->setPosition( Vec2::ZERO );
|
|
|
|
pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
|
2014-03-07 15:36:45 +08:00
|
|
|
|
|
|
|
addChild(pMenu, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CustomParticleWidgetScene::runThisTest()
|
|
|
|
{
|
|
|
|
Layer* pLayer = new CustomParticleWidgetLayer();
|
|
|
|
addChild(pLayer);
|
|
|
|
pLayer->release();
|
|
|
|
|
|
|
|
CCDirector::getInstance()->replaceScene(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CustomParticleWidgetScene::BackCallback(Ref* pSender)
|
|
|
|
{
|
|
|
|
CustomGUITestScene* pScene = new CustomGUITestScene();
|
|
|
|
pScene->runThisTest();
|
|
|
|
pScene->release();
|
|
|
|
}
|