diff --git a/VPet-Simulator.Core/Handle/PetLoader.cs b/VPet-Simulator.Core/Handle/PetLoader.cs index f0144c6..91046a8 100644 --- a/VPet-Simulator.Core/Handle/PetLoader.cs +++ b/VPet-Simulator.Core/Handle/PetLoader.cs @@ -31,18 +31,23 @@ namespace VPet_Simulator.Core /// public List path = new List(); /// - /// 宠物名字 + /// 宠物介绍名字 /// public string Name; /// /// 宠物介绍 /// public string Intor; + /// + /// 宠物默认名字 + /// + public string PetName; public GraphCore.Config Config; public PetLoader(LpsDocument lps, DirectoryInfo directory) { Name = lps.First().Info; Intor = lps.First()["intor"].Info; + PetName = lps.First()["petname"].Info; path.Add(directory.FullName + "\\" + lps.First()["path"].Info); Config = new Config(lps); } diff --git a/VPet-Simulator.Windows.Interface/Setting.cs b/VPet-Simulator.Windows.Interface/Setting.cs index 3974609..4766e2e 100644 --- a/VPet-Simulator.Windows.Interface/Setting.cs +++ b/VPet-Simulator.Windows.Interface/Setting.cs @@ -207,6 +207,10 @@ namespace VPet_Simulator.Windows.Interface FindorAddLine("theme").Info = value; } } + /// + /// 当前宠物的储存数据 + /// + public ILine PetData => this["petdata"]; private int presslength; private int intercycle; diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index 77b9922..4b0edf2 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -37,7 +37,6 @@ namespace VPet_Simulator.Windows private NotifyIcon notifyIcon; public PetHelper petHelper; public System.Timers.Timer AutoSaveTimer = new System.Timers.Timer(); - public MainWindow() { LocalizeCore.StoreTranslation = true; @@ -157,7 +156,7 @@ namespace VPet_Simulator.Windows private List rndtext; public long lastclicktime { get; set; } - public void LoadLatestSave() + public void LoadLatestSave(string petname) { if (Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\UserData")) { @@ -169,7 +168,7 @@ namespace VPet_Simulator.Windows return; } } - Core.Save = new GameSave("萝莉斯".Translate()); + Core.Save = new GameSave(petname.Translate()); } public void GameLoad() { @@ -230,13 +229,16 @@ namespace VPet_Simulator.Windows LocalizeCore.LoadCulture(Set.Language); Dispatcher.BeginInvoke(new Action(() => LoadingText.Content = "尝试加载游戏MOD".Translate())); + //当前桌宠动画 + var petloader = Pets.Find(x => x.Name == Set.PetGraph); + petloader ??= Pets[0]; //加载游戏内容 Core.Controller = new MWController(this); if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps")) GameLoad(new LpsDocument(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps")).First()); else//如果加载存档失败了,试试加载备份,如果没备份,就新建一个 - LoadLatestSave(); + LoadLatestSave(petloader.PetName); AutoSaveTimer.Elapsed += AutoSaveTimer_Elapsed; @@ -289,8 +291,8 @@ namespace VPet_Simulator.Windows Dispatcher.Invoke(new Action(() => { LoadingText.Content = "尝试加载动画和生成缓存".Translate(); - var pl = Pets.Find(x => x.Name == Set.PetGraph); - Core.Graph = pl == null ? Pets[0].Graph() : pl.Graph(); + + Core.Graph = petloader.Graph(); LoadingText.Content = "正在加载CGPT".Translate(); winSetting = new winGameSetting(this); diff --git a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs index f360c8a..9cfb94b 100644 --- a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs +++ b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs @@ -720,9 +720,17 @@ namespace VPet_Simulator.Windows { if (!AllowChange) return; + + var petloader = mw.Pets.Find(x => x.Name == mw.Set.PetGraph); + petloader ??= mw.Pets[0]; + bool ischangename = mw.Core.Save.Name == petloader.PetName.Translate(); + mw.Set.PetGraph = mw.Pets[PetBox.SelectedIndex].Name; PetIntor.Text = mw.Pets[PetBox.SelectedIndex].Intor.Translate(); ButtonRestartGraph.Visibility = Visibility.Visible; + + if (ischangename) + mw.Core.Save.Name = petloader.PetName.Translate(); } private void TextBoxPetName_TextChanged(object sender, TextChangedEventArgs e) @@ -766,9 +774,9 @@ namespace VPet_Simulator.Windows }); break; case "OFF": - default: + default: break; - } + } } private void CGPType_Checked(object sender, RoutedEventArgs e) @@ -814,7 +822,7 @@ namespace VPet_Simulator.Windows BtnCGPTReSet.IsEnabled = false; BtnCGPTReSet.Content = "聊天框已关闭".Translate(); break; - } + } } private void ButtonSetting_MouseDown(object sender, MouseButtonEventArgs e) @@ -1000,8 +1008,13 @@ namespace VPet_Simulator.Windows { if (!AllowChange) return; + var petloader = mw.Pets.Find(x => x.Name == mw.Set.PetGraph); + petloader ??= mw.Pets[0]; + bool ischangename = mw.Core.Save.Name == petloader.PetName.Translate(); LocalizeCore.LoadCulture((string)LanguageBox.SelectedItem); mw.Set.Language = LocalizeCore.CurrentCulture; + if(ischangename) + mw.Core.Save.Name = petloader.PetName.Translate(); } private void MainTab_SelectionChanged(object sender, SelectionChangedEventArgs e) diff --git a/VPet-Simulator.Windows/mod/0000_core/pet/vup.lps b/VPet-Simulator.Windows/mod/0000_core/pet/vup.lps index fddbd6d..f5a3063 100644 --- a/VPet-Simulator.Windows/mod/0000_core/pet/vup.lps +++ b/VPet-Simulator.Windows/mod/0000_core/pet/vup.lps @@ -1,4 +1,4 @@ -pet#默认虚拟桌宠:|intor#虚拟主播模拟器默认人物形象:|path#vup:| +pet#默认虚拟桌宠:|intor#虚拟主播模拟器默认人物形象:|path#vup:|petname#萝莉斯:| touchhead:|px#159:|py#16:|sw#189:|sh#178:| touchraised:|happy_px#0:|happy_py#50:|happy_sw#500:|happy_sh#200:|nomal_px#0:|nomal_py#50:|nomal_sw#500:|nomal_sh#200:|poorcondition_px#0:|poorcondition_py#50:|poorcondition_sw#500:|poorcondition_sh#200:|ill_px#0:|ill_py#200:|ill_sw#500:|ill_sh#300:| raisepoint:|happy_x#290:|happy_y#128:|nomal_x#290:|nomal_y#128:|poorcondition_x#290:|poorcondition_y#128:|ill_x#225:|ill_y#115:|