工作超模检查

This commit is contained in:
ZouJin 2023-08-26 07:23:30 +10:00
parent 2ff8a39694
commit 5661e7dc64
4 changed files with 44 additions and 7 deletions

View File

@ -152,13 +152,19 @@ namespace VPet_Simulator.Core
Work wwork; Work wwork;
Work wstudy; Work wstudy;
Work wplay; Work wplay;
public Func<Work, bool> WorkCheck;
public void StartWork(Work work) public void StartWork(Work work)
{ {
if (!m.Core.Controller.EnableFunction || m.Core.Save.Mode != GameSave.ModeType.Ill) if (!m.Core.Controller.EnableFunction || m.Core.Save.Mode != GameSave.ModeType.Ill)
if (!m.Core.Controller.EnableFunction || m.Core.Save.Level >= work.LevelLimit) 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)) if (m.State == Main.WorkingState.Work && m.StateID == m.Core.Graph.GraphConfig.Works.IndexOf(work))
m.WorkTimer.Stop(); m.WorkTimer.Stop();
else m.WorkTimer.Start(work); else
{
if (WorkCheck != null && !WorkCheck.Invoke(work))
return;
m.WorkTimer.Start(work);
}
else else
MessageBoxX.Show(LocalizeCore.Translate("您的桌宠等级不足{0}/{2}\n无法进行{1}", m.Core.Save.Level.ToString() MessageBoxX.Show(LocalizeCore.Translate("您的桌宠等级不足{0}/{2}\n无法进行{1}", m.Core.Save.Level.ToString()
, work.NameTrans, work.LevelLimit), LocalizeCore.Translate("{0}取消", work.NameTrans)); , work.NameTrans, work.LevelLimit), LocalizeCore.Translate("{0}取消", work.NameTrans));

View File

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static VPet_Simulator.Core.GraphHelper;
namespace VPet_Simulator.Windows.Interface
{
public static class ExtensionFunction
{
/// <summary>
/// 判断这个工作是否超模
/// </summary>
/// <param name="work">工作</param>
/// <returns>是否超模</returns>
public static bool IsOverLoad(Work work)
{//判断这个工作是否超模
var spend = (Math.Pow(work.StrengthFood * 2 + 1, 2) / 6 + Math.Pow(work.StrengthDrink * 2 + 1, 2) / 9 +
Math.Pow(work.Feeling * 2 + 1, 2) / 12) * (Math.Pow(work.LevelLimit / 2 + 1, 0.5) / 4 + 1) - 0.5;
var get = (work.MoneyBase + work.MoneyLevel * 10) * (work.MoneyLevel + 1) * (1 + work.FinishBonus / 2);
if(work.Type != Work.WorkType.Work)
{
get /= 12;//经验值换算
}
var rel = get / spend;
return rel > 2; // 推荐rel为1.0-1.4之间 超过2.0就是超模
}
}
}

View File

@ -115,6 +115,7 @@
<Reference Include="WindowsBase" /> <Reference Include="WindowsBase" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ExtensionFunction.cs" />
<Compile Include="IMainWindow.cs" /> <Compile Include="IMainWindow.cs" />
<Compile Include="Mod\ClickText.cs" /> <Compile Include="Mod\ClickText.cs" />
<Compile Include="Mod\ICheckText.cs" /> <Compile Include="Mod\ICheckText.cs" />

View File

@ -3,12 +3,12 @@ touchhead:|px#159:|py#16:|sw#189:|sh#178:|
touchraised:|happy_px#0:|happy_py#50:|happy_sw#500:|happy_sh#200:|nomal_px#0:|nomal_py#50:|nomal_sw#500:|nomal_sh#200:|poorcondition_px#0:|poorcondition_py#50:|poorcondition_sw#500:|poorcondition_sh#200:|ill_px#0:|ill_py#200:|ill_sw#500:|ill_sh#300:| touchraised:|happy_px#0:|happy_py#50:|happy_sw#500:|happy_sh#200:|nomal_px#0:|nomal_py#50:|nomal_sw#500:|nomal_sh#200:|poorcondition_px#0:|poorcondition_py#50:|poorcondition_sw#500:|poorcondition_sh#200:|ill_px#0:|ill_py#200:|ill_sw#500:|ill_sh#300:|
raisepoint:|happy_x#290:|happy_y#128:|nomal_x#290:|nomal_y#128:|poorcondition_x#290:|poorcondition_y#128:|ill_x#225:|ill_y#115:| raisepoint:|happy_x#290:|happy_y#128:|nomal_x#290:|nomal_y#128:|poorcondition_x#290:|poorcondition_y#128:|ill_x#225:|ill_y#115:|
work:|Type#Work:|Name#文案:|MoneyBase#8:|MoneyLevel#0.5:|Graph#workone:|StrengthFood#3.5:|StrengthDrink#2.5:|Feeling#1.5:|Time#60:|FinishBonus#0.1:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:| work:|Type#Work:|Name#文案:|MoneyBase#8:|MoneyLevel#0.5:|Graph#workone:|StrengthFood#3.5:|StrengthDrink#2.5:|Feeling#1.5:|Time#60:|FinishBonus#0.1:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:|
work:|Type#Work:|Name#清屏:|MoneyBase#16:|MoneyLevel#1:|Graph#workclean:|StrengthFood#7.5:|StrengthDrink#4.5:|Feeling#2.5:|Time#180:|FinishBonus#0.25:|LevelLimit#10:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:| work:|Type#Work:|Name#清屏:|MoneyBase#16:|MoneyLevel#1:|Graph#workclean:|StrengthFood#5:|StrengthDrink#4:|Feeling#2.5:|Time#90:|FinishBonus#0.2:|LevelLimit#10:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:|
work:|Type#Work:|Name#直播:|MoneyBase#30:|MoneyLevel#1.5:|Graph#worktwo:|StrengthFood#4.5:|StrengthDrink#7.5:|Feeling#2.5:|Time#180:|FinishBonus#0.25:|LevelLimit#20:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:| work:|Type#Work:|Name#直播:|MoneyBase#30:|MoneyLevel#1.5:|Graph#worktwo:|StrengthFood#4.5:|StrengthDrink#8.5:|Feeling#3:|Time#180:|FinishBonus#0.25:|LevelLimit#20:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:|
work:|Type#Study:|Name#学习:|MoneyBase#16:|MoneyLevel#2:|Graph#study:|StrengthFood#1.5:|StrengthDrink#2:|Feeling#3:|Time#45:|FinishBonus#0.2:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:| work:|Type#Study:|Name#学习:|MoneyBase#30:|MoneyLevel#2:|Graph#study:|StrengthFood#1.5:|StrengthDrink#2:|Feeling#3:|Time#45:|FinishBonus#0.2:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:|
work:|Type#Study:|Name#研究:|MoneyBase#30:|MoneyLevel#3:|Graph#studytwo:|StrengthFood#2.5:|StrengthDrink#3.5:|Feeling#4.5:|Time#75:|FinishBonus#0.4:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|LevelLimit#15:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:| work:|Type#Study:|Name#研究:|MoneyBase#60:|MoneyLevel#3:|Graph#studytwo:|StrengthFood#1.5:|StrengthDrink#3.5:|Feeling#4:|Time#75:|FinishBonus#0.4:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|LevelLimit#15:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:|
work:|Type#Play:|Name#玩游戏:|MoneyBase#10:|MoneyLevel#2:|Graph#playone:|StrengthFood#1.5:|StrengthDrink#1.5:|Feeling#4:|Time#30:|FinishBonus#0.2:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:| work:|Type#Play:|Name#玩游戏:|MoneyBase#10:|MoneyLevel#2:|Graph#playone:|StrengthFood#1:|StrengthDrink#0.5:|Feeling#4:|Time#30:|FinishBonus#0.2:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:|
///work:|Type#Play:|Name#删错误:|MoneyBase#10:|MoneyLevel#2:|Graph#removeobject:|StrengthFood#1:|StrengthDrink#0.5:|Feeling#4:|Time#60:|FinishBonus#0.25:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:|LevelLimit#6:| ///先注释掉,等动画补齐后再继续整 work:|Type#Play:|Name#删错误:|MoneyBase#10:|MoneyLevel#2:|Graph#removeobject:|StrengthFood#0.5:|StrengthDrink#0.5:|Feeling#4:|Time#60:|FinishBonus#0.25:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:|LevelLimit#6:|
move:|graph#climb.left:|LocateType#Left:|LocateLength#145:|TriggerLeft#100:|TriggerTop#200:|TriggerType#65:|CheckType#64:|CheckTop#100:|SpeedY#-10:|Distance#7:|ModeType#14:| move:|graph#climb.left:|LocateType#Left:|LocateLength#145:|TriggerLeft#100:|TriggerTop#200:|TriggerType#65:|CheckType#64:|CheckTop#100:|SpeedY#-10:|Distance#7:|ModeType#14:|
move:|graph#climb.left:|LocateType#Left:|LocateLength#145:|TriggerLeft#100:|TriggerBottom#200:|TriggerType#129:|CheckType#128:|CheckBottom#100:|SpeedY#10:|Distance#7:|ModeType#14:| move:|graph#climb.left:|LocateType#Left:|LocateLength#145:|TriggerLeft#100:|TriggerBottom#200:|TriggerType#129:|CheckType#128:|CheckBottom#100:|SpeedY#10:|Distance#7:|ModeType#14:|
move:|graph#climb.right:|LocateType#Right:|LocateLength#185:|TriggerRight#100:|TriggerTop#200:|TriggerType#66:|CheckType#64:|CheckTop#100:|SpeedY#-10:|Distance#7:|ModeType#14:| move:|graph#climb.right:|LocateType#Right:|LocateLength#185:|TriggerRight#100:|TriggerTop#200:|TriggerType#66:|CheckType#64:|CheckTop#100:|SpeedY#-10:|Distance#7:|ModeType#14:|