工作操作优化

This commit is contained in:
ZouJin 2024-03-18 22:26:50 +08:00
parent 7fd2f74740
commit ea785811da
5 changed files with 28 additions and 17 deletions

View File

@ -545,7 +545,7 @@ namespace VPet_Simulator.Core
/// 开始工作
/// </summary>
/// <param name="work">工作内容</param>
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;
}
}
}

View File

@ -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,7 +141,7 @@ namespace VPet_Simulator.Core
private void MenuStudy_Click(object sender, RoutedEventArgs e)
{
m.StartWork(wstudy);
StartWork(wstudy);
}
Work wwork;
Work wstudy;
@ -144,11 +150,11 @@ namespace VPet_Simulator.Core
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)

View File

@ -7,7 +7,9 @@
mc:Ignorable="d" Margin="5" Width="340" Height="100" Background="{DynamicResource SecondaryLight}"
BorderBrush="{DynamicResource Secondary}">
<Grid>
<Image x:Name="uimg" HorizontalAlignment="Left" Source="/Res/TopLogo2019.PNG" Margin="4" />
<Border HorizontalAlignment="Left" Margin="4" CornerRadius="43">
<Image x:Name="uimg" Source="/Res/TopLogo2019.PNG" />
</Border>
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Margin="110,0,0,0"
Foreground="{DynamicResource DARKPrimaryDarker}" FontSize="16">
<Run Text="{ll:Str 访客}" />: <Run x:Name="rPetName" Text="{ll:Str 萝莉斯}" FontSize="20" FontWeight="Bold" />

View File

@ -8,8 +8,10 @@
Title="{ll:Str 访客表}" MinHeight="400" Width="400" Closed="Window_Closed" FontSize="16" SizeToContent="Height"
MaxHeight="800" ResizeMode="CanMinimize" Closing="Window_Closing">
<Grid>
<Image x:Name="HostHead" Margin="20" Width="80" Height="80" HorizontalAlignment="Left" VerticalAlignment="Top"
Source="/Res/TopLogo2019.PNG" />
<Border Margin="20" Width="80" Height="80" HorizontalAlignment="Left" VerticalAlignment="Top" CornerRadius="40">
<Image x:Name="HostHead" Source="/Res/TopLogo2019.PNG" />
</Border>
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Margin="120,20,0,0"
Foreground="{DynamicResource DARKPrimaryDarker}">
<Run x:Name="hostPet" Text="萝莉斯" FontSize="24" FontWeight="Bold" /> <Run Text="{ll:Str 的访客表}" />

View File

@ -178,7 +178,7 @@ public partial class winWorkMenu : Window
{
if (nowworkdisplay != null)
{
mw.Main.StartWork(nowworkdisplay);
if (mw.Main.StartWork(nowworkdisplay))
Close();
}
}