PuzzleSDK
UIPageViewIndicatorTest类 参考

#include <UIPageViewTest.h>

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

Public 成员函数

 CREATE_FUNC (UIPageViewIndicatorTest)
 
 UIPageViewIndicatorTest ()
 
 ~UIPageViewIndicatorTest ()
 
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 属性

cocos2d::ui::Text * _displayValueLabel
 
- 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
 

详细描述

在文件 UIPageViewTest.h159 行定义.

构造及析构函数说明

◆ UIPageViewIndicatorTest()

UIPageViewIndicatorTest::UIPageViewIndicatorTest ( )

在文件 UIPageViewTest.cpp997 行定义.

998: _displayValueLabel(nullptr)
999{
1000
1001}
cocos2d::ui::Text * _displayValueLabel

◆ ~UIPageViewIndicatorTest()

UIPageViewIndicatorTest::~UIPageViewIndicatorTest ( )

在文件 UIPageViewTest.cpp1003 行定义.

1004{
1005}

成员函数说明

◆ CREATE_FUNC()

UIPageViewIndicatorTest::CREATE_FUNC ( UIPageViewIndicatorTest  )

◆ init()

bool UIPageViewIndicatorTest::init ( )
overridevirtual

重载 UIScene .

在文件 UIPageViewTest.cpp1007 行定义.

1008{
1009 if (UIScene::init())
1010 {
1011 Size widgetSize = _widget->getContentSize();
1012
1013 // Add a label in which the dragpanel events will be displayed
1014 _displayValueLabel = Text::create("PageView indicator custom texture\nscale : 0.5, index color: RED", "fonts/Marker Felt.ttf", 16);
1015 _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
1016 _displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f,
1017 widgetSize.height / 2.0f +
1018 _displayValueLabel->getContentSize().height));
1019 _uiLayer->addChild(_displayValueLabel);
1020
1021 // Add the black background
1022 Text* alert = Text::create("PageView", "fonts/Marker Felt.ttf", 30);
1023 alert->setColor(Color3B(159, 168, 176));
1024 alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 3.075f));
1025 _uiLayer->addChild(alert);
1026
1027 Layout* root = static_cast<Layout*>(_uiLayer->getChildByTag(81));
1028
1029 Layout* background = dynamic_cast<Layout*>(root->getChildByName("background_Panel"));
1030
1031 // Create the page view
1032 PageView* pageView = PageView::create();
1033 pageView->setContentSize(Size(240.0f, 130.0f));
1034 Size backgroundSize = background->getContentSize();
1035 pageView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
1036 (backgroundSize.width - pageView->getContentSize().width) / 2.0f,
1037 (widgetSize.height - backgroundSize.height) / 2.0f +
1038 (backgroundSize.height - pageView->getContentSize().height) / 2.0f));
1039 pageView->setDirection(ui::PageView::Direction::VERTICAL);
1040 pageView->removeAllItems();
1041
1042 pageView->setIndicatorEnabled(true);
1043 pageView->setIndicatorSpaceBetweenIndexNodes(5);
1044 pageView->setIndicatorIndexNodesScale(0.5);
1045 pageView->setIndicatorIndexNodesTexture("cocosui/green_edit.png");
1046 pageView->setIndicatorIndexNodesColor(Color3B::RED);
1047
1048 int pageCount = 4;
1049 for (int i = 0; i < pageCount; ++i)
1050 {
1051 Layout* layout = Layout::create();
1052 layout->setContentSize(Size(240.0f, 130.0f));
1053
1054 ImageView* imageView = ImageView::create("cocosui/scrollviewbg.png");
1055 imageView->setScale9Enabled(true);
1056 imageView->setContentSize(Size(240.0f, 130.0f));
1057 imageView->setPosition(Vec2(layout->getContentSize().width / 2.0f, layout->getContentSize().height / 2.0f));
1058 layout->addChild(imageView);
1059
1060 Text* label = Text::create(StringUtils::format("page %d",(i+1)), "fonts/Marker Felt.ttf", 30);
1061 label->setColor(Color3B(192, 192, 192));
1062 label->setPosition(Vec2(layout->getContentSize().width / 2.0f, layout->getContentSize().height / 2.0f));
1063 layout->addChild(label);
1064
1065 pageView->insertCustomItem(layout, i);
1066 }
1067
1068 _uiLayer->addChild(pageView);
1069
1070
1071 return true;
1072 }
1073 return false;
1074}
cocos2d::Layer * _uiLayer
Definition: UIScene.h:44
virtual bool init() override
Definition: UIScene.cpp:46
cocos2d::ui::Layout * _widget
Definition: UIScene.h:45

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

+ 函数调用图:

类成员变量说明

◆ _displayValueLabel

cocos2d::ui::Text* UIPageViewIndicatorTest::_displayValueLabel
protected

在文件 UIPageViewTest.h170 行定义.

被这些函数引用 init().


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