25#include "extensions/cocos-ext.h"
28#include "editor-support/cocostudio/CCSGUIReader.h"
32using namespace cocos2d::ui;
53 _widget =
dynamic_cast<Layout*
>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile(
"cocosui/UITest/UITest.json"));
56 Size screenSize = Director::getInstance()->getWinSize();
57 Size rootSize =
_widget->getContentSize();
58 _uiLayer->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
59 (screenSize.height - rootSize.height) / 2));
63 auto restartButton = Helper::seekWidgetByName(
_widget,
"middle_Button");
64 restartButton->setVisible(
false);
65 restartButton->setEnabled(
false);
67 auto leftButton = Helper::seekWidgetByName(
_widget,
"left_Button");
68 leftButton->setVisible(
false);
69 leftButton->setEnabled(
false);
71 auto rightButton = Helper::seekWidgetByName(
_widget,
"right_Button");
72 rightButton->setVisible(
false);
73 rightButton->setEnabled(
false);
75 Layout* root =
static_cast<Layout*
>(
_uiLayer->getChildByTag(81));
77 _sceneTitle =
dynamic_cast<Text*
>(root->getChildByName(
"UItest"));
std::string getTestCaseName() const
virtual void onEnter() override
virtual void onEnter() override
cocos2d::Layer * _uiLayer
virtual bool init() override
cocos2d::ui::Text * _sceneTitle
cocos2d::ui::Layout * _widget