日程表:套餐部分

This commit is contained in:
ZouJin 2024-05-28 20:08:01 +08:00
parent 531c473f94
commit 490eb62bab
9 changed files with 120 additions and 17 deletions

View File

@ -140,7 +140,7 @@ public class ScheduleTask
}
if (ScheduleItems[NowIndex] is WorkScheduleItem wsi)
{
mw.Main.StartWork(wsi.Work);
mw.Main.StartWork(wsi.Work.Double(wsi.DBL));
NowIndex++;
}
else if (ScheduleItems[NowIndex] is RestScheduleItem rsi)
@ -163,6 +163,41 @@ public class ScheduleTask
public Package PackageWork { get; set; }
public Package PackageStudy { get; set; }
/// <summary>
/// 添加工作到日程表
/// </summary>
/// <param name="work">工作</param>
/// <param name="dbl">倍率</param>
public void AddWork(Work work, int dbl)
{
ScheduleItems.Add(new WorkScheduleItem(this, work, dbl));
}
/// <summary>
/// 添加学习到日程表
/// </summary>
/// <param name="work">工作</param>
/// <param name="dbl">倍率</param>
public void AddStudy(Work work, int dbl)
{
ScheduleItems.Add(new StudyScheduleItem(this, work, dbl));
}
/// <summary>
/// 添加游玩到日程表
/// </summary>
/// <param name="work">工作</param>
/// <param name="dbl">倍率</param>
public void AddPlay(Work work, int dbl)
{
ScheduleItems.Add(new PlayScheduleItem(this, work, dbl));
}
/// <summary>
/// 添加休息到日程表
/// </summary>
/// <param name="restTime">休息时间</param>
public void AddRest(int restTime)
{
ScheduleItems.Add(new RestScheduleItem(this, restTime));
}
/// <summary>
/// 日程表日程
/// </summary>
public class ScheduleItemBase : NotifyPropertyChangedBase
@ -296,6 +331,11 @@ public class ScheduleTask
/// 可用等级
/// </summary>
[Line] public int Level { get; set; }
/// <summary>
/// 是否生效
/// </summary>
/// <returns>判断套餐是否生效</returns>
public bool IsActive() => DateTime.Now < EndTime;
}
/// <summary>
/// 套餐详细

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 KiB

View File

@ -87,8 +87,6 @@
<None Remove="Res\img\rank6.png" />
<None Remove="Res\img\rbgb.png" />
<None Remove="Res\img\rbgt.png" />
<None Remove="Res\img\r_agency_job.png" />
<None Remove="Res\img\r_agency_training.png" />
<None Remove="Res\img\r_autobuy_1.png" />
<None Remove="Res\img\r_autobuy_2.png" />
<None Remove="Res\img\r_autobuy_3.png" />
@ -139,8 +137,6 @@
<Resource Include="Res\img\rank1.png" />
<Resource Include="Res\img\rank3.png" />
<Resource Include="Res\img\rbgb.png" />
<Resource Include="Res\img\r_agency_job.png" />
<Resource Include="Res\img\r_agency_training.png" />
<Resource Include="Res\img\r_mostfood_Food.png" />
<Resource Include="Res\remixicon.ttf" />
<Resource Include="vpeticon.ico">

View File

@ -4,7 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" Foreground="{StaticResource PrimaryText}"
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="375"
xmlns:local="clr-namespace:VPet_Simulator.Windows" mc:Ignorable="d" Title="{ll:Str 工作面板}" Height="400"
Style="{DynamicResource BaseWindowXStyle}" Background="{DynamicResource PrimaryLighter}" Width="650"
ResizeMode="CanMinimize" Closed="Window_Closed">
<pu:WindowX.Resources>
@ -136,7 +136,7 @@
</Grid>
<Button x:Name="btnAddAuto" Grid.Row="1" Content="{ll:Str 添加至日程表}" Padding="0"
Style="{DynamicResource ThemedButtonStyle}" Background="{DynamicResource PrimaryDarker}"
Click="btnStart_Click" Margin="5" Height="25" Visibility="Collapsed" />
Click="btnAddAuto_Click" Margin="5" Height="25" IsEnabled="False" />
<Button x:Name="btnStart" Grid.Row="2" Height="30" Content="{ll:Str 开始工作}"
Style="{DynamicResource ThemedButtonStyle}" Background="{DynamicResource PrimaryDarker}"
Click="btnStart_Click" FontSize="16" FontWeight="Bold" />
@ -190,7 +190,7 @@
</UniformGrid>
<Image x:Name="imgAgency" RenderOptions.BitmapScalingMode="HighQuality" Grid.Row="2"
Grid.RowSpan="2" Margin="-20,0" Stretch="Uniform"
Source="/Res/img/r_agency_job.png" />
Source="/Res/img/r_singleexp_3.png" />
<ToggleButton x:Name="tbtnCurrentPlan" Grid.Row="3" HorizontalAlignment="Right"
Style="{DynamicResource StandardToggleButtonStyle}" Padding="5,3"
Content="{ll:Str '当前套餐'}">
@ -228,8 +228,8 @@
<Slider x:Name="sliderTaskLevel" Grid.Row="2" pu:SliderHelper.ThumbWidth="10"
pu:SliderHelper.ThumbCornerRadius="2" pu:SliderHelper.ThumbHeight="16"
pu:SliderHelper.ThumbBorderThickness="2" SmallChange="1" Value="1"
Minimum="1" TickFrequency="1" IsSnapToTickEnabled="True" LargeChange="1"
Style="{DynamicResource StandardSliderStyle}"
Maximum="25" Minimum="15" TickFrequency="5" IsSnapToTickEnabled="True"
LargeChange="1" Style="{DynamicResource StandardSliderStyle}"
TickPlacement="BottomRight"></Slider>
<Grid Grid.Row="4" Margin="0,7,0,0">
<Grid.RowDefinitions>
@ -250,9 +250,13 @@
<TextBlock Grid.Row="1" Text="{ll:Str '等级需求'}" />
<TextBlock Grid.Row="1" Grid.Column="2" HorizontalAlignment="Right"
Foreground="{DynamicResource DARKPrimary}" Text="Lv 100" />
<TextBlock Grid.Row="2" Text="{ll:Str '合同持续时间'}" />
<TextBlock Grid.Row="2" Text="{ll:Str '持续时间'}" />
<TextBlock Grid.Row="2" Grid.Column="2" HorizontalAlignment="Right"
Foreground="{DynamicResource DARKPrimary}" Text="7 天" />
<TextBlock Grid.Row="3" Text="{ll:Str '描述'}" />
<TextBlock 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"
@ -300,6 +304,10 @@
<TextBlock Grid.Row="3" Text="{ll:Str '截止日期'}" />
<TextBlock 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 Grid.Row="5" Text="{ll:Str '办理费用'}" VerticalAlignment="Bottom" />
<TextBlock Grid.Row="5" Grid.Column="2" HorizontalAlignment="Right"
VerticalAlignment="Center"
@ -581,9 +589,11 @@
</Grid>
</TabItem>
</TabControl>
<Label x:Name="blockTask" Content="{ll:Str '日程表将在15级开放'}" Background="{DynamicResource DARKPrimaryTransA}"
<Label x:Name="blockTask" Content="{ll:Str '日程表将在15级开放'}"
Background="{DynamicResource DARKPrimaryTransA}"
Foreground="{DynamicResource DARKPrimaryText}" FontSize="36" FontWeight="Bold" Margin="-15"
VerticalContentAlignment="Center" HorizontalContentAlignment="Center" d:Visibility="Collapsed" />
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
d:Visibility="Collapsed" />
</Grid>
</Grid>
</Grid>

View File

@ -77,6 +77,8 @@ public partial class winWorkMenu : WindowX
_schedules = mw.ScheduleTask.ScheduleItems;
ShowImageDefault(type);
CalculateSceduleTime();
imgAgency.Source = mw.ImageSources.FindImage("work_" + mw.Set.PetGraph + "_agency_job", "work_agency_job");
if (mw.Core.Save.Level > 15)
blockTask.Visibility = Visibility.Collapsed;
AllowChange = true;
@ -180,21 +182,25 @@ public partial class winWorkMenu : WindowX
detailTypes.ItemsSource = _workDetails;
btnStart.Content = "开始工作".Translate();
ComboBoxHelper.SetWatermark(detailTypes, "---" + "请选择".Translate() + "工作".Translate() + "---");
btnAddAuto.IsEnabled = mw.ScheduleTask.PackageWork?.IsActive() == true;
break;
case 1:
detailTypes.ItemsSource = _studyDetails;
btnStart.Content = "开始学习".Translate();
ComboBoxHelper.SetWatermark(detailTypes, "---" + "请选择".Translate() + "学习".Translate() + "---");
btnAddAuto.IsEnabled = mw.ScheduleTask.PackageStudy?.IsActive() == true;
break;
case 2:
detailTypes.ItemsSource = _playDetails;
btnStart.Content = "开始玩耍".Translate();
ComboBoxHelper.SetWatermark(detailTypes, "---" + "请选择".Translate() + "玩耍".Translate() + "---");
btnAddAuto.IsEnabled = mw.Core.Save.Level >= 15;
break;
case 3:
detailTypes.ItemsSource = _starDetails;
btnStart.Content = "开始工作".Translate();
ComboBoxHelper.SetWatermark(detailTypes, "---" + "请选择".Translate() + "---");
btnAddAuto.IsEnabled = mw.Core.Save.Level >= 15;
break;
case 4:
gdWork.Visibility = Visibility.Collapsed;
@ -345,16 +351,23 @@ public partial class winWorkMenu : WindowX
{
return;
}
sliderTaskLevel.Maximum = mw.Core.Save.Level / 5 * 5;
if (sender == tbtnAgencyJob)
{
imgAgency.Source = new BitmapImage(new Uri($"pack://application:,,,/Res/img/r_agency_job.png"));
imgAgency.Source = mw.ImageSources.FindImage("work_" + mw.Set.PetGraph + "_agency_job", "work_agency_job");
tbtnAgencyTraning.IsChecked = false;
//TODO:加载套餐combTaskType
rTaskType.Text = "抽成".Translate();
}
else if (sender == tbtnAgencyTraning)
{
imgAgency.Source = new BitmapImage(new Uri($"pack://application:,,,/Res/img/r_agency_training.png"));
imgAgency.Source = mw.ImageSources.FindImage("work_" + mw.Set.PetGraph + "_agency_training", "work_agency_training");
tbtnAgencyJob.IsChecked = false;
rTaskType.Text = "效率".Translate();
}
}
@ -384,7 +397,7 @@ public partial class winWorkMenu : WindowX
}
else
{
_schedules.Add(new RestScheduleItem(mw.ScheduleTask, 30));
mw.ScheduleTask.AddRest(30);
}
}
else
@ -454,6 +467,50 @@ public partial class winWorkMenu : WindowX
_schedules.Remove(scheduleItem);
_schedules.Insert(Math.Min(index + 1, _schedules.Count), scheduleItem);
}
private void btnAddAuto_Click(object sender, RoutedEventArgs e)
{
//看看套餐
switch (nowwork.Type)
{
case Work.WorkType.Work:
if (mw.ScheduleTask.PackageWork?.IsActive() != true)
{
MessageBoxX.Show("工作套餐未激活,请前往日程表签署工作中介套餐".Translate(), "套餐未激活".Translate());
return;
}
else if (mw.ScheduleTask.PackageWork.Level > nowworkdisplay.LevelLimit)
{
MessageBoxX.Show("工作套餐等级不足({0}/{1}),\n请选择更低等级要求/倍率的工作或前往日程表签署新的工作中介套餐".Translate(mw.ScheduleTask.PackageWork.Level,
nowworkdisplay.LevelLimit), "套餐等级不足".Translate());
return;
}
mw.ScheduleTask.AddWork(nowwork, 30);
break;
case Work.WorkType.Study:
if (mw.ScheduleTask.PackageStudy?.IsActive() != true)
{
MessageBoxX.Show("学习套餐未激活,请前往日程表签署培训机构套餐".Translate(), "套餐未激活".Translate());
return;
}
else if (mw.ScheduleTask.PackageStudy.Level > nowworkdisplay.LevelLimit)
{
MessageBoxX.Show("学习套餐等级不足({0}/{1}),\n请选择更低等级要求/倍率的学习或前往日程表签署新的培训机构套餐".Translate(mw.ScheduleTask.PackageStudy.Level,
nowworkdisplay.LevelLimit), "套餐等级不足".Translate());
return;
}
mw.ScheduleTask.AddStudy(nowwork, 30);
break;
case Work.WorkType.Play:
if (mw.Core.Save.Level < 15)
{
MessageBoxX.Show("等级不足15级,无法使用日程表".Translate(), "等级不足".Translate());
return;
}
mw.ScheduleTask.AddPlay(nowwork, 30);
break;
}
}
}

View File

Before

Width:  |  Height:  |  Size: 624 KiB

After

Width:  |  Height:  |  Size: 624 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 KiB