public static void DeleteRecord(RecordInfo info, Action done = null, Action error = null) { if (VSEManager.accountType == VSEManager.AccountType.VSEClass || VSEManager.accountType == VSEManager.AccountType.NotLogin) { LocalRecordStorage.DeleteStorage(RecordInfoToName(info)); UpdateRecordInfos(y => { done?.Invoke(); }); } else { Storage.RemoteStorage.DeleteStorage(RecordInfoToName(info), x => { if (x) { UpdateRecordInfos(y => { done?.Invoke(); }); } else { error?.Invoke(); } }); } }
/// <summary> /// 覆盖保存存档内容 /// </summary> public static void SaveRecord(Record record, Action done = null, Action error = null) { if (record.info.id.Equals(-2)) { Storage.UnityStorage.SetStorage($"tempRecord", record); done?.Invoke(); return; } else if (VSEManager.accountType == VSEManager.AccountType.VSEClass || VSEManager.accountType == VSEManager.AccountType.NotLogin) { LocalRecordStorage.SetStorage(RecordInfoToName(record.info), record); UpdateRecordInfos(y => { done?.Invoke(); }); } else { Storage.RemoteStorage.SetStorage(RecordInfoToName(record.info), record, responseAction: x => { UpdateRecordInfos(y => { done?.Invoke(); }); }, error: y => error?.Invoke()); } }
public static Record GetRecord(RecordInfo info, Action <Record> done, Action <string> error = null) { if (info.id == -2) { return(Storage.UnityStorage.GetStorage <Record>("tempRecord", null, null)); } else if (VSEManager.accountType == VSEManager.AccountType.VSEClass || VSEManager.accountType == VSEManager.AccountType.NotLogin) { done?.Invoke(LocalRecordStorage.GetStorage(RecordInfoToName(info))); } else { Storage.RemoteStorage.GetStorage(RecordInfoToName(info), done, error); } return(null); }
/// <summary> /// 获取存档信息列表 /// </summary> public static void UpdateRecordInfos(Action <List <RecordInfo> > action) { if (VSEManager.accountType == VSEManager.AccountType.VSEClass || VSEManager.accountType == VSEManager.AccountType.NotLogin) { var x = LocalRecordStorage.GetAllKeys(); _recordInfos = x.Select(y => NameToRecordInfo(y)).ToList(); Main.m_Event.Throw <RecordUpdateEventHandler>(); action?.Invoke(_recordInfos); } else { Storage.RemoteStorage.GetAllKeys(x => { _recordInfos = x.Select(y => NameToRecordInfo(y)).ToList(); Main.m_Event.Throw <RecordUpdateEventHandler>(); action?.Invoke(_recordInfos); }); } }