PuzzleSDK
UILoadingBarTest_Scale9_State_Change类 参考

#include <UILoadingBarTest.h>

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

Public 成员函数

 CREATE_FUNC (UILoadingBarTest_Scale9_State_Change)
 
 UILoadingBarTest_Scale9_State_Change ()
 
 ~UILoadingBarTest_Scale9_State_Change ()
 
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
 
- 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.h91 行定义.

构造及析构函数说明

◆ UILoadingBarTest_Scale9_State_Change()

UILoadingBarTest_Scale9_State_Change::UILoadingBarTest_Scale9_State_Change ( )

在文件 UILoadingBarTest.cpp308 行定义.

309 : _count(0)
310{
311
312}

◆ ~UILoadingBarTest_Scale9_State_Change()

UILoadingBarTest_Scale9_State_Change::~UILoadingBarTest_Scale9_State_Change ( )

在文件 UILoadingBarTest.cpp314 行定义.

315{
316
317}

成员函数说明

◆ CREATE_FUNC()

UILoadingBarTest_Scale9_State_Change::CREATE_FUNC ( UILoadingBarTest_Scale9_State_Change  )

◆ init()

bool UILoadingBarTest_Scale9_State_Change::init ( )
overridevirtual

重载 UIScene .

在文件 UILoadingBarTest.cpp319 行定义.

320{
321 if (UIScene::init())
322 {
323 Size widgetSize = _widget->getContentSize();
324
325 // Add the alert
326 Text *alert = Text::create("LoadingBar right scale9 render", "fonts/Marker Felt.ttf", 20);
327 alert->setColor(Color3B(159, 168, 176));
328 alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 2.7f));
329 _uiLayer->addChild(alert);
330
331 // Create the loading bar
332 LoadingBar* loadingBar = LoadingBar::create("cocosui/sliderThumb.png");
333 loadingBar->setTag(0);
334 loadingBar->ignoreContentAdaptWithSize(false);
335 //loadingBar->setScale9Enabled(true);
336 loadingBar->setCapInsets(Rect(0, 0, 0, 0));
337 loadingBar->setContentSize(Size(200, 80));
338 loadingBar->setDirection(LoadingBar::Direction::LEFT);
339 loadingBar->setPercent(100);
340
341 loadingBar->setTouchEnabled(true);
342 loadingBar->addTouchEventListener([=](Ref* sender, Widget::TouchEventType type){
343 if (type == Widget::TouchEventType::ENDED) {
344 if (loadingBar->isScale9Enabled())
345 {
346 loadingBar->setScale9Enabled(false);
347 }
348 else
349 loadingBar->setScale9Enabled(true);
350 }
351 });
352
353 loadingBar->setPosition(Vec2(widgetSize.width / 2.0f,
354 widgetSize.height / 2.0f + loadingBar->getContentSize().height / 4.0f));
355
356 _uiLayer->addChild(loadingBar);
357
358 return true;
359 }
360 return false;
361}
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().

+ 函数调用图:

类成员变量说明

◆ _count

int UILoadingBarTest_Scale9_State_Change::_count
protected

在文件 UILoadingBarTest.h101 行定义.


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