diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index 988bb95f40fceb3ec38f9b7fee9aca90ab8e10fb..c256808fec28f1357a01d6fd6dd481d2e2d8faf6 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -569,14 +569,19 @@ namespace VPet_Simulator.Windows Task.Run(Steamworks.SteamUserStats.StoreStats); } } + /// + /// 加载游戏 + /// public bool GameLoad(ILine line) { if (line == null) return false; if (string.IsNullOrWhiteSpace(line.ToString())) return false; + Core.Save = GameSave.Load(line); - if (Core.Save.Money == 0 && Core.Save.Likability == 0 && Core.Save.Exp == 0 + + if (Core.Save.Money == 0 && Core.Save.Likability == 0 && Core.Save.Exp == 0 && Core.Save.StrengthDrink == 0 && Core.Save.StrengthFood == 0)//数据全是0,可能是bug return false; long hash = line.GetInt64("hash"); diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index 80ee288978423df15a0e99cadcb0ddcfbe5c7574..20bef4dab8399136ea779121a718f14fee4a4670 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -232,8 +232,16 @@ namespace VPet_Simulator.Windows .GetFiles("*.lps").OrderByDescending(x => x.LastWriteTime).FirstOrDefault(); if (latestsave != null) { - if (GameLoad(new Line(File.ReadAllText(latestsave.FullName)))) - return; + try + { + if (GameLoad(new Line(File.ReadAllText(latestsave.FullName)))) + return; + MessageBoxX.Show("存档损毁,无法加载该存档\n可能是上次储存出错或Steam云同步导致的\n请在设置中加载备份还原存档", "存档损毁".Translate()); + } + catch (Exception ex) + { + MessageBoxX.Show("存档损毁,无法加载该存档\n可能是数据溢出/超模导致的" + '\n' + ex.Message, "存档损毁".Translate()); + } } } Core.Save = new GameSave(petname.Translate()); @@ -364,21 +372,37 @@ namespace VPet_Simulator.Windows await Dispatcher.InvokeAsync(new Action(() => LoadingText.Content = "尝试加载游戏存档".Translate())); //加载存档 Core.Controller = new MWController(this); - if (!(File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps") && - GameLoad(new LpsDocument(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps")).First()))) + if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps")) + try + { + if (GameLoad(new LpsDocument(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps")).First())) + { + //如果加载存档失败了,试试加载备份,如果没备份,就新建一个 + LoadLatestSave(petloader.PetName); + } + + } + catch (Exception ex) + { + MessageBoxX.Show("存档损毁,无法加载该存档\n可能是数据溢出/超模导致的" + '\n' + ex.Message, "存档损毁".Translate()); + //如果加载存档失败了,试试加载备份,如果没备份,就新建一个 + LoadLatestSave(petloader.PetName); + } + else //如果加载存档失败了,试试加载备份,如果没备份,就新建一个 LoadLatestSave(petloader.PetName); + AutoSaveTimer.Elapsed += AutoSaveTimer_Elapsed; - if(Set.Statistics[(gdbe)"stat_bb_food"] < 0 || Set.Statistics[(gdbe)"stat_bb_drink"] < 0 || Set.Statistics[(gdbe)"stat_bb_drug"] < 0 + if (Set.Statistics[(gdbe)"stat_bb_food"] < 0 || Set.Statistics[(gdbe)"stat_bb_drink"] < 0 || Set.Statistics[(gdbe)"stat_bb_drug"] < 0 || Set.Statistics[(gdbe)"stat_bb_snack"] < 0 || Set.Statistics[(gdbe)"stat_bb_functional"] < 0 || Set.Statistics[(gdbe)"stat_bb_meal"] < 0 || Set.Statistics[(gdbe)"stat_bb_gift"] < 0) { hashCheck = false; } - if (Set.AutoSaveInterval > 0) + if (Set.AutoSaveInterval > 0) { AutoSaveTimer.Interval = Set.AutoSaveInterval * 60000; AutoSaveTimer.Start(); diff --git a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs index 39225efa862e51113fa90fe4dcff92429b1ce817..bb07ddccb99f275d5761a096550fbcaf359687ef 100644 --- a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs +++ b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs @@ -1049,7 +1049,15 @@ namespace VPet_Simulator.Windows if (MessageBoxX.Show("存档名称:{0}\n存档等级:{1}\n存档金钱:{2}\n是否加载该备份存档? 当前游戏数据会丢失" .Translate(gs.Name, gs.Level, gs.Money), "是否加载该备份存档? 当前游戏数据会丢失".Translate(), MessageBoxButton.YesNo, MessageBoxIcon.Info) == MessageBoxResult.Yes) { - mw.GameLoad(l); + try + { + if (!mw.GameLoad(l)) + MessageBoxX.Show("存档损毁,无法加载该存档\n可能是上次储存出错或Steam云同步导致的\n请在设置中加载备份还原存档", "存档损毁".Translate()); + } + catch (Exception ex) + { + MessageBoxX.Show("存档损毁,无法加载该存档\n可能是数据溢出/超模导致的" + '\n' + ex.Message, "存档损毁".Translate()); + } } } catch (Exception exp) diff --git a/VPet-Simulator.Windows/mod/0000_core/lang/en/Base2308.lps b/VPet-Simulator.Windows/mod/0000_core/lang/en/Base2308.lps index a4bf748d349d15d8ab8ee1f8e4608a68d3c856be..d1b9c3ee6b9237b37910b1a46021306114039643 100644 --- a/VPet-Simulator.Windows/mod/0000_core/lang/en/Base2308.lps +++ b/VPet-Simulator.Windows/mod/0000_core/lang/en/Base2308.lps @@ -35,4 +35,7 @@ MOD加载错误,是MOD({0})导致的\n如有可能请发送 错误信息截图 导致的\n如有可能请发送 错误信息截图和引发错误之前的操作 给开发者:service@exlb.net\n感谢您对游戏开发的支持\n#If possible, Please send a screenshot of the error message and the action you took before triggering the error to developer: service@exlb.net\nThanks for your support of the game development\n:| 清理指令已下达,下次启动桌宠时生效#The cleanup command has been issued and will take effect the next time the table pet is started:| 服务器超载,请稍后重试#Server overload, please try again later:| -存档损毁,无法加载该备份\n请更换备份重试#Archive damage, unable to load the backup\nPlease replace the backup and try again:| \ No newline at end of file +存档损毁,无法加载该备份\n请更换备份重试#Archive damage, unable to load the backup\nPlease replace the backup and try again:| +存档损毁#Archive damage:| +存档损毁,无法加载该存档\n可能是数据溢出/超模导致的#Archive damage, unable to load the archive\nIt may be caused by data overflow/overmodel:| +存档损毁,无法加载该存档\n可能是上次储存出错或Steam云同步导致的\n请在设置中加载备份还原存档#Archive damage, unable to load the archive\nIt may be caused by an error in the last storage or Steam cloud synchronization\nPlease load the backup in the settings to restore the archive:| \ No newline at end of file diff --git a/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hans/Base2308.lps b/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hans/Base2308.lps index c4b005fe34fa09a248dfe4f3221b1da4673e670b..c39a3122f920d05cc511bc0dcfce3341f45e1689 100644 --- a/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hans/Base2308.lps +++ b/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hans/Base2308.lps @@ -35,4 +35,7 @@ MOD加载错误,是MOD({0})导致的\n如有可能请发送 错误信息截图 导致的\n如有可能请发送 错误信息截图和引发错误之前的操作 给开发者:service@exlb.net\n感谢您对游戏开发的支持\n#导致的\n如有可能请发送 错误信息截图和引发错误之前的操作 给开发者:service@exlb.net\n感谢您对游戏开发的支持\n:| 清理指令已下达,下次启动桌宠时生效#清理指令已下达,下次启动桌宠时生效:| 服务器超载,请稍后重试#服务器超载,请稍后重试:| -存档损毁,无法加载该备份\n请更换备份重试#存档损毁,无法加载该备份\n请更换备份重试:| \ No newline at end of file +存档损毁,无法加载该备份\n请更换备份重试#存档损毁,无法加载该备份\n请更换备份重试:| +存档损毁#存档损毁:| +存档损毁,无法加载该存档\n可能是数据溢出/超模导致的#存档损毁,无法加载该存档\n可能是数据溢出/超模导致的:| +存档损毁,无法加载该存档\n可能是上次储存出错或Steam云同步导致的\n请在设置中加载备份还原存档#存档损毁,无法加载该存档\n可能是上次储存出错或Steam云同步导致的\n请在设置中加载备份还原存档:| \ No newline at end of file diff --git a/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hant/Base2308.lps b/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hant/Base2308.lps index 28a9c1603b7695b880fa20ad1549aec682664de0..04e4663aaaeff1d702b9a4838b04fe7f2b0e3770 100644 --- a/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hant/Base2308.lps +++ b/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hant/Base2308.lps @@ -35,4 +35,7 @@ MOD加载错误,是MOD({0})导致的\n如有可能请发送 错误信息截图 导致的\n如有可能请发送 错误信息截图和引发错误之前的操作 给开发者:service@exlb.net\n感谢您对游戏开发的支持\n#導致的\n如有可能請發送 錯誤資訊截圖和引發錯誤之前的操作 給開發者:service@exlb.net\n感謝您對遊戲開發的支持\n:| 清理指令已下达,下次启动桌宠时生效#清理指令已下達,下次啟動桌寵時生效:| 服务器超载,请稍后重试#伺服器超載,請稍後重試:| -存档损毁,无法加载该备份\n请更换备份重试#存檔損毀,無法加載該備份\n請更換備份重試:| \ No newline at end of file +存档损毁,无法加载该备份\n请更换备份重试#存檔損毀,無法加載該備份\n請更換備份重試:| +存档损毁#存檔損毀:| +存档损毁,无法加载该存档\n可能是数据溢出/超模导致的#存檔損毀,無法加載該存檔\n可能是資料溢出/超模導致的:| +存档损毁,无法加载该存档\n可能是上次储存出错或Steam云同步导致的\n请在设置中加载备份还原存档#存檔損毀,無法加載該存檔\n可能是上次儲存出錯或Steam雲同步導致的\n請在設定中加載備份還原存檔:| \ No newline at end of file