HParentalGateShowInterface.h 1.28 KB
//
//  HParentalGateShowInterface.h
//  HalloweenSpaceInvaders
//
//  Created by Katarzyna Kalinowska-Górska on 14/10/2019.
//

#ifndef HParentalGateShowInterface_h
#define HParentalGateShowInterface_h

#include "HParentalGateView.h"
#include "cocos2d.h"

class HParentalGateShowInterface {

public:
    bool isShowingParentalGate(){return _isPresentingParentalGate;};
    virtual void presentParentalGate(std::function<void()> onSuccessCallback, std::function<void()> onFailureCallback);
    virtual void hideParentalGate();
    virtual void PGSI_addChild(cocos2d::Node* n) {
        auto selfNode = dynamic_cast<cocos2d::Node*>(this);
        if(selfNode != nullptr){
            selfNode->addChild(n);
        }
    }
    virtual cocos2d::Node* PGSI_getChildByTag(int t) {
        auto selfNode = dynamic_cast<cocos2d::Node*>(this);
        if(selfNode != nullptr){
            return selfNode->getChildByTag(t);
        }
        return nullptr;
    }
    virtual cocos2d::EventDispatcher* PGSI_getEventDispatcher(){
        auto selfNode = dynamic_cast<cocos2d::Node*>(this);
        if(selfNode != nullptr){
            return selfNode->getEventDispatcher();
        }
        return nullptr;
    }
    
protected:
    bool _isPresentingParentalGate;

};
    
#endif /* HParentalGateShowInterface_h */