Add config options for all parts of the info panel

This commit is contained in:
Patrick
2022-06-23 19:41:05 +04:00
parent 8bb93d80cf
commit 9dd3f3c6b6
2 changed files with 111 additions and 16 deletions

View File

@@ -100,4 +100,78 @@ public interface EasyGiantsFoundryConfig extends Config {
default boolean highlightKovac() {
return true;
}
@ConfigSection(
name = "Info Panel",
description = "Settings for the Info Panel overlay",
position = 1
)
String infoPanelList = "infoPanelList";
@ConfigItem(
keyName = "infoPanel",
name = "Draw Info Panel",
description = "Toggle for drawing the information panel",
position = 0,
section = infoPanelList
)
default boolean drawInfoPanel() {
return true;
}
@ConfigItem(
keyName = "infoPanel",
name = "Title",
description = "Toggle for \"Easy Giant's Foundry\" text",
position = 1,
section = infoPanelList
)
default boolean drawTitle() {
return true;
}
@ConfigItem(
keyName = "heatInfo",
name = "Heat",
description = "Toggle for Heat text",
position = 2,
section = infoPanelList
)
default boolean drawHeatInfo() {
return true;
}
@ConfigItem(
keyName = "stageInfo",
name = "Stage",
description = "Toggle for Stage text",
position = 3,
section = infoPanelList
)
default boolean drawStageInfo() {
return true;
}
@ConfigItem(
keyName = "actionsLeft",
name = "Actions Left",
description = "Toggle for Actions left text",
position = 4,
section = infoPanelList
)
default boolean drawActionsLeft() {
return true;
}
@ConfigItem(
keyName = "heatLeft",
name = "Heat Left",
description = "Toggle for Heat left text",
position = 5,
section = infoPanelList
)
default boolean drawHeatLeft() {
return true;
}
}

View File

@@ -19,11 +19,17 @@ import net.runelite.client.ui.overlay.components.TitleComponent;
@Singleton
public class FoundryOverlay2D extends OverlayPanel
{
@Inject
private EasyGiantsFoundryState state;
private EasyGiantsFoundryHelper helper;
private EasyGiantsFoundryConfig config;
@Inject
private EasyGiantsFoundryHelper helper;
private FoundryOverlay2D(EasyGiantsFoundryState state, EasyGiantsFoundryHelper helper, EasyGiantsFoundryConfig config)
{
this.state = state;
this.helper = helper;
this.config = config;
}
private Color getHeatColor(int actions, int heat)
{
@@ -43,7 +49,7 @@ public class FoundryOverlay2D extends OverlayPanel
@Override
public Dimension render(Graphics2D graphics)
{
if (!state.isEnabled() || state.getCurrentStage() == null)
if (!state.isEnabled() || state.getCurrentStage() == null || !config.drawInfoPanel())
{
return null;
}
@@ -51,23 +57,38 @@ public class FoundryOverlay2D extends OverlayPanel
Heat heat = state.getCurrentHeat();
Stage stage = state.getCurrentStage();
if (config.drawTitle())
{
panelComponent.getChildren().add(TitleComponent.builder().text("Easy Giant's Foundry").build());
}
if (config.drawHeatInfo())
{
panelComponent.getChildren().add(
LineComponent.builder().left("Heat").right(heat.getName() + " (" + state.getHeatAmount() / 10 + "%)").rightColor(heat.getColor()).build()
);
}
if (config.drawStageInfo())
{
panelComponent.getChildren().add(
LineComponent.builder().left("Stage").right(stage.getName() + " (" + state.getProgressAmount() / 10 + "%)").rightColor(stage.getHeat().getColor()).build()
);
}
int actionsLeft = helper.getActionsLeftInStage();
int heatLeft = helper.getActionsForHeatLevel();
if (config.drawActionsLeft())
{
panelComponent.getChildren().add(
LineComponent.builder().left("Actions left").right(actionsLeft + "").build()
);
}
if (config.drawHeatLeft())
{
panelComponent.getChildren().add(
LineComponent.builder().left("Heat left").right(heatLeft + "").rightColor(getHeatColor(actionsLeft, heatLeft)).build()
);
}
return super.render(graphics);
}