2022-02-24 18:51:36 +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
|
|
|
|
2022-10-01 16:24:52 +08:00
|
|
|
https://axmolengine.github.io/
|
2013-12-25 17:40:54 +08:00
|
|
|
|
|
|
|
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__
|
|
|
|
|
2020-10-21 10:12:00 +08:00
|
|
|
#include "CocoStudio.h"
|
2023-06-11 13:08:08 +08:00
|
|
|
#include "base/Vector.h"
|
|
|
|
#include "base/EventListenerCustom.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
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
class CCS_DLL BaseTriggerCondition : public ax::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();
|
|
|
|
};
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
class CCS_DLL BaseTriggerAction : public ax::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();
|
|
|
|
};
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
class CCS_DLL TriggerObj : public ax::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:
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vector<BaseTriggerCondition*> _cons;
|
|
|
|
ax::Vector<BaseTriggerAction*> _acts;
|
2014-03-04 23:55:36 +08:00
|
|
|
unsigned int _id;
|
|
|
|
bool _enabled;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vector<ax::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
|