// // RepeatedActionScheduler.h // SteveMaggieCpp // // Created by Katarzyna Kalinowska-Górska on 27.05.2017. // // #ifndef RepeatedActionScheduler_h #define RepeatedActionScheduler_h #include "json/document.h" #include #include #include "cocos2d.h" class ActionParseDelegate; class RepeatedActionScheduler { public: struct ScheduledActionsData { std::string callbackKey; std::string storedValueKey; long long lastTimeRun; }; static RepeatedActionScheduler& getInstance() { static RepeatedActionScheduler instance; return instance; }; void clearAllScheduledActions(ActionParseDelegate* parseDelegate); cocos2d::Action* scheduleActionIfNeeded(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); bool isActionValidRepeatedAction(const rapidjson::Value& jsonActionObject); protected: std::map _scheduledActionsData; std::map> _waitingFunctions; }; #endif /* RepeatedActionScheduler_h */