ToyAlertView.h 1.08 KB
//
//  ToyAlertView.h
//  HalloweenSpaceInvaders
//
//  Created by Katarzyna Kalinowska-Górska on 09/10/2019.
//

#ifndef ToyAlertView_h
#define ToyAlertView_h

#include "cocos2d.h"
#include <string>

class ToyAlertView : public cocos2d::LayerColor {
public:
    static ToyAlertView* create(std::string message, std::string okText, std::string cancelText, cocos2d::Color3B okColor, cocos2d::Color3B cancelColor, std::function<void()> onConfirmCallback,std::function<void()> onCancelCallback);

protected:
    
    std::function<void()> _onConfirmCallback;
    std::function<void()> _onCancelCallback;
    
    bool init(std::string message, std::string okText, std::string cancelText, cocos2d::Color3B okColor, cocos2d::Color3B cancelColor, std::function<void()> onConfirmCallback,std::function<void()> onCancelCallback);
    void setupAppearance(std::string message, std::string okText, std::string cancelText, cocos2d::Color3B okColor, cocos2d::Color3B cancelColor);
    
    void onCancelClicked(cocos2d::Ref* pSender);
    void onOKClicked(cocos2d::Ref* pSender);
};

#endif /* ToyAlertView_h */