From a9d3541af086910e7b5fb99bed06deca0e0a23d2 Mon Sep 17 00:00:00 2001 From: ZouJin Date: Tue, 26 Mar 2024 19:27:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A7=E7=89=88=E4=BB=A3=E7=A0=81=E5=85=BC?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Core/Display/ToolBar.xaml | 14 ++++++----- VPet-Simulator.Windows.Interface/ISetting.cs | 15 ++++++------ VPet-Simulator.Windows.Interface/Mod/Food.cs | 2 +- VPet-Simulator.Windows/Function/Setting.cs | 23 ++++++++++++++++--- VPet-Simulator.Windows/MainWindow.cs | 3 ++- .../MutiPlayer/MPFriends.xaml.cs | 2 +- .../WinDesign/winWorkMenu.xaml.cs | 16 ++++++++++--- 7 files changed, 52 insertions(+), 23 deletions(-) diff --git a/VPet-Simulator.Core/Display/ToolBar.xaml b/VPet-Simulator.Core/Display/ToolBar.xaml index 0c60992..8f32c9e 100644 --- a/VPet-Simulator.Core/Display/ToolBar.xaml +++ b/VPet-Simulator.Core/Display/ToolBar.xaml @@ -49,9 +49,11 @@ + Text="{ll:Str 宠物已经生病\, 通过服用药物可以恢复}" ToolTip="{ll:Str 宠物已经生病\, 通过服用药物可以恢复}" TextWrapping="Wrap" + x:FieldModifier="public" /> + Text="{ll:Str 已关闭数据计算\, 可放心挂机}" ToolTip="{ll:Str 已关闭数据计算\, 可放心挂机}" TextWrapping="Wrap" + x:FieldModifier="public" /> @@ -120,13 +122,13 @@ - + + pu:DropDownHelper.MaxHeight="100" x:FieldModifier="public" /> + pu:DropDownHelper.MaxHeight="100" x:FieldModifier="public" /> + pu:DropDownHelper.MaxHeight="100" x:FieldModifier="public" /> diff --git a/VPet-Simulator.Windows.Interface/ISetting.cs b/VPet-Simulator.Windows.Interface/ISetting.cs index cfec533..7e7ad29 100644 --- a/VPet-Simulator.Windows.Interface/ISetting.cs +++ b/VPet-Simulator.Windows.Interface/ISetting.cs @@ -192,15 +192,14 @@ namespace VPet_Simulator.Windows.Interface /// 获取或设置在任务切换器(Alt+Tab)中是否隐藏窗口,重启后生效 /// bool HideFromTaskControl { get; set; } + + /// + /// 读写自定义游戏设置(给mod准备的接口) + /// + /// 游戏设置 + /// 如果找到相同名称的第一个Line,则为该Line; 否则为新建的相同名称Line + ILine this[string lineName] { get; set; } - /// - /// 更好买数据 - /// - ILine BetterBuyData { get; } - /// - /// 游戏数据 - /// - ILine GameData { get; } /// /// 联机允许交互 /// diff --git a/VPet-Simulator.Windows.Interface/Mod/Food.cs b/VPet-Simulator.Windows.Interface/Mod/Food.cs index 8af7e3c..09d7494 100644 --- a/VPet-Simulator.Windows.Interface/Mod/Food.cs +++ b/VPet-Simulator.Windows.Interface/Mod/Food.cs @@ -171,7 +171,7 @@ namespace VPet_Simulator.Windows.Interface public void LoadImageSource(IMainWindow imw) { ImageSource = imw.ImageSources.FindImage("food_" + (Image ?? Name), "food"); - Star = imw.Set.BetterBuyData["star"].GetInfos().Contains(Name); + Star = imw.Set["betterbuy"].GetInfos().Contains(Name); LoadEatTimeSource(imw); } public void LoadEatTimeSource(IMainWindow imw) diff --git a/VPet-Simulator.Windows/Function/Setting.cs b/VPet-Simulator.Windows/Function/Setting.cs index 2eb38a6..1e0c2bb 100644 --- a/VPet-Simulator.Windows/Function/Setting.cs +++ b/VPet-Simulator.Windows/Function/Setting.cs @@ -500,9 +500,26 @@ namespace VPet_Simulator.Windows get => this["mutiplay"].GetBool("notouch"); set => this["mutiplay"].SetBool("notouch", value); } - public ILine BetterBuyData => FindorAddLine("betterbuy"); - - public ILine GameData => FindorAddLine("gamedata"); + /// + /// 读写自定义游戏设置(给mod准备的接口) + /// + /// 游戏设置 + /// 如果找到相同名称的第一个Line,则为该Line; 否则为新建的相同名称Line + ILine ISetting.this[string lineName] + { + get + { + if (lineName == "onmod") + return new Line("onmod", "true"); + return FindorAddLine(lineName); + } + set + { + if (value.Name == "onmod") + return; + AddorReplaceLine(value); + } + } public void SetZoomLevel(double level) => mw.SetZoomLevel(level); diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index de6c27c..1782027 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -34,6 +34,7 @@ using Image = System.Windows.Controls.Image; using System.Data; using System.Windows.Media; using System.Windows.Threading; +using MessageBox = System.Windows.MessageBox; namespace VPet_Simulator.Windows { @@ -1693,7 +1694,7 @@ namespace VPet_Simulator.Windows } catch (Exception e) { - new winReport(this, "由于插件引起的游戏启动错误".Translate() + "\n" + e.ToString()).Show(); + Task.Run(() => MessageBox.Show(this, "由于插件引起的游戏启动错误".Translate() + "\n" + e.ToString())); } Foods.ForEach(item => item.LoadImageSource(this)); Main.TimeHandle += Handle_Music; diff --git a/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml.cs b/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml.cs index ce84910..787dceb 100644 --- a/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml.cs +++ b/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml.cs @@ -390,7 +390,7 @@ public partial class MPFriends : WindowX, IMPFriend Foods.ForEach(item => { item.ImageSource = ImageSources.FindImage("food_" + (item.Image ?? item.Name), "food"); - item.Star = mw.Set.BetterBuyData["star"].GetInfos().Contains(Name); + item.Star = mw.Set["betterbuy"]["star"].GetInfos().Contains(Name); }); Main.PlayVoiceVolume = mw.Set.VoiceVolume; diff --git a/VPet-Simulator.Windows/WinDesign/winWorkMenu.xaml.cs b/VPet-Simulator.Windows/WinDesign/winWorkMenu.xaml.cs index 2d36701..d116d14 100644 --- a/VPet-Simulator.Windows/WinDesign/winWorkMenu.xaml.cs +++ b/VPet-Simulator.Windows/WinDesign/winWorkMenu.xaml.cs @@ -26,6 +26,7 @@ public partial class winWorkMenu : Window List ws; List ss; List ps; + List starList; public void ShowImageDefault(Work.WorkType type) => WorkViewImage.Source = mw.ImageSources.FindImage("work_" + mw.Set.PetGraph + "_t_" + type.ToString(), "work_" + type.ToString()); public winWorkMenu(MainWindow mw, Work.WorkType type) { @@ -54,6 +55,7 @@ public partial class winWorkMenu : Window lbPlay.Items.Add(v.NameTrans); } + tbc.SelectedIndex = (int)type; ShowImageDefault(type); } @@ -82,7 +84,7 @@ public partial class winWorkMenu : Window { wDouble.IsEnabled = true; wDouble.Maximum = max; - wDouble.Value = mw.Set.GameData.GetInt("workmenu_" + nowwork.Name, 1); + wDouble.Value = mw.Set["workmenu"].GetInt("workmenu_" + nowwork.Name, 1); } } if (wDouble.Value == 1) @@ -127,7 +129,6 @@ public partial class winWorkMenu : Window private void tbc_SelectionChanged(object sender, SelectionChangedEventArgs e) { - ShowImageDefault((Work.WorkType)tbc.SelectedIndex); switch (tbc.SelectedIndex) { case 0: @@ -139,13 +140,17 @@ public partial class winWorkMenu : Window case 2: btnStart.Content = "开始玩耍".Translate(); break; + case 3: + btnStart.Content = "开始工作".Translate(); + return; } + ShowImageDefault((Work.WorkType)tbc.SelectedIndex); } private void wDouble_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) { if (!AllowChange) return; - mw.Set.GameData.SetInt("workmenu_" + nowwork.Name, (int)wDouble.Value); + mw.Set["workmenu"].SetInt("double_" + nowwork.Name, (int)wDouble.Value); ShowWork(nowwork.Double((int)wDouble.Value)); } @@ -183,4 +188,9 @@ public partial class winWorkMenu : Window Close(); } } + + private void lbStart_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + + } }