支持改名功能

This commit is contained in:
ZouJin 2023-02-18 14:49:13 +11:00
parent 458ec315f0
commit 8db05e1b9a
4 changed files with 32 additions and 17 deletions

View File

@ -149,7 +149,18 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="StandardTextBoxStyle" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="FontSize" Value="14" />
<Setter Property="Height" Value="30" />
<Setter Property="Background" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="BorderThickness" Value="1.5" />
<Setter Property="BorderBrush" Value="{DynamicResource DARKPrimary}" />
<Setter Property="Padding" Value="7,0,15,0" />
<Setter Property="pu:TextBoxHelper.CornerRadius" Value="5" />
<Setter Property="pu:TextBoxHelper.WatermarkForeground" Value="#DCDCDC" />
<Setter Property="pu:ShadowHelper.BlurRadius" Value="15" />
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
</Style>
<Style x:Key="StandardSliderStyle" TargetType="Slider" BasedOn="{StaticResource {x:Type Slider}}">
<Setter Property="Background" Value="{DynamicResource DARKPrimaryTrans4}" />
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryDark}" />

View File

@ -2,29 +2,17 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VPet_Simulator.Core;
using static VPet_Simulator.Core.GraphCore;
using Microsoft.Win32;
using System.Windows.Forms;
using MessageBox = System.Windows.MessageBox;
using ContextMenu = System.Windows.Forms.ContextMenu;
using MenuItem = System.Windows.Forms.MenuItem;
using Application = System.Windows.Application;
using System.Timers;
using System.Windows.Forms.VisualStyles;
using LinePutScript;
namespace VPet_Simulator.Windows
{
@ -143,6 +131,9 @@ namespace VPet_Simulator.Windows
//加载游戏内容
Core.Controller = new MWController(this);
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps"))
Core.Save = new Save(new LpsDocument(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps")).First());
else
Core.Save = new Save("萝莉斯");
AutoSaveTimer.Elapsed += AutoSaveTimer_Elapsed;
@ -209,6 +200,11 @@ namespace VPet_Simulator.Windows
notifyIcon.Icon = new System.Drawing.Icon(Application.GetResourceStream(new Uri("pack://application:,,,/vpeticon.ico")).Stream);
notifyIcon.Visible = true;
notifyIcon.BalloonTipClicked += (a, b) =>
{
Topmost = false;
winSetting.Show();
};
if (!Set["SingleTips"].GetBool("helloworld"))
{

View File

@ -175,7 +175,8 @@
<RowDefinition Height="35" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="长按间隔" VerticalAlignment="Center" FontSize="14" />
<TextBlock Grid.Row="1" Text="桌宠名字" VerticalAlignment="Center" FontSize="14" />
<TextBox x:Name="TextBoxPetName" Grid.Row="1" Grid.Column="2" Style="{DynamicResource StandardTextBoxStyle}" TextChanged="TextBoxPetName_TextChanged"/>
<Grid Grid.Column="2" Grid.Row="0"
ToolTip="数据计算和互动计算时间间隔,间隔越短需要互动的频率可能会增加.&#13;间隔越大越不容易打扰到当前工作">
<Grid.ColumnDefinitions>

View File

@ -55,7 +55,7 @@ namespace VPet_Simulator.Windows
StartUpBox.IsChecked = mw.Set.StartUPBoot;
StartUpSteamBox.IsChecked = mw.Set.StartUPBootSteam;
TextBoxPetName.Text = mw.Core.Save.Name;
foreach (PetLoader pl in mw.Pets)
{
PetBox.Items.Add(pl.Name);
@ -614,5 +614,12 @@ namespace VPet_Simulator.Windows
PetIntor.Text = mw.Pets[PetBox.SelectedIndex].Intor;
ButtonRestartGraph.Visibility = Visibility.Visible;
}
private void TextBoxPetName_TextChanged(object sender, TextChangedEventArgs e)
{
if (!AllowChange)
return;
mw.Core.Save.Name = TextBoxPetName.Text;
}
}
}