mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
备份系统
This commit is contained in:
parent
a911d9ba34
commit
9e28514e0e
@ -122,6 +122,14 @@ namespace VPet_Simulator.Windows.Interface
|
||||
set => SetInt("autosave", value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 备份保存最大数量
|
||||
/// </summary>
|
||||
public int BackupSaveMaxNum
|
||||
{
|
||||
get => Math.Max(GetInt("bakupsave", 20), 1);
|
||||
set => SetInt("bakupsave", value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否置于顶层
|
||||
/// </summary>
|
||||
public bool TopMost
|
||||
|
@ -69,17 +69,22 @@ namespace VPet_Simulator.Windows
|
||||
Set["betterbuy"]["star"].info = string.Join(",", list);
|
||||
}
|
||||
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Setting.lps", Set.ToString());
|
||||
var ds = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory + @"\UserData");
|
||||
if (ds.Length > 20)
|
||||
File.Delete(ds[0]);
|
||||
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + $"\\UserData\\Save_{st}.lps"))
|
||||
File.Delete(AppDomain.CurrentDomain.BaseDirectory + $"\\UserData\\Save_{st}.lps");
|
||||
|
||||
if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\UserData"))
|
||||
Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + @"\UserData");
|
||||
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps"))
|
||||
File.Move(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps", AppDomain.CurrentDomain.BaseDirectory + $"\\UserData\\Save_{st}.lps");
|
||||
|
||||
if (Core != null && Core.Save != null)
|
||||
{
|
||||
var ds = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory + @"\UserData");
|
||||
while (ds.Length > Set.BackupSaveMaxNum)
|
||||
File.Delete(ds[0]);
|
||||
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + $"\\UserData\\Save_{st}.lps"))
|
||||
File.Delete(AppDomain.CurrentDomain.BaseDirectory + $"\\UserData\\Save_{st}.lps");
|
||||
|
||||
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps"))
|
||||
File.Move(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps", AppDomain.CurrentDomain.BaseDirectory + $"\\UserData\\Save_{st}.lps");
|
||||
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps", Core.Save.ToLine().ToString());
|
||||
}
|
||||
if (CGPTClient != null)
|
||||
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\ChatGPTSetting.json", CGPTClient.Save());
|
||||
}
|
||||
|
@ -13,8 +13,9 @@
|
||||
</DataTemplate>
|
||||
</pu:WindowX.Resources>-->
|
||||
<Grid>
|
||||
<TabControl x:Name="MainTab" Margin="5" BorderThickness="0" pu:TabControlHelper.ItemsHeight="NaN" Background="Transparent"
|
||||
pu:TabControlHelper.ItemsPadding="10,7" pu:TabControlHelper.ItemsCornerRadius="4"
|
||||
<TabControl x:Name="MainTab" Margin="5" BorderThickness="0" pu:TabControlHelper.ItemsHeight="NaN"
|
||||
Background="Transparent" pu:TabControlHelper.ItemsPadding="10,7"
|
||||
pu:TabControlHelper.ItemsCornerRadius="4"
|
||||
pu:TabControlHelper.ItemsHoverBackground="{DynamicResource PrimaryLight}"
|
||||
pu:TabControlHelper.ItemsSelectedBackground="{DynamicResource PrimaryDark}"
|
||||
pu:TabControlHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}"
|
||||
@ -116,12 +117,13 @@
|
||||
|
||||
</Grid>
|
||||
<TextBlock Grid.Row="6" Text="消息框" VerticalAlignment="Center" />
|
||||
<pu:Switch x:Name="SwitchMsgOut" Grid.Column="2" Grid.Row="6" BorderBrush="{DynamicResource PrimaryDark}"
|
||||
CheckedBackground="{DynamicResource Primary}" CheckedBorderBrush="{DynamicResource Primary}"
|
||||
Background="Transparent" BoxWidth="35" BoxHeight="18" ToggleSize="14"
|
||||
ToggleShadowColor="{x:Null}" ToggleBrush="{DynamicResource PrimaryDark}"
|
||||
<pu:Switch x:Name="SwitchMsgOut" Grid.Column="2" Grid.Row="6"
|
||||
BorderBrush="{DynamicResource PrimaryDark}" CheckedBackground="{DynamicResource Primary}"
|
||||
CheckedBorderBrush="{DynamicResource Primary}" Background="Transparent" BoxWidth="35"
|
||||
BoxHeight="18" ToggleSize="14" ToggleShadowColor="{x:Null}"
|
||||
ToggleBrush="{DynamicResource PrimaryDark}"
|
||||
CheckedToggleBrush="{DynamicResource DARKPrimaryText}" Checked="SwitchMsgOut_Checked"
|
||||
Unchecked="SwitchMsgOut_Checked" ToolTip="将消息框置于外部" Content="将消息框置于外部"/>
|
||||
Unchecked="SwitchMsgOut_Checked" ToolTip="将消息框置于外部" Content="将消息框置于外部" />
|
||||
<TextBlock Grid.Row="7" Text="开机启动" VerticalAlignment="Center" />
|
||||
<Grid Grid.Row="7" Grid.Column="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
@ -133,8 +135,9 @@
|
||||
CheckedBorderBrush="{DynamicResource Primary}" Background="Transparent" BoxWidth="35"
|
||||
BoxHeight="18" ToggleSize="14" ToggleShadowColor="{x:Null}"
|
||||
ToggleBrush="{DynamicResource PrimaryDark}" Content="开机启动"
|
||||
CheckedToggleBrush="{DynamicResource DARKPrimaryText}" ToolTip="该游戏随着开机启动该程序 如需卸载游戏,请关闭该选项"
|
||||
Checked="StartUpBox_Checked" Unchecked="StartUpBox_Checked" />
|
||||
CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
|
||||
ToolTip="该游戏随着开机启动该程序 如需卸载游戏,请关闭该选项" Checked="StartUpBox_Checked"
|
||||
Unchecked="StartUpBox_Checked" />
|
||||
<pu:Switch x:Name="StartUpSteamBox" BorderBrush="{DynamicResource PrimaryDark}"
|
||||
CheckedBackground="{DynamicResource Primary}"
|
||||
IsEnabled="{Binding ElementName=StartUpBox,Path=IsChecked}"
|
||||
@ -157,115 +160,144 @@
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="系统" BorderBrush="{DynamicResource PrimaryDarker}">
|
||||
<StackPanel>
|
||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Background="{x:Null}"
|
||||
TextWrapping="Wrap">
|
||||
<ScrollViewer>
|
||||
<StackPanel>
|
||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Background="{x:Null}"
|
||||
TextWrapping="Wrap">
|
||||
<Run FontWeight="Bold" FontSize="18">自动保存频率</Run><LineBreak />
|
||||
<Run>在指定时间后自动保存游戏数据,频繁的自动保存可能会导致卡顿</Run>
|
||||
</TextBlock>
|
||||
<ComboBox x:Name="CBAutoSave" SelectedIndex="3" VerticalAlignment="Top" Margin="10,5,0,0"
|
||||
HorizontalAlignment="Left" Style="{DynamicResource StandardComboBoxStyle}" Width="200"
|
||||
SelectionChanged="CBAutoSave_SelectionChanged" FontSize="16">
|
||||
<ComboBoxItem>
|
||||
<ComboBoxItem.Tag>
|
||||
<system:Int32>-1</system:Int32>
|
||||
</ComboBoxItem.Tag> 关闭自动保存
|
||||
</ComboBoxItem>
|
||||
<ComboBoxItem>
|
||||
<ComboBoxItem.Tag>
|
||||
<system:Int32>5</system:Int32>
|
||||
</ComboBoxItem.Tag> 每5分钟一次
|
||||
</ComboBoxItem>
|
||||
<ComboBoxItem>
|
||||
<ComboBoxItem.Tag>
|
||||
<system:Int32>10</system:Int32>
|
||||
</ComboBoxItem.Tag> 每10分钟一次
|
||||
</ComboBoxItem>
|
||||
<ComboBoxItem>
|
||||
<ComboBoxItem.Tag>
|
||||
<system:Int32>20</system:Int32>
|
||||
</ComboBoxItem.Tag> 每20分钟一次
|
||||
</ComboBoxItem>
|
||||
<ComboBoxItem>
|
||||
<ComboBoxItem.Tag>
|
||||
<system:Int32>30</system:Int32>
|
||||
</ComboBoxItem.Tag> 每半小时一次
|
||||
</ComboBoxItem>
|
||||
<ComboBoxItem>
|
||||
<ComboBoxItem.Tag>
|
||||
<system:Int32>60</system:Int32>
|
||||
</ComboBoxItem.Tag> 每小时一次
|
||||
</ComboBoxItem>
|
||||
</ComboBox>
|
||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Background="{x:Null}"
|
||||
TextWrapping="Wrap" Margin="0,10,0,0">
|
||||
<Run>在指定时间后自动保存游戏数据</Run>
|
||||
</TextBlock>
|
||||
<ComboBox x:Name="CBAutoSave" SelectedIndex="3" VerticalAlignment="Top" Margin="10,5,0,0"
|
||||
HorizontalAlignment="Left" Style="{DynamicResource StandardComboBoxStyle}" Width="200"
|
||||
SelectionChanged="CBAutoSave_SelectionChanged" FontSize="16">
|
||||
<ComboBoxItem>
|
||||
<ComboBoxItem.Tag>
|
||||
<system:Int32>-1</system:Int32>
|
||||
</ComboBoxItem.Tag> 关闭自动保存
|
||||
</ComboBoxItem>
|
||||
<ComboBoxItem>
|
||||
<ComboBoxItem.Tag>
|
||||
<system:Int32>5</system:Int32>
|
||||
</ComboBoxItem.Tag> 每5分钟一次
|
||||
</ComboBoxItem>
|
||||
<ComboBoxItem>
|
||||
<ComboBoxItem.Tag>
|
||||
<system:Int32>10</system:Int32>
|
||||
</ComboBoxItem.Tag> 每10分钟一次
|
||||
</ComboBoxItem>
|
||||
<ComboBoxItem>
|
||||
<ComboBoxItem.Tag>
|
||||
<system:Int32>20</system:Int32>
|
||||
</ComboBoxItem.Tag> 每20分钟一次
|
||||
</ComboBoxItem>
|
||||
<ComboBoxItem>
|
||||
<ComboBoxItem.Tag>
|
||||
<system:Int32>30</system:Int32>
|
||||
</ComboBoxItem.Tag> 每半小时一次
|
||||
</ComboBoxItem>
|
||||
<ComboBoxItem>
|
||||
<ComboBoxItem.Tag>
|
||||
<system:Int32>60</system:Int32>
|
||||
</ComboBoxItem.Tag> 每小时一次
|
||||
</ComboBoxItem>
|
||||
</ComboBox>
|
||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Background="{x:Null}"
|
||||
TextWrapping="Wrap" Margin="0,6,0,0">
|
||||
<Run FontWeight="Bold" FontSize="18">从备份中还原</Run><LineBreak />
|
||||
<Run>虚拟桌宠模拟器在每次保存的时候都会备份上次储存的存档, 当原始存档丢失,受损或误操作时, 就可以还原他们</Run>
|
||||
</TextBlock>
|
||||
<Grid Margin="0,5,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="35" />
|
||||
<RowDefinition Height="35" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="15" />
|
||||
<ColumnDefinition Width="3*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="备份数量" VerticalAlignment="Center" />
|
||||
<pu:NumberInput x:Name="numBackupSaveMaxNum" Grid.Column="2" Minimum="1" Value="20" Margin="0,1,0,1" CornerRadius="4"
|
||||
BorderBrush="{DynamicResource PrimaryDarker}" BorderThickness="1.5" ValueChanged="numBackupSaveMaxNum_ValueChanged" />
|
||||
<TextBlock Grid.Row="1" Text="加载存档" VerticalAlignment="Center" />
|
||||
<Button x:Name="BtnSaveReload" pu:ButtonHelper.CornerRadius="4" Content="加载" Grid.Column="3"
|
||||
Background="{DynamicResource SecondaryLight}" Padding="1" Margin="5" Grid.Row="1" ToolTip="加载上次保存的存档" Click="BtnSaveReload_Click" />
|
||||
<ComboBox x:Name="CBSaveReLoad" SelectedIndex="3"
|
||||
Style="{DynamicResource StandardComboBoxStyle}" FontSize="16" Grid.Column="2"
|
||||
Grid.Row="1" MouseEnter="CBSaveReLoad_MouseEnter" />
|
||||
</Grid>
|
||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Background="{x:Null}"
|
||||
TextWrapping="Wrap" Margin="0,10,0,0">
|
||||
<Run FontWeight="Bold" FontSize="18">操作设置</Run><LineBreak />
|
||||
<Run>游戏操作相关设置</Run>
|
||||
</TextBlock>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="15" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="35" />
|
||||
<RowDefinition Height="35" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="长按间隔" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="1" Text="桌宠名字" VerticalAlignment="Center" />
|
||||
<TextBox x:Name="TextBoxPetName" Grid.Row="1" Grid.Column="2"
|
||||
Style="{DynamicResource StandardTextBoxStyle}" TextChanged="TextBoxPetName_TextChanged"
|
||||
FontSize="16" />
|
||||
<Grid Grid.Column="2" Grid.Row="0" ToolTip="数据计算和互动计算时间间隔,间隔越短需要互动的频率可能会增加. 间隔越大越不容易打扰到当前工作">
|
||||
</TextBlock>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="15" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PressLengthSlider" TickFrequency="0.01" IsSnapToTickEnabled="True"
|
||||
Style="{DynamicResource StandardSliderStyle}" VerticalAlignment="Center" Maximum="5"
|
||||
SmallChange=".05" Minimum="0.05" LargeChange="0.1" Value="0.5"
|
||||
ValueChanged="PressLengthSlider_ValueChanged" />
|
||||
<TextBlock Grid.Column="1" Margin="10,0,0,0" VerticalAlignment="Center" Width="60"
|
||||
Text="{Binding ElementName=PressLengthSlider,Path=Value,StringFormat={}{0:f2} 秒}"
|
||||
Foreground="{DynamicResource DARKPrimaryDarker}" FontWeight="Bold"
|
||||
Background="{x:Null}" />
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="35" />
|
||||
<RowDefinition Height="35" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="长按间隔" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="1" Text="桌宠名字" VerticalAlignment="Center" />
|
||||
<TextBox x:Name="TextBoxPetName" Grid.Row="1" Grid.Column="2"
|
||||
Style="{DynamicResource StandardTextBoxStyle}"
|
||||
TextChanged="TextBoxPetName_TextChanged" FontSize="16" />
|
||||
<Grid Grid.Column="2" Grid.Row="0"
|
||||
ToolTip="数据计算和互动计算时间间隔,间隔越短需要互动的频率可能会增加. 间隔越大越不容易打扰到当前工作">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PressLengthSlider" TickFrequency="0.01" IsSnapToTickEnabled="True"
|
||||
Style="{DynamicResource StandardSliderStyle}" VerticalAlignment="Center"
|
||||
Maximum="5" SmallChange=".05" Minimum="0.05" LargeChange="0.1" Value="0.5"
|
||||
ValueChanged="PressLengthSlider_ValueChanged" />
|
||||
<TextBlock Grid.Column="1" Margin="10,0,0,0" VerticalAlignment="Center" Width="60"
|
||||
Text="{Binding ElementName=PressLengthSlider,Path=Value,StringFormat={}{0:f2} 秒}"
|
||||
Foreground="{DynamicResource DARKPrimaryDarker}" FontWeight="Bold"
|
||||
Background="{x:Null}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Background="{x:Null}"
|
||||
TextWrapping="Wrap" Margin="0,10,0,0">
|
||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Background="{x:Null}"
|
||||
TextWrapping="Wrap" Margin="0,10,0,0">
|
||||
<Run FontWeight="Bold" FontSize="18">聊天设置</Run><LineBreak />
|
||||
<Run>使用ChatGPT进行聊天等相关设置</Run>
|
||||
</TextBlock>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="15" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="35" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="使用模式" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="1" Text="相关功能" VerticalAlignment="Center" />
|
||||
<Grid Grid.Column="2">
|
||||
</TextBlock>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="15" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<RadioButton x:Name="RBCGPTUseAPI" Style="{DynamicResource StandardRadioButtonStyle}"
|
||||
Content="使用从ChatGPT 申请的的API" ToolTip="需要去OpenAI官网申请" GroupName="cgpttype"
|
||||
Grid.Column="1" Checked="CGPType_Checked" />
|
||||
<RadioButton x:Name="RBCGPTUseLB" Style="{DynamicResource StandardRadioButtonStyle}"
|
||||
Content="使用桌宠开发者 提供的免费API" ToolTip="需遵循相关协议法律法规并有聊天字数限制" GroupName="cgpttype"
|
||||
IsChecked="True" Checked="CGPType_Checked" />
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="35" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="使用模式" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="1" Text="相关功能" VerticalAlignment="Center" />
|
||||
<Grid Grid.Column="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<RadioButton x:Name="RBCGPTUseAPI" Style="{DynamicResource StandardRadioButtonStyle}"
|
||||
Content="使用从ChatGPT 申请的的API" ToolTip="需要去OpenAI官网申请" GroupName="cgpttype"
|
||||
Grid.Column="1" Checked="CGPType_Checked" />
|
||||
<RadioButton x:Name="RBCGPTUseLB" Style="{DynamicResource StandardRadioButtonStyle}"
|
||||
Content="使用桌宠开发者 提供的免费API" ToolTip="需遵循相关协议法律法规并有聊天字数限制"
|
||||
GroupName="cgpttype" IsChecked="True" Checked="CGPType_Checked" />
|
||||
</Grid>
|
||||
<Button x:Name="BtnCGPTReSet" pu:ButtonHelper.CornerRadius="4" Content="初始化桌宠聊天程序"
|
||||
Margin="4" Grid.Column="2" Background="{DynamicResource SecondaryLight}" Padding="1"
|
||||
Grid.Row="1" Click="ChatGPT_Reset_Click" />
|
||||
</Grid>
|
||||
<Button x:Name="BtnCGPTReSet" pu:ButtonHelper.CornerRadius="4" Content="初始化桌宠聊天程序" Margin="4"
|
||||
Grid.Column="2" Background="{DynamicResource SecondaryLight}" Padding="1" Grid.Row="1"
|
||||
Click="ChatGPT_Reset_Click" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
<TabItem Header="互动" BorderBrush="{DynamicResource PrimaryDarker}">
|
||||
<StackPanel>
|
||||
@ -574,7 +606,8 @@
|
||||
<TabItem Header="关于" BorderBrush="{DynamicResource PrimaryDarker}"
|
||||
Foreground="{DynamicResource PrimaryText}">
|
||||
<Grid>
|
||||
<Image x:Name="ImageWHY" Width="64" HorizontalAlignment="Right" VerticalAlignment="Top" Height="64" Source="/Res/TopLogo2019.PNG" Margin="0,325,55,0" />
|
||||
<Image x:Name="ImageWHY" Width="64" HorizontalAlignment="Right" VerticalAlignment="Top" Height="64"
|
||||
Source="/Res/TopLogo2019.PNG" Margin="0,325,55,0" />
|
||||
<TextBlock Margin="0,0,0,0" Text="虚拟主播模拟器 规格" FontSize="20" FontWeight="Bold"
|
||||
VerticalAlignment="Top" />
|
||||
<TextBlock Margin="0,130,0,0" FontWeight="Bold" VerticalAlignment="Top">
|
||||
|
@ -4,6 +4,7 @@ using Steamworks.Ugc;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
@ -68,6 +69,7 @@ namespace VPet_Simulator.Windows
|
||||
|
||||
TextBoxStartUpX.Text = mw.Set.StartRecordPoint.X.ToString();
|
||||
TextBoxStartUpY.Text = mw.Set.StartRecordPoint.Y.ToString();
|
||||
numBackupSaveMaxNum.Value = mw.Set.BackupSaveMaxNum;
|
||||
if (mw.Set.StartRecordLast == true)
|
||||
{
|
||||
StartPlace.IsChecked = true;
|
||||
@ -798,5 +800,51 @@ namespace VPet_Simulator.Windows
|
||||
else
|
||||
mw.Main.MsgBar.SetPlaceIN();
|
||||
}
|
||||
|
||||
private void numBackupSaveMaxNum_ValueChanged(object sender, Panuon.WPF.SelectedValueChangedRoutedEventArgs<double> e)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
mw.Set.BackupSaveMaxNum = (int)numBackupSaveMaxNum.Value;
|
||||
}
|
||||
int reloadid = 0;
|
||||
private void CBSaveReLoad_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (reloadid != mw.Set.Statistics[(gint)"savetimes"])
|
||||
{
|
||||
reloadid = mw.Set.Statistics[(gint)"savetimes"];
|
||||
CBSaveReLoad.SelectedItem = null;
|
||||
CBSaveReLoad.Items.Clear();
|
||||
if (Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\UserData"))
|
||||
{
|
||||
foreach (var file in new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + @"\UserData")
|
||||
.GetFiles().OrderByDescending(x => x.LastWriteTime))
|
||||
{
|
||||
if (file.Extension.ToLower() == ".lps")
|
||||
{
|
||||
CBSaveReLoad.Items.Add(file.Name.Split('.').First());
|
||||
}
|
||||
}
|
||||
CBSaveReLoad.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnSaveReload_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (CBSaveReLoad.SelectedItem != null)
|
||||
{
|
||||
string txt = (string)CBSaveReLoad.SelectedItem;
|
||||
string path = AppDomain.CurrentDomain.BaseDirectory + @"\UserData\" + txt + ".lps";
|
||||
if (File.Exists(path))
|
||||
{
|
||||
GameSave gs = GameSave.Load(new Line(File.ReadAllText(path)));
|
||||
if (MessageBoxX.Show($"存档名称:{gs.Name}\n存档等级:{gs.Level}\n存档金钱:{gs.Money}\n是否加载该备份存档? 当前游戏数据会丢失", "是否加载该备份存档? 当前游戏数据会丢失", MessageBoxButton.YesNo, MessageBoxIcon.Info) == MessageBoxResult.Yes)
|
||||
{
|
||||
mw.Core.Save = gs;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user