Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: code generator thing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Feb 5, 2024
1 parent beffdf2 commit 40c987b
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 24 deletions.
1 change: 0 additions & 1 deletion RotationSolver.Basic/Actions/BaseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public bool IsInCooldown

public bool EnoughLevel => Info.EnoughLevel;


public ActionSetting Setting { get; set; }

public ActionConfig Config
Expand Down
4 changes: 1 addition & 3 deletions RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public const string
public MacroInfo DutyEnd { get; set; } = new MacroInfo();

[ConditionBool, UI("Show RS logo animation",
Filter =UiWindows)]
Filter = UiWindows)]
private static readonly bool _drawIconAnimation = true;

[ConditionBool, UI("Auto turn off when player is moving between areas.",
Expand Down Expand Up @@ -80,8 +80,6 @@ public const string
Filter =UiInformation)]
private static readonly bool _showInfoOnToast = true;



[ConditionBool, UI("Lock the movement when casting or when doing some actions.",
Description = "LT is for gamepad player", Filter = Extra)]
private static readonly bool _poslockCasting = false;
Expand Down
1 change: 0 additions & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_GCD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ bool RaiseAction(out IAction act, bool ignoreCastingCheck)
protected virtual bool RaiseGCD(out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.RaiseGCD(out act) ?? false) return true;

act = null; return false;
}

Expand Down
10 changes: 8 additions & 2 deletions RotationSolver.SourceGenerators/JobChoiceConfigGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,15 @@ private void Execute(SourceProductionContext context, ImmutableArray<(VariableDe
{
get
{
if (!{{variableName}}Dict.TryGetValue(DataCenter.Job, out var dict)) return {{variableName}};
if (!{{variableName}}Dict.TryGetValue(DataCenter.Job, out var dict))
{
dict = {{variableName}}Dict[DataCenter.Job] = new();
}
if (!dict.TryGetValue(RotationChoice, out var value)) return {{variableName}};
if (!dict.TryGetValue(RotationChoice, out var value))
{
value = dict[RotationChoice] = {{variableName}};
}
return value;
}
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.SourceGenerators/JobConfigGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private void Execute(SourceProductionContext context, ImmutableArray<(VariableDe
get
{
if ({{variableName}}Dict.TryGetValue(DataCenter.Job, out var value)) return value;
return {{variableName}};
return {{variableName}}Dict[DataCenter.Job] = {{variableName}};
}
set
{
Expand Down
6 changes: 3 additions & 3 deletions RotationSolver/UI/RotationConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,7 @@ private static void DrawRotations()

private static void DrawRotationsSettings()
{
_allSearchables.DrawItems(Configs.Rotations);
_allSearchable.DrawItems(Configs.Rotations);
}

private static void DrawRotationsLoaded()
Expand Down Expand Up @@ -2078,7 +2078,7 @@ private static void DrawListActions()

ImGui.TableNextColumn();

_allSearchables.DrawItems(Configs.List);
_allSearchable.DrawItems(Configs.List);

ImGui.TextWrapped(UiString.ConfigWindow_List_HostileCastingAreaDesc.Local());

Expand Down Expand Up @@ -2338,7 +2338,7 @@ private static void DrawListTerritories()
#region Debug
private static void DrawDebug()
{
_allSearchables.DrawItems(Configs.Debug);
_allSearchable.DrawItems(Configs.Debug);

if (!Player.Available || !Service.Config.InDebug) return;

Expand Down
25 changes: 12 additions & 13 deletions RotationSolver/UI/RotationConfigWindow_Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using RotationSolver.Data;
using RotationSolver.Helpers;
using RotationSolver.Localization;
using RotationSolver.UI.SearchableConfigs;
using RotationSolver.UI.SearchableSettings;
using RotationSolver.Updaters;

Expand All @@ -19,13 +18,13 @@ public partial class RotationConfigWindow
private string _searchText = string.Empty;
private ISearchable[] _searchResults = [];

private static SearchableCollection _allSearchables = new();
private static SearchableCollection _allSearchable = new();

private void SearchingBox()
{
if (ImGui.InputTextWithHint("##Rotation Solver Search Box", UiString.ConfigWindow_Searching.Local(), ref _searchText, 128, ImGuiInputTextFlags.AutoSelectAll))
{
_searchResults = _allSearchables.SearchItems(_searchText);
_searchResults = _allSearchable.SearchItems(_searchText);
}
}

Expand Down Expand Up @@ -189,7 +188,7 @@ private static void DrawBasicTimer()

ImGui.Spacing();

_allSearchables.DrawItems(Configs.BasicTimer);
_allSearchable.DrawItems(Configs.BasicTimer);
}

private static readonly CollapsingHeaderGroup _autoSwitch = new(new()
Expand All @@ -212,7 +211,7 @@ private static void DrawBasicTimer()
};
private static void DrawBasicAutoSwitch()
{
_allSearchables.DrawItems(Configs.BasicAutoSwitch);
_allSearchable.DrawItems(Configs.BasicAutoSwitch);
_autoSwitch?.Draw();
}

Expand Down Expand Up @@ -268,7 +267,7 @@ private static void DrawBasicNamedConditions()

private static void DrawBasicOthers()
{
_allSearchables.DrawItems(Configs.BasicParams);
_allSearchable.DrawItems(Configs.BasicParams);

if (Service.Config.SayHelloToAll)
{
Expand Down Expand Up @@ -305,15 +304,15 @@ private static void DrawUI()
{
{
UiString.ConfigWindow_UI_Information.Local,
() => _allSearchables.DrawItems(Configs.UiInformation)
() => _allSearchable.DrawItems(Configs.UiInformation)
},
{
UiString.ConfigWindow_UI_Overlay.Local,
() =>_allSearchables.DrawItems(Configs.UiOverlay)
() =>_allSearchable.DrawItems(Configs.UiOverlay)
},
{
UiString.ConfigWindow_UI_Windows.Local,
() =>_allSearchables.DrawItems(Configs.UiWindows)
() =>_allSearchable.DrawItems(Configs.UiWindows)
},
});

Expand All @@ -334,7 +333,7 @@ private static void DrawAuto()
.Local());
ImGui.Separator();

_allSearchables.DrawItems(Configs.AutoActionUsage);
_allSearchable.DrawItems(Configs.AutoActionUsage);
}
},
{ UiString.ConfigWindow_Auto_ActionCondition.Local, DrawAutoActionCondition },
Expand Down Expand Up @@ -408,7 +407,7 @@ private static void DrawAutoActionCondition()
ImGui.TextWrapped(UiString.ConfigWindow_Auto_ActionCondition_Description.Local());
ImGui.Separator();

_allSearchables.DrawItems(Configs.AutoActionCondition);
_allSearchable.DrawItems(Configs.AutoActionCondition);
}
#endregion

Expand All @@ -426,7 +425,7 @@ private static void DrawTarget()

private static void DrawTargetConfig()
{
_allSearchables.DrawItems(Configs.TargetConfig);
_allSearchable.DrawItems(Configs.TargetConfig);
}

private static void DrawTargetHostile()
Expand Down Expand Up @@ -494,7 +493,7 @@ private static void DrawExtra()

{
UiString.ConfigWindow_Extra_Others.Local,
() => _allSearchables.DrawItems(Configs.Extra)
() => _allSearchable.DrawItems(Configs.Extra)
},
});

Expand Down

0 comments on commit 40c987b

Please sign in to comment.