attackstyles: Add a toggle to Always show style
This commit is contained in:
@@ -35,6 +35,17 @@ import net.runelite.client.config.ConfigItem;
|
|||||||
)
|
)
|
||||||
public interface AttackStylesConfig extends Config
|
public interface AttackStylesConfig extends Config
|
||||||
{
|
{
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "alwaysShowStyle",
|
||||||
|
name = "Always show style",
|
||||||
|
description = "Show attack style indicator at all times",
|
||||||
|
position = 1
|
||||||
|
)
|
||||||
|
default boolean alwaysShowStyle()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "warnForDefensive",
|
keyName = "warnForDefensive",
|
||||||
name = "Warn for defensive",
|
name = "Warn for defensive",
|
||||||
|
|||||||
@@ -37,24 +37,33 @@ public class AttackStylesOverlay extends Overlay
|
|||||||
private static final int COMPONENT_WIDTH = 80;
|
private static final int COMPONENT_WIDTH = 80;
|
||||||
|
|
||||||
private final AttackStylesPlugin plugin;
|
private final AttackStylesPlugin plugin;
|
||||||
|
private final AttackStylesConfig config;
|
||||||
private final PanelComponent panelComponent = new PanelComponent();
|
private final PanelComponent panelComponent = new PanelComponent();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AttackStylesOverlay(AttackStylesPlugin plugin)
|
public AttackStylesOverlay(AttackStylesPlugin plugin, AttackStylesConfig config)
|
||||||
{
|
{
|
||||||
setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT);
|
setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
this.config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dimension render(Graphics2D graphics)
|
public Dimension render(Graphics2D graphics)
|
||||||
{
|
{
|
||||||
final String attackStyleString = plugin.getAttackStyle().getName();
|
boolean warnedSkillSelected = plugin.isWarnedSkillSelected();
|
||||||
|
|
||||||
panelComponent.setTitleColor(plugin.isWarnedSkillSelected() ? Color.RED : Color.WHITE);
|
if (warnedSkillSelected || config.alwaysShowStyle())
|
||||||
panelComponent.setTitle(attackStyleString);
|
{
|
||||||
panelComponent.setWidth(COMPONENT_WIDTH);
|
final String attackStyleString = plugin.getAttackStyle().getName();
|
||||||
|
|
||||||
return panelComponent.render(graphics);
|
panelComponent.setTitleColor(warnedSkillSelected ? Color.RED : Color.WHITE);
|
||||||
|
panelComponent.setTitle(attackStyleString);
|
||||||
|
panelComponent.setWidth(COMPONENT_WIDTH);
|
||||||
|
|
||||||
|
return panelComponent.render(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user