diff --git a/VPet-Simulator.Core/Display/MainLogic.cs b/VPet-Simulator.Core/Display/MainLogic.cs index 4165161..54dbfb6 100644 --- a/VPet-Simulator.Core/Display/MainLogic.cs +++ b/VPet-Simulator.Core/Display/MainLogic.cs @@ -545,7 +545,7 @@ namespace VPet_Simulator.Core /// 开始工作 /// /// 工作内容 - public void StartWork(Work work) + public bool StartWork(Work work) { if (!Core.Controller.EnableFunction || Core.Save.Mode != IGameSave.ModeType.Ill) if (!Core.Controller.EnableFunction || Core.Save.Level >= work.LevelLimit) @@ -554,8 +554,9 @@ namespace VPet_Simulator.Core else { if (WorkCheck != null && !WorkCheck.Invoke(work)) - return; + return false; WorkTimer.Start(work); + return true; } else MessageBoxX.Show(LocalizeCore.Translate("您的桌宠等级不足{0}/{2}\n无法进行{1}", Core.Save.Level.ToString() @@ -563,7 +564,7 @@ namespace VPet_Simulator.Core else MessageBoxX.Show(LocalizeCore.Translate("您的桌宠 {0} 生病啦,没法进行{1}", Core.Save.Name, work.NameTrans), LocalizeCore.Translate("{0}取消", work.NameTrans)); - ToolBar.Visibility = Visibility.Collapsed; + return false; } } } diff --git a/VPet-Simulator.Core/Display/ToolBar.xaml.cs b/VPet-Simulator.Core/Display/ToolBar.xaml.cs index 8d673cf..2c66419 100644 --- a/VPet-Simulator.Core/Display/ToolBar.xaml.cs +++ b/VPet-Simulator.Core/Display/ToolBar.xaml.cs @@ -58,6 +58,11 @@ namespace VPet_Simulator.Core MenuStudy.Items.Clear(); MenuPlay.Items.Clear(); } + public void StartWork(Work w) + { + if (m.StartWork(w)) + Visibility = Visibility.Collapsed; + } public void LoadWork() { @@ -83,7 +88,8 @@ namespace VPet_Simulator.Core { Header = w.NameTrans }; - mi.Click += (s, e) => m.StartWork(w); + mi.Click += (s, e) => StartWork(w); + MenuWork.Items.Add(mi); } } @@ -105,7 +111,7 @@ namespace VPet_Simulator.Core { Header = w.NameTrans }; - mi.Click += (s, e) => m.StartWork(w); + mi.Click += (s, e) => StartWork(w); MenuStudy.Items.Add(mi); } } @@ -127,7 +133,7 @@ namespace VPet_Simulator.Core { Header = w.NameTrans }; - mi.Click += (s, e) => m.StartWork(w); + mi.Click += (s, e) => StartWork(w); MenuPlay.Items.Add(mi); } } @@ -135,20 +141,20 @@ namespace VPet_Simulator.Core private void MenuStudy_Click(object sender, RoutedEventArgs e) { - m.StartWork(wstudy); + StartWork(wstudy); } Work wwork; Work wstudy; Work wplay; - - + + private void MenuWork_Click(object sender, RoutedEventArgs e) { - m.StartWork(wwork); + StartWork(wwork); } private void MenuPlay_Click(object sender, RoutedEventArgs e) { - m.StartWork(wplay); + StartWork(wplay); } private void M_TimeUIHandle(Main m) diff --git a/VPet-Simulator.Windows/MutiPlayer/MPUserControl.xaml b/VPet-Simulator.Windows/MutiPlayer/MPUserControl.xaml index 8ffabe5..1d375c3 100644 --- a/VPet-Simulator.Windows/MutiPlayer/MPUserControl.xaml +++ b/VPet-Simulator.Windows/MutiPlayer/MPUserControl.xaml @@ -7,7 +7,9 @@ mc:Ignorable="d" Margin="5" Width="340" Height="100" Background="{DynamicResource SecondaryLight}" BorderBrush="{DynamicResource Secondary}"> - + + + : @@ -16,7 +18,7 @@