PuzzleSDK
UILoadingBarIssue12249类 参考

#include <UILoadingBarTest.h>

+ 类 UILoadingBarIssue12249 继承关系图:
+ UILoadingBarIssue12249 的协作图:

Public 成员函数

 CREATE_FUNC (UILoadingBarIssue12249)
 
 UILoadingBarIssue12249 ()
 
 ~UILoadingBarIssue12249 ()
 
virtual bool init () override
 
void update (float delta) override
 
- Public 成员函数 继承自 UIScene
 UIScene ()
 
 ~UIScene ()
 
virtual void onEnter () override
 
- Public 成员函数 继承自 TestCase
 TestCase ()
 
 ~TestCase ()
 
virtual std::string title () const
 
virtual std::string subtitle () const
 
virtual Type getTestType () const
 
virtual float getDuration () const
 
virtual std::string getExpectedOutput () const
 
virtual std::string getActualOutput () const
 
virtual void restartTestCallback (cocos2d::Ref *sender)
 
virtual void nextTestCallback (cocos2d::Ref *sender)
 
virtual void priorTestCallback (cocos2d::Ref *sender)
 
virtual void onBackCallback (cocos2d::Ref *sender)
 
void setTestSuite (TestSuite *testSuite)
 
TestSuitegetTestSuite () const
 
float getRunTime () const
 
void setTestCaseName (const std::string &name)
 
std::string getTestCaseName () const
 
const cocos2d::Label * getSubtitleLable () const
 
const cocos2d::MenuItemImage * getRestartTestItem () const
 

Protected 属性

int _count
 
- Protected 属性 继承自 UIScene
cocos2d::Layer * _uiLayer
 
cocos2d::ui::Layout * _widget
 
cocos2d::ui::Text * _sceneTitle
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 

详细描述

在文件 UILoadingBarTest.h119 行定义.

构造及析构函数说明

◆ UILoadingBarIssue12249()

UILoadingBarIssue12249::UILoadingBarIssue12249 ( )

在文件 UILoadingBarTest.cpp452 行定义.

453: _count(0)
454{
455
456}

◆ ~UILoadingBarIssue12249()

UILoadingBarIssue12249::~UILoadingBarIssue12249 ( )

在文件 UILoadingBarTest.cpp458 行定义.

459{
460 unscheduleUpdate();
461}

成员函数说明

◆ CREATE_FUNC()

UILoadingBarIssue12249::CREATE_FUNC ( UILoadingBarIssue12249  )

◆ init()

bool UILoadingBarIssue12249::init ( )
overridevirtual

重载 UIScene .

在文件 UILoadingBarTest.cpp463 行定义.

464{
465 if (UIScene::init())
466 {
467 scheduleUpdate();
468
469 Size widgetSize = _widget->getContentSize();
470
471 // Add the alert
472 Text* alert = Text::create("Test LoadingBar Change Direction",
473 "fonts/Marker Felt.ttf", 30);
474 alert->setColor(Color3B(159, 168, 176));
475 alert->setPosition(Vec2(widgetSize.width / 2.0f,
476 widgetSize.height / 2.0f - alert->getContentSize().height * 1.75f));
477 _uiLayer->addChild(alert);
478
479 // Create the loading bar
480 LoadingBar* loadingBar = LoadingBar::create("cocosui/sliderProgress.png");
481 loadingBar->setScale9Enabled(true);
482 loadingBar->setContentSize(Size(200, loadingBar->getContentSize().height * 1.5));
483 loadingBar->setTag(0);
484 loadingBar->setPosition(Vec2(widgetSize.width / 2.0f,
485 widgetSize.height / 2.0f + loadingBar->getContentSize().height / 4.0f));
486
487 LoadingBar* loadingBarCopy = LoadingBar::create();
488 loadingBarCopy->setScale9Enabled(true);
489 loadingBarCopy->loadTexture("cocosui/sliderProgress.png");
490 loadingBarCopy->setContentSize(Size(200, loadingBarCopy->getContentSize().height * 1.5));
491 loadingBarCopy->setTag(1);
492 loadingBarCopy->setPosition(loadingBar->getPosition()
493 + Vec2(0, -40));
494 loadingBarCopy->setDirection(LoadingBar::Direction::RIGHT);
495
496 Button* button = Button::create("cocosui/animationbuttonnormal.png",
497 "cocosui/animationbuttonpressed.png");
498 button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + 50));
499 button->setTitleText("Click to change direction!");
500
501 button->addTouchEventListener([=](Ref*, Widget::TouchEventType type)
502 {
503 if (type == Widget::TouchEventType::ENDED)
504 {
505 if (loadingBar->getDirection() == LoadingBar::Direction::LEFT)
506 {
507 loadingBar->setDirection(LoadingBar::Direction::RIGHT);
508 loadingBarCopy->setDirection(LoadingBar::Direction::LEFT);
509 }
510 else
511 {
512 loadingBar->setDirection(LoadingBar::Direction::LEFT);
513 loadingBarCopy->setDirection(LoadingBar::Direction::RIGHT);
514 }
515 }
516 });
517 _uiLayer->addChild(loadingBar,1);
518 _uiLayer->addChild(loadingBarCopy,2);
519 _uiLayer->addChild(button);
520
521 return true;
522 }
523 return false;
524}
cocos2d::Layer * _uiLayer
Definition: UIScene.h:44
virtual bool init() override
Definition: UIScene.cpp:46
cocos2d::ui::Layout * _widget
Definition: UIScene.h:45

引用了 UIScene::_uiLayer, UIScene::_widget , 以及 UIScene::init().

+ 函数调用图:

◆ update()

void UILoadingBarIssue12249::update ( float  delta)
override

在文件 UILoadingBarTest.cpp526 行定义.

527{
528 _count++;
529 if (_count > 100)
530 {
531 _count = 0;
532 }
533 LoadingBar* loadingBar = static_cast<LoadingBar*>(_uiLayer->getChildByTag(0));
534 LoadingBar* loadingBarCopy = static_cast<LoadingBar*>(_uiLayer->getChildByTag(1));
535 loadingBar->setPercent(_count);
536 loadingBarCopy->setPercent(_count);
537}

引用了 _count , 以及 UIScene::_uiLayer.

类成员变量说明

◆ _count

int UILoadingBarIssue12249::_count
protected

在文件 UILoadingBarTest.h130 行定义.

被这些函数引用 update().


该类的文档由以下文件生成: