mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-13 12:14:18 +01:00
Fixed automated design selector being dumb.
This commit is contained in:
parent
bb42f35d7e
commit
7022fc4fc9
1 changed files with 18 additions and 18 deletions
|
|
@ -17,12 +17,12 @@ namespace Glamourer.Gui.Tabs.AutomationTab;
|
||||||
|
|
||||||
public class SetSelector : IDisposable
|
public class SetSelector : IDisposable
|
||||||
{
|
{
|
||||||
private readonly Configuration _config;
|
private readonly Configuration _config;
|
||||||
private readonly AutoDesignManager _manager;
|
private readonly AutoDesignManager _manager;
|
||||||
private readonly AutomationChanged _event;
|
private readonly AutomationChanged _event;
|
||||||
private readonly ActorService _actors;
|
private readonly ActorService _actors;
|
||||||
private readonly ObjectManager _objects;
|
private readonly ObjectManager _objects;
|
||||||
private readonly List<AutoDesignSet> _list = new();
|
private readonly List<(AutoDesignSet, int)> _list = new();
|
||||||
|
|
||||||
public AutoDesignSet? Selection { get; private set; }
|
public AutoDesignSet? Selection { get; private set; }
|
||||||
public int SelectionIndex { get; private set; } = -1;
|
public int SelectionIndex { get; private set; } = -1;
|
||||||
|
|
@ -117,11 +117,11 @@ public class SetSelector : IDisposable
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_list.Clear();
|
_list.Clear();
|
||||||
foreach (var set in _manager)
|
foreach (var (set, idx) in _manager.WithIndex())
|
||||||
{
|
{
|
||||||
var id = set.Identifiers[0].ToString();
|
var id = set.Identifiers[0].ToString();
|
||||||
if (CheckFilters(set, id))
|
if (CheckFilters(set, id))
|
||||||
_list.Add(set);
|
_list.Add((set, idx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -178,15 +178,15 @@ public class SetSelector : IDisposable
|
||||||
_endAction = null;
|
_endAction = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawSetSelectable(AutoDesignSet set, int index)
|
private void DrawSetSelectable((AutoDesignSet Set, int Index) pair)
|
||||||
{
|
{
|
||||||
using var id = ImRaii.PushId(index);
|
using var id = ImRaii.PushId(pair.Index);
|
||||||
using (var color = ImRaii.PushColor(ImGuiCol.Text, set.Enabled ? ColorId.EnabledAutoSet.Value() : ColorId.DisabledAutoSet.Value()))
|
using (var color = ImRaii.PushColor(ImGuiCol.Text, pair.Set.Enabled ? ColorId.EnabledAutoSet.Value() : ColorId.DisabledAutoSet.Value()))
|
||||||
{
|
{
|
||||||
if (ImGui.Selectable(GetSetName(set, index), set == Selection, ImGuiSelectableFlags.None, _selectableSize))
|
if (ImGui.Selectable(GetSetName(pair.Set, pair.Index), pair.Set == Selection, ImGuiSelectableFlags.None, _selectableSize))
|
||||||
{
|
{
|
||||||
Selection = set;
|
Selection = pair.Set;
|
||||||
SelectionIndex = index;
|
SelectionIndex = pair.Index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -194,13 +194,13 @@ public class SetSelector : IDisposable
|
||||||
var lineStart = new Vector2(ImGui.GetItemRectMin().X, lineEnd.Y);
|
var lineStart = new Vector2(ImGui.GetItemRectMin().X, lineEnd.Y);
|
||||||
ImGui.GetWindowDrawList().AddLine(lineStart, lineEnd, ImGui.GetColorU32(ImGuiCol.Border), ImGuiHelpers.GlobalScale);
|
ImGui.GetWindowDrawList().AddLine(lineStart, lineEnd, ImGui.GetColorU32(ImGuiCol.Border), ImGuiHelpers.GlobalScale);
|
||||||
|
|
||||||
DrawDragDrop(set, index);
|
DrawDragDrop(pair.Set, pair.Index);
|
||||||
|
|
||||||
var text = set.Identifiers[0].ToString();
|
var text = pair.Set.Identifiers[0].ToString();
|
||||||
if (IncognitoMode)
|
if (IncognitoMode)
|
||||||
text = set.Identifiers[0].Incognito(text);
|
text = pair.Set.Identifiers[0].Incognito(text);
|
||||||
var textSize = ImGui.CalcTextSize(text);
|
var textSize = ImGui.CalcTextSize(text);
|
||||||
var textColor = set.Identifiers.Any(_objects.ContainsKey) ? ColorId.AutomationActorAvailable : ColorId.AutomationActorUnavailable;
|
var textColor = pair.Set.Identifiers.Any(_objects.ContainsKey) ? ColorId.AutomationActorAvailable : ColorId.AutomationActorUnavailable;
|
||||||
ImGui.SetCursorPos(new Vector2(ImGui.GetContentRegionAvail().X - textSize.X,
|
ImGui.SetCursorPos(new Vector2(ImGui.GetContentRegionAvail().X - textSize.X,
|
||||||
ImGui.GetCursorPosY() - ImGui.GetTextLineHeightWithSpacing()));
|
ImGui.GetCursorPosY() - ImGui.GetTextLineHeightWithSpacing()));
|
||||||
ImGuiUtil.TextColored(textColor.Value(), text);
|
ImGuiUtil.TextColored(textColor.Value(), text);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue