2014-03-04 16:51:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
#include "UIScrollViewTest_Editor.h"
|
|
|
|
|
|
|
|
|
|
|
|
// UIScrollViewTest_Vertical_Editor
|
|
|
|
|
|
|
|
UIScrollViewTest_Vertical_Editor::UIScrollViewTest_Vertical_Editor()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UIScrollViewTest_Vertical_Editor::~UIScrollViewTest_Vertical_Editor()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UIScrollViewTest_Vertical_Editor::init()
|
|
|
|
{
|
|
|
|
if (UIScene_Editor::init())
|
|
|
|
{
|
2014-03-11 17:13:54 +08:00
|
|
|
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Vertical_Editor/ui_scrollview_editor_1.json"));
|
2014-03-04 16:51:35 +08:00
|
|
|
_touchGroup->addChild(_layout);
|
|
|
|
Size screenSize = CCDirector::getInstance()->getWinSize();
|
|
|
|
Size rootSize = _layout->getSize();
|
2014-04-15 18:23:40 +08:00
|
|
|
_touchGroup->setPosition(Vector2((screenSize.width - rootSize.width) / 2,
|
2014-03-04 16:51:35 +08:00
|
|
|
(screenSize.height - rootSize.height) / 2));
|
|
|
|
|
|
|
|
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
|
|
|
|
|
|
|
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
|
|
|
back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene));
|
|
|
|
|
|
|
|
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
|
|
|
|
|
|
|
Button* left_button = Button::create();
|
2014-03-07 20:46:27 +08:00
|
|
|
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
2014-04-15 18:23:40 +08:00
|
|
|
left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width,
|
2014-03-04 16:51:35 +08:00
|
|
|
left_button->getSize().height * 0.625));
|
|
|
|
left_button->setTouchEnabled(true);
|
|
|
|
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
|
2014-03-24 10:12:40 +08:00
|
|
|
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
2014-03-04 16:51:35 +08:00
|
|
|
_layout->addChild(left_button);
|
|
|
|
|
|
|
|
Button* right_button = Button::create();
|
2014-03-07 20:46:27 +08:00
|
|
|
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
2014-04-15 18:23:40 +08:00
|
|
|
right_button->setPosition(Vector2(_layout->getSize().width / 2 + right_button->getSize().width,
|
2014-03-04 16:51:35 +08:00
|
|
|
right_button->getSize().height * 0.625));
|
|
|
|
right_button->setTouchEnabled(true);
|
2014-03-24 10:12:40 +08:00
|
|
|
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
2014-03-04 16:51:35 +08:00
|
|
|
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
|
|
|
|
_layout->addChild(right_button);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// UIScrollViewTest_Horizontal_Editor
|
|
|
|
|
|
|
|
UIScrollViewTest_Horizontal_Editor::UIScrollViewTest_Horizontal_Editor()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UIScrollViewTest_Horizontal_Editor::~UIScrollViewTest_Horizontal_Editor()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UIScrollViewTest_Horizontal_Editor::init()
|
|
|
|
{
|
|
|
|
if (UIScene_Editor::init())
|
|
|
|
{
|
2014-03-11 17:13:54 +08:00
|
|
|
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Horizontal_Editor/ui_scrollview_horizontal_editor_1.json"));
|
2014-03-04 16:51:35 +08:00
|
|
|
_touchGroup->addChild(_layout);
|
|
|
|
Size screenSize = CCDirector::getInstance()->getWinSize();
|
|
|
|
Size rootSize = _layout->getSize();
|
2014-04-15 18:23:40 +08:00
|
|
|
_touchGroup->setPosition(Vector2((screenSize.width - rootSize.width) / 2,
|
2014-03-04 16:51:35 +08:00
|
|
|
(screenSize.height - rootSize.height) / 2));
|
|
|
|
|
|
|
|
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
|
|
|
|
|
|
|
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
|
|
|
back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene));
|
|
|
|
|
|
|
|
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
|
|
|
|
|
|
|
Button* left_button = Button::create();
|
2014-03-07 20:46:27 +08:00
|
|
|
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
2014-04-15 18:23:40 +08:00
|
|
|
left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width,
|
2014-03-04 16:51:35 +08:00
|
|
|
left_button->getSize().height * 0.625));
|
|
|
|
left_button->setTouchEnabled(true);
|
|
|
|
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
|
2014-03-24 10:12:40 +08:00
|
|
|
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
2014-03-04 16:51:35 +08:00
|
|
|
_layout->addChild(left_button);
|
|
|
|
|
|
|
|
Button* right_button = Button::create();
|
2014-03-07 20:46:27 +08:00
|
|
|
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
2014-04-15 18:23:40 +08:00
|
|
|
right_button->setPosition(Vector2(_layout->getSize().width / 2 + right_button->getSize().width,
|
2014-03-04 16:51:35 +08:00
|
|
|
right_button->getSize().height * 0.625));
|
|
|
|
right_button->setTouchEnabled(true);
|
2014-03-24 10:12:40 +08:00
|
|
|
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
2014-03-04 16:51:35 +08:00
|
|
|
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
|
|
|
|
_layout->addChild(right_button);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// UIScrollViewTest_Both_Editor
|
|
|
|
|
|
|
|
UIScrollViewTest_Both_Editor::UIScrollViewTest_Both_Editor()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UIScrollViewTest_Both_Editor::~UIScrollViewTest_Both_Editor()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UIScrollViewTest_Both_Editor::init()
|
|
|
|
{
|
|
|
|
if (UIScene_Editor::init())
|
|
|
|
{
|
2014-03-11 17:13:54 +08:00
|
|
|
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Both_Editor/ui_scrollview_both_editor_1.json"));
|
2014-03-04 16:51:35 +08:00
|
|
|
_touchGroup->addChild(_layout);
|
|
|
|
Size screenSize = CCDirector::getInstance()->getWinSize();
|
|
|
|
Size rootSize = _layout->getSize();
|
2014-04-15 18:23:40 +08:00
|
|
|
_touchGroup->setPosition(Vector2((screenSize.width - rootSize.width) / 2,
|
2014-03-04 16:51:35 +08:00
|
|
|
(screenSize.height - rootSize.height) / 2));
|
|
|
|
|
|
|
|
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
|
|
|
|
|
|
|
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
|
|
|
back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene));
|
|
|
|
|
|
|
|
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
|
|
|
|
|
|
|
Button* left_button = Button::create();
|
2014-03-07 20:46:27 +08:00
|
|
|
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
2014-04-15 18:23:40 +08:00
|
|
|
left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width,
|
2014-03-04 16:51:35 +08:00
|
|
|
left_button->getSize().height * 0.625));
|
|
|
|
left_button->setTouchEnabled(true);
|
|
|
|
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
|
2014-03-24 10:12:40 +08:00
|
|
|
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
2014-03-04 16:51:35 +08:00
|
|
|
_layout->addChild(left_button);
|
|
|
|
|
|
|
|
Button* right_button = Button::create();
|
2014-03-07 20:46:27 +08:00
|
|
|
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
2014-04-15 18:23:40 +08:00
|
|
|
right_button->setPosition(Vector2(_layout->getSize().width / 2 + right_button->getSize().width,
|
2014-03-04 16:51:35 +08:00
|
|
|
right_button->getSize().height * 0.625));
|
|
|
|
right_button->setTouchEnabled(true);
|
2014-03-24 10:12:40 +08:00
|
|
|
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
2014-03-04 16:51:35 +08:00
|
|
|
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
|
|
|
|
_layout->addChild(right_button);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// UIScrollViewTest_ScrollToPercentBothDirection_Editor
|
|
|
|
|
|
|
|
UIScrollViewTest_ScrollToPercentBothDirection_Editor::UIScrollViewTest_ScrollToPercentBothDirection_Editor()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UIScrollViewTest_ScrollToPercentBothDirection_Editor::~UIScrollViewTest_ScrollToPercentBothDirection_Editor()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UIScrollViewTest_ScrollToPercentBothDirection_Editor::init()
|
|
|
|
{
|
|
|
|
if (UIScene_Editor::init())
|
|
|
|
{
|
2014-03-11 17:13:54 +08:00
|
|
|
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UITest/UITest.json"));
|
2014-03-04 16:51:35 +08:00
|
|
|
_touchGroup->addChild(_layout);
|
|
|
|
Size screenSize = CCDirector::getInstance()->getWinSize();
|
|
|
|
Size rootSize = _layout->getSize();
|
2014-04-15 18:23:40 +08:00
|
|
|
_touchGroup->setPosition(Vector2((screenSize.width - rootSize.width) / 2,
|
2014-03-04 16:51:35 +08:00
|
|
|
(screenSize.height - rootSize.height) / 2));
|
|
|
|
|
|
|
|
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
|
|
|
|
|
|
|
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
|
|
|
back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene));
|
|
|
|
|
|
|
|
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
|
|
|
|
|
|
|
Button* left_button = static_cast<Button*>(Helper::seekWidgetByName(root, "left_Button"));
|
|
|
|
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
|
|
|
|
|
|
|
|
Button* middle_button = static_cast<Button*>(Helper::seekWidgetByName(root, "middle_Button"));
|
|
|
|
middle_button->setVisible(false);
|
|
|
|
|
|
|
|
Button* right_button = static_cast<Button*>(Helper::seekWidgetByName(root, "right_Button"));
|
|
|
|
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor
|
|
|
|
|
|
|
|
UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor::UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor::~UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor::init()
|
|
|
|
{
|
|
|
|
if (UIScene_Editor::init())
|
|
|
|
{
|
2014-03-11 17:13:54 +08:00
|
|
|
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UITest/UITest.json"));
|
2014-03-04 16:51:35 +08:00
|
|
|
_touchGroup->addChild(_layout);
|
|
|
|
Size screenSize = CCDirector::getInstance()->getWinSize();
|
|
|
|
Size rootSize = _layout->getSize();
|
2014-04-15 18:23:40 +08:00
|
|
|
_touchGroup->setPosition(Vector2((screenSize.width - rootSize.width) / 2,
|
2014-03-04 16:51:35 +08:00
|
|
|
(screenSize.height - rootSize.height) / 2));
|
|
|
|
|
|
|
|
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
|
|
|
|
|
|
|
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
|
|
|
back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene));
|
|
|
|
|
|
|
|
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
|
|
|
|
|
|
|
Button* left_button = static_cast<Button*>(Helper::seekWidgetByName(root, "left_Button"));
|
|
|
|
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
|
|
|
|
|
|
|
|
Button* middle_button = static_cast<Button*>(Helper::seekWidgetByName(root, "middle_Button"));
|
|
|
|
middle_button->setVisible(false);
|
|
|
|
|
|
|
|
Button* right_button = static_cast<Button*>(Helper::seekWidgetByName(root, "right_Button"));
|
|
|
|
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|