Exemplo n.º 1
0
 public void OnCloudSaveResult(string result)
 {
     if (result == "OK") // handle reading or writing of saved game.
     {
         platformSaveUtil.ShowSaveResultPopup();
     }
     else // handle error
     {
         platformSaveUtil.ShowSaveErrorPopup(
             PlatformInterface.instance.textHelper.GetText("platform_cloud_save_fail") +
             "\n\n" + result);
     }
 }
Exemplo n.º 2
0
    public void ExecuteCloudSave()
    {
#if !NO_GPGS
        PlatformInterface.instance.saveLoadManager.SaveBeforeCloudSave();
        platformSaveUtil.ShowSaveProgressPopup();

        var savedGameClient = PlayGamesPlatform.Instance.SavedGame;
        if (savedGameClient != null)
        {
            Open(savedGameClient,
                 true,
                 OnSavedGameOpenedAndWriteConflictResolve,
                 OnSavedGameOpenedAndWrite);
        }
        else
        {
            platformSaveUtil.ShowSaveErrorPopup("OnClick_cloudSave: savedGameClient null");
            PlatformInterface.instance.logManager.Add(PlatformInterface.instance.logEntryType.GameCloudSaveFailure, 0,
                                                      1);
        }
#endif
    }
Exemplo n.º 3
0
    public void OnSavedGameWritten(SavedGameRequestStatus status, ISavedGameMetadata game)
    {
        if (status == SavedGameRequestStatus.Success)
        {
            // handle reading or writing of saved game.
            PlatformSaveUtil.ShowSaveResultPopup();
        }
        else
        {
            // handle error
            PlatformSaveUtil.ShowSaveErrorPopup(string.Format("OnSavedGameWritten: OnSavedGameWritten failed! - {0}",
                                                              status));
            BalloonLogManager.Add(BalloonLogEntry.Type.GameCloudSaveFailure, 0, 3);
        }

        //rootCanvasGroup.interactable = true;
    }
Exemplo n.º 4
0
    public void OnSavedGameOpenedAndWrite(SavedGameRequestStatus status, ISavedGameMetadata game)
    {
        if (status == SavedGameRequestStatus.Success)
        {
            // handle reading or writing of saved game.

            SushiDebug.LogFormat("OnSavedGameOpenedAndWrite: Save game open (write) success! Filename: {0}",
                                 game.Filename);

            SerializeAndSaveGame(game);
        }
        else
        {
            // handle error
            PlatformSaveUtil.ShowSaveErrorPopup(
                string.Format("OnSavedGameOpenedAndWrite: Save game open (write) failed! - {0}", status));
            //rootCanvasGroup.interactable = true;
            BalloonLogManager.Add(BalloonLogEntry.Type.GameCloudSaveFailure, 0, 2);
        }
    }
Exemplo n.º 5
0
    public void ExecuteCloudSave()
    {
#if !NO_GPGS
        SaveLoadManager.Save(BalloonSpawner.instance, ConfigPopup.instance, BalloonSound.instance, Data.instance,
                             SaveLoadManager.SaveReason.BeforeCloudSave);
        PlatformSaveUtil.ShowSaveProgressPopup();

        var savedGameClient = PlayGamesPlatform.Instance.SavedGame;
        if (savedGameClient != null)
        {
            Open(savedGameClient,
                 true,
                 OnSavedGameOpenedAndWriteConflictResolve,
                 OnSavedGameOpenedAndWrite);
        }
        else
        {
            PlatformSaveUtil.ShowSaveErrorPopup("OnClick_cloudSave: savedGameClient null");
            BalloonLogManager.Add(BalloonLogEntry.Type.GameCloudSaveFailure, 0, 1);
        }
#endif
    }
Exemplo n.º 6
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);
        }
    }