2014-03-04 16:51:35 +08:00
|
|
|
#include "UIScene_Editor.h"
|
|
|
|
#include "GUIEditorTest.h"
|
2014-03-11 17:13:54 +08:00
|
|
|
#include "ui/CocosGUI.h"
|
2014-03-04 16:51:35 +08:00
|
|
|
#include "UISceneManager_Editor.h"
|
|
|
|
|
2015-04-09 12:23:47 +08:00
|
|
|
USING_NS_CC;
|
|
|
|
using namespace cocos2d::ui;
|
2014-03-04 16:51:35 +08:00
|
|
|
|
|
|
|
UIScene_Editor::UIScene_Editor()
|
2015-04-03 14:31:03 +08:00
|
|
|
: _touchGroup(nullptr)
|
2014-04-09 22:53:59 +08:00
|
|
|
, _layout(nullptr)
|
2015-04-03 14:31:03 +08:00
|
|
|
, _sceneTitle(nullptr)
|
2014-03-04 16:51:35 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UIScene_Editor::~UIScene_Editor()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UIScene_Editor::init()
|
|
|
|
{
|
2015-04-03 14:31:03 +08:00
|
|
|
if (TestCase::init())
|
2014-03-04 16:51:35 +08:00
|
|
|
{
|
|
|
|
_touchGroup = Layer::create();
|
2015-04-03 14:31:03 +08:00
|
|
|
addChild(_touchGroup);
|
2014-07-01 14:21:27 +08:00
|
|
|
|
2014-03-04 16:51:35 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
void UIScene_Editor::onEnter()
|
2014-07-01 14:21:27 +08:00
|
|
|
{
|
2015-04-03 14:31:03 +08:00
|
|
|
TestCase::onEnter();
|
2014-07-01 14:21:27 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
if (_sceneTitle)
|
2014-03-04 16:51:35 +08:00
|
|
|
{
|
2015-04-03 14:31:03 +08:00
|
|
|
_sceneTitle->setString(getTestCaseName());
|
2014-03-04 16:51:35 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
void UIScene_Editor::onExit()
|
2014-03-04 16:51:35 +08:00
|
|
|
{
|
2015-04-03 14:31:03 +08:00
|
|
|
cocostudio::destroyCocosStudio();
|
|
|
|
|
|
|
|
TestCase::onExit();
|
2014-03-04 16:51:35 +08:00
|
|
|
}
|
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
void UIScene_Editor::configureGUIScene()
|
2014-03-04 16:51:35 +08:00
|
|
|
{
|
2015-04-03 14:31:03 +08:00
|
|
|
if (_touchGroup)
|
2014-03-04 16:51:35 +08:00
|
|
|
{
|
2015-07-15 12:04:48 +08:00
|
|
|
Size screenSize = Director::getInstance()->getWinSize();
|
2015-04-03 14:31:03 +08:00
|
|
|
Size rootSize = _layout->getContentSize();
|
|
|
|
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
|
|
|
(screenSize.height - rootSize.height) / 2));
|
2014-03-04 16:51:35 +08:00
|
|
|
}
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
if (_layout)
|
|
|
|
{
|
|
|
|
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
|
|
|
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
|
|
|
}
|
|
|
|
}
|