// // Created by parth on 2/4/2019. // #ifndef PROJ_ANDROID_SINGLETON_H #define PROJ_ANDROID_SINGLETON_H #include "cocos2d.h" #include #if CC_TARGET_PLATFORM == CC_PLATFORM_IOS #include "ObjCCall.h" #elif CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID #else #endif struct structClubTableData{ int product_id; int club_id; int tableType; int rangeStart; }; class Singleton : public cocos2d::Node { Singleton(); static Singleton* _instance1; static std::string userToken; static std::string firebaseToken; static int clubID; static int role; static int playerID; static std::string clubIDString; static cocos2d::Sprite *profilePic; static int productID; static int classType; static bool isAudioMute; static bool isTitleScene; static bool isGameScene; static struct structClubTableData clubTableData; typedef std::list WordList; // cocos2d::Node * node = cocos2d::Node::create(); public: static Singleton* getInstance(); void setUserToken(std::string userToken); std::string getUserToken(); void setClubID(int userToken); int getClubID(); void setRole(int userToken); int getRole(); void setClubIDString(std::string clubIDStringToSet); std::string getClubIDString(); void setPlayerID(int clubIDToSet); int getPlayerID(); std::string getPlaterIDString(); void setProfilePic(cocos2d::Sprite *clubIDToSet); cocos2d::Sprite* getProfilePic(); std::string getCountryName(); void setProductID(int productIDToSet); int getProductID(); std::string convertFloatIntoKilloAndMil(float value); std::string shortString(std::string originalString , int numberofCharcter); struct structClubTableData getclubtableData(); void setclubtableData(int product_id, int club_id, int tableType, int rangeStart); void setAudioIsMute(bool isMute); void DatePlusDays( struct tm* date, int days ); bool makePayment(int productID, cocos2d::Node *node); void setTitleScene(bool setTitleScene); bool getTitleScene(); void setGameScene(bool setGameScene); bool getGameScene(); void setClassType(int setClassType); int getClassType(); bool checkNeworkConnectivity(); // checkingForImageUploadStatus(float dt); // void checkingForImageUploadStatus(float dt); void split(const std::string& s, char c, std::vector& v); void checkForResponseAfterAPICallInJava(float dt); void setFireBaseToken(std::string firebaseTokenToSet); std::string getFireBaseToken(); int getNetworkStrength(); void padRandomAfterSpace(std::string &input); void padAfterPunctuation(std::string &input); std::string justyfyString(std::string inputString, int maxLengthUser = 40); std::string justifyText( const std::string &text ); WordList splitTextIntoWords( const std::string &text ); void justifyLine( std::string line ); }; #endif //PROJ_ANDROID_SINGLETON_H