closed #5110, refactor

This commit is contained in:
andyque 2014-05-14 17:07:24 +08:00
parent 9d5c2ba773
commit 6cb3b47488
4 changed files with 113 additions and 183 deletions

View File

@ -116,7 +116,7 @@ void LoadingBar::setDirection(cocos2d::ui::LoadingBar::Direction direction)
} }
LoadingBar::Direction LoadingBar::getDirection() LoadingBar::Direction LoadingBar::getDirection()const
{ {
return _direction; return _direction;
} }

View File

@ -82,7 +82,7 @@ public:
* *
* @return Direction * @return Direction
*/ */
Direction getDirection(); Direction getDirection()const;
/** /**
* Load texture for loadingbar. * Load texture for loadingbar.

View File

@ -25,27 +25,27 @@ g_guisTests[] =
"GUI Dynamic Create Test", "GUI Dynamic Create Test",
[](Ref* sender) [](Ref* sender)
{ {
CocosGUITestScene *pScene = new CocosGUITestScene(); CocosGUITestScene *scene = new CocosGUITestScene();
pScene->runThisTest(); scene->runThisTest();
pScene->release(); scene->release();
} }
}, },
{ {
"GUI Editor Test", "GUI Editor Test",
[](Ref* sender) [](Ref* sender)
{ {
GUIEditorTestScene* pScene = new GUIEditorTestScene(); GUIEditorTestScene* scene = new GUIEditorTestScene();
pScene->runThisTest(); scene->runThisTest();
pScene->release(); scene->release();
} }
}, },
{ {
"Custom GUI Test", "Custom GUI Test",
[](Ref* sender) [](Ref* sender)
{ {
CustomGUITestScene* pScene = new CustomGUITestScene(); CustomGUITestScene* scene = new CustomGUITestScene();
pScene->runThisTest(); scene->runThisTest();
pScene->release(); scene->release();
} }
}, },
}; };

View File

@ -21,12 +21,12 @@ g_guisTests[] =
"VideoPlayerTest", "VideoPlayerTest",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUIVideoPlayerTest); sceneManager->setCurrentUISceneId(kUIVideoPlayerTest);
pManager->setMinUISceneId(kUIVideoPlayerTest); sceneManager->setMinUISceneId(kUIVideoPlayerTest);
pManager->setMaxUISceneId(kUIVideoPlayerTest); sceneManager->setMaxUISceneId(kUIVideoPlayerTest);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },
#endif #endif
@ -34,12 +34,12 @@ g_guisTests[] =
"focus test", "focus test",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(KUIFocusTest_HBox); sceneManager->setCurrentUISceneId(KUIFocusTest_HBox);
pManager->setMinUISceneId(KUIFocusTest_HBox); sceneManager->setMinUISceneId(KUIFocusTest_HBox);
pManager->setMaxUISceneId(KUIFocusTest_NestedLayout3); sceneManager->setMaxUISceneId(KUIFocusTest_NestedLayout3);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },
{ {
@ -47,250 +47,180 @@ g_guisTests[] =
"ButtonTest", "ButtonTest",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUIButtonTest); sceneManager->setCurrentUISceneId(kUIButtonTest);
pManager->setMinUISceneId(kUIButtonTest); sceneManager->setMinUISceneId(kUIButtonTest);
pManager->setMaxUISceneId(kUIButtonTest_Title); sceneManager->setMaxUISceneId(kUIButtonTest_Title);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },
{ {
"CheckBoxTest", "CheckBoxTest",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUICheckBoxTest); sceneManager->setCurrentUISceneId(kUICheckBoxTest);
pManager->setMinUISceneId(kUICheckBoxTest); sceneManager->setMinUISceneId(kUICheckBoxTest);
pManager->setMaxUISceneId(kUICheckBoxTest); sceneManager->setMaxUISceneId(kUICheckBoxTest);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },
{ {
"SliderTest", "SliderTest",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUISliderTest); sceneManager->setCurrentUISceneId(kUISliderTest);
pManager->setMinUISceneId(kUISliderTest); sceneManager->setMinUISceneId(kUISliderTest);
pManager->setMaxUISceneId(kUISliderTest_Scale9); sceneManager->setMaxUISceneId(kUISliderTest_Scale9);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },
/*
{
"PotentiometerTest",
[](Ref* sender)
{
UISceneManager* pManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUIPotentiometerTest);
pManager->setMinUISceneId(kUIPotentiometerTest);
pManager->setMaxUISceneId(kUIPotentiometerTest);
Scene* pScene = pManager->currentUIScene();
Director::getInstance()->replaceScene(pScene);
}
},
*/
/*
{
"SwitchTest",
[](Ref* sender)
{
UISceneManager* pManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUISwitchTest_Horizontal);
pManager->setMinUISceneId(kUISwitchTest_Horizontal);
pManager->setMaxUISceneId(kUISwitchTest_VerticalAndTitleVertical);
Scene* pScene = pManager->currentUIScene();
Director::getInstance()->replaceScene(pScene);
}
},
*/
{ {
"ImageViewTest", "ImageViewTest",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUIImageViewTest); sceneManager->setCurrentUISceneId(kUIImageViewTest);
pManager->setMinUISceneId(kUIImageViewTest); sceneManager->setMinUISceneId(kUIImageViewTest);
pManager->setMaxUISceneId(kUIImageViewTest_Scale9); sceneManager->setMaxUISceneId(kUIImageViewTest_Scale9);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },
{ {
"LoadingBarTest", "LoadingBarTest",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUILoadingBarTest_Left); sceneManager->setCurrentUISceneId(kUILoadingBarTest_Left);
pManager->setMinUISceneId(kUILoadingBarTest_Left); sceneManager->setMinUISceneId(kUILoadingBarTest_Left);
pManager->setMaxUISceneId(kUILoadingBarTest_Right_Scale9); sceneManager->setMaxUISceneId(kUILoadingBarTest_Right_Scale9);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },
/*
{
"ProgressTimerTest",
[](Ref* sender)
{
UISceneManager* pManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUIProgressTimerTest_Radial);
pManager->setMinUISceneId(kUIProgressTimerTest_Radial);
pManager->setMaxUISceneId(kUIProgressTimerTest_WithSpriteFrame);
Scene* pScene = pManager->currentUIScene();
Director::getInstance()->replaceScene(pScene);
}
},
*/
{ {
"TextAtalsTest", "TextAtalsTest",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUITextAtlasTest); sceneManager->setCurrentUISceneId(kUITextAtlasTest);
pManager->setMinUISceneId(kUITextAtlasTest); sceneManager->setMinUISceneId(kUITextAtlasTest);
pManager->setMaxUISceneId(kUITextAtlasTest); sceneManager->setMaxUISceneId(kUITextAtlasTest);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },
{ {
"TextTest", "TextTest",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUITextTest); sceneManager->setCurrentUISceneId(kUITextTest);
pManager->setMinUISceneId(kUITextTest); sceneManager->setMinUISceneId(kUITextTest);
pManager->setMaxUISceneId(kUITextTest_TTF); sceneManager->setMaxUISceneId(kUITextTest_TTF);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },
{ {
"TextBMFontTest", "TextBMFontTest",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUITextBMFontTest); sceneManager->setCurrentUISceneId(kUITextBMFontTest);
pManager->setMinUISceneId(kUITextBMFontTest); sceneManager->setMinUISceneId(kUITextBMFontTest);
pManager->setMaxUISceneId(kUITextBMFontTest); sceneManager->setMaxUISceneId(kUITextBMFontTest);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },
{ {
"TextFieldTest", "TextFieldTest",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUITextFieldTest); sceneManager->setCurrentUISceneId(kUITextFieldTest);
pManager->setMinUISceneId(kUITextFieldTest); sceneManager->setMinUISceneId(kUITextFieldTest);
pManager->setMaxUISceneId(kUITextFieldTest_LineWrap); sceneManager->setMaxUISceneId(kUITextFieldTest_LineWrap);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },
{ {
"LayoutTest", "LayoutTest",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUILayoutTest); sceneManager->setCurrentUISceneId(kUILayoutTest);
pManager->setMinUISceneId(kUILayoutTest); sceneManager->setMinUISceneId(kUILayoutTest);
pManager->setMaxUISceneId(kUILayoutTest_Layout_Relative_Location); sceneManager->setMaxUISceneId(kUILayoutTest_Layout_Relative_Location);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },
{ {
"ScrollViewTest", "ScrollViewTest",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUIScrollViewTest_Vertical); sceneManager->setCurrentUISceneId(kUIScrollViewTest_Vertical);
pManager->setMinUISceneId(kUIScrollViewTest_Vertical); sceneManager->setMinUISceneId(kUIScrollViewTest_Vertical);
pManager->setMaxUISceneId(kUIScrollViewTest_ScrollToPercentBothDirection_Bounce); sceneManager->setMaxUISceneId(kUIScrollViewTest_ScrollToPercentBothDirection_Bounce);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },
{ {
"PageViewTest", "PageViewTest",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUIPageViewTest); sceneManager->setCurrentUISceneId(kUIPageViewTest);
pManager->setMinUISceneId(kUIPageViewTest); sceneManager->setMinUISceneId(kUIPageViewTest);
pManager->setMaxUISceneId(kUIPageViewTest); sceneManager->setMaxUISceneId(kUIPageViewTest);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },
{ {
"ListViewTest", "ListViewTest",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUIListViewTest_Vertical); sceneManager->setCurrentUISceneId(kUIListViewTest_Vertical);
pManager->setMinUISceneId(kUIListViewTest_Vertical); sceneManager->setMinUISceneId(kUIListViewTest_Vertical);
pManager->setMaxUISceneId(kUIListViewTest_Horizontal); sceneManager->setMaxUISceneId(kUIListViewTest_Horizontal);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },
/*
{
"GridViewTest",
[](Ref* sender)
{
UISceneManager* pManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUIGridViewTest_Mode_Column);
pManager->setMinUISceneId(kUIGridViewTest_Mode_Column);
pManager->setMaxUISceneId(kUIGridViewTest_Mode_Row);
Scene* pScene = pManager->currentUIScene();
Director::getInstance()->replaceScene(pScene);
}
},
*/
/*
{
"PickerViewTest",
[](Ref* sender)
{
UISceneManager* pManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUIPickerViewTest_Vertical);
pManager->setMinUISceneId(kUIPickerViewTest_Vertical);
pManager->setMaxUISceneId(kUIPickerViewTest_Horizontal);
Scene* pScene = pManager->currentUIScene();
Director::getInstance()->replaceScene(pScene);
}
},
*/
{ {
"WidgetAddNodeTest", "WidgetAddNodeTest",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUIWidgetAddNodeTest); sceneManager->setCurrentUISceneId(kUIWidgetAddNodeTest);
pManager->setMinUISceneId(kUIWidgetAddNodeTest); sceneManager->setMinUISceneId(kUIWidgetAddNodeTest);
pManager->setMaxUISceneId(kUIWidgetAddNodeTest); sceneManager->setMaxUISceneId(kUIWidgetAddNodeTest);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },
{ {
"RichTextTest", "RichTextTest",
[](Ref* sender) [](Ref* sender)
{ {
UISceneManager* pManager = UISceneManager::sharedUISceneManager(); UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
pManager->setCurrentUISceneId(kUIRichTextTest); sceneManager->setCurrentUISceneId(kUIRichTextTest);
pManager->setMinUISceneId(kUIRichTextTest); sceneManager->setMinUISceneId(kUIRichTextTest);
pManager->setMaxUISceneId(kUIRichTextTest); sceneManager->setMaxUISceneId(kUIRichTextTest);
Scene* pScene = pManager->currentUIScene(); Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(pScene); Director::getInstance()->replaceScene(scene);
} }
}, },