public void OnGetDataFailed(string error) { InitStorageResult initStorageResult = new InitStorageResult(); initStorageResult.Status = InitStorageStatus.Failed; initStorageResult.Message = error; RemoveCallback("OnGetDataSucceed"); ExecuteCallBack("OnGetDataFailed", initStorageResult); }
public void OnGetDataSucceed(string data) { InitStorageResult initStorageResult = new InitStorageResult(); initStorageResult.Status = InitStorageStatus.Success; Storage_LoadData(data); Storage_Is_Syncd = true; Storage_Is_Syncing = false; StorageIsInit = true; lastChangeStorage = Time.unscaledTime; RemoveCallback("OnGetDataFailed"); ExecuteCallBack("OnGetDataSucceed", initStorageResult); }
public void STORAGE_Init(Action <InitStorageResult> OnResult) { if (!StorageIsInit) { if (!Application.isEditor) { if (Application.platform == RuntimePlatform.Android) { #if UNITY_ANDROID RegisterCallBack("OnGetDataSucceed", (x) => { OnResult((InitStorageResult)x); }); RegisterCallBack("OnGetDataFailed", (x) => { OnResult((InitStorageResult)x); }); bazaarBridgePlugin.Call("GetSavedData"); #endif } else { InitStorageResult result = new InitStorageResult(); result.Status = InitStorageStatus.Failed; result.Message = "CafeSDK work only on android !"; if (OnResult != null) { OnResult(result); } } } else { InitStorageResult result = new InitStorageResult(); result.Status = InitStorageStatus.Success; Storage_LoadData(PlayerPrefs.GetString("cafesdk_storage_data", "")); Storage_Is_Syncd = true; Storage_Is_Syncing = false; StorageIsInit = true; if (OnResult != null) { OnResult(result); } } } else { InitStorageResult result = new InitStorageResult(); result.Status = InitStorageStatus.Success; if (OnResult != null) { OnResult(result); } } }