// Callback chamado ao receber as informacoes da versao atual, comparando com a ultima versao do jogo void OnCheckVersion(string error, IJSonObject data) { // Se o usuario ja estiver com a ultima versao do jogo, retornar if (isUpdatedVersion) { return; } // Se houver algum erro, tentar novamente e retornar if (error != null || data == null || data.IsEmpty() || data.IsError() || data.ToString() == "Version check failed!") { CheckVersion(); return; } // Pega a ultima versao obrigatoria (force update) e a ultima versao em geral float last = data.Get("last").GetFloat("version"); float update = data.Get("update").GetFloat("version"); // Se a versao do usuario for menor que a versao obrigatoria, força usuario a atualizar if (appVersion < update) { string description = data.Get("update").GetString("description"); // Up Top Fix Me //game_native.showMessage(appName, description, BUTTON_UPDATE_YES); return; } else { isUpdatedVersion = true; } // Se a versao do usuario for menor que a ultima versao, apenas perguntar se o usuario deseja atualizar if (appVersion < last) { string description = data.Get("update").GetString("description"); // Up Top Fix Me Flow.game_native.showMessageOkCancel(this, "ConfirmCheck", NativeCallback, "", appName, (description != null && description != "") ? description: MESSAGE_VERSION_OLD, BUTTON_UPDATE_YES, BUTTON_UPDATE_NO); } }
public static double GetDouble(this IJSonObject json, string key) { IJSonObject _json = json.Get(key); if (!_json.IsEmpty()) { return(_json.ToString().ToDouble()); } Error("GetDouble", ERROR_KEY_NOT_FOUND, key); return(default(float)); }
public static int GetInt(this IJSonObject json, string key) { IJSonObject _json = json.Get(key); if (!_json.IsEmpty()) { return(_json.ToString().ToInt32()); } Error("GetInt", ERROR_KEY_NOT_FOUND, key); return(default(int)); }
public static string GetString(this IJSonObject json, string key) { IJSonObject _json = json.Get(key); if (!_json.IsEmpty() || !_json.ToString().IsNull()) { return(_json.ToString()); } Error("GetString", ERROR_KEY_NOT_FOUND, key); return(""); }
public static char GetChar(this IJSonObject json, string key) { IJSonObject _json = json.Get(key); if (!_json.IsEmpty()) { return(_json.ToString().ToChar()); } Error("GetChar", ERROR_KEY_NOT_FOUND, key); return(default(char)); }
public static Quaternion GetQuaternion(this IJSonObject json, string key) { IJSonObject _json = json.Get(key); if (!_json.IsEmpty()) { return(_json.ToString().ToQuaternion()); } Error("GetQuarternion", ERROR_KEY_NOT_FOUND, key); return(default(Quaternion)); }
public static Vector4 GetVector4(this IJSonObject json, string key) { IJSonObject _json = json.Get(key); if (!_json.IsEmpty()) { return(_json.ToString().ToVector4()); } Error("GetVector4", ERROR_KEY_NOT_FOUND, key); return(default(Vector4)); }
public static bool GetBool(this IJSonObject json, string key) { IJSonObject _json = json.Get(key); if (!_json.IsEmpty()) { return(_json.ToString().ToBool()); } Error("GetBool", ERROR_KEY_NOT_FOUND, key); return(default(bool)); }
public static System.DateTime GetDateTime(this IJSonObject json, string key) { IJSonObject _json = json.Get(key); if (!_json.IsEmpty()) { System.DateTime date = default(System.DateTime); try { date = _json.DateTimeValue; } catch { Error("GetDateTime", ERROR_INVALID_DATETIME, json.ToString()); } return(date); } Error("GetDateTime", ERROR_KEY_NOT_FOUND, key); return(default(System.DateTime)); }
// Callback chamado ao receber as informacoes da versao atual, comparando com a ultima versao do jogo void OnCheckVersion(string error, IJSonObject data) { // Se o usuario ja estiver com a ultima versao do jogo, retornar if (isUpdatedVersion) return; // Se houver algum erro, tentar novamente e retornar if (error != null || data == null || data.IsEmpty() || data.IsError() || data.ToString() == "Version check failed!") { CheckVersion(); return; } // Pega a ultima versao obrigatoria (force update) e a ultima versao em geral float last = data.Get("last").GetFloat("version"); float update = data.Get("update").GetFloat("version"); // Se a versao do usuario for menor que a versao obrigatoria, força usuario a atualizar if (appVersion < update) { string description = data.Get("update").GetString("description"); // Up Top Fix Me //game_native.showMessage(appName, description, BUTTON_UPDATE_YES); return; } else { isUpdatedVersion = true; } // Se a versao do usuario for menor que a ultima versao, apenas perguntar se o usuario deseja atualizar if (appVersion < last) { string description = data.Get("update").GetString("description"); // Up Top Fix Me Flow.game_native.showMessageOkCancel(this, "ConfirmCheck", NativeCallback, "", appName,(description != null && description != "") ? description: MESSAGE_VERSION_OLD,BUTTON_UPDATE_YES, BUTTON_UPDATE_NO); } }