Exemple #1
0
 private void GetCloudSaveLatestTimestampCallback(Byte[] data, SiliconStudio.Social.ResponseData.Status status)
 {
     if (data != null)
     {
         this.ValidateCloudSaveData(data, delegate(Boolean isValidate)
         {
             if (isValidate)
             {
                 this.RawStorage.RawData = data;
                 this.RawStorage.GetLatestTimestamp(delegate(Boolean isSuccess, Double timestamp)
                 {
                     this.getCloudSaveLatestTimestampFinishDelegate(ISharedDataSerializer.LastErrno, isSuccess, timestamp);
                     this.RawStorage.RawData = null;
                 });
             }
             else
             {
                 ISharedDataSerializer.LastErrno = DataSerializerErrorCode.CloudDataCorruption;
                 ISharedDataLog.LogError("Cloud data is invalid!");
                 this.getCloudSaveLatestTimestampFinishDelegate(ISharedDataSerializer.LastErrno, false, 0.0);
             }
         });
     }
     else
     {
         ISharedDataSerializer.LastErrno = ISharedDataSerializer.ConvertCloudStatusToDataSerializerErrorCode(status);
         this.getCloudSaveLatestTimestampFinishDelegate(ISharedDataSerializer.LastErrno, false, 0.0);
     }
 }
Exemple #2
0
 protected void CloudSaveCallBack(Boolean isSuccess, SiliconStudio.Social.ResponseData.Status status)
 {
     if (isSuccess)
     {
         global::Debug.Log("+++ CloudSaveCallBack");
     }
     global::Debug.Log("Result status:" + status);
 }
Exemple #3
0
 protected void CloudLoadCallBack(Byte[] data, SiliconStudio.Social.ResponseData.Status status)
 {
     if (data == null)
     {
         return;
     }
     if (data.Length != 0)
     {
         global::Debug.Log("+++ CloudLoadCallBack : " + Encoding.UTF8.GetString(data));
     }
     global::Debug.Log("Result status: " + status);
 }
Exemple #4
0
 private void DownloadFromCloudOnCloudLoadCallBack(Byte[] data, SiliconStudio.Social.ResponseData.Status status)
 {
     if (data != null)
     {
         this.ValidateCloudSaveData(data, delegate(Boolean isValidate)
         {
             if (isValidate)
             {
                 this.RawStorage.RawData = data;
                 this.Storage.SaveRawData(data, delegate(Boolean isSuccess)
                 {
                     this.RawStorage.GetLatestSlotAndSave(delegate(Int32 latestSlotID, Int32 latestSaveID)
                     {
                         this.latestCloudSlotID = latestSlotID;
                         this.latestCloudSaveID = latestSaveID;
                         if (this.latestCloudSlotID != -1 && this.latestCloudSaveID != -1)
                         {
                             this.RawStorage.LoadSlotPreview(this.latestCloudSlotID, delegate(Int32 slotID, List <SharedDataPreviewSlot> previewData)
                             {
                                 this.downloadFromCloudRemoteDataPreviewSlot = previewData[this.latestCloudSaveID];
                                 this.downloadFromCloudLocalDataPreviewSlot  = this.downloadFromCloudRemoteDataPreviewSlot;
                                 this.downloadFromCloudFinishDelegate(ISharedDataSerializer.LastErrno, true, this.downloadFromCloudLocalDataPreviewSlot, this.downloadFromCloudRemoteDataPreviewSlot);
                                 this.ClearCloudSyncPreviewCache();
                                 this.RawStorage.RawData = null;
                             });
                         }
                         else
                         {
                             this.downloadFromCloudFinishDelegate(ISharedDataSerializer.LastErrno, true, this.downloadFromCloudLocalDataPreviewSlot, this.downloadFromCloudRemoteDataPreviewSlot);
                             this.ClearCloudSyncPreviewCache();
                         }
                     });
                 });
             }
             else
             {
                 ISharedDataSerializer.LastErrno = DataSerializerErrorCode.CloudDataCorruption;
                 ISharedDataLog.LogError("Cloud data is invalid!");
                 this.downloadFromCloudFinishDelegate(ISharedDataSerializer.LastErrno, true, this.downloadFromCloudLocalDataPreviewSlot, this.downloadFromCloudRemoteDataPreviewSlot);
                 this.ClearCloudSyncPreviewCache();
             }
         });
     }
     else
     {
         ISharedDataSerializer.LastErrno = ISharedDataSerializer.ConvertCloudStatusToDataSerializerErrorCode(status);
         this.downloadFromCloudFinishDelegate(ISharedDataSerializer.LastErrno, false, (SharedDataPreviewSlot)null, (SharedDataPreviewSlot)null);
         this.ClearCloudSyncPreviewCache();
     }
 }
Exemple #5
0
 private void LoadCloudSyncPreviewOnFileExistCallBack(Boolean isExist, SiliconStudio.Social.ResponseData.Status status)
 {
     if (isExist)
     {
         base.StartCoroutine(SiliconStudio.Social.Cloud_Load(this, new Action <Byte[], SiliconStudio.Social.ResponseData.Status>(this.LoadCloudSyncPreviewOnCloudLoadCallBack)));
     }
     else
     {
         ISharedDataLog.LogWarning("Cloud data does not exist!. Return success status.");
         ISharedDataSerializer.LastErrno = DataSerializerErrorCode.CloudFileNotFound;
         this.onSyncCloudSlotFinishDelegate(ISharedDataSerializer.LastErrno, true, this.loadCloudSyncPreviewLocalPreview, (SharedDataPreviewSlot)null);
         this.ClearCloudSyncPreviewCache();
     }
 }
Exemple #6
0
    private void LoadCloudSyncPreviewOnCloudLoadCallBack(Byte[] data, SiliconStudio.Social.ResponseData.Status status)
    {
        global::Debug.Log("in LoadCloudSyncPreviewOnCloudLoadCallBack 1 " + status);
        global::Debug.Log("in LoadCloudSyncPreviewOnCloudLoadCallBack 4");

        if (data != null)
        {
            this.ValidateCloudSaveData(data, delegate(Boolean isSuccess)
            {
                if (isSuccess)
                {
                    this.RawStorage.RawData = data;
                    this.RawStorage.GetLatestSlotAndSave(delegate(Int32 latestCloudSlotID, Int32 latestCloudSaveID)
                    {
                        if (latestCloudSlotID != -1 && latestCloudSaveID != -1)
                        {
                            this.RawStorage.LoadSlotPreview(latestCloudSlotID, delegate(Int32 slotID, List <SharedDataPreviewSlot> previewData)
                            {
                                this.loadCloudSyncPreviewRemotePreview = previewData[latestCloudSaveID];
                                this.onSyncCloudSlotFinishDelegate(ISharedDataSerializer.LastErrno, true, this.loadCloudSyncPreviewLocalPreview, this.loadCloudSyncPreviewRemotePreview);
                                this.ClearCloudSyncPreviewCache();
                                this.RawStorage.RawData = null;
                            });
                        }
                        else
                        {
                            this.onSyncCloudSlotFinishDelegate(ISharedDataSerializer.LastErrno, true, this.loadCloudSyncPreviewLocalPreview, this.loadCloudSyncPreviewRemotePreview);
                            this.ClearCloudSyncPreviewCache();
                        }
                    });
                }
                else
                {
                    ISharedDataSerializer.LastErrno = DataSerializerErrorCode.CloudDataCorruption;
                    ISharedDataLog.LogError("Cloud data is invalid!");
                    this.onSyncCloudSlotFinishDelegate(ISharedDataSerializer.LastErrno, true, this.loadCloudSyncPreviewLocalPreview, this.loadCloudSyncPreviewRemotePreview);
                }
            });
        }
        else
        {
            ISharedDataLog.LogWarning("Cloud data is null!");
            ISharedDataSerializer.LastErrno = ISharedDataSerializer.ConvertCloudStatusToDataSerializerErrorCode(status);
            this.onSyncCloudSlotFinishDelegate(ISharedDataSerializer.LastErrno, true, this.loadCloudSyncPreviewLocalPreview, this.loadCloudSyncPreviewRemotePreview);
            this.ClearCloudSyncPreviewCache();
        }
    }
Exemple #7
0
 protected void CloudFileExistCallBack(Boolean isExist, SiliconStudio.Social.ResponseData.Status status)
 {
     global::Debug.Log("+++ CloudFileExistCallBack : " + isExist);
     global::Debug.Log("Result status: " + status);
 }
Exemple #8
0
    public static DataSerializerErrorCode ConvertCloudStatusToDataSerializerErrorCode(SiliconStudio.Social.ResponseData.Status input)
    {
        switch (input)
        {
        case SiliconStudio.Social.ResponseData.Status.UnknownError:
            return(DataSerializerErrorCode.CloudDataUnknownError);

        case SiliconStudio.Social.ResponseData.Status.DocumentNotFound:
            return(DataSerializerErrorCode.CloudFileNotFound);

        case SiliconStudio.Social.ResponseData.Status.DownloadTimeout:
            return(DataSerializerErrorCode.CloudConnectionTimeout);

        case SiliconStudio.Social.ResponseData.Status.ConnectionError:
            return(DataSerializerErrorCode.CloudConnectionError);
        }
        return(DataSerializerErrorCode.Success);
    }