ToyMiscUtils.h 2.19 KB
//
//  ToyMiscUtils.h
//  SteveMaggieCpp
//
//  Created by Katarzyna Kalinowska-Górska on 17.05.2017.
//
//

#ifndef ToyMiscUtils_h
#define ToyMiscUtils_h

#include "ToyPlainSprite.h"

class ToyMiscUtils
{
    public:
    
        enum class ExtendDirectionX {
            BOTH = 0,
            LEFT = 1,
            RIGHT = 2
        };
    
        enum class ExtendDirectionY {
            BOTH = 0,
            UP = 1,
            DOWN = 2,
        };
    
    enum class Level {
        CHILD = 0,
        TEEN = 1,
        ADULT = 2
    };
    
    static const char* levelToString(Level level) {
        if(level == Level::CHILD){
            return "CHILD";
        } else if(level == Level::TEEN){
            return "TEEN";
        } else return "ADULT";
    }
    
    static float StandardAnimationTime;
    static float QuickAnimationTime;
    
    static const std::string MAGGIE_TOUCHED_UD_KEY;
    static const std::string WHICH_LEVEL_UD_KEY;
    static const std::string TOS_ACCEPTED_UD_KEY;
    static const std::string BG_MUSIC_PLAYING_UD_KEY;
    static void saveMaggieTouched();
    static bool wasMaggieTouched();
    static void saveTOSAccepted();
    static bool wasTOSAccepted();
    static void saveLastLevel(Level level);
    static void saveLastLevel(int level);
    static Level lastLevel();
    static int nextLevel();
    static void saveBgMusicPlaying(bool bgMusicPlaying);
    static bool shouldBgMusicPlay();
    
    static void showView(cocos2d::Node*, bool animated, float toAlpha = 255);
    static void hideView(cocos2d::Node*, bool animated);
    static void hideAndRemoveView(cocos2d::Node*, bool animated);
    
    static cocos2d::Rect getExtendedActiveArea(cocos2d::Node* object, float extendPercentValueX = 0, float extendPercentValueY = 0, ExtendDirectionX extendDirX = ExtendDirectionX::BOTH, ExtendDirectionY extendDirY = ExtendDirectionY::BOTH);
    
    static bool isNodeVisible(cocos2d::Node* node);
    static std::string boolToString(bool value);
    
//#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    static void showAppCloseConfirmDialog(std::function<void()> onCancelCallback);
    static bool closeAppCloseConfirmDialogIfNecessary();
//#endif
};

#endif /* ToyMiscUtils_h */