From d7a7e0b6748ac659ab5b0e7f8264f97503fe4d01 Mon Sep 17 00:00:00 2001 From: ZouJin Date: Thu, 14 Mar 2024 19:31:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E9=9D=A2=E6=9D=BF=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Core/Display/ToolBar.xaml.cs | 9 +- VPet-Simulator.Core/Graph/GraphHelper.cs | 29 +++- .../ExtensionFunction.cs | 24 ++- VPet-Simulator.Windows.Interface/Source.cs | 2 +- VPet-Simulator.Windows/MainWindow.cs | 56 +++++++ VPet-Simulator.Windows/MainWindow.xaml.cs | 2 + VPet-Simulator.Windows/Res/img/error.png | Bin 0 -> 6138 bytes .../VPet-Simulator.Windows.csproj | 2 + .../WinDesign/winWorkMenu.xaml | 45 ++++-- .../WinDesign/winWorkMenu.xaml.cs | 142 +++++++++++++++++- .../mod/0000_core/pet/vup.lps | 2 +- 11 files changed, 282 insertions(+), 31 deletions(-) create mode 100644 VPet-Simulator.Windows/Res/img/error.png 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 0000000000000000000000000000000000000000..a32627a290b9abead48b7a3593eb1a6ba34a5686 GIT binary patch literal 6138 zcmbVQ2{@E%`)3SI_O+yP#*(#JZDSbOr5J>=X2uwd8D`7~6D=ccM9P+kN>cW+XJkT3 zLUpoaon%NVOG%v;->W)Z=X~G!U*GlrT<<&c&hz~4`~KbcbKk$2%Sl(fgOs?6xR8*L zl;d{WUBLVN>J1SCUM)Ol&H`_18QZ;CLP8P>tGBSw`8;JIAyF>H!z;?m*$GRchr@|M z^guE^Hk<*Vg@nwv#WIK_Dme-oNDiSy;MC`uTGXMGAe{OhBWI*D!-gD6*}k7icHfWp zAnm7;OoP<7SwPKWv4Decaug978%~R0VPkRX-~D2N=hbC|I`lgvii%UWS`7&Ga(0E< z(3xbYF&qgaA(3dPi76aqY-nhV+zLe_(MSZ+2!TSwP{vrKAr@r<{rRU3L}La8V|Urw z|BMBE!l{QwMKQ1lL`+N!JjMV{XNDk9rlzI{BpQK6!vF+~#g2#~#=;_48h?7QC9_CO z3L}a_kASXvBnHy=Md8!|raw{$XZ&&-!TMPypkRntA_IYfBUe-U4h$mw!ZG$SY2Skf zkq~4WIh-63#R9OXUsy&cJ&Mi>rT-tUe{KIQ08mS@eBO64@>qpsBH%4FhY#Bom|PObG z!5ZplXJd>qH8zH!;i$g?w^LX^J=p)AoDmX>M*U!{r4egtHkEaJvZ)UGodb+Ui6FxP zB2Yp7&8d^=0`6e|V`cXD^86*|zk0C8`q|QBB4~7C5Xz3f1M5lKpwFwD?jo; z{CkSu_x>V5f5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Hr1{f(sHHaRp_IHEI`5P0PFlk7!la8CoEhDGd0gD`elz0*WO z{9E75f%a{YeeS}b5P+$I!t2h%cP%5Y#l&w@I*n%r{+^x2i9I zbmjM)Z_Lf*c{h#%UxS!SVo}RvQyjW3&XfMiT^5ieLFlxf zp#1V@h*uw@;d?F^ce#V5s9buH-qm3_%so(3`Q`8uVSVp=mjbSE z%KIRB1{{Sj%lc!XtgS8+ZJDL#WHFAME|o_!ncyK|ty$x!y;`Gh3z29loZoybJvduyF zbgN3IFBFX&ew)fivNW+Sn+Gy;`N)o~;hFQ%_&e@(`phDCp{<-dpIS>h0$cDE}}0$Kv`v*CqR?2j-I zF0HXG9#F3;25CP5I=ee4>6q&EA?<@;&H=>+k5essjM|b)F28s5)3b};#KFlA*4}yi z`bs21xKt5{Z(O_CQVzrB2!cb`l)W6zOF1w>BGGz}@H}ZsGxoW&YrV*!$&_7AqOuS_ zD_+>K#hOoZbssW_1&uTBQB3*@hj$*7{Y1k^WcTv0*bB*JCzoP5FB|@Z73r4LOV!%i ztCH`W=Hz5jFafHZxY$Lw2mVRyVb$HHvaw|wto4qK>Jm|(T&|9dfDI#jiFP(@35mh=ioY~$StWn`4iuN|5XTI2;R6U zt|6N99N713tLfW92?Zu(p#Ky)1L)YcOhI{e@%ZG#@d)(04BwWa)EdX;S7L-_aoLX`lcx2}-KqEe zZoZbm12QtQT1a~GXyE><_dqh978P<(=dvYV0!a)k%0iilUmRW>EMUW`X3s6y30|ok zHY99xi|;$cN!g(MZY^DCrjYPAVg zjsK%(q&LL_LUUTV7`6AY*@*3Z-Q1++k&&mSo}if9&k{Z{U9r^Kl#Sx1#JC%UVbwV! zP^8eW>p#{!+E;`{jt@^w>n>bh{qMY^ L9p1LWnvn1>p?X=K literal 0 HcmV?d00001 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 @@ - - - + + + - - + + - - + + -