// 是否可以继续游戏 public virtual bool IsCanContinueGame() { string id = Prefers.GetLastAchiveID(); var tempAchive = GetAchieveMgr(Prefers.GetLastAchiveLocal()); return(tempAchive.IsHaveArchive(id) && tempAchive.IsArchiveValid(id)); }
protected override void OnAllLoadEnd1() { base.OnAllLoadEnd1(); if (!Prefers.IsCustomLanguage() && PlatSDKMgr.IsSuportPlatformLanguage()) { Switch(PlatSDKMgr.GetLanguageType()); } }
public override void OnEnable() { base.OnEnable(); try { if (LocalArchiveMgr != null) { LocalArchiveMgr.Init(GetLocalArchivePath()); } if (RemoteArchiveMgr != null) { RemoteArchiveMgr.Init(GetCloudArchivePath()); } } catch (Exception e) { if (e != null) { CLog.Error(e.ToString()); } } UseRemoteArchives(!Prefers.GetLastAchiveLocal()); }
// 另存当前游戏 // isSetDirty=true 刷新存储文件(会卡) ,否则不刷新,比如自动存储的时候不需要刷新 // isSnapshot=true 通过最近的一次快照存储游戏 public virtual DBBaseGame SaveCurGameAs(string id, bool useSnapshot, bool isAsyn, bool isDirtyList, bool isHide, bool forceLocalArchive) { //保存 if (id != Const.STR_DBTempSaveName) { Prefers.SetLastAchiveID(id); Prefers.SetLastAchiveLocal(IsCurArchivesLocal()); } ArchiveFile <TGameData> archiveFile; if (useSnapshot) { //使用最近的一次快照 if (!HasSnapshot) { throw new NotImplementedException("最近一次没有快照,请手动调用Sanpshot"); } } else { //临时快照 Snapshot(false); } if (forceLocalArchive) { archiveFile = LocalArchiveMgr.SaveData(id, CurGameData, isAsyn, isDirtyList, isHide); } else { archiveFile = CurArchiveMgr.SaveData(id, CurGameData, isAsyn, isDirtyList, isHide); } Callback_OnSaveGame?.Invoke(archiveFile); return(CurGameData); }
// 继续游戏 public virtual void ContinueGame() { DBMgr.UseRemoteArchives(!Prefers.GetLastAchiveLocal()); LoadGame(Prefers.GetLastAchiveID()); }