This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add delay for all conditions in action sequencer.
- Loading branch information
1 parent
b2c34bd
commit e1009e9
Showing
8 changed files
with
75 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using RotationSolver.Localization; | ||
using RotationSolver.UI; | ||
|
||
namespace RotationSolver.ActionSequencer; | ||
|
||
internal abstract class BaseCondition : ICondition | ||
{ | ||
public float DelayMin = 0; | ||
public float DelayMax = 0; | ||
|
||
private RandomDelay _delay = new RandomDelay(); | ||
|
||
[JsonIgnore] | ||
private const float MIN = 0, MAX = 60; | ||
|
||
public bool IsTrue(ICustomRotation rotation) | ||
{ | ||
if (_delay.GetRange == null) | ||
{ | ||
_delay.GetRange = () => (DelayMin, DelayMax); | ||
} | ||
return _delay.Delay(IsTrueInside(rotation)); | ||
} | ||
|
||
public abstract bool IsTrueInside(ICustomRotation rotation); | ||
|
||
public void Draw(ICustomRotation rotation) | ||
{ | ||
ImGui.SetNextItemWidth(80 * ImGuiHelpers.GlobalScale); | ||
if(ImGui.DragFloatRange2($"##Random Delay {GetHashCode()}", ref DelayMin, ref DelayMax, 0.1f, MIN, MAX)) | ||
{ | ||
DelayMin = Math.Max(Math.Min(DelayMin, DelayMax), MIN); | ||
DelayMax = Math.Min(Math.Max(DelayMin, DelayMax), MAX); | ||
} | ||
ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ActionSequencer_Delay_Description); | ||
|
||
ImGui.SameLine(); | ||
DrawInside(rotation); | ||
} | ||
|
||
public abstract void DrawInside(ICustomRotation rotation); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters