mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
工作面板
This commit is contained in:
parent
fec9f514fc
commit
4aa4f4f41b
@ -1,4 +1,6 @@
|
|||||||
using System;
|
using LinePutScript.Localization.WPF;
|
||||||
|
using Panuon.WPF.UI;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -6,6 +8,7 @@ using System.Timers;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Documents;
|
using System.Windows.Documents;
|
||||||
|
using static VPet_Simulator.Core.GraphHelper;
|
||||||
using static VPet_Simulator.Core.GraphInfo;
|
using static VPet_Simulator.Core.GraphInfo;
|
||||||
|
|
||||||
namespace VPet_Simulator.Core
|
namespace VPet_Simulator.Core
|
||||||
@ -508,5 +511,60 @@ namespace VPet_Simulator.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Empty,
|
Empty,
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获得工作列表分类
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ws">所有工作</param>
|
||||||
|
/// <param name="ss">所有学习</param>
|
||||||
|
/// <param name="ps">所有娱乐</param>
|
||||||
|
public void WorkList(out List<Work> ws, out List<Work> ss, out List<Work> ps)
|
||||||
|
{
|
||||||
|
ws = new List<Work>();
|
||||||
|
ss = new List<Work>();
|
||||||
|
ps = new List<Work>();
|
||||||
|
foreach (var w in Core.Graph.GraphConfig.Works)
|
||||||
|
{
|
||||||
|
switch (w.Type)
|
||||||
|
{
|
||||||
|
case Work.WorkType.Study:
|
||||||
|
ss.Add(w);
|
||||||
|
break;
|
||||||
|
case Work.WorkType.Work:
|
||||||
|
ws.Add(w);
|
||||||
|
break;
|
||||||
|
case Work.WorkType.Play:
|
||||||
|
ps.Add(w);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 工作检测
|
||||||
|
/// </summary>
|
||||||
|
public Func<Work, bool> WorkCheck;
|
||||||
|
/// <summary>
|
||||||
|
/// 开始工作
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="work">工作内容</param>
|
||||||
|
public void StartWork(Work work)
|
||||||
|
{
|
||||||
|
if (!Core.Controller.EnableFunction || Core.Save.Mode != IGameSave.ModeType.Ill)
|
||||||
|
if (!Core.Controller.EnableFunction || Core.Save.Level >= work.LevelLimit)
|
||||||
|
if (State == Main.WorkingState.Work && StateID == Core.Graph.GraphConfig.Works.IndexOf(work))
|
||||||
|
WorkTimer.Stop();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (WorkCheck != null && !WorkCheck.Invoke(work))
|
||||||
|
return;
|
||||||
|
WorkTimer.Start(work);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
MessageBoxX.Show(LocalizeCore.Translate("您的桌宠等级不足{0}/{2}\n无法进行{1}", Core.Save.Level.ToString()
|
||||||
|
, work.NameTrans, work.LevelLimit), LocalizeCore.Translate("{0}取消", work.NameTrans));
|
||||||
|
else
|
||||||
|
MessageBoxX.Show(LocalizeCore.Translate("您的桌宠 {0} 生病啦,没法进行{1}", Core.Save.Name,
|
||||||
|
work.NameTrans), LocalizeCore.Translate("{0}取消", work.NameTrans));
|
||||||
|
Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ namespace VPet_Simulator.Core
|
|||||||
LoadWork();
|
LoadWork();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void LoadWork()
|
public void LoadWork()
|
||||||
{
|
{
|
||||||
MenuWork.Click -= MenuWork_Click;
|
MenuWork.Click -= MenuWork_Click;
|
||||||
@ -58,24 +59,9 @@ namespace VPet_Simulator.Core
|
|||||||
MenuWork.Items.Clear();
|
MenuWork.Items.Clear();
|
||||||
MenuStudy.Items.Clear();
|
MenuStudy.Items.Clear();
|
||||||
MenuPlay.Items.Clear();
|
MenuPlay.Items.Clear();
|
||||||
List<Work> ws = new List<Work>();
|
|
||||||
List<Work> ss = new List<Work>();
|
m.WorkList(out List<Work> ws, out List<Work> ss, out List<Work> ps);
|
||||||
List<Work> ps = new List<Work>();
|
|
||||||
foreach (var w in m.Core.Graph.GraphConfig.Works)
|
|
||||||
{
|
|
||||||
switch (w.Type)
|
|
||||||
{
|
|
||||||
case Work.WorkType.Study:
|
|
||||||
ss.Add(w);
|
|
||||||
break;
|
|
||||||
case Work.WorkType.Work:
|
|
||||||
ws.Add(w);
|
|
||||||
break;
|
|
||||||
case Work.WorkType.Play:
|
|
||||||
ps.Add(w);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ws.Count == 0)
|
if (ws.Count == 0)
|
||||||
{
|
{
|
||||||
MenuWork.Visibility = Visibility.Collapsed;
|
MenuWork.Visibility = Visibility.Collapsed;
|
||||||
@ -94,7 +80,7 @@ namespace VPet_Simulator.Core
|
|||||||
{
|
{
|
||||||
Header = w.NameTrans
|
Header = w.NameTrans
|
||||||
};
|
};
|
||||||
mi.Click += (s, e) => StartWork(w);
|
mi.Click += (s, e) => m.StartWork(w);
|
||||||
MenuWork.Items.Add(mi);
|
MenuWork.Items.Add(mi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,7 +102,7 @@ namespace VPet_Simulator.Core
|
|||||||
{
|
{
|
||||||
Header = w.NameTrans
|
Header = w.NameTrans
|
||||||
};
|
};
|
||||||
mi.Click += (s, e) => StartWork(w);
|
mi.Click += (s, e) => m.StartWork(w);
|
||||||
MenuStudy.Items.Add(mi);
|
MenuStudy.Items.Add(mi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,7 +124,7 @@ namespace VPet_Simulator.Core
|
|||||||
{
|
{
|
||||||
Header = w.NameTrans
|
Header = w.NameTrans
|
||||||
};
|
};
|
||||||
mi.Click += (s, e) => StartWork(w);
|
mi.Click += (s, e) => m.StartWork(w);
|
||||||
MenuPlay.Items.Add(mi);
|
MenuPlay.Items.Add(mi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,42 +132,20 @@ namespace VPet_Simulator.Core
|
|||||||
|
|
||||||
private void MenuStudy_Click(object sender, RoutedEventArgs e)
|
private void MenuStudy_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
StartWork(wstudy);
|
m.StartWork(wstudy);
|
||||||
}
|
}
|
||||||
Work wwork;
|
Work wwork;
|
||||||
Work wstudy;
|
Work wstudy;
|
||||||
Work wplay;
|
Work wplay;
|
||||||
/// <summary>
|
|
||||||
/// 工作检测
|
|
||||||
/// </summary>
|
|
||||||
public Func<Work, bool> WorkCheck;
|
|
||||||
public void StartWork(Work work)
|
|
||||||
{
|
|
||||||
if (!m.Core.Controller.EnableFunction || m.Core.Save.Mode != IGameSave.ModeType.Ill)
|
|
||||||
if (!m.Core.Controller.EnableFunction || m.Core.Save.Level >= work.LevelLimit)
|
|
||||||
if (m.State == Main.WorkingState.Work && m.StateID == m.Core.Graph.GraphConfig.Works.IndexOf(work))
|
|
||||||
m.WorkTimer.Stop();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (WorkCheck != null && !WorkCheck.Invoke(work))
|
|
||||||
return;
|
|
||||||
m.WorkTimer.Start(work);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
MessageBoxX.Show(LocalizeCore.Translate("您的桌宠等级不足{0}/{2}\n无法进行{1}", m.Core.Save.Level.ToString()
|
|
||||||
, work.NameTrans, work.LevelLimit), LocalizeCore.Translate("{0}取消", work.NameTrans));
|
|
||||||
else
|
|
||||||
MessageBoxX.Show(LocalizeCore.Translate("您的桌宠 {0} 生病啦,没法进行{1}", m.Core.Save.Name,
|
|
||||||
work.NameTrans), LocalizeCore.Translate("{0}取消", work.NameTrans));
|
|
||||||
Visibility = Visibility.Collapsed;
|
|
||||||
}
|
|
||||||
private void MenuWork_Click(object sender, RoutedEventArgs e)
|
private void MenuWork_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
StartWork(wwork);
|
m.StartWork(wwork);
|
||||||
}
|
}
|
||||||
private void MenuPlay_Click(object sender, RoutedEventArgs e)
|
private void MenuPlay_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
StartWork(wplay);
|
m.StartWork(wplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void M_TimeUIHandle(Main m)
|
private void M_TimeUIHandle(Main m)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using LinePutScript.Dictionary;
|
using LinePutScript.Dictionary;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using VPet_Simulator.Core;
|
using VPet_Simulator.Core;
|
||||||
|
|
||||||
@ -155,6 +156,14 @@ namespace VPet_Simulator.Windows.Interface
|
|||||||
/// 游戏存档数据
|
/// 游戏存档数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
GameSave_v2 GameSavesData { get; }
|
GameSave_v2 GameSavesData { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// 主窗体 Grid
|
||||||
|
/// </summary>
|
||||||
|
Grid MGHost { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// 主窗体 Pet Grid
|
||||||
|
/// </summary>
|
||||||
|
Grid PetGrid { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
|
||||||
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" Background="{x:Null}" WindowStyle="None"
|
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" Background="{x:Null}" WindowStyle="None"
|
||||||
SizeToContent="Height" xmlns:local="clr-namespace:VPet_Simulator.Windows" mc:Ignorable="d" ShowInTaskbar="False"
|
SizeToContent="Height" xmlns:local="clr-namespace:VPet_Simulator.Windows" mc:Ignorable="d" ShowInTaskbar="False"
|
||||||
ResizeMode="NoResize" Title="MWFriends" Width="250" pu:WindowXCaption.Height="0">
|
ResizeMode="NoResize" Title="MWFriends" Width="250" pu:WindowXCaption.Height="0">
|
||||||
|
@ -275,6 +275,9 @@ namespace VPet_Simulator.Windows
|
|||||||
petHelper.ReloadLocation();
|
petHelper.ReloadLocation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//private DateTime timecount = DateTime.Now;
|
//private DateTime timecount = DateTime.Now;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存设置
|
/// 保存设置
|
||||||
@ -1134,6 +1137,10 @@ namespace VPet_Simulator.Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Grid IMainWindow.MGHost => MGHost;
|
||||||
|
|
||||||
|
Grid IMainWindow.PetGrid => MGrid;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 移除所有聊天对话框
|
/// 移除所有聊天对话框
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
<WindowChrome.WindowChrome>
|
<WindowChrome.WindowChrome>
|
||||||
<WindowChrome GlassFrameThickness="-1" />
|
<WindowChrome GlassFrameThickness="-1" />
|
||||||
</WindowChrome.WindowChrome>
|
</WindowChrome.WindowChrome>
|
||||||
<Grid>
|
<Grid x:Name="MGHost" x:FieldModifier="public">
|
||||||
<Grid x:Name="MGrid" Width="250" Height="Auto" >
|
<Grid x:Name="MGrid" Width="250" Height="Auto" x:FieldModifier="public">
|
||||||
<Label x:Name="LoadingText" HorizontalAlignment="Center" VerticalAlignment="Center"
|
<Label x:Name="LoadingText" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||||
Background="{DynamicResource DARKPrimaryLight}" Foreground="{DynamicResource DARKPrimaryText}"
|
Background="{DynamicResource DARKPrimaryLight}" Foreground="{DynamicResource DARKPrimaryText}"
|
||||||
Content="Loading" />
|
Content="Loading" />
|
||||||
|
@ -113,6 +113,7 @@
|
|||||||
<None Remove="Res\img\r_worktime_4.png" />
|
<None Remove="Res\img\r_worktime_4.png" />
|
||||||
<None Remove="Res\img\r_worktime_5.png" />
|
<None Remove="Res\img\r_worktime_5.png" />
|
||||||
<None Remove="Res\img\r_worktime_6.png" />
|
<None Remove="Res\img\r_worktime_6.png" />
|
||||||
|
<None Remove="RichPresence.vdf" />
|
||||||
<None Remove="快捷键通用注解.md" />
|
<None Remove="快捷键通用注解.md" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -124,7 +125,9 @@
|
|||||||
<Resource Include="Res\img\rbgb.png" />
|
<Resource Include="Res\img\rbgb.png" />
|
||||||
<Resource Include="Res\img\r_mostfood_Food.png" />
|
<Resource Include="Res\img\r_mostfood_Food.png" />
|
||||||
<Resource Include="Res\remixicon.ttf" />
|
<Resource Include="Res\remixicon.ttf" />
|
||||||
<Resource Include="vpeticon.ico" />
|
<Resource Include="vpeticon.ico">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Resource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Update="Properties\Settings.Designer.cs">
|
<Compile Update="Properties\Settings.Designer.cs">
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" Height="500" Width="500" VerticalAlignment="Top">
|
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" Height="500" Width="500" VerticalAlignment="Top">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Border Background="{DynamicResource SecondaryLighter}" BorderBrush="{DynamicResource Secondary}"
|
<Border Background="{DynamicResource SecondaryLighter}" BorderBrush="{DynamicResource Secondary}"
|
||||||
BorderThickness="5" VerticalAlignment="Top" Margin="5,50,5,5" CornerRadius="5" Padding="5">
|
BorderThickness="5" VerticalAlignment="Top" Margin="5,5,5,5" CornerRadius="5" Padding="5">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="4*" />
|
<ColumnDefinition Width="4*" />
|
||||||
|
36
VPet-Simulator.Windows/WinDesign/winWorkMenu.xaml
Normal file
36
VPet-Simulator.Windows/WinDesign/winWorkMenu.xaml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<Window x:Class="VPet_Simulator.Windows.winWorkMenu" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||||
|
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">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="1*" />
|
||||||
|
<RowDefinition Height="1*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="1*" />
|
||||||
|
<ColumnDefinition Width="1*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TabControl Grid.RowSpan="2">
|
||||||
|
<TabItem Header="{ll:Str '学习'}">
|
||||||
|
<ListBox x:Name="lbStudy" />
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="{ll:Str '玩耍'}">
|
||||||
|
<ListBox x:Name="lbPlay" />
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="{ll:Str '工作'}">
|
||||||
|
<ListBox x:Name="lbWork" />
|
||||||
|
</TabItem>
|
||||||
|
</TabControl>
|
||||||
|
<Image x:Name="WorkViewImage" Grid.Column="1" Margin="10,10,10,33" Source="/Res/img/r_singlemoney_1.png" />
|
||||||
|
<Button Grid.Row="1" Grid.Column="1" VerticalAlignment="Bottom" Margin="5" Height="30" Content="开始工作"
|
||||||
|
Background="{DynamicResource DARKPrimary}" BorderThickness="1" pu:ButtonHelper.CornerRadius="5"
|
||||||
|
BorderBrush="{DynamicResource DARKPrimaryDarker}" Foreground="{DynamicResource DARKPrimaryText}"
|
||||||
|
FontWeight="Bold" FontSize="20" IsEnabled="False" />
|
||||||
|
<Label Background="{x:Null}" Grid.Column="1" VerticalAlignment="Bottom" Content="请从侧边栏选择工作" FontSize="24"
|
||||||
|
Foreground="{DynamicResource DARKPrimaryDark}" FontWeight="Bold" />
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
@ -11,6 +11,7 @@ using System.Windows.Input;
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using static VPet_Simulator.Core.GraphHelper;
|
||||||
|
|
||||||
namespace VPet_Simulator.Windows;
|
namespace VPet_Simulator.Windows;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -18,8 +19,29 @@ namespace VPet_Simulator.Windows;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class winWorkMenu : Window
|
public partial class winWorkMenu : Window
|
||||||
{
|
{
|
||||||
public winWorkMenu()
|
MainWindow mw;
|
||||||
|
List<Work> ws;
|
||||||
|
List<Work> ss;
|
||||||
|
List<Work> ps;
|
||||||
|
public winWorkMenu(MainWindow mw)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
this.mw = mw;
|
||||||
|
|
||||||
|
mw.Main.WorkList(out ws, out ss, out ps);
|
||||||
|
|
||||||
|
foreach (var v in ws)
|
||||||
|
{
|
||||||
|
lbWork.Items.Add(v.NameTrans);
|
||||||
|
}
|
||||||
|
foreach (var v in ss)
|
||||||
|
{
|
||||||
|
lbStudy.Items.Add(v.NameTrans);
|
||||||
|
}
|
||||||
|
foreach (var v in ps)
|
||||||
|
{
|
||||||
|
lbPlay.Items.Add(v.NameTrans);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,12 +0,0 @@
|
|||||||
<Window x:Class="VPet_Simulator.Windows.winWorkMenu"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:local="clr-namespace:VPet_Simulator.Windows"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="winWorkMenu" Height="450" Width="800">
|
|
||||||
<Grid>
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
Loading…
Reference in New Issue
Block a user