BlockingActionParser.h 1.84 KB
//
//  BlockingActionParser.h
//  SteveMaggieCpp
//
//  Created by Katarzyna Kalinowska-Górska on 31.05.2017.
//
//

#ifndef BlockingActionParser_h
#define BlockingActionParser_h

#include "ActionParser.h"
#include "ColourableSprite.h"

class BlockingActionParser
{
     public:

        static BlockingActionParser& getInstance()
        {
            static BlockingActionParser instance;
            return instance;
        };

        cocos2d::Action* parseJSONAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished = true);
    
    protected:
        cocos2d::Action* parseCallFunctionWithBlockingAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished);
        cocos2d::Action* parseWaitForTouchAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished);
        cocos2d::Action* parseWaitForPaletteComponentAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished);
        cocos2d::Action* parseWaitForDragAndDropAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished);
        cocos2d::Action* parseWaitForObjectUnlockAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished);
    
        std::function<void()> parseWaitForObjectUnlockActionFunction_ColourableSprite(ColourableSprite* unlockingObject, const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished);
    
        void runCompletingActions(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, int indexForConditionedActions = 0);
};


#endif /* BlockingActionParser_h */