corp: hide damage overlay

This commit is contained in:
Ron Young
2018-08-23 11:52:50 -05:00
parent 48be128122
commit c907d70c46
2 changed files with 26 additions and 10 deletions

View File

@@ -41,4 +41,15 @@ public interface CorpConfig extends Config
{
return true;
}
@ConfigItem(
keyName = "showDamage",
name = "Show damage overlay",
description = "Show total damage overlay",
position = 2
)
default boolean showDamage()
{
return true;
}
}

View File

@@ -47,17 +47,19 @@ class CorpDamageOverlay extends Overlay
{
private final Client client;
private final CorpPlugin corpPlugin;
private final CorpConfig config;
private final PanelComponent panelComponent = new PanelComponent();
@Inject
private CorpDamageOverlay(Client client, CorpPlugin corpPlugin)
private CorpDamageOverlay(Client client, CorpPlugin corpPlugin, CorpConfig config)
{
setPosition(OverlayPosition.TOP_LEFT);
setLayer(OverlayLayer.UNDER_WIDGETS);
setPriority(OverlayPriority.LOW);
this.client = client;
this.corpPlugin = corpPlugin;
this.config = config;
}
@Override
@@ -114,16 +116,19 @@ class CorpDamageOverlay extends Overlay
}
}
panelComponent.getChildren().add(LineComponent.builder()
.left("Your damage")
.right(Integer.toString(myDamage))
.rightColor(damageForKill > 0 && myDamage >= damageForKill ? Color.GREEN : Color.RED)
.build());
if (config.showDamage())
{
panelComponent.getChildren().add(LineComponent.builder()
.left("Your damage")
.right(Integer.toString(myDamage))
.rightColor(damageForKill > 0 && myDamage >= damageForKill ? Color.GREEN : Color.RED)
.build());
panelComponent.getChildren().add(LineComponent.builder()
.left("Total damage")
.right(Integer.toString(totalDamage))
.build());
panelComponent.getChildren().add(LineComponent.builder()
.left("Total damage")
.right(Integer.toString(totalDamage))
.build());
}
return panelComponent.render(graphics);
}