diff --git a/VPet-Simulator.Core/Display/ToolBar.xaml.cs b/VPet-Simulator.Core/Display/ToolBar.xaml.cs index 35d231d..8d673cf 100644 --- a/VPet-Simulator.Core/Display/ToolBar.xaml.cs +++ b/VPet-Simulator.Core/Display/ToolBar.xaml.cs @@ -45,9 +45,7 @@ namespace VPet_Simulator.Core m.TimeUIHandle += M_TimeUIHandle; LoadWork(); } - - - public void LoadWork() + public void LoadClean() { MenuWork.Click -= MenuWork_Click; MenuWork.Visibility = Visibility.Visible; @@ -59,6 +57,11 @@ namespace VPet_Simulator.Core MenuWork.Items.Clear(); MenuStudy.Items.Clear(); MenuPlay.Items.Clear(); + } + + public void LoadWork() + { + LoadClean(); m.WorkList(out List ws, out List ss, out List ps); diff --git a/VPet-Simulator.Core/Graph/GraphHelper.cs b/VPet-Simulator.Core/Graph/GraphHelper.cs index 54f0421..2daa274 100644 --- a/VPet-Simulator.Core/Graph/GraphHelper.cs +++ b/VPet-Simulator.Core/Graph/GraphHelper.cs @@ -81,7 +81,7 @@ namespace VPet_Simulator.Core /// /// 工作/学习 /// - public class Work + public class Work : ICloneable { /// /// 类型 @@ -181,6 +181,33 @@ namespace VPet_Simulator.Core { m.Display(Graph, AnimatType.A_Start, () => m.DisplayBLoopingForce(Graph)); } + /// + /// 克隆相同的工作/学习 + /// + public object Clone() + { + return new Work + { + Type = this.Type, + Name = this.Name, + Graph = this.Graph, + MoneyBase = this.MoneyBase, + StrengthFood = this.StrengthFood, + StrengthDrink = this.StrengthDrink, + Feeling = this.Feeling, + LevelLimit = this.LevelLimit, + Time = this.Time, + FinishBonus = this.FinishBonus, + BorderBrush = this.BorderBrush, + Background = this.Background, + ButtonBackground = this.ButtonBackground, + ButtonForeground = this.ButtonForeground, + Foreground = this.Foreground, + Left = this.Left, + Top = this.Top, + Width = this.Width + }; + } } /// diff --git a/VPet-Simulator.Windows.Interface/ExtensionFunction.cs b/VPet-Simulator.Windows.Interface/ExtensionFunction.cs index 4c3d589..6373ec5 100644 --- a/VPet-Simulator.Windows.Interface/ExtensionFunction.cs +++ b/VPet-Simulator.Windows.Interface/ExtensionFunction.cs @@ -42,7 +42,7 @@ namespace VPet_Simulator.Windows.Interface public static double Spend(this Work work) { return (MathPow(work.StrengthFood, 1.5) / 3 + MathPow(work.StrengthDrink, 1.5) / 4 + MathPow(work.Feeling, 1.5) / 4 + - work.LevelLimit / 10 + MathPow(work.StrengthFood + work.StrengthDrink + work.Feeling, 1.5) / 10) * 3; + work.LevelLimit / 10.0 + MathPow(work.StrengthFood + work.StrengthDrink + work.Feeling, 1.5) / 10) * 3; } /// /// 判断这个工作是否超模 @@ -59,15 +59,20 @@ namespace VPet_Simulator.Windows.Interface work.FinishBonus = 0; if (work.Type == Work.WorkType.Play && work.Feeling > 0) work.Feeling *= -1; + if (work.Time < 10) + work.Time = 10; var spend = work.Spend(); var get = work.Get(); var rel = get / spend; if (rel < 0) return true; - if (Math.Abs(get) > 1.1 * work.LevelLimit + 10) //等级获取速率限制 + var lvlimit = 1.1 * work.LevelLimit + 10; + if (work.Type != Work.WorkType.Work) + lvlimit *= 10; + if (Math.Abs(work.MoneyBase) > lvlimit) //等级获取速率限制 return true; - return rel < 1.3; // 推荐rel为1左右 超过1.3就是超模 + return rel > 1.3; // 推荐rel为1左右 超过1.3就是超模 } /// /// 数值梯度下降法 修复超模工作 @@ -155,6 +160,19 @@ namespace VPet_Simulator.Windows.Interface } } } + /// + /// 将工作的属性值翻倍 + /// + public static Work Double(this Work work, int value) + { + Work w = (Work)work.Clone(); + w.MoneyBase *= value; + w.StrengthFood *= 0.48 + 0.6 * value; + w.StrengthDrink *= 0.48 + 0.6 * value; + w.Feeling *= 0.48 + 0.6 * value; + w.LevelLimit = (work.LevelLimit + 10) * value; + return w; + } public static string FoodToDescription(this IFood food) { diff --git a/VPet-Simulator.Windows.Interface/Source.cs b/VPet-Simulator.Windows.Interface/Source.cs index d2bef45..0c372c5 100644 --- a/VPet-Simulator.Windows.Interface/Source.cs +++ b/VPet-Simulator.Windows.Interface/Source.cs @@ -143,7 +143,7 @@ namespace VPet_Simulator.Windows.Interface throw new Exception($"image nofound {imagename}"); return v; #else - return FindSourceUri(imagename, "pack://application:,,,/Res/Image/system/error.png"); + return FindSourceUri(imagename, "pack://application:,,,/Res/img/error.png"); #endif } diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index 0d66883..a1ea75f 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -72,6 +72,8 @@ namespace VPet_Simulator.Windows public UIElement TalkBox; public winGameSetting winSetting { get; set; } public winBetterBuy winBetterBuy { get; set; } + + public winWorkMenu winWorkMenu { get; set; } //public ChatGPTClient CGPTClient; public ImageResources ImageSources { get; set; } = new ImageResources(); /// @@ -473,6 +475,20 @@ namespace VPet_Simulator.Windows winSetting.MainTab.SelectedIndex = page; winSetting.Show(); } + public void ShowWorkMenu(Work.WorkType type) + { + if (winWorkMenu == null) + { + winWorkMenu = new winWorkMenu(this, type); + winWorkMenu.Show(); + } + else + { + winWorkMenu.tbc.SelectedIndex = (int)type; + winWorkMenu.Focus(); + winWorkMenu.Topmost = true; + } + } public void ShowBetterBuy(Food.FoodType type) { winBetterBuy.Show(type); @@ -1548,6 +1564,45 @@ namespace VPet_Simulator.Windows Main.Resources = Application.Current.Resources; Main.MsgBar.This.Resources = Application.Current.Resources; Main.ToolBar.Resources = Application.Current.Resources; + Main.ToolBar.LoadClean(); + Main.WorkList(out List ws, out List ss, out List ps); + if (ws.Count == 0) + { + Main.ToolBar.MenuWork.Visibility = Visibility.Collapsed; + } + else + { + Main.ToolBar.MenuWork.Click += (x, y) => + { + Main.ToolBar.Visibility = Visibility.Collapsed; + ShowWorkMenu(Work.WorkType.Work); + }; + } + if (ss.Count == 0) + { + Main.ToolBar.MenuStudy.Visibility = Visibility.Collapsed; + } + else + { + Main.ToolBar.MenuStudy.Click += (x, y) => + { + Main.ToolBar.Visibility = Visibility.Collapsed; + ShowWorkMenu(Work.WorkType.Study); + }; + } + if (ps.Count == 0) + { + Main.ToolBar.MenuPlay.Visibility = Visibility.Collapsed; + } + else + { + Main.ToolBar.MenuPlay.Click += (x, y) => + { + Main.ToolBar.Visibility = Visibility.Collapsed; + ShowWorkMenu(Work.WorkType.Play); + }; + } + //加载主题: LoadTheme(Set.Theme); @@ -1932,6 +1987,7 @@ namespace VPet_Simulator.Windows //} } + TextBlock tlvplus; private void MWUIHandle(Main main) { diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index 8879286..cd042a5 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -287,6 +287,7 @@ namespace VPet_Simulator.Windows petHelper?.Close(); winSetting?.Close(); winBetterBuy?.Close(); + winWorkMenu?.Close(); if (IsSteamUser) SteamClient.Shutdown();//关掉和Steam的连线 if (notifyIcon != null) @@ -328,6 +329,7 @@ namespace VPet_Simulator.Windows petHelper?.Close(); winSetting?.Close(); winBetterBuy?.Close(); + winWorkMenu?.Close(); App.MainWindows.Remove(this); if (notifyIcon != null) { diff --git a/VPet-Simulator.Windows/Res/img/error.png b/VPet-Simulator.Windows/Res/img/error.png new file mode 100644 index 0000000..a32627a Binary files /dev/null and b/VPet-Simulator.Windows/Res/img/error.png differ diff --git a/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj b/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj index de1ca05..e3198c7 100644 --- a/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj +++ b/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj @@ -66,6 +66,7 @@ + @@ -119,6 +120,7 @@ + diff --git a/VPet-Simulator.Windows/WinDesign/winWorkMenu.xaml b/VPet-Simulator.Windows/WinDesign/winWorkMenu.xaml index a940ff2..1ca9cf4 100644 --- a/VPet-Simulator.Windows/WinDesign/winWorkMenu.xaml +++ b/VPet-Simulator.Windows/WinDesign/winWorkMenu.xaml @@ -3,8 +3,8 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF" - xmlns:local="clr-namespace:VPet_Simulator.Windows" mc:Ignorable="d" Title="{ll:Str 工作面板}" Height="400" - Width="600" ResizeMode="CanMinimize" FontSize="16"> + xmlns:local="clr-namespace:VPet_Simulator.Windows" mc:Ignorable="d" Title="{ll:Str 工作面板}" Height="550" + Width="680" ResizeMode="CanMinimize" FontSize="16" Closed="Window_Closed"> @@ -14,23 +14,40 @@ - - - + + + - - + + - - + + -