2014-03-04 16:51:35 +08:00
|
|
|
#include "UILoadingBarTest_Editor.h"
|
|
|
|
|
2015-04-09 12:23:47 +08:00
|
|
|
USING_NS_CC;
|
|
|
|
using namespace cocos2d::ui;
|
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
UILoadingBarEditorTests::UILoadingBarEditorTests()
|
|
|
|
{
|
|
|
|
ADD_TEST_CASE(UILoadingBarTest_Editor);
|
|
|
|
}
|
2014-03-04 16:51:35 +08:00
|
|
|
// UILoadingBarTest_Editor
|
|
|
|
|
|
|
|
UILoadingBarTest_Editor::UILoadingBarTest_Editor()
|
2014-07-04 11:48:55 +08:00
|
|
|
:_count(0)
|
2014-03-04 16:51:35 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UILoadingBarTest_Editor::~UILoadingBarTest_Editor()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-07-01 15:19:40 +08:00
|
|
|
void UILoadingBarTest_Editor::configureGUIScene()
|
|
|
|
{
|
2015-04-03 14:31:03 +08:00
|
|
|
UIScene_Editor::configureGUIScene();
|
|
|
|
|
2014-07-01 15:19:40 +08:00
|
|
|
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
|
|
|
|
|
|
|
LoadingBar* loadingBar_left_to_right = dynamic_cast<LoadingBar*>(Helper::seekWidgetByName(root, "LoadingBar_856"));
|
|
|
|
loadingBar_left_to_right->setPercent(0);
|
|
|
|
|
|
|
|
LoadingBar* loadingBar_right_to_left = dynamic_cast<LoadingBar*>(Helper::seekWidgetByName(root, "LoadingBar_857"));
|
|
|
|
loadingBar_right_to_left->setPercent(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UILoadingBarTest_Editor::init()
|
|
|
|
{
|
|
|
|
if (UIScene_Editor::init())
|
|
|
|
{
|
|
|
|
scheduleUpdate();
|
2014-03-04 16:51:35 +08:00
|
|
|
|
2015-05-14 18:08:37 +08:00
|
|
|
Node* node = CSLoader::createNode("cocosui/UIEditorTest/UILoadingBar/res.csb");
|
2014-10-10 10:44:16 +08:00
|
|
|
Node* child = node->getChildByTag(5);
|
|
|
|
child->removeFromParent();
|
|
|
|
_layout = static_cast<Layout*>(child);
|
2014-07-01 15:19:40 +08:00
|
|
|
_touchGroup->addChild(_layout);
|
2014-10-10 10:44:16 +08:00
|
|
|
|
2014-07-01 15:19:40 +08:00
|
|
|
this->configureGUIScene();
|
2014-10-10 10:44:16 +08:00
|
|
|
|
2014-03-04 16:51:35 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void UILoadingBarTest_Editor::update(float delta)
|
|
|
|
{
|
|
|
|
_count++;
|
|
|
|
if (_count > 100)
|
|
|
|
{
|
|
|
|
_count = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
|
|
|
|
|
|
|
LoadingBar* loadingBar_left_to_right = dynamic_cast<LoadingBar*>(Helper::seekWidgetByName(root, "LoadingBar_856"));
|
|
|
|
loadingBar_left_to_right->setPercent(_count);
|
|
|
|
|
|
|
|
LoadingBar* loadingBar_right_to_left = dynamic_cast<LoadingBar*>(Helper::seekWidgetByName(root, "LoadingBar_857"));
|
|
|
|
loadingBar_right_to_left->setPercent(_count);
|
|
|
|
}
|