Пример #1
0
    public void ExecuteCloudLoad()
    {
        PlatformSaveUtil.ShowLoadProgressPopup();

        var remoteSaveDict = PlatformSaveUtil.DeserializeSaveData(File.ReadAllBytes(RemoteSaveFileForEditor));

        PlatformSaveUtil.LoadDataAndLoadSplashScene(remoteSaveDict);
    }
Пример #2
0
    public void OnSavedGameDataRead(SavedGameRequestStatus status, byte[] data)
    {
        if (status == SavedGameRequestStatus.Success)
        {
            // handle processing the byte array data
            SushiDebug.LogFormat("OnSavedGameDataRead success! - Data size: {0} bytes", data.Length);

            var remoteSaveDict = PlatformSaveUtil.DeserializeSaveData(data);

            PlatformSaveUtil.LoadDataAndLoadSplashScene(remoteSaveDict);
        }
        else
        {
            // handle error
            PlatformSaveUtil.ShowLoadErrorPopup("OnSavedGameDataRead: status == SavedGameRequestStatus.Success");
            BalloonLogManager.Add(BalloonLogEntry.Type.GameCloudLoadFailure, 0, 4);
        }
    }
Пример #3
0
    public void OnCloudLoadResult(string result, byte[] data)
    {
        if (result == "OK")
        {
            SushiDebug.LogFormat("OnCloudLoadResult: data length {0} bytes", data != null ? data.Length : 0);
            // 메타데이터 조회의 경우와 실제 세이브 데이터 로딩의 경우를 나눠서 처리
            if (onPeekResultSave != null)
            {
                SushiDebug.Log("OnCloudLoadResult: onPeekResultSave valid");
                var cloudMetadata = CloudMetadata.Invalid;
                if (data == null || data.Length == 0)
                {
                }
                else
                {
                    try
                    {
                        var remoteSaveDict = PlatformSaveUtil.DeserializeSaveData(data);
                        cloudMetadata = new CloudMetadata
                        {
                            level = PlatformSaveUtil.GetInt32FromRemoteSaveDict(remoteSaveDict,
                                                                                PlatformSaveUtil.ACCOUNT_LEVEL_KEY),
                            levelExp = PlatformSaveUtil.GetInt32FromRemoteSaveDict(remoteSaveDict,
                                                                                   PlatformSaveUtil.ACCOUNT_LEVEL_EXP_KEY),
                            gem = PlatformSaveUtil.GetBigIntegerFromRemoteSaveDict(remoteSaveDict,
                                                                                   PlatformSaveUtil.ACCOUNT_GEM_KEY),
                            riceRate = PlatformSaveUtil.GetBigIntegerFromRemoteSaveDict(remoteSaveDict,
                                                                                        PlatformSaveUtil.ACCOUNT_RICE_RATE_KEY),
                            saveDate = PlatformSaveUtil.GetInt64FromRemoteSaveDict(remoteSaveDict,
                                                                                   PlatformSaveUtil.SAVE_DATE_KEY)
                        };
                    }
                    catch
                    {
                        cloudMetadata = CloudMetadata.Invalid;
                    }
                }

                onPeekResultSave(cloudMetadata);
                onPeekResultSave = null;
            }
            else
            {
                SushiDebug.Log("OnCloudLoadResult: onPeekResultSave empty. data load...");
                if (data == null || data.Length == 0)
                {
                    PlatformSaveUtil.ShowLoadErrorPopup("OnCloudLoadResult: Cloud save data corrupted");
                }
                else
                {
                    SushiDebug.LogFormat("OnCloudLoadResult: success! - Data size: {0} bytes", data.Length);
                    var remoteSaveDict = PlatformSaveUtil.DeserializeSaveData(data);
                    PlatformSaveUtil.LoadDataAndLoadSplashScene(remoteSaveDict);
                }
            }
        }
        else
        {
            PlatformSaveUtil.ShowSaveErrorPopup(TextHelper.GetText("platform_cloud_load_fail") + "\n\n" + result);
        }
    }