背景和头像缺失
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,265 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __TestCpp__UIButtonTest__
|
||||
#define __TestCpp__UIButtonTest__
|
||||
|
||||
#include "../UIScene.h"
|
||||
|
||||
DEFINE_TEST_SUITE(UIButtonTests);
|
||||
|
||||
class UIButtonTest : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIButtonTest);
|
||||
|
||||
UIButtonTest();
|
||||
~UIButtonTest();
|
||||
|
||||
virtual bool init() override;
|
||||
void touchEvent(cocos2d::Ref* sender, cocos2d::ui::Widget::TouchEventType type);
|
||||
|
||||
void printWidgetResources(cocos2d::Ref* sender);
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
cocos2d::ui::Button* _button;
|
||||
};
|
||||
|
||||
class UIButtonTest_Scale9 : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIButtonTest_Scale9);
|
||||
|
||||
UIButtonTest_Scale9();
|
||||
~UIButtonTest_Scale9();
|
||||
|
||||
virtual bool init() override;
|
||||
void touchEvent(cocos2d::Ref* sender, cocos2d::ui::Widget::TouchEventType type);
|
||||
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
class UIButtonTest_Scale9_State_Change : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIButtonTest_Scale9_State_Change);
|
||||
|
||||
UIButtonTest_Scale9_State_Change();
|
||||
~UIButtonTest_Scale9_State_Change();
|
||||
|
||||
virtual bool init() override;
|
||||
void touchEvent(cocos2d::Ref* sender, cocos2d::ui::Widget::TouchEventType type);
|
||||
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
class UIButtonTest_PressedAction : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIButtonTest_PressedAction);
|
||||
|
||||
UIButtonTest_PressedAction();
|
||||
~UIButtonTest_PressedAction();
|
||||
|
||||
virtual bool init() override;
|
||||
void touchEvent(cocos2d::Ref* sender, cocos2d::ui::Widget::TouchEventType type);
|
||||
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
class UIButtonTest_Title : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIButtonTest_Title);
|
||||
|
||||
UIButtonTest_Title();
|
||||
~UIButtonTest_Title();
|
||||
|
||||
virtual bool init() override;
|
||||
void touchEvent(cocos2d::Ref* sender, cocos2d::ui::Widget::TouchEventType type);
|
||||
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
class UIButtonTestRemoveSelf : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIButtonTestRemoveSelf);
|
||||
|
||||
UIButtonTestRemoveSelf();
|
||||
~UIButtonTestRemoveSelf();
|
||||
|
||||
virtual bool init() override;
|
||||
void touchEvent(cocos2d::Ref* sender, cocos2d::ui::Widget::TouchEventType type);
|
||||
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
class UIButtonTestSwitchScale9 : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIButtonTestSwitchScale9);
|
||||
|
||||
UIButtonTestSwitchScale9();
|
||||
~UIButtonTestSwitchScale9();
|
||||
|
||||
virtual bool init() override;
|
||||
void touchEvent(cocos2d::Ref* sender, cocos2d::ui::Widget::TouchEventType type);
|
||||
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
class UIButtonTestZoomScale : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIButtonTestZoomScale);
|
||||
|
||||
UIButtonTestZoomScale();
|
||||
~UIButtonTestZoomScale();
|
||||
|
||||
virtual bool init() override;
|
||||
void sliderEvent(cocos2d::Ref* sender, cocos2d::ui::Slider::EventType type);
|
||||
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
class UIButtonTextOnly : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIButtonTextOnly);
|
||||
|
||||
UIButtonTextOnly();
|
||||
~UIButtonTextOnly();
|
||||
|
||||
virtual bool init() override;
|
||||
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
class UIButtonIgnoreContentSizeTest : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIButtonIgnoreContentSizeTest);
|
||||
|
||||
UIButtonIgnoreContentSizeTest();
|
||||
~UIButtonIgnoreContentSizeTest();
|
||||
|
||||
virtual bool init() override;
|
||||
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
class UIButtonTitleEffectTest : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIButtonTitleEffectTest);
|
||||
|
||||
UIButtonTitleEffectTest();
|
||||
~UIButtonTitleEffectTest();
|
||||
|
||||
virtual bool init() override;
|
||||
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
class UIButtonFlipTest : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIButtonFlipTest);
|
||||
|
||||
UIButtonFlipTest();
|
||||
~UIButtonFlipTest();
|
||||
|
||||
virtual bool init() override;
|
||||
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
class UIButtonNormalDefaultTest : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIButtonNormalDefaultTest);
|
||||
|
||||
UIButtonNormalDefaultTest();
|
||||
~UIButtonNormalDefaultTest();
|
||||
|
||||
virtual bool init() override;
|
||||
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
class UIButtonDisableDefaultTest : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIButtonDisableDefaultTest);
|
||||
|
||||
UIButtonDisableDefaultTest();
|
||||
~UIButtonDisableDefaultTest();
|
||||
|
||||
virtual bool init() override;
|
||||
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
class UIButtonCloneTest : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIButtonCloneTest);
|
||||
|
||||
UIButtonCloneTest();
|
||||
~UIButtonCloneTest();
|
||||
|
||||
virtual bool init() override;
|
||||
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
class Issue12249 : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(Issue12249);
|
||||
|
||||
Issue12249();
|
||||
|
||||
virtual bool init() override;
|
||||
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
#endif /* defined(__TestCpp__UIButtonTest__) */
|
||||
@@ -0,0 +1,91 @@
|
||||
#include "UIButtonTest_Editor.h"
|
||||
|
||||
USING_NS_CC;
|
||||
using namespace cocos2d::ui;
|
||||
|
||||
// UIButtonTest_Editor
|
||||
|
||||
UIButtonEditorTests::UIButtonEditorTests()
|
||||
{
|
||||
ADD_TEST_CASE(UIButtonTest_Editor);
|
||||
}
|
||||
|
||||
UIButtonTest_Editor::UIButtonTest_Editor()
|
||||
: _displayValueLabel(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
UIButtonTest_Editor::~UIButtonTest_Editor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UIButtonTest_Editor::configureGUIScene()
|
||||
{
|
||||
UIScene_Editor::configureGUIScene();
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Button* button = static_cast<Button*>(Helper::seekWidgetByName(root, "Button_123"));
|
||||
button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Editor::touchEvent, this));
|
||||
|
||||
Button* title_button = static_cast<Button*>(Helper::seekWidgetByName(root, "Button_126"));
|
||||
title_button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Editor::touchEvent, this));
|
||||
|
||||
Button* scale9_button = static_cast<Button*>(Helper::seekWidgetByName(root, "Button_129"));
|
||||
scale9_button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Editor::touchEvent,this));
|
||||
}
|
||||
|
||||
bool UIButtonTest_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
Node* node = CSLoader::createNode("cocosui/UIEditorTest/UIButton/res.csb");
|
||||
Node* child = node->getChildByTag(4);
|
||||
child->removeFromParent();
|
||||
_layout = static_cast<Layout*>(child);
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
|
||||
|
||||
_displayValueLabel = ui::Text::create();
|
||||
_displayValueLabel->setFontName("Marker Felt");
|
||||
_displayValueLabel->setFontSize(30);
|
||||
_displayValueLabel->setString("No event");
|
||||
_displayValueLabel->setPosition(Vec2(_layout->getContentSize().width / 2,
|
||||
_layout->getContentSize().height - _displayValueLabel->getContentSize().height * 1.75f));
|
||||
|
||||
_touchGroup->addChild(_displayValueLabel,20);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void UIButtonTest_Editor::touchEvent(Ref *pSender, Widget::TouchEventType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case Widget::TouchEventType::BEGAN:
|
||||
_displayValueLabel->setString("Touch Down");
|
||||
break;
|
||||
|
||||
case Widget::TouchEventType::MOVED:
|
||||
_displayValueLabel->setString("Touch Moved");
|
||||
break;
|
||||
|
||||
case Widget::TouchEventType::ENDED:
|
||||
_displayValueLabel->setString("Touch Ended");
|
||||
break;
|
||||
|
||||
case Widget::TouchEventType::CANCELED:
|
||||
_displayValueLabel->setString("Touch Canceled");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2014 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __TestCpp__UIButtonTest_Editor__
|
||||
#define __TestCpp__UIButtonTest_Editor__
|
||||
|
||||
#include "../UIScene_Editor.h"
|
||||
#include "BaseTest.h"
|
||||
|
||||
DEFINE_TEST_SUITE(UIButtonEditorTests);
|
||||
|
||||
class UIButtonTest_Editor : public UIScene_Editor
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIButtonTest_Editor);
|
||||
|
||||
UIButtonTest_Editor();
|
||||
~UIButtonTest_Editor();
|
||||
|
||||
virtual bool init() override;
|
||||
|
||||
void touchEvent(cocos2d::Ref* sender, cocos2d::ui::Widget::TouchEventType type);
|
||||
virtual void configureGUIScene() override;
|
||||
|
||||
protected:
|
||||
cocos2d::ui::Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
#endif /* defined(__TestCpp__UIButtonTest_Editor__) */
|
||||
Reference in New Issue
Block a user