feat(engine): Inventory HUDs button in Avalonia Settings inventory section
Sends /ra huds show to the RynthAi plugin. Includes the floating HUDs changelog (RynthAi 0.6.23). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
fe1cad1146
commit
75a1f63c68
3 changed files with 145 additions and 0 deletions
|
|
@ -1600,6 +1600,16 @@ internal static partial class RynthAiPanel
|
|||
/// typing "/ra <action> <value>". The plugin copies both strings and applies
|
||||
/// the command on its pump thread, so the buffers can be freed as soon as this returns.
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Lets other engine panels send a "/ra <action> <value>" command to the RynthAi
|
||||
/// plugin, binding the plugin export first if this panel has not done so yet.
|
||||
/// </summary>
|
||||
internal static void SendRynthAiCommand(string action, string value)
|
||||
{
|
||||
if (_applyRemoteCommand == null) TryBind();
|
||||
SendRemoteCmd(action, value);
|
||||
}
|
||||
|
||||
private static void SendRemoteCmd(string action, string value)
|
||||
{
|
||||
if (_applyRemoteCommand == null)
|
||||
|
|
|
|||
|
|
@ -961,6 +961,10 @@ internal static class SettingsPanel
|
|||
p.Children.Add(BoolRow("Combine Bags During Salvage", state.Data.CombineBagsDuringSalvage,
|
||||
v => { state.Data.CombineBagsDuringSalvage = v; Push(state); },
|
||||
"When salvaging an item, also add any under-full salvage bag of the same material to the salvage panel."));
|
||||
// The HUD windows are ImGui windows owned by the RynthAi plugin, so the engine only asks it to open them.
|
||||
p.Children.Add(ButtonRow("Floating HUDs", "Inventory HUDs...",
|
||||
() => RynthAiPanel.SendRynthAiCommand("huds", "show"),
|
||||
"Opens the item count HUD / Mini Remote setup window (/ra huds)."));
|
||||
|
||||
p.Children.Add(Spacer());
|
||||
p.Children.Add(SectionHeader("Loot Timers (ms)"));
|
||||
|
|
@ -1318,6 +1322,44 @@ internal static class SettingsPanel
|
|||
return row;
|
||||
}
|
||||
|
||||
/// <summary>Label on the left, a single action button on the right.</summary>
|
||||
private static Control ButtonRow(string label, string buttonText, Action onClick, string? tooltip = null)
|
||||
{
|
||||
var btn = new Button
|
||||
{
|
||||
Content = buttonText,
|
||||
FontSize = 10,
|
||||
Height = 20,
|
||||
MinWidth = 160,
|
||||
Padding = new Thickness(4, 1),
|
||||
Background = ColBtnFill,
|
||||
Foreground = ColTextDim,
|
||||
BorderBrush = ColBtnBord,
|
||||
BorderThickness = new Thickness(1),
|
||||
HorizontalContentAlignment = HorizontalAlignment.Center,
|
||||
};
|
||||
btn.Click += (_, _) => onClick();
|
||||
|
||||
var row = new Grid
|
||||
{
|
||||
ColumnDefinitions = new ColumnDefinitions("*,Auto"),
|
||||
Margin = new Thickness(0, 2, 0, 2),
|
||||
Height = 22,
|
||||
};
|
||||
var lblBlock = new TextBlock { Text = label, Foreground = ColTextDim, FontSize = 11, VerticalAlignment = VerticalAlignment.Center };
|
||||
Grid.SetColumn(lblBlock, 0);
|
||||
Grid.SetColumn(btn, 1);
|
||||
row.Children.Add(lblBlock);
|
||||
row.Children.Add(btn);
|
||||
|
||||
if (tooltip != null)
|
||||
{
|
||||
ToolTip.SetTip(row, tooltip);
|
||||
ToolTip.SetShowDelay(row, 400);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
// SimpleTheme wraps TextBox content in a ScrollViewer, and its vertical
|
||||
// scrollbar's up RepeatButton is a filled triangle Path. On these short
|
||||
// (Height=20) single-line numeric fields that scrollbar shows and the
|
||||
|
|
|
|||
Loading…
Reference in a new issue