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: rotation condition comparation.
- Loading branch information
1 parent
a932dcc
commit c266442
Showing
9 changed files
with
266 additions
and
28 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using ECommons.ExcelServices; | ||
using Newtonsoft.Json.Linq; | ||
using RotationSolver.Basic.Configuration; | ||
using RotationSolver.Localization; | ||
|
||
namespace RotationSolver.UI.SearchableConfigs; | ||
|
||
internal class DragIntSearchPlugin : DragIntSearch | ||
{ | ||
private PluginConfigInt _config; | ||
|
||
public override string ID => _config.ToString(); | ||
|
||
public override string Name => _config.ToName(); | ||
|
||
public override string Description => _config.ToDescription(); | ||
|
||
public override Action DrawTooltip => _config.ToAction(); | ||
|
||
public override string Command => _config.ToCommand(); | ||
|
||
public DragIntSearchPlugin(PluginConfigInt config) | ||
{ | ||
_config = config; | ||
} | ||
|
||
public override void ResetToDefault() | ||
{ | ||
Service.ConfigNew.SetValue(_config, Service.ConfigNew.GetDefault(_config)); | ||
} | ||
|
||
protected override int GetValue(Job job) | ||
{ | ||
return Service.ConfigNew.GetValue(_config); | ||
} | ||
|
||
protected override void SetValue(Job job, int value) | ||
{ | ||
Service.ConfigNew.SetValue(_config, value); | ||
} | ||
} | ||
|
||
internal abstract class DragIntSearch : Searchable | ||
{ | ||
public int Min { get; } | ||
public int Max { get; } | ||
public float Speed { get; } | ||
protected abstract int GetValue(Job job); | ||
protected abstract void SetValue(Job job, int value); | ||
public override void Draw(Job job) | ||
{ | ||
var value = GetValue(job); | ||
if(ImGui.DragInt($"{Name}##Config_{ID}", ref value, Speed, Min, Max)) | ||
{ | ||
SetValue(job, value); | ||
} | ||
if (ImGui.IsItemHovered()) ShowTooltip(); | ||
} | ||
} |
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
Oops, something went wrong.