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); } }
public override void UploadToCloud(ISharedDataSerializer.OnSyncCloudSlotStart onStartDelegate, ISharedDataSerializer.OnSyncCloudSlotFinish onFinishDelegate) { ISharedDataSerializer.LastErrno = DataSerializerErrorCode.Success; this.ClearUploadToCloudCache(); if (onStartDelegate != null) { onStartDelegate(ISharedDataSerializer.LastErrno); } this.uploadToCloudFinishDelegate = onFinishDelegate; this.Storage.GetLatestSlotAndSave(delegate(Int32 latestSlot, Int32 latestSave) { this.latestSlotID = latestSlot; this.latestSaveID = latestSave; this.Storage.LoadRawData(delegate(Byte[] rawData) { if (rawData != null) { this.uploadToCloudRawData = rawData; this.LoadSlotPreview(this.latestSlotID, delegate(DataSerializerErrorCode errNo, Int32 slotID, List <SharedDataPreviewSlot> data) { if (data != null) { this.uploadToCloudLocalDataPreviewSlot = data[this.latestSaveID]; UInt64 playDuration = this.uploadToCloudLocalDataPreviewSlot.PlayDuration; Int32 num = (Int32)playDuration % 60; Int32 num2 = num / 60; Int32 num3 = num2 / 60; num2 %= 60; Int32 days = num3 / 24; num3 %= 24; TimeSpan playTime = new TimeSpan(days, num3, num2, num); base.StartCoroutine(SiliconStudio.Social.Cloud_Save(this, this.uploadToCloudRawData, playTime, delegate(Boolean isSuccess, SiliconStudio.Social.ResponseData.Status status) { if (isSuccess) { this.uploadToCloudRemoteDataPreviewSlot = this.uploadToCloudLocalDataPreviewSlot; } else { ISharedDataSerializer.LastErrno = ISharedDataSerializer.ConvertCloudStatusToDataSerializerErrorCode(status); } this.uploadToCloudFinishDelegate(ISharedDataSerializer.LastErrno, isSuccess, this.uploadToCloudLocalDataPreviewSlot, this.uploadToCloudRemoteDataPreviewSlot); this.ClearUploadToCloudCache(); })); } else { this.uploadToCloudFinishDelegate(ISharedDataSerializer.LastErrno, false, (SharedDataPreviewSlot)null, (SharedDataPreviewSlot)null); this.ClearUploadToCloudCache(); } }); } else { this.uploadToCloudFinishDelegate(ISharedDataSerializer.LastErrno, false, (SharedDataPreviewSlot)null, (SharedDataPreviewSlot)null); this.ClearUploadToCloudCache(); } }); }); }
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(); } }
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(); } }
public void StartEvents(Byte[] ebFileData) { EventEngine.resyncBGMSignal = 0; //Debug.Log("Reset resyncBGMSignal = " + (object)EventEngine.resyncBGMSignal); this._ff9 = FF9StateSystem.Common.FF9; this._ff9.charArray.Clear(); this._ff9Sys = PersistenSingleton <FF9StateSystem> .Instance; BinaryReader br = new BinaryReader(new MemoryStream(ebFileData)); this.SetupCodeParam(br); this._ff9.mapNameStr = FF9TextTool.LocationName(this._ff9.fldMapNo); this._defaultMapName = this._ff9.mapNameStr; switch (this._ff9Sys.mode) { case 1: this.gMode = 1; break; case 2: this.gMode = 2; break; case 3: this.gMode = 3; UIManager.World.EnableMapButton = true; break; case 8: this.gMode = 4; break; } EventInput.IsProcessingInput = this.gMode != 2 && this.gMode != 4; EMinigame.GetTheAirShipAchievement(); EMinigame.GetHelpAllVictimsInCleyraTown(); TimerUI.SetEnable(this._ff9.timerDisplay); TimerUI.SetDisplay(this._ff9.timerDisplay); TimerUI.SetPlay(this._ff9.timerControl); this.allObjsEBData = new Byte[this.sSourceObjN][]; this.toBeAddedObjUIDList.Clear(); for (Int32 index = 0; index < this.sSourceObjN; ++index) { br.BaseStream.Seek(128L, SeekOrigin.Begin); Int32 num = (Int32)this.sObjTable[index].ofs; Int32 count = (Int32)this.sObjTable[index].size; br.BaseStream.Seek((Int64)num, SeekOrigin.Current); this.allObjsEBData[index] = br.ReadBytes(count); //if (count < 4) //; } if ((this.sEventContext0.inited == 1 || this.sEventContext0.inited == 3) && this.gMode == 2) { this.sEventContext1.copy(this.sEventContext0); } this._context = this.sEventContext0; this.InitMP(); this.InitObj(); EventInput.IsProcessingInput = true; EIcon.InitFIcon(); EIcon.SetAIcon(0); for (Int32 index = 0; index < 80; ++index) { this._context.mapvar[index] = 0; } this._context.usercontrol = 0; this._context.controlUID = 0; this._context.idletimer = 0; EIcon.SetHereIcon(0); this.gStopObj = null; this._context.dashinh = 0; this._context.twist_a = 0; this._context.twist_d = 0; this.eTb.gMesCount = this.gAnimCount = 10; this._noEvents = false; this.InitEncount(); NewThread(0, 0); this._context.activeObj.obj.state = EventEngine.stateInit; this.SetupPartyUID(); for (Int32 index = 0; index < 8; ++index) { this._objPtrList[index] = null; } this._opLStart = 0; if (this.gMode == 2) { for (Int32 index = 0; index < 4; ++index) { Int32 partyMember = this.eTb.GetPartyMember(index); if (partyMember >= 0) { Actor actor = new Actor(this.sSourceObjN - 9 + partyMember, 0, EventEngine.sizeOfActor); } } this._context.partyObjTail = this._context.activeObjTail; } else { this._ff9.btl_rain = 0; } this._opLStart = 4; if (this.gMode == 1 && this.sEventContext1.inited == 1 && this.sEventContext1.lastmap == this._ff9.fldMapNo || this.gMode == 3 && this.sEventContext1.inited == 3 && this.sEventContext1.lastmap == this._ff9.wldMapNo || this._ff9Sys.prevMode == 9 && this.sEventContext1.inited != 0) { this.sEventContext0.copy(this.sEventContext1); this.Request(this.FindObjByUID(0), 0, 10, false); this.EnterBattleEnd(); } else { if (this.gMode != 2 && this.gMode != 4) { Boolean flag1 = this._ff9.fldMapNo == 70; Boolean flag2 = this._ff9.fldMapNo == 2200 && this.eBin.getVarManually(EBin.SC_COUNTER_SVR) == 9450 && this.eBin.getVarManually(EBin.MAP_INDEX_SVR) == 9999; Boolean flag3 = this._ff9.fldMapNo == 150 && this.eBin.getVarManually(EBin.SC_COUNTER_SVR) == 1155 && this.eBin.getVarManually(EBin.MAP_INDEX_SVR) == 325; Boolean flag4 = this._ff9.fldMapNo == 1251 && this.eBin.getVarManually(EBin.SC_COUNTER_SVR) == 5400; Boolean flag5 = this._ff9.fldMapNo == 1602 && this.eBin.getVarManually(EBin.SC_COUNTER_SVR) == 6645 && this.eBin.getVarManually(EBin.MAP_INDEX_SVR) == 16; Boolean flag6 = this._ff9.fldMapNo == 1757 && this.eBin.getVarManually(EBin.SC_COUNTER_SVR) == 6740; Boolean flag7 = this._ff9.fldMapNo == 2752 && this.eBin.getVarManually(EBin.SC_COUNTER_SVR) == 11100 && this.eBin.getVarManually(EBin.MAP_INDEX_SVR) == 9999; Boolean flag8 = this._ff9.fldMapNo == 3001 && this.eBin.getVarManually(EBin.SC_COUNTER_SVR) == 12000 && this.eBin.getVarManually(EBin.MAP_INDEX_SVR) == 0; Boolean flag9 = this._ff9.fldMapNo == 2161 && this.eBin.getVarManually(EBin.SC_COUNTER_SVR) == 10000 && this.eBin.getVarManually(EBin.MAP_INDEX_SVR) == 32; if (!flag1 && !flag4 && (!flag5 && !flag6) && (!flag3 && !flag2 && (!flag7 && !flag8)) && !flag9) { FF9StateSystem.Settings.UpdateTickTime(); ISharedDataSerializer serializer = FF9StateSystem.Serializer; serializer.Autosave(null, (e, s) => { }); } } this.ProcessEvents(); } this._context.inited = (Byte)this.gMode; this._context.lastmap = this.gMode != 1 ? (this.gMode != 3 ? (UInt16)0 : (UInt16)this._ff9.wldMapNo) : (UInt16)this._ff9.fldMapNo; br.Close(); SpawnCustomChatacters(); PersistenSingleton <CheatingManager> .Instance.ApplyDataWhenEventStart(); }