PuzzleSDK
UILoadingBarTest_Direction类 参考

#include <UILoadingBarTest.h>

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

Public 成员函数

 CREATE_FUNC (UILoadingBarTest_Direction)
 
 UILoadingBarTest_Direction ()
 
 ~UILoadingBarTest_Direction ()
 
virtual bool init () 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
 
cocos2d::ui::LoadingBar * _loadingBar
 
- 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.h133 行定义.

构造及析构函数说明

◆ UILoadingBarTest_Direction()

UILoadingBarTest_Direction::UILoadingBarTest_Direction ( )

在文件 UILoadingBarTest.cpp541 行定义.

542 : _count(0)
543{
544
545}

◆ ~UILoadingBarTest_Direction()

UILoadingBarTest_Direction::~UILoadingBarTest_Direction ( )

在文件 UILoadingBarTest.cpp547 行定义.

548{
549 //unscheduleUpdate();
550}

成员函数说明

◆ CREATE_FUNC()

UILoadingBarTest_Direction::CREATE_FUNC ( UILoadingBarTest_Direction  )

◆ init()

bool UILoadingBarTest_Direction::init ( )
overridevirtual

重载 UIScene .

在文件 UILoadingBarTest.cpp552 行定义.

553{
554 if (UIScene::init())
555 {
556 //scheduleUpdate();
557
558 Size widgetSize = _widget->getContentSize();
559
560 // Add the alert
561 Text* alert = Text::create("Test LoadingBar Change Direction",
562 "fonts/Marker Felt.ttf", 30);
563 alert->setColor(Color3B(159, 168, 176));
564 alert->setPosition(Vec2(widgetSize.width / 2.0f,
565 widgetSize.height / 2.0f - alert->getContentSize().height * 1.75f));
566 _uiLayer->addChild(alert);
567
568 // Create the loading bar
569 LoadingBar* loadingBar = LoadingBar::create("cocosui/sliderProgress.png");
570 loadingBar->setTag(0);
571 loadingBar->setPercent(80);
572 loadingBar->setPosition(Vec2(widgetSize.width / 2.0f,
573 widgetSize.height / 2.0f + loadingBar->getContentSize().height / 4.0f));
574
575 auto loadingBarCopy = (LoadingBar*)loadingBar->clone();
576 loadingBarCopy->setTag(1);
577 loadingBarCopy->setPosition(loadingBar->getPosition()
578 + Vec2(0, -40));
579 loadingBarCopy->setDirection(LoadingBar::Direction::RIGHT);
580
581 Button* button = Button::create("cocosui/animationbuttonnormal.png",
582 "cocosui/animationbuttonpressed.png");
583 button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + 50));
584 button->setTitleText("Click to change direction!");
585
586 button->addTouchEventListener([=](Ref*, Widget::TouchEventType type)
587 {
588 if (type == Widget::TouchEventType::ENDED)
589 {
590 if (loadingBar->getDirection() == LoadingBar::Direction::LEFT)
591 {
592 loadingBar->setDirection(LoadingBar::Direction::RIGHT);
593 loadingBarCopy->setDirection(LoadingBar::Direction::LEFT);
594 }
595 else
596 {
597 loadingBar->setDirection(LoadingBar::Direction::LEFT);
598 loadingBarCopy->setDirection(LoadingBar::Direction::RIGHT);
599 }
600 }
601 });
602 _uiLayer->addChild(loadingBar, 1);
603 _uiLayer->addChild(loadingBarCopy, 2);
604 _uiLayer->addChild(button);
605
606 _loadingBar = loadingBar;
607 return true;
608 }
609 return false;
610}
cocos2d::ui::LoadingBar * _loadingBar
cocos2d::Layer * _uiLayer
Definition: UIScene.h:44
virtual bool init() override
Definition: UIScene.cpp:46
cocos2d::ui::Layout * _widget
Definition: UIScene.h:45

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

+ 函数调用图:

类成员变量说明

◆ _count

int UILoadingBarTest_Direction::_count
protected

在文件 UILoadingBarTest.h142 行定义.

◆ _loadingBar

cocos2d::ui::LoadingBar* UILoadingBarTest_Direction::_loadingBar
protected

在文件 UILoadingBarTest.h143 行定义.

被这些函数引用 init().


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