axmol/extensions/cocostudio/TriggerObj.h

90 lines
2.9 KiB
C
Raw Normal View History

2015-06-17 13:16:06 +08:00
/****************************************************************************
2020-10-17 16:32:16 +08:00
Copyright (c) 2013-2017 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__
#include "CocoStudio.h"
2014-08-29 15:39:52 +08:00
#include "base/CCVector.h"
2016-04-18 15:09:21 +08:00
#include "base/CCEventListenerCustom.h"
2013-12-25 17:40:54 +08:00
2021-12-25 10:04:45 +08:00
namespace cocostudio
{
2014-03-05 17:08:59 +08:00
2020-10-17 16:32:16 +08:00
class CCS_DLL BaseTriggerCondition : public cocos2d::Ref
2013-12-25 17:40:54 +08:00
{
protected:
2020-10-17 16:32:16 +08:00
BaseTriggerCondition(void);
2021-12-25 10:04:45 +08:00
2013-12-25 17:40:54 +08:00
public:
2020-10-17 16:32:16 +08:00
virtual ~BaseTriggerCondition(void);
2013-12-25 17:40:54 +08:00
virtual bool init();
virtual bool detect();
2021-12-25 10:04:45 +08:00
virtual void serialize(const rapidjson::Value& val);
virtual void serialize(cocostudio::CocoLoader* cocoLoader, cocostudio::stExpCocoNode* cocoNode);
2013-12-25 17:40:54 +08:00
virtual void removeAll();
};
2020-10-17 16:32:16 +08:00
class CCS_DLL BaseTriggerAction : public cocos2d::Ref
2013-12-25 17:40:54 +08:00
{
protected:
2020-10-17 16:32:16 +08:00
BaseTriggerAction(void);
2021-12-25 10:04:45 +08:00
2013-12-25 17:40:54 +08:00
public:
2020-10-17 16:32:16 +08:00
virtual ~BaseTriggerAction(void);
2013-12-25 17:40:54 +08:00
virtual bool init();
virtual void done();
2021-12-25 10:04:45 +08:00
virtual void serialize(const rapidjson::Value& val);
virtual void serialize(cocostudio::CocoLoader* cocoLoader, cocostudio::stExpCocoNode* cocoNode);
2013-12-25 17:40:54 +08:00
virtual void removeAll();
};
2020-10-17 16:32:16 +08:00
class CCS_DLL TriggerObj : public cocos2d::Ref
2013-12-25 17:40:54 +08:00
{
public:
2020-10-17 16:32:16 +08:00
TriggerObj(void);
virtual ~TriggerObj(void);
2013-12-25 17:40:54 +08:00
virtual bool init();
2020-10-17 16:32:16 +08:00
static TriggerObj* create(void);
2021-12-25 10:04:45 +08:00
2013-12-25 17:40:54 +08:00
virtual bool detect();
virtual void done();
virtual void removeAll();
2021-12-25 10:04:45 +08:00
virtual void serialize(const rapidjson::Value& val);
virtual void serialize(cocostudio::CocoLoader* cocoLoader, cocostudio::stExpCocoNode* cocoNode);
2014-03-04 23:55:36 +08:00
unsigned int getId();
void setEnabled(bool enabled);
2021-12-25 10:04:45 +08:00
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
};
2021-12-25 10:04:45 +08:00
} // namespace cocostudio
2013-12-25 17:40:54 +08:00
#endif