切换皮肤时显示多开功能

This commit is contained in:
ZouJin 2023-10-15 21:12:00 +08:00
parent 51ee6f5159
commit c1a9182cb7
5 changed files with 62 additions and 10 deletions

View File

@ -290,7 +290,11 @@ namespace VPet_Simulator.Windows
Environment.Exit(0);
}
else
{
winSetting?.Close();
winBetterBuy?.Close();
App.MainWindows.Remove(this);
}
}

View File

@ -78,6 +78,7 @@ namespace VPet_Simulator.Windows
if (petboxid == -1)
petboxid = 0;
PetBox.SelectedIndex = petboxid;
petboxbef = petboxid;
PetIntor.Text = mw.Pets[petboxid].Intor.Translate();
TextBoxStartUpX.Text = mw.Set.StartRecordPoint.X.ToString();
@ -957,23 +958,64 @@ namespace VPet_Simulator.Windows
mw.Set.StartUPBootSteam = StartUpSteamBox.IsChecked == true;
GenStartUP();
}
private int petboxbef;
private void petbox_back()
{
AllowChange = false;
PetBox.SelectedIndex = petboxbef;
AllowChange = true;
}
private void PetBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!AllowChange)
return;
if (mw.PrefixSave == "")
{
switch (MessageBoxX.Show("是否多开一个新的桌宠使用 {0} 皮肤\n各自存档独立保存,互不影响\n支持同时显示多个宠物".Translate(mw.Pets[PetBox.SelectedIndex].Name.Translate()),
"是否多开".Translate(), MessageBoxButton.YesNoCancel))
{
case MessageBoxResult.Yes:
var savename = mw.Pets[PetBox.SelectedIndex].Name;
petbox_back();
foreach (var c in @"()#:|/\?*<>-")
if (savename.Contains(c))
{
MessageBoxX.Show("存档名不能包括特殊符号".Translate());
return;
}
if (App.MutiSaves.FirstOrDefault(x => x.ToLower() == savename.ToLower()) != null)
{
MessageBoxX.Show("存档名重复".Translate());
return;
}
var lps = new LPS(mw.Set.ToString());
lps.SetInt("savetimes", 0);
lps["gameconfig"].SetString("petgraph", savename);
File.WriteAllText(ExtensionValue.BaseDirectory + @$"\Setting-{savename}.lps", lps.ToString());
App.MutiSaves.Add(savename);
new MainWindow(savename).Show();
return;
case MessageBoxResult.No:
break;
default:
petbox_back();
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();
petboxbef = PetBox.SelectedIndex;
mw.Set.PetGraph = mw.Pets[petboxbef].Name;
PetIntor.Text = mw.Pets[petboxbef].Intor.Translate();
ButtonRestartGraph.Visibility = Visibility.Visible;
if (ischangename)
{
mw.Core.Save.Name = mw.Pets[PetBox.SelectedIndex].PetName.Translate();
mw.Core.Save.Name = mw.Pets[petboxbef].PetName.Translate();
TextBoxPetName.Text = mw.Core.Save.Name;
if (mw.IsSteamUser)
SteamFriends.SetRichPresence("username", mw.Core.Save.Name);
@ -1410,7 +1452,7 @@ namespace VPet_Simulator.Windows
{
MessageBoxX.Show("当前多开已经加载".Translate());
return;
}
}
new MainWindow(str).Show();
}
@ -1428,7 +1470,7 @@ namespace VPet_Simulator.Windows
MessageBoxX.Show("存档名重复".Translate());
return;
}
var lps = new LPS(mw.Set);
lps.SetInt("savetimes", 0);
File.WriteAllText(ExtensionValue.BaseDirectory + @$"\Setting-{savename}.lps", lps.ToString());

View File

@ -19,4 +19,6 @@ selecttext#Options Chat Text:|
存档名重复#Duplicate archive name:|
当前多开已经加载#Currently loaded:|
导致的\n如有可能请发送 错误信息截图和引发错误之前的操作给相应MOD作者\n感谢您对MOD开发的支持\n#Caused. \nIf possible, please send the error message screenshot and the operation before the error to the corresponding MOD author\nThank you for your support for MOD development\n:|
搜索设置#Search settings:|
搜索设置#Search settings:|
是否多开一个新的桌宠使用 {0} 皮肤\n各自存档独立保存,互不影响\n支持同时显示多个宠物#Whether to open a new VPet to use {0} skin\nEach archive is saved independently and does not affect each other\nSupports displaying multiple pets at the same time:|
是否多开#Whether to open multiple:|

View File

@ -19,4 +19,6 @@ selecttext#选项聊天文本:|
存档名重复#存档名重复:|
当前多开已经加载#当前多开已经加载:|
导致的\n如有可能请发送 错误信息截图和引发错误之前的操作给相应MOD作者\n感谢您对MOD开发的支持\n#导致的\n如有可能请发送 错误信息截图和引发错误之前的操作给相应MOD作者\n感谢您对MOD开发的支持\n:|
搜索设置#搜索设置:|
搜索设置#搜索设置:|
是否多开一个新的桌宠使用 {0} 皮肤\n各自存档独立保存,互不影响\n支持同时显示多个宠物#是否多开一个新的桌宠使用 {0} 皮肤\n各自存档独立保存,互不影响\n支持同时显示多个宠物:|
是否多开#是否多开:|

View File

@ -19,4 +19,6 @@ selecttext#選項聊天文字:|
存档名重复#存檔名重複:|
当前多开已经加载#當前多開已經加載:|
导致的\n如有可能请发送 错误信息截图和引发错误之前的操作给相应MOD作者\n感谢您对MOD开发的支持\n#導致的\n如有可能請發送 錯誤信息截圖和引發錯誤之前的操作給相應MOD作者\n感謝您對MOD開發的\n:|
搜索设置#搜索設定:|
搜索设置#搜索設定:|
是否多开一个新的桌宠使用 {0} 皮肤\n各自存档独立保存,互不影响\n支持同时显示多个宠物#是否多開一個新的桌寵使用 {0} 皮膚\n各自存檔獨立保存互不影響\n支持同時顯示多個寵物:|
是否多开#是否多開:|