2015-06-17 13:16:06 +08:00
|
|
|
|
/****************************************************************************
|
2014-01-07 11:47:11 +08:00
|
|
|
|
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
2013-12-25 17:40:54 +08:00
|
|
|
|
|
|
|
|
|
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 __TRIGGEROBJ_H__
|
|
|
|
|
#define __TRIGGEROBJ_H__
|
|
|
|
|
|
2016-03-20 21:53:44 +08:00
|
|
|
|
#include "editor-support/cocostudio/CocoStudio.h"
|
2014-08-29 15:39:52 +08:00
|
|
|
|
#include "base/CCVector.h"
|
2013-12-25 17:40:54 +08:00
|
|
|
|
|
2014-03-07 13:52:54 +08:00
|
|
|
|
namespace cocos2d {
|
|
|
|
|
class EventListenerCustom;
|
|
|
|
|
}
|
2013-12-25 17:40:54 +08:00
|
|
|
|
|
2014-03-05 17:08:59 +08:00
|
|
|
|
namespace cocostudio {
|
|
|
|
|
|
2014-07-21 17:45:56 +08:00
|
|
|
|
class CC_STUDIO_DLL BaseTriggerCondition : public cocos2d::Ref
|
2013-12-25 17:40:54 +08:00
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
BaseTriggerCondition(void);
|
|
|
|
|
public:
|
2014-03-04 23:55:36 +08:00
|
|
|
|
virtual ~BaseTriggerCondition(void);
|
2013-12-25 17:40:54 +08:00
|
|
|
|
virtual bool init();
|
|
|
|
|
virtual bool detect();
|
2014-03-04 23:55:36 +08:00
|
|
|
|
virtual void serialize(const rapidjson::Value &val);
|
2014-06-25 11:58:36 +08:00
|
|
|
|
virtual void serialize(cocostudio::CocoLoader *cocoLoader, cocostudio::stExpCocoNode *cocoNode);
|
2013-12-25 17:40:54 +08:00
|
|
|
|
virtual void removeAll();
|
|
|
|
|
};
|
|
|
|
|
|
2014-07-21 17:45:56 +08:00
|
|
|
|
class CC_STUDIO_DLL BaseTriggerAction : public cocos2d::Ref
|
2013-12-25 17:40:54 +08:00
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
BaseTriggerAction(void);
|
|
|
|
|
public:
|
2014-03-04 23:55:36 +08:00
|
|
|
|
virtual ~BaseTriggerAction(void);
|
2013-12-25 17:40:54 +08:00
|
|
|
|
virtual bool init();
|
|
|
|
|
virtual void done();
|
2014-03-04 23:55:36 +08:00
|
|
|
|
virtual void serialize(const rapidjson::Value &val);
|
2014-06-25 11:58:36 +08:00
|
|
|
|
virtual void serialize(cocostudio::CocoLoader *cocoLoader, cocostudio::stExpCocoNode *cocoNode);
|
2013-12-25 17:40:54 +08:00
|
|
|
|
virtual void removeAll();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2014-07-21 17:45:56 +08:00
|
|
|
|
class CC_STUDIO_DLL TriggerObj : public cocos2d::Ref
|
2013-12-25 17:40:54 +08:00
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
TriggerObj(void);
|
|
|
|
|
virtual ~TriggerObj(void);
|
|
|
|
|
virtual bool init();
|
|
|
|
|
static TriggerObj* create(void);
|
|
|
|
|
|
|
|
|
|
virtual bool detect();
|
|
|
|
|
virtual void done();
|
|
|
|
|
virtual void removeAll();
|
|
|
|
|
virtual void serialize(const rapidjson::Value &val);
|
2014-06-25 11:58:36 +08:00
|
|
|
|
virtual void serialize(cocostudio::CocoLoader *cocoLoader, cocostudio::stExpCocoNode *cocoNode);
|
2014-03-04 23:55:36 +08:00
|
|
|
|
unsigned int getId();
|
|
|
|
|
void setEnabled(bool enabled);
|
2013-12-25 17:40:54 +08:00
|
|
|
|
|
|
|
|
|
private:
|
2013-12-25 19:46:09 +08:00
|
|
|
|
cocos2d::Vector<BaseTriggerCondition*> _cons;
|
|
|
|
|
cocos2d::Vector<BaseTriggerAction*> _acts;
|
2014-03-04 23:55:36 +08:00
|
|
|
|
unsigned int _id;
|
|
|
|
|
bool _enabled;
|
|
|
|
|
cocos2d::Vector<cocos2d::EventListenerCustom*> _listeners;
|
2013-12-25 17:40:54 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|