axmol/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.h

222 lines
4.9 KiB
C
Raw Normal View History

2013-09-20 22:23:13 +08:00
#ifndef __SCENEEDITORTESTSCENE_H__
#define __SCENEEDITORTESTSCENE_H__
#include "cocos2d.h"
#include "extensions/cocos-ext.h"
#include "cocostudio/CocoStudio.h"
#include "BaseTest.h"
2013-09-20 22:23:13 +08:00
DEFINE_TEST_SUITE(CocoStudioSceneEditTests);
2013-09-20 22:23:13 +08:00
class SceneEditorTestBase : public TestCase
2013-09-20 22:23:13 +08:00
{
public:
virtual bool init() override;
virtual std::string title() const override;
protected:
MenuItemImage *restartItem;
MenuItemImage *nextItem;
MenuItemImage *backItem;
2014-06-25 14:32:38 +08:00
protected:
virtual void changeLoadTypeCallback(cocos2d::Ref *pSender);
virtual void defaultPlay() = 0; // must to be overrided
void loadFileChangeHelper(std::string& filePathName ); // switch json& csb
private:
bool _isCsbLoad; // default is false
cocos2d::Label* _loadtypelb;
static const char* _loadtypeStr[2];
2014-06-25 14:32:38 +08:00
protected:
cocos2d::Node* _rootNode;
std::string _filePath;
};
class LoadSceneEdtiorFileTest : public SceneEditorTestBase
{
public:
CREATE_FUNC(LoadSceneEdtiorFileTest);
LoadSceneEdtiorFileTest();
~LoadSceneEdtiorFileTest();
virtual std::string title() const override;
virtual void onEnter() override;
virtual void onExit() override;
cocos2d::Node* createGameScene();
2014-06-25 14:32:38 +08:00
private:
void defaultPlay();
};
class SpriteComponentTest : public SceneEditorTestBase
{
public:
CREATE_FUNC(SpriteComponentTest);
SpriteComponentTest();
~SpriteComponentTest();
virtual std::string title() const override;
virtual void onEnter() override;
virtual void onExit() override;
cocos2d::Node* createGameScene();
2014-06-25 14:32:38 +08:00
private:
void defaultPlay();
};
class ArmatureComponentTest : public SceneEditorTestBase
{
public:
CREATE_FUNC(ArmatureComponentTest);
ArmatureComponentTest();
~ArmatureComponentTest();
virtual std::string title() const override;
virtual void onEnter() override;
virtual void onExit() override;
cocos2d::Node* createGameScene();
2014-06-25 14:32:38 +08:00
private:
void defaultPlay();
};
class UIComponentTest : public SceneEditorTestBase
{
public:
CREATE_FUNC(UIComponentTest);
UIComponentTest();
~UIComponentTest();
virtual std::string title() const override;
virtual void onEnter() override;
virtual void onExit() override;
cocos2d::Node* createGameScene();
void touchEvent(cocos2d::Ref *pSender, ui::Widget::TouchEventType type);
private:
2014-06-25 14:32:38 +08:00
void defaultPlay();
};
class TmxMapComponentTest : public SceneEditorTestBase
{
public:
CREATE_FUNC(TmxMapComponentTest);
TmxMapComponentTest();
~TmxMapComponentTest();
virtual std::string title() const override;
virtual void onEnter() override;
virtual void onExit() override;
cocos2d::Node* createGameScene();
2014-06-25 14:32:38 +08:00
private:
void defaultPlay();
};
class ParticleComponentTest : public SceneEditorTestBase
{
public:
CREATE_FUNC(ParticleComponentTest);
ParticleComponentTest();
~ParticleComponentTest();
virtual std::string title() const override;
virtual void onEnter() override;
virtual void onExit() override;
cocos2d::Node* createGameScene();
2014-06-25 14:32:38 +08:00
protected:
void defaultPlay();
};
class EffectComponentTest : public SceneEditorTestBase
{
public:
CREATE_FUNC(EffectComponentTest);
EffectComponentTest();
~EffectComponentTest();
virtual std::string title() const override;
virtual void onEnter() override;
virtual void onExit() override;
cocos2d::Node* createGameScene();
void animationEvent(cocostudio::Armature *armature, cocostudio::MovementEventType movementType, const std::string& movementID);
private:
2014-06-25 14:32:38 +08:00
void defaultPlay();
};
class BackgroundComponentTest : public SceneEditorTestBase
{
public:
CREATE_FUNC(BackgroundComponentTest);
BackgroundComponentTest();
~BackgroundComponentTest();
virtual std::string title() const override;
virtual void onEnter() override;
virtual void onExit() override;
cocos2d::Node* createGameScene();
2014-06-25 14:32:38 +08:00
private:
void defaultPlay();
};
class AttributeComponentTest : public SceneEditorTestBase
{
public:
CREATE_FUNC(AttributeComponentTest);
AttributeComponentTest();
~AttributeComponentTest();
virtual std::string title() const override;
virtual void onEnter() override;
virtual void onExit() override;
bool initData();
cocos2d::Node* createGameScene();
2014-06-25 14:32:38 +08:00
private:
2014-06-25 14:32:38 +08:00
void defaultPlay();
};
class TriggerTest : public SceneEditorTestBase
{
public:
CREATE_FUNC(TriggerTest);
TriggerTest();
~TriggerTest();
virtual std::string title() const override;
virtual void onEnter() override;
virtual void onExit() override;
2013-12-26 01:17:04 +08:00
// default implements are used to call script callback if exist
virtual bool onTouchBegan(Touch *touch, Event *unused_event);
virtual void onTouchMoved(Touch *touch, Event *unused_event);
virtual void onTouchEnded(Touch *touch, Event *unused_event);
virtual void onTouchCancelled(Touch *touch, Event *unused_event);
// update of game
void gameLogic(float dt);
2013-09-20 22:23:13 +08:00
// create scene
2013-09-20 22:23:13 +08:00
cocos2d::Node* createGameScene();
2013-09-20 22:23:13 +08:00
private:
void defaultPlay();
2013-12-26 01:17:04 +08:00
cocos2d::EventListener* _touchListener;
2013-09-20 22:23:13 +08:00
};
#endif // __HELLOWORLD_SCENE_H__