#ifdef ENABLE_CLOUD_SAVE
// sdkbox::PluginSdkboxPlay::loadAllData(); //DEPRECATED
sdkbox::PluginSdkboxPlay::loadAllGameData();
#else
INFO("cloud save is not enable");
#endif
}),
MenuItemFont::create("Save game data", [](cocos2d::Ref* sender) {
// comment this to compile with old version sdkboxplay
#ifdef ENABLE_CLOUD_SAVE
//sdkbox::PluginSdkboxPlay::saveGameData("key1", "{\"game_name\": \"sdkbox go\", \"stage\": 3}"); //
DEPRECATED
std::string sData("1bC\0u\4;Y\5L", 10);
const void* data = (const void*)sData.c_str();
int len = (int)sData.length();
sdkbox::PluginSdkboxPlay::saveGameDataBinary("key3", data, len);
#else
INFO("cloud save is not enable");
#endif
Hi all, quick question about the new methods (given that the ones explained in the official docs seems to be deprecated…), what sData here exactly? could it be anything? what if you want to save a json string? should we encode it (base64) or whatever, or could it be saved as the old method used to do?
Thanks in advance, I would appreciate a better example of cloud save/load as well as the docs being updated.
OK, I have this working now, using rapidjson handle the json string that goes into the saved data. The problem now is that when I launch the game, and I call loadAllGameData() or loadOneGameData() the onLoadGameData callback gets triggered twice: the first time with the actula saved games, and the second one with savedData = NULL and error = “”.
Is this the correct behaviour? should it be happening at all?
Also, I would like to know how could I know in a reliable way that there is no saved games? when it is returning null when there are actually data there?
OK, thanks htlxyz, so it is safe to assume in that when the data is null and error is empty is done loading data right? and that this will be always the last time the callback is triggered right? Thanks again.