日程表-自动工作功能

This commit is contained in:
ZouJin 2024-06-01 04:20:15 +08:00
parent 1db29375d0
commit 6c50779355
5 changed files with 426 additions and 93 deletions

View File

@ -2,6 +2,7 @@
using LinePutScript.Converter;
using LinePutScript.Localization.WPF;
using Panuon.WPF;
using Panuon.WPF.UI;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@ -9,6 +10,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using System.Windows;
using System.Windows.Media;
using static VPet_Simulator.Core.GraphHelper;
using static VPet_Simulator.Core.GraphHelper.Work;
@ -126,7 +128,9 @@ public class ScheduleTask
RestTimer.Start();
}
}
/// <summary>
/// 开始工作
/// </summary>
public void StartWork()
{
RestTime = -100;
@ -140,6 +144,40 @@ public class ScheduleTask
}
if (ScheduleItems[NowIndex] is WorkScheduleItem wsi)
{
//判断能否工作
if (wsi.Work.Type == WorkType.Work)
{
if (PackageWork?.IsActive() != true)
{
mw.Dispatcher.Invoke(() => MessageBoxX.Show("工作套餐未激活,请前往日程表签署工作中介套餐".Translate(), "套餐未激活".Translate()));
IsOn = false;
return;
}
else if (PackageWork.Level < wsi.Work.LevelLimit)
{
mw.Dispatcher.Invoke(() => MessageBoxX.Show("工作套餐等级不足({0}/{1}),\n请选择更低等级要求/倍率的工作或前往日程表签署新的工作中介套餐".Translate(PackageWork.Level,
wsi.Work.LevelLimit), "套餐等级不足".Translate()));
IsOn = false;
return;
}
}
else if (wsi.Work.Type == WorkType.Study)
{
if (PackageStudy?.IsActive() != true)
{
mw.Dispatcher.Invoke(() => MessageBoxX.Show("学习套餐未激活,请前往日程表签署培训机构套餐".Translate(), "套餐未激活".Translate()));
IsOn = false;
return;
}
else if (PackageStudy.Level < wsi.Work.LevelLimit)
{
mw.Dispatcher.Invoke(() => MessageBoxX.Show("学习套餐等级不足({0}/{1}),\n请选择更低等级要求/倍率的学习或前往日程表签署新的培训机构套餐".Translate(PackageStudy.Level,
wsi.Work.LevelLimit), "套餐等级不足".Translate()));
IsOn = false;
return;
}
}
mw.Main.StartWork(wsi.Work.Double(wsi.DBL));
NowIndex++;
}
@ -151,6 +189,22 @@ public class ScheduleTask
}
}
}
/// <summary>
/// 开始日程表
/// </summary>
public void Start()
{
IsOn = true;
StartWork();
}
/// <summary>
/// 停止日程表
/// </summary>
public void Stop()
{
IsOn = false;
RestTime = -100;
}
private int RestTime = 2;
private Timer RestTimer = new Timer()
{
@ -229,6 +283,7 @@ public class ScheduleTask
return Task.ScheduleItems[Task.NowIndex] == this;
}
}
public Visibility IsNowVisibility => IsNow ? Visibility.Visible : Visibility.Collapsed;
}
/// <summary>
/// 工作日程表日程
@ -263,9 +318,25 @@ public class ScheduleTask
public ImageSource Image { get; set; }
public string WorkName => Work.NameTrans;
public string WorkName
{
get => Work.NameTrans;
set { }
}
public override int WorkTime => Work.Time;
public string WorkLevel
{
get => $"Lv {(Work.LevelLimit + 10) * DBL}";
set { }
}
public override int WorkTime
{
get => Work.Time;
set { }
}
public Visibility IsOKVisibility => (Task.PackageWork?.IsActive() != true || Task.PackageWork.Level < Work.LevelLimit) ? Visibility.Visible : Visibility.Collapsed;
public bool IsPreviousIsRest { get => _isPreviousIsRest; set => Set(ref _isPreviousIsRest, value); }
private bool _isPreviousIsRest;
@ -278,6 +349,8 @@ public class ScheduleTask
public StudyScheduleItem(ScheduleTask task, Work work, int dbl) : base(task, work, dbl)
{
}
public new Visibility IsOKVisibility => (Task.PackageStudy?.IsActive() != true || Task.PackageStudy.Level < Work.LevelLimit) ? Visibility.Visible : Visibility.Collapsed;
}
/// <summary>
/// 工作日程表日程
@ -287,8 +360,18 @@ public class ScheduleTask
public PlayScheduleItem(ScheduleTask task, Work work, int dbl) : base(task, work, dbl)
{
}
public override int WorkTime => Work.Time / 2;
public override int RestTime => Work.Time / 2;
public override int WorkTime
{
get => Work.Time / 2;
set { }
}
public override int RestTime
{
get => Work.Time / 2;
set { }
}
public new Visibility IsOKVisibility => Visibility.Collapsed;
}
/// <summary>
/// 休息日程表日程
@ -311,6 +394,9 @@ public class ScheduleTask
/// </summary>
public class Package
{
public Package()
{
}
/// <summary>
/// 套餐名称
/// </summary>
@ -346,7 +432,7 @@ public class ScheduleTask
/// <summary>
/// 截止时间
/// </summary>
[Line] public DateTime EndTime { get; set; }
[Line] public DateTime EndTime { get; set; } = DateTime.MinValue;
/// <summary>
/// 可用等级
/// </summary>
@ -356,12 +442,25 @@ public class ScheduleTask
/// </summary>
/// <returns>判断套餐是否生效</returns>
public bool IsActive() => DateTime.Now < EndTime;
public Package(PackageFull packageFull, int level)
{
Name = packageFull.Name;
Describe = packageFull.Describe;
Commissions = packageFull.Commissions;
Price = packageFull.Price * (200 * level - 100);
EndTime = DateTime.Now.AddDays(packageFull.Duration);
Level = (int)(level / packageFull.LevelInNeed);
}
}
/// <summary>
/// 套餐详细
/// </summary>
public class PackageFull : Package
{
public PackageFull()
{
}
/// <summary>
/// 持续时间 (天)
/// </summary>
@ -374,7 +473,7 @@ public class ScheduleTask
/// <summary>
/// 工作类型
/// </summary>
[Line] public Work.WorkType WorkType { get; set; }
[Line] public WorkType WorkType { get; set; }
public void FixOverLoad()
{
@ -382,7 +481,7 @@ public class ScheduleTask
{
Duration = 1;
}
if (Price > 0)
if (Price < 0)
{
Price = 1;
}
@ -394,8 +493,8 @@ public class ScheduleTask
{
Commissions = 0.2;
}
var use = Math.Sign(Commissions - 0.25) * Math.Pow(Math.Abs(Commissions * 100 - 15), 1.5) +
Math.Sign(LevelInNeed - 1.2) * Math.Pow(Math.Abs(LevelInNeed * 100 - 15), 1.5) +
var use = Math.Sign(Commissions - 0.15) * Math.Pow(Math.Abs(Commissions * 100 - 15), 1.5) +
Math.Sign(LevelInNeed - 1.2) * Math.Pow(Math.Abs(LevelInNeed * 100 - 120), 1.5) +
(Price * LevelInNeed * 100 - 100) / 4;
var get = Math.Sqrt(Duration);
var realvalue = use / get;
@ -407,6 +506,8 @@ public class ScheduleTask
Duration = 7;
}
}
public override string ToString() => NameTrans;
}
}

View File

@ -20,7 +20,7 @@ public partial class MainWindow
/// <summary>
/// 版本号
/// </summary>
public int version { get; } = 11016;
public int version { get; } = 11020;
/// <summary>
/// 版本号
/// </summary>

View File

@ -205,7 +205,7 @@
</Grid>
<Border Grid.Column="2" Background="White" CornerRadius="4" />
<Grid Grid.Column="2" Margin="7">
<Grid
<Grid d:Visibility="Collapsed"
Visibility="{Binding IsChecked, Converter={x:Static pu:Converters.TrueToCollapseConverter}, ElementName=tbtnCurrentPlan}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@ -217,7 +217,8 @@
</Grid.RowDefinitions>
<ComboBox x:Name="combTaskType" Margin="0,3,0,0"
Style="{DynamicResource StandardComboBoxStyle}"
pu:ComboBoxHelper.Watermark="--请选择套餐--" />
pu:ComboBoxHelper.Watermark="--请选择套餐--"
SelectionChanged="combTaskType_SelectionChanged" />
<TextBlock Grid.Row="1" Margin="0,7,0,0" VerticalAlignment="Bottom"
Text="{ll:Str 选择等级}" />
<TextBlock Grid.Row="1" Margin="0,7,0,0" FontSize="16"
@ -230,7 +231,7 @@
pu:SliderHelper.ThumbBorderThickness="2" SmallChange="1" Value="1"
Maximum="25" Minimum="15" TickFrequency="5" IsSnapToTickEnabled="True"
LargeChange="1" Style="{DynamicResource StandardSliderStyle}"
TickPlacement="BottomRight"></Slider>
TickPlacement="BottomRight" ValueChanged="sliderTaskLevel_ValueChanged"></Slider>
<Grid Grid.Row="4" Margin="0,7,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="22" />
@ -245,21 +246,25 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock x:Name="rTaskType">抽成</TextBlock>
<TextBlock Grid.Column="2" HorizontalAlignment="Right"
<TextBlock x:Name="rCommissions" Grid.Column="2" HorizontalAlignment="Right"
Foreground="{DynamicResource DARKPrimary}" Text="20%" />
<TextBlock Grid.Row="1" Text="{ll:Str '等级需求'}" />
<TextBlock Grid.Row="1" Text="{ll:Str '可用等级'}" />
<TextBlock Grid.Row="1" Grid.Column="2" HorizontalAlignment="Right"
Foreground="{DynamicResource DARKPrimary}" Text="Lv 100" />
Foreground="{DynamicResource DARKPrimary}">
Lv <Run x:Name="rLevelNeed" Text="100" />
</TextBlock>
<TextBlock Grid.Row="2" Text="{ll:Str '持续时间'}" />
<TextBlock Grid.Row="2" Grid.Column="2" HorizontalAlignment="Right"
Foreground="{DynamicResource DARKPrimary}" Text="7 天" />
Foreground="{DynamicResource DARKPrimary}">
<Run x:Name="rDuration" Text="7" /> <Run Text="{ll:Str '天'}" />
</TextBlock>
<TextBlock Grid.Row="3" Text="{ll:Str '描述'}" />
<TextBlock Grid.Row="3" Text="游玩《虚拟桌宠模拟器》,参加桌宠 ChatVPet 项目。任务目标,即刻拯救桌宠!"
Grid.Column="1" Grid.ColumnSpan="2" TextWrapping="Wrap"
FontSize="12" />
<TextBlock x:Name="rDescribe" Grid.Row="3"
Text="游玩《虚拟桌宠模拟器》,参加桌宠 ChatVPet 项目。任务目标,即刻拯救桌宠!" Grid.Column="1"
Grid.ColumnSpan="2" TextWrapping="Wrap" FontSize="12" />
<TextBlock Grid.Row="4" Text="{ll:Str '办理费用'}" VerticalAlignment="Bottom" />
<TextBlock Grid.Row="4" Grid.Column="2" HorizontalAlignment="Right"
VerticalAlignment="Center"
<TextBlock x:Name="rpPrice" Grid.Row="4" Grid.Column="2"
HorizontalAlignment="Right" VerticalAlignment="Center"
Foreground="{DynamicResource DARKPrimary}" Text="100000"
FontSize="26" />
</Grid>
@ -268,7 +273,7 @@
Background="{DynamicResource PrimaryDarker}" Click="btnSignAgency_Click"
FontSize="16" FontWeight="Bold" />
</Grid>
<Grid d:Visibility="Collapsed"
<Grid
Visibility="{Binding IsChecked, Converter={x:Static pu:Converters.FalseToCollapseConverter}, ElementName=tbtnCurrentPlan}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@ -276,7 +281,7 @@
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Text="{ll:Str '当前套餐'}" Opacity="0.7" />
<TextBlock Grid.Row="1" Text="{ll:Str '暂无签署套餐'}" FontSize="24"
<TextBlock x:Name="rpnName" Grid.Row="1" Text="{ll:Str '暂无签署套餐'}" FontSize="24"
Foreground="{DynamicResource DARKPrimary}" />
<Grid Grid.Row="2" Margin="0,7,0,0">
<Grid.RowDefinitions>
@ -293,24 +298,31 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Text,ElementName=rTaskType}" />
<TextBlock Grid.Column="2" HorizontalAlignment="Right"
<TextBlock x:Name="rpnCommissions" Grid.Column="2"
HorizontalAlignment="Right"
Foreground="{DynamicResource DARKPrimary}" Text="20%" />
<TextBlock Grid.Row="1" Text="{ll:Str '可用等级'}" />
<TextBlock Grid.Row="1" Grid.Column="2" HorizontalAlignment="Right"
Foreground="{DynamicResource DARKPrimary}" Text="Lv 100" />
Foreground="{DynamicResource DARKPrimary}">
<Run Text="Lv" />
<Run x:Name="rpnLevelInNeed" Text="100" />
</TextBlock>
<TextBlock Grid.Row="2" Text="{ll:Str '剩余时间'}" />
<TextBlock Grid.Row="2" Grid.Column="2" HorizontalAlignment="Right"
Foreground="{DynamicResource DARKPrimary}" Text="7 天" />
Foreground="{DynamicResource DARKPrimary}">
<Run x:Name="rpnEndDay" Text="7" /> <Run Text="{ll:Str '小时'}" />
</TextBlock>
<TextBlock Grid.Row="3" Text="{ll:Str '截止日期'}" />
<TextBlock Grid.Row="3" Grid.Column="2" HorizontalAlignment="Right"
<TextBlock x:Name="rpnEndDate" Grid.Row="3" Grid.Column="2"
HorizontalAlignment="Right"
Foreground="{DynamicResource DARKPrimary}" Text="05/27" />
<TextBlock Grid.Row="4" Text="{ll:Str '描述'}" />
<TextBlock Grid.Row="4" Text="游玩《虚拟桌宠模拟器》,参加桌宠 ChatVPet 项目。任务目标,即刻拯救桌宠!"
Grid.Column="1" Grid.ColumnSpan="2" TextWrapping="Wrap"
Margin="10,0,0,0" />
<TextBlock x:Name="rpnDescribe" Grid.Row="4"
Text="游玩《虚拟桌宠模拟器》,参加桌宠 ChatVPet 项目。任务目标,即刻拯救桌宠!" Grid.Column="1"
Grid.ColumnSpan="2" TextWrapping="Wrap" Margin="10,0,0,0" />
<TextBlock Grid.Row="5" Text="{ll:Str '办理费用'}" VerticalAlignment="Bottom" />
<TextBlock Grid.Row="5" Grid.Column="2" HorizontalAlignment="Right"
VerticalAlignment="Center"
<TextBlock x:Name="rpnPrice" Grid.Row="5" Grid.Column="2"
HorizontalAlignment="Right" VerticalAlignment="Center"
Foreground="{DynamicResource DARKPrimary}" Text="100000"
FontSize="26" />
</Grid>
@ -365,13 +377,16 @@
Click="btn_scheduleDown_Click">&#xea4c;</Button>
</StackPanel>
<Image Stretch="Uniform"
Source="/Res/img/r_autobuy_3.png" />
Source="{Binding Image}" Margin="5" />
<StackPanel Grid.Column="1"
VerticalAlignment="Center">
<TextBlock Text="{ll:Str '工作内容'}" />
<TextBlock FontSize="16"
Foreground="{DynamicResource DARKPrimary}"
Text="{Binding WorkName}" />
<TextBlock FontSize="16">
<Run Text="{Binding WorkName}"
Foreground="{DynamicResource DARKPrimaryDark}" />
<Run Text="{Binding WorkLevel}"
Foreground="{DynamicResource DARKPrimaryLight}" />
</TextBlock>
<TextBlock Text="{ll:Str '持续时间'}" />
<TextBlock FontSize="16"
Foreground="{DynamicResource DARKPrimary}">
@ -381,10 +396,33 @@
</StackPanel>
<Button Grid.Column="2"
HorizontalAlignment="Right"
Background="Transparent"
VerticalAlignment="Center"
ToolTip="{ll:Str '删除'}"
Background="Transparent" FontSize="20"
Foreground="{DynamicResource DangerBrush}"
FontFamily="{StaticResource RemixIcon}"
Click="btn_removeSchedule_Click">&#xeb97;</Button>
<Button Grid.Column="2" Margin="0,0,0,10"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
ToolTip="{ll:Str '套餐等级不足'}"
FontWeight="Bold" FontSize="20"
Background="Transparent"
Content="&#xECA1;"
Visibility="{Binding IsOKVisibility}"
Click="btn_removeSchedule_Click"
Foreground="{DynamicResource WarningBrush}"
FontFamily="{StaticResource RemixIcon}" />
<Button Grid.Column="2" Margin="0,10,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
ToolTip="{ll:Str '当前日程进度'}"
FontWeight="Bold" FontSize="20"
Background="Transparent"
Content="&#xEC42;"
Visibility="{Binding IsNowVisibility}"
Foreground="{DynamicResource DARKPrimary}"
FontFamily="{StaticResource RemixIcon}" />
</Grid>
</Border>
</StackPanel>
@ -417,13 +455,16 @@
Click="btn_scheduleDown_Click">&#xea4c;</Button>
</StackPanel>
<Image Stretch="Uniform"
Source="/Res/img/r_autobuy_3.png" />
Source="{Binding Image}" Margin="5" />
<StackPanel Grid.Column="1"
VerticalAlignment="Center">
<TextBlock Text="{ll:Str '学习内容'}" />
<TextBlock FontSize="16"
Foreground="{DynamicResource DARKPrimary}"
Text="{Binding WorkName}" />
<TextBlock FontSize="16">
<Run Text="{Binding WorkName}"
Foreground="{DynamicResource DARKPrimaryDark}" />
<Run Text="{Binding WorkLevel}"
Foreground="{DynamicResource DARKPrimaryLight}" />
</TextBlock>
<TextBlock Text="{ll:Str '持续时间'}" />
<TextBlock FontSize="16"
Foreground="{DynamicResource DARKPrimary}">
@ -433,10 +474,33 @@
</StackPanel>
<Button Grid.Column="2"
HorizontalAlignment="Right"
Background="Transparent"
VerticalAlignment="Center"
ToolTip="{ll:Str '删除'}"
Background="Transparent" FontSize="20"
Foreground="{DynamicResource DangerBrush}"
FontFamily="{StaticResource RemixIcon}"
Click="btn_removeSchedule_Click">&#xeb97;</Button>
<Button Grid.Column="2" Margin="0,0,0,10"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
ToolTip="{ll:Str '套餐等级不足'}"
FontWeight="Bold" FontSize="20"
Background="Transparent"
Content="&#xECA1;"
Visibility="{Binding IsOKVisibility}"
Click="btn_removeSchedule_Click"
Foreground="{DynamicResource WarningBrush}"
FontFamily="{StaticResource RemixIcon}" />
<Button Grid.Column="2" Margin="0,10,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
ToolTip="{ll:Str '当前日程进度'}"
FontWeight="Bold" FontSize="20"
Background="Transparent"
Content="&#xEC42;"
Visibility="{Binding IsNowVisibility}"
Foreground="{DynamicResource DARKPrimary}"
FontFamily="{StaticResource RemixIcon}" />
</Grid>
</Border>
</StackPanel>
@ -469,13 +533,16 @@
Click="btn_scheduleDown_Click">&#xea4c;</Button>
</StackPanel>
<Image Stretch="Uniform"
Source="/Res/img/r_autobuy_3.png" />
Source="{Binding Image}" Margin="5" />
<StackPanel Grid.Column="1"
VerticalAlignment="Center">
<TextBlock Text="{ll:Str '玩耍内容'}" />
<TextBlock FontSize="16"
Foreground="{DynamicResource DARKPrimary}"
Text="{Binding WorkName}" />
<TextBlock FontSize="16">
<Run Text="{Binding WorkName}"
Foreground="{DynamicResource DARKPrimaryDark}" />
<Run Text="{Binding WorkLevel}"
Foreground="{DynamicResource DARKPrimaryLight}" />
</TextBlock>
<TextBlock Text="{ll:Str '持续时间'}" />
<TextBlock FontSize="16"
Foreground="{DynamicResource DARKPrimary}">
@ -485,10 +552,34 @@
</StackPanel>
<Button Grid.Column="2"
HorizontalAlignment="Right"
Background="Transparent"
ToolTip="{ll:Str '删除'}"
VerticalAlignment="Center"
Background="Transparent" FontSize="20"
Foreground="{DynamicResource DangerBrush}"
FontFamily="{StaticResource RemixIcon}"
Click="btn_removeSchedule_Click">&#xeb97;</Button>
<Button Grid.Column="2" Margin="0,0,0,10"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
ToolTip="{ll:Str '套餐等级不足'}"
FontWeight="Bold" FontSize="20"
Background="Transparent"
Content="&#xECA1;"
Visibility="{Binding IsOKVisibility}"
Click="btn_removeSchedule_Click"
Foreground="{DynamicResource WarningBrush}"
FontFamily="{StaticResource RemixIcon}" />
<Button Grid.Column="2" Margin="0,10,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
ToolTip="{ll:Str '当前日程进度'}"
FontWeight="Bold" FontSize="20"
Background="Transparent"
Content="&#xEC42;"
Visibility="{Binding IsNowVisibility}"
Foreground="{DynamicResource DARKPrimary}"
FontFamily="{StaticResource RemixIcon}" />
</Grid>
</Border>
</StackPanel>
@ -500,6 +591,7 @@
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Margin="7,0">
<TextBlock VerticalAlignment="Center"
@ -525,13 +617,19 @@
Foreground="{DynamicResource DARKPrimary}"
FontSize="16" Text="{ll:Str '分钟'}" />
</StackPanel>
<Button Grid.Column="2" HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="Transparent"
<Button Grid.Column="2" VerticalAlignment="Center"
ToolTip="{ll:Str '删除'}"
Background="Transparent" FontSize="20"
Foreground="{DynamicResource DangerBrush}"
FontFamily="{StaticResource RemixIcon}"
Content="&#xeb97;"
Click="btn_removeSchedule_Click" />
Click="btn_removeSchedule_Click">&#xeb97;</Button>
<Button Grid.Column="1" VerticalAlignment="Center"
ToolTip="{ll:Str '当前日程进度'}"
Visibility="{Binding IsNowVisibility}"
FontWeight="Bold" FontSize="20"
Background="Transparent" Content="&#xEC42;"
Foreground="{DynamicResource DARKPrimary}"
FontFamily="{StaticResource RemixIcon}" />
</Grid>
</Border>
</DataTemplate>
@ -582,8 +680,9 @@
Text="100%" FontWeight="Bold" />
<ToggleButton x:Name="btnStartSchedule" Grid.Row="4"
Style="{DynamicResource ThemedToggleButtonStyle}" Height="30"
Content="{ll:Str 开始日程}" Background="{DynamicResource PrimaryDarker}"
FontSize="16" FontWeight="Bold" Click="btnStartSchedule_Click" />
pu:ToggleButtonHelper.CheckedContent="{ll:Str 停止日程}" Content="{ll:Str 开始日程}"
Background="{DynamicResource PrimaryDarker}" FontSize="16" FontWeight="Bold"
Click="btnStartSchedule_Click" />
</Grid>
</Grid>

View File

@ -78,10 +78,24 @@ public partial class winWorkMenu : WindowX
ShowImageDefault(type);
CalculateSceduleTime();
imgAgency.Source = mw.ImageSources.FindImage("work_" + mw.Set.PetGraph + "_agency_job", "work_agency_job");
tbtnAgencyTraning.IsChecked = false;
rTaskType.Text = "抽成".Translate();
foreach (var v in mw.SchedulePackage.FindAll(x => x.WorkType == Work.WorkType.Work))
combTaskType.Items.Add(v);
if (mw.Core.Save.Level > 15)
blockTask.Visibility = Visibility.Collapsed;
rpnDisplay(mw.ScheduleTask.PackageWork, Work.WorkType.Work);
sliderTaskLevel.Maximum = mw.Core.Save.Level / 5 * 5;
if (mw.Core.Save.Level > 200)
sliderTaskLevel.TickFrequency = mw.Core.Save.Level / 100 * 5;
else
sliderTaskLevel.TickFrequency = 5;
tbtnCurrentPlan.IsChecked = mw.ScheduleTask.PackageWork?.IsActive() == true;
btnStartSchedule.IsChecked = false;
AllowChange = true;
combTaskType.SelectedIndex = 0;
ComboBoxHelper.SetWatermark(detailTypes, "---" + "请选择".Translate() + "---");
@ -116,6 +130,10 @@ public partial class winWorkMenu : WindowX
{
wDouble.IsEnabled = true;
wDouble.Maximum = max;
if (max > 25)
wDouble.TickFrequency = max / 25;
else
wDouble.TickFrequency = 1;
wDouble.Value = mw.Set["workmenu"].GetInt("double_" + nowwork.Name, 1);
}
}
@ -162,11 +180,6 @@ public partial class winWorkMenu : WindowX
tbtn_star.IsChecked = IsWorkStar(work);
}
public void LoadSchedule()
{
}
private void LsbCategory_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Dispatcher.BeginInvoke(() =>
@ -307,18 +320,34 @@ public partial class winWorkMenu : WindowX
private void btnStartSchedule_Click(object sender, RoutedEventArgs e)
{
if (btnStartSchedule.IsChecked == mw.ScheduleTask.IsOn)
return;
if (mw.ScheduleTask.IsOn)
{
mw.ScheduleTask.Stop();
}
else
{
if (sworkTime / (double)(sworkTime + srestTime) > 0.71)
{
MessageBoxX.Show("工作时间过长,请添加更多的休息时间".Translate(), "工作时间过长".Translate());
btnStartSchedule.IsChecked = false;
return;
}
mw.ScheduleTask.Start();
}
}
private void NumberInput_ValueChanged(object sender, SelectedValueChangedRoutedEventArgs<double?> e)
{
CalculateSceduleTime();
}
int sworkTime = 0;
int srestTime = 0;
private void CalculateSceduleTime()
{
int workTime = 0;
int restTime = 0;
sworkTime = 0;
srestTime = 0;
for (int i = 0; i < _schedules.Count; i++)
{
var item = _schedules[i];
@ -327,16 +356,16 @@ public partial class winWorkMenu : WindowX
{
workItem.IsPreviousIsRest = lastItem is RestScheduleItem;
}
workTime += item.WorkTime;
restTime += item.RestTime;
sworkTime += item.WorkTime;
srestTime += item.RestTime;
}
rpgbSchedule.Maximum = workTime + restTime;
rpgbSchedule.Value = workTime;
rpgbSchedule.Maximum = sworkTime + srestTime;
rpgbSchedule.Value = sworkTime;
runScheduleWork.Text = workTime.ToString();
runScheduleRest.Text = restTime.ToString();
runScheduleWork.Text = sworkTime.ToString();
runScheduleRest.Text = srestTime.ToString();
double ps = workTime / (double)(workTime + restTime);
double ps = sworkTime / (double)(sworkTime + srestTime);
runSchedulePercentage.Text = ps.ToString("p0");
if (ps > 0.71)
runSchedulePercentage.Foreground = new SolidColorBrush(Colors.OrangeRed);
@ -344,6 +373,38 @@ public partial class winWorkMenu : WindowX
runSchedulePercentage.Foreground = Function.ResourcesBrush(Function.BrushType.DARKPrimary);
rpgbSchedule.Foreground = runSchedulePercentage.Foreground;
}
private void rpnDisplay(Package package, Work.WorkType type)
{
if (package == null)
{
rpnDescribe.Text = rpnName.Text = "暂无签署套餐".Translate();
rpnEndDate.Text = rpnPrice.Text = rpnCommissions.Text = "-";
rpnEndDay.Text = "0";
return;
}
rpnName.Text = package.NameTrans;
if (Work.WorkType.Work == type)
{
rpnCommissions.Text = package.Commissions.ToString("p0");
}
else
{
rpnCommissions.Text = (1 - package.Commissions).ToString("p0");
}
rpnDescribe.Text = package.Describe;
rpnPrice.Text = package.Price.ToString("N0");
rpnEndDate.Text = package.EndTime.ToString("MM/dd");
rpnLevelInNeed.Text = package.Level.ToString();
var totalhour = (package.EndTime - DateTime.Now).TotalHours;
if (totalhour <= 0)
rpnEndDay.Text = "0";
else if (totalhour <= 24)
rpnEndDay.Text = totalhour.ToString("f1");
else
rpnEndDay.Text = totalhour.ToString("f0");
}
private void tbtn_Agency_CheckChanged(object sender, RoutedEventArgs e)
{
@ -352,22 +413,37 @@ public partial class winWorkMenu : WindowX
return;
}
sliderTaskLevel.Maximum = mw.Core.Save.Level / 5 * 5;
if (mw.Core.Save.Level > 200)
sliderTaskLevel.TickFrequency = mw.Core.Save.Level / 100 * 5;
else
sliderTaskLevel.TickFrequency = 5;
if (sender == tbtnAgencyJob)
{
imgAgency.Source = mw.ImageSources.FindImage("work_" + mw.Set.PetGraph + "_agency_job", "work_agency_job");
tbtnAgencyTraning.IsChecked = false;
//TODO:加载套餐combTaskType
//加载套餐combTaskType
rTaskType.Text = "抽成".Translate();
combTaskType.Items.Clear();
foreach (var v in mw.SchedulePackage.FindAll(x => x.WorkType == Work.WorkType.Work))
combTaskType.Items.Add(v);
combTaskType.SelectedIndex = 0;
//加载现有套餐
rpnDisplay(mw.ScheduleTask.PackageWork, nowselefull.WorkType);
tbtnCurrentPlan.IsChecked = mw.ScheduleTask.PackageWork?.IsActive() == true;
}
else if (sender == tbtnAgencyTraning)
{
imgAgency.Source = mw.ImageSources.FindImage("work_" + mw.Set.PetGraph + "_agency_training", "work_agency_training");
tbtnAgencyJob.IsChecked = false;
rTaskType.Text = "效率".Translate();
combTaskType.Items.Clear();
foreach (var v in mw.SchedulePackage.FindAll(x => x.WorkType == Work.WorkType.Study))
combTaskType.Items.Add(v);
combTaskType.SelectedIndex = 0;
//加载现有套餐
rpnDisplay(mw.ScheduleTask.PackageStudy, nowselefull.WorkType);
tbtnCurrentPlan.IsChecked = mw.ScheduleTask.PackageStudy?.IsActive() == true;
}
}
@ -382,7 +458,31 @@ public partial class winWorkMenu : WindowX
private void btnSignAgency_Click(object sender, RoutedEventArgs e)
{
if (nowselefull == null) return;
Package package = new Package(nowselefull, (int)sliderTaskLevel.Value);
if (package.Price > mw.Core.Save.Money)
{
MessageBoxX.Show("金钱不足".Translate(), "签署失败".Translate());
return;
}
if (nowselefull.WorkType == Work.WorkType.Work)
{
if (mw.ScheduleTask.PackageWork?.IsActive() == true
&& MessageBoxX.Show("工作套餐已激活,是否替换?".Translate(), "套餐已激活".Translate(), MessageBoxButton.YesNo) == MessageBoxResult.No)
return;
mw.ScheduleTask.PackageWork = package;
rpnDisplay(mw.ScheduleTask.PackageWork, nowselefull.WorkType);
}
else
{
if (mw.ScheduleTask.PackageStudy?.IsActive() == true
&& MessageBoxX.Show("学习套餐已激活,是否替换?".Translate(), "套餐已激活".Translate(), MessageBoxButton.YesNo) == MessageBoxResult.No)
return;
mw.ScheduleTask.PackageStudy = package;
rpnDisplay(mw.ScheduleTask.PackageStudy, nowselefull.WorkType);
}
mw.Core.Save.Money -= package.Price;
MessageBoxX.Show("套餐 {0} 签署成功".Translate(package.NameTrans), "签署成功".Translate());
}
private void btn_addRest_Click(object sender, RoutedEventArgs e)
@ -479,7 +579,7 @@ public partial class winWorkMenu : WindowX
MessageBoxX.Show("工作套餐未激活,请前往日程表签署工作中介套餐".Translate(), "套餐未激活".Translate());
return;
}
else if (mw.ScheduleTask.PackageWork.Level > nowworkdisplay.LevelLimit)
else if (mw.ScheduleTask.PackageWork.Level < nowworkdisplay.LevelLimit)
{
MessageBoxX.Show("工作套餐等级不足({0}/{1}),\n请选择更低等级要求/倍率的工作或前往日程表签署新的工作中介套餐".Translate(mw.ScheduleTask.PackageWork.Level,
nowworkdisplay.LevelLimit), "套餐等级不足".Translate());
@ -493,7 +593,7 @@ public partial class winWorkMenu : WindowX
MessageBoxX.Show("学习套餐未激活,请前往日程表签署培训机构套餐".Translate(), "套餐未激活".Translate());
return;
}
else if (mw.ScheduleTask.PackageStudy.Level > nowworkdisplay.LevelLimit)
else if (mw.ScheduleTask.PackageStudy.Level < nowworkdisplay.LevelLimit)
{
MessageBoxX.Show("学习套餐等级不足({0}/{1}),\n请选择更低等级要求/倍率的学习或前往日程表签署新的培训机构套餐".Translate(mw.ScheduleTask.PackageStudy.Level,
nowworkdisplay.LevelLimit), "套餐等级不足".Translate());
@ -511,6 +611,39 @@ public partial class winWorkMenu : WindowX
break;
}
}
PackageFull nowselefull;
private void combTaskType_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!AllowChange) return;
if (combTaskType.SelectedItem is not PackageFull sf)
{
return;
}
nowselefull = sf;
nowselefullDisplay();
}
private void nowselefullDisplay()
{
if (nowselefull.WorkType == Work.WorkType.Work)
{
rCommissions.Text = nowselefull.Commissions.ToString("p0");
}
else
{
rCommissions.Text = (1 - nowselefull.Commissions).ToString("p0");
}
int level = (int)sliderTaskLevel.Value;
rLevelNeed.Text = ((int)(sliderTaskLevel.Value / nowselefull.LevelInNeed)).ToString();
rDuration.Text = nowselefull.Duration.ToString();
rpPrice.Text = ((200 * level - 100) * nowselefull.Price).ToString("N0");
rDescribe.Text = nowselefull.Describe;
}
private void sliderTaskLevel_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (!AllowChange) return;
nowselefullDisplay();
}
}

View File

@ -1,14 +1,14 @@
SchedulePackage:|Name#基础套餐:|Commissions#20%:|LevelInNeed#125%:|Duration#7:|Price#1:|Describe#基础套餐,给你们看标准的,反正也没人用。:|WorkType#Work:|
SchedulePackage:|Name#萌新套餐:|Commissions#35%:|LevelInNeed#105%:|Duration#7:|Price#0.8:|Describe#要求低,萌新很友好,但是抽成多了,欺负新来的。:|WorkType#Work:|
SchedulePackage:|Name#大佬套餐:|Commissions#5%:|LevelInNeed#140%:|Duration#14:|Price#0.2:|Describe#哇,等级好高!是大佬!:|WorkType#Work:|
SchedulePackage:|Name#实习:|Commissions#30%:|LevelInNeed#120%:|Duration#15:|Price#0.3:|Describe#记得实习证明叫单位盖章:|WorkType#Work:|
SchedulePackage:|Name#交学费:|Commissions#15%:|LevelInNeed#120%:|Duration#14:|Price#2.2:|Describe#上学交学费,工作也交学费:|WorkType#Work:|
SchedulePackage:|Name#桌宠会员专属:|Commissions#5%:|LevelInNeed#110%:|Duration#30:|Price#5.5:|Describe#《虚拟桌宠模拟器》会员专享权益多达11项功能首次开通连续包月只要4块.:|WorkType#Work:|
SchedulePackage:|Name#入职体验:|Commissions#20%:|LevelInNeed#120%:|Duration#1:|Price#0.8:|Describe#无要求体验一天,还是老板赚钱:|WorkType#Work:|
SchedulePackage:|Name#补习班:|Commissions#20%:|LevelInNeed#125%:|Duration#7:|Price#1:|Describe#非常普通的补习班,数据也很普通,让你怀疑怎么会出现在这里。:|WorkType#Study:|
SchedulePackage:|Name#从入门到入土:|Commissions#35%:|LevelInNeed#105%:|Duration#7:|Price#0.8:|Describe#报名就送《从入门到跑路》,《从入门到放弃》。:|WorkType#Study:|
SchedulePackage:|Name#老兵夏令营:|Commissions#5%:|LevelInNeed#140%:|Duration#14:|Price#0.2:|Describe#报名就送老兵烧烤5代金券:|WorkType#Study:|
SchedulePackage:|Name#速成班:|Commissions#30%:|LevelInNeed#120%:|Duration#15:|Price#0.3:|Describe#当你打了个喷嚏,老师已经开始讲下一本书了。:|WorkType#Study:|
SchedulePackage:|Name#暑假班:|Commissions#15%:|LevelInNeed#120%:|Duration#14:|Price#2.2:|Describe#如果暑假就是用来补课的那不如取消算了。:|WorkType#Study:|
SchedulePackage:|Name#体验课:|Commissions#20%:|LevelInNeed#120%:|Duration#1:|Price#0.8:|Describe#帅哥,美女,游泳健身了解一下。:|WorkType#Study:|
SchedulePackage:|Name#琪露诺的算术教室:|Commissions#50%:|LevelInNeed#100%:|Duration#14:|Price#0:|Describe#效率低很正常你能听懂50%已经是⑨级别了。:|WorkType#Study:|
SchedulePackage:|Name#基础套餐:|Commissions#0.2:|LevelInNeed#1.25:|Duration#7:|Price#1:|Describe#基础套餐,给你们看标准的,反正也没人用。:|WorkType#Work:|
SchedulePackage:|Name#萌新套餐:|Commissions#0.35:|LevelInNeed#1.05:|Duration#7:|Price#0.8:|Describe#要求低,萌新很友好,但是抽成多了,欺负新来的。:|WorkType#Work:|
SchedulePackage:|Name#大佬套餐:|Commissions#0.05:|LevelInNeed#1.4:|Duration#14:|Price#0.2:|Describe#哇,等级好高!是大佬!:|WorkType#Work:|
SchedulePackage:|Name#实习:|Commissions#0.3:|LevelInNeed#1.2:|Duration#15:|Price#0.3:|Describe#记得实习证明叫单位盖章:|WorkType#Work:|
SchedulePackage:|Name#交学费:|Commissions#0.15:|LevelInNeed#1.2:|Duration#14:|Price#2.2:|Describe#上学交学费,工作也交学费:|WorkType#Work:|
SchedulePackage:|Name#桌宠会员专属:|Commissions#0.05:|LevelInNeed#1.1:|Duration#30:|Price#5.5:|Describe#《虚拟桌宠模拟器》会员专享权益多达11项功能首次开通连续包月只要4块.:|WorkType#Work:|
SchedulePackage:|Name#入职体验:|Commissions#0.2:|LevelInNeed#1.2:|Duration#1:|Price#0.8:|Describe#无要求体验一天,还是老板赚钱:|WorkType#Work:|
SchedulePackage:|Name#补习班:|Commissions#0.2:|LevelInNeed#1.25:|Duration#7:|Price#1:|Describe#非常普通的补习班,数据也很普通,让你怀疑怎么会出现在这里。:|WorkType#Study:|
SchedulePackage:|Name#从入门到入土:|Commissions#0.35:|LevelInNeed#1.05:|Duration#7:|Price#0.8:|Describe#报名就送《从入门到放弃》,《从入门到跑路》。:|WorkType#Study:|
SchedulePackage:|Name#老兵夏令营:|Commissions#0.05:|LevelInNeed#1.4:|Duration#14:|Price#0.2:|Describe#报名就送老兵烧烤5代金券:|WorkType#Study:|
SchedulePackage:|Name#速成班:|Commissions#0.3:|LevelInNeed#1.2:|Duration#15:|Price#0.3:|Describe#当你打了个喷嚏,老师已经开始讲下一本书了。:|WorkType#Study:|
SchedulePackage:|Name#暑假班:|Commissions#0.15:|LevelInNeed#1.2:|Duration#14:|Price#2.2:|Describe#如果暑假就是用来补课的那不如取消算了。:|WorkType#Study:|
SchedulePackage:|Name#体验课:|Commissions#0.2:|LevelInNeed#1.2:|Duration#1:|Price#0.8:|Describe#帅哥,美女,游泳健身了解一下。:|WorkType#Study:|
SchedulePackage:|Name#琪露诺的算术教室:|Commissions#0.5:|LevelInNeed#1:|Duration#30:|Price#0:|Describe#效率低很正常你能听懂50%已经是⑨级别了。:|WorkType#Study:|