From abd339c22203d4843f6cf6e5062721c877abb9e2 Mon Sep 17 00:00:00 2001 From: ZouJin Date: Thu, 21 Mar 2024 14:36:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E6=8A=95=E5=96=82=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=86=85=E5=AD=98=E5=9B=9E=E6=94=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VPet-Simulator.Core.csproj | 2 +- .../VPet-Simulator.Windows.Interface.csproj | 2 +- .../MutiPlayer/MPFriends.xaml.cs | 24 +++++++++++++++---- .../MutiPlayer/winMPBetterBuy.xaml.cs | 2 +- .../VPet-Simulator.Windows.csproj | 2 +- VPet.Solution/VPet.Solution.csproj | 2 +- 6 files changed, 24 insertions(+), 10 deletions(-) diff --git a/VPet-Simulator.Core/VPet-Simulator.Core.csproj b/VPet-Simulator.Core/VPet-Simulator.Core.csproj index 2589545..8bb326f 100644 --- a/VPet-Simulator.Core/VPet-Simulator.Core.csproj +++ b/VPet-Simulator.Core/VPet-Simulator.Core.csproj @@ -23,7 +23,7 @@ - + diff --git a/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj b/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj index c64364b..9f66bdf 100644 --- a/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj +++ b/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj @@ -16,7 +16,7 @@ - + diff --git a/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml.cs b/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml.cs index 7b3e951..fa6fb25 100644 --- a/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml.cs +++ b/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml.cs @@ -326,28 +326,41 @@ public partial class MPFriends : WindowX, IMPFriend Main.ToolBar.AddMenuButton(ToolBar.MenuType.Feed, "吃饭".Translate(), () => { - new winMPBetterBuy(this).Show(Food.FoodType.Meal); + ShowBetterBuy(Food.FoodType.Meal); }); Main.ToolBar.AddMenuButton(ToolBar.MenuType.Feed, "喝水".Translate(), () => { - new winMPBetterBuy(this).Show(Food.FoodType.Drink); + ShowBetterBuy(Food.FoodType.Drink); }); Main.ToolBar.AddMenuButton(ToolBar.MenuType.Feed, "收藏".Translate(), () => { - new winMPBetterBuy(this).Show(Food.FoodType.Star); + ShowBetterBuy(Food.FoodType.Star); }); Main.ToolBar.AddMenuButton(ToolBar.MenuType.Feed, "药品".Translate(), () => { - new winMPBetterBuy(this).Show(Food.FoodType.Drug); + ShowBetterBuy(Food.FoodType.Drug); }); Main.ToolBar.AddMenuButton(ToolBar.MenuType.Feed, "礼品".Translate(), () => { - new winMPBetterBuy(this).Show(Food.FoodType.Gift); + ShowBetterBuy(Food.FoodType.Gift); }); Loaded = true; })); } + public winMPBetterBuy winMPBetterBuy; + + public void ShowBetterBuy(Food.FoodType foodType) + { + if (winMPBetterBuy != null) + winMPBetterBuy.Show(foodType); + else + { + winMPBetterBuy = new winMPBetterBuy(this); + winMPBetterBuy.Show(foodType); + } + } + public new bool Loaded = false; /// @@ -618,6 +631,7 @@ public partial class MPFriends : WindowX, IMPFriend } } } + winMPBetterBuy.Close(); Main?.Dispose(); mw.Windows.Remove(this); } diff --git a/VPet-Simulator.Windows/MutiPlayer/winMPBetterBuy.xaml.cs b/VPet-Simulator.Windows/MutiPlayer/winMPBetterBuy.xaml.cs index 2c3f794..8f3c1a4 100644 --- a/VPet-Simulator.Windows/MutiPlayer/winMPBetterBuy.xaml.cs +++ b/VPet-Simulator.Windows/MutiPlayer/winMPBetterBuy.xaml.cs @@ -267,7 +267,7 @@ namespace VPet_Simulator.Windows private void WindowX_Closing(object sender, System.ComponentModel.CancelEventArgs e) { - + mf.winMPBetterBuy = null; } private void Switch_Loaded(object sender, RoutedEventArgs e) diff --git a/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj b/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj index 46d9ac7..7650e61 100644 --- a/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj +++ b/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj @@ -214,7 +214,7 @@ - + diff --git a/VPet.Solution/VPet.Solution.csproj b/VPet.Solution/VPet.Solution.csproj index d9a0db0..6ba5633 100644 --- a/VPet.Solution/VPet.Solution.csproj +++ b/VPet.Solution/VPet.Solution.csproj @@ -20,7 +20,7 @@ - +