Merge pull request #2440 from deathbeam/infobox-new-system
More customization of component system
This commit is contained in:
@@ -31,6 +31,7 @@ import javax.inject.Inject;
|
|||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
public class AttackStylesOverlay extends Overlay
|
public class AttackStylesOverlay extends Overlay
|
||||||
{
|
{
|
||||||
@@ -49,13 +50,18 @@ public class AttackStylesOverlay extends Overlay
|
|||||||
@Override
|
@Override
|
||||||
public Dimension render(Graphics2D graphics)
|
public Dimension render(Graphics2D graphics)
|
||||||
{
|
{
|
||||||
|
panelComponent.getChildren().clear();
|
||||||
boolean warnedSkillSelected = plugin.isWarnedSkillSelected();
|
boolean warnedSkillSelected = plugin.isWarnedSkillSelected();
|
||||||
|
|
||||||
if (warnedSkillSelected || config.alwaysShowStyle())
|
if (warnedSkillSelected || config.alwaysShowStyle())
|
||||||
{
|
{
|
||||||
final String attackStyleString = plugin.getAttackStyle().getName();
|
final String attackStyleString = plugin.getAttackStyle().getName();
|
||||||
panelComponent.setTitleColor(warnedSkillSelected ? Color.RED : Color.WHITE);
|
|
||||||
panelComponent.setTitle(attackStyleString);
|
panelComponent.getChildren().add(TitleComponent.builder()
|
||||||
|
.text(attackStyleString)
|
||||||
|
.color(warnedSkillSelected ? Color.RED : Color.WHITE)
|
||||||
|
.build());
|
||||||
|
|
||||||
panelComponent.setPreferredSize(new Dimension(
|
panelComponent.setPreferredSize(new Dimension(
|
||||||
graphics.getFontMetrics().stringWidth(attackStyleString) + 10,
|
graphics.getFontMetrics().stringWidth(attackStyleString) + 10,
|
||||||
0));
|
0));
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ class BlastFurnaceOverlay extends Overlay
|
|||||||
@Inject
|
@Inject
|
||||||
BlastFurnaceOverlay(Client client, BlastFurnacePlugin plugin)
|
BlastFurnaceOverlay(Client client, BlastFurnacePlugin plugin)
|
||||||
{
|
{
|
||||||
setPosition(OverlayPosition.TOP_LEFT);
|
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
|
setPosition(OverlayPosition.TOP_LEFT);
|
||||||
imagePanelComponent.setOrientation(PanelComponent.Orientation.HORIZONTAL);
|
imagePanelComponent.setOrientation(PanelComponent.Orientation.HORIZONTAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public class CerberusOverlay extends Overlay
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.iconManager = iconManager;
|
this.iconManager = iconManager;
|
||||||
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||||
|
panelComponent.setOrientation(PanelComponent.Orientation.HORIZONTAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -60,8 +61,6 @@ public class CerberusOverlay extends Overlay
|
|||||||
}
|
}
|
||||||
|
|
||||||
panelComponent.getChildren().clear();
|
panelComponent.getChildren().clear();
|
||||||
panelComponent.setOrientation(PanelComponent.Orientation.HORIZONTAL);
|
|
||||||
panelComponent.setTitle("Ghost order");
|
|
||||||
|
|
||||||
// Ghosts are already sorted
|
// Ghosts are already sorted
|
||||||
plugin.getGhosts().stream()
|
plugin.getGhosts().stream()
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.IMA
|
|||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class AnagramClue extends ClueScroll implements TextClueScroll, NpcClueScroll, LocationClueScroll
|
public class AnagramClue extends ClueScroll implements TextClueScroll, NpcClueScroll, LocationClueScroll
|
||||||
@@ -167,7 +168,7 @@ public class AnagramClue extends ClueScroll implements TextClueScroll, NpcClueSc
|
|||||||
@Override
|
@Override
|
||||||
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin)
|
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin)
|
||||||
{
|
{
|
||||||
panelComponent.setTitle("Anagram Clue");
|
panelComponent.getChildren().add(TitleComponent.builder().text("Anagram Clue").build());
|
||||||
panelComponent.getChildren().add(LineComponent.builder().left("NPC:").build());
|
panelComponent.getChildren().add(LineComponent.builder().left("NPC:").build());
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
.left(getNpc())
|
.left(getNpc())
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.IMA
|
|||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class CipherClue extends ClueScroll implements TextClueScroll, NpcClueScroll, LocationClueScroll
|
public class CipherClue extends ClueScroll implements TextClueScroll, NpcClueScroll, LocationClueScroll
|
||||||
@@ -76,7 +77,7 @@ public class CipherClue extends ClueScroll implements TextClueScroll, NpcClueScr
|
|||||||
@Override
|
@Override
|
||||||
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin)
|
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin)
|
||||||
{
|
{
|
||||||
panelComponent.setTitle("Cipher Clue");
|
panelComponent.getChildren().add(TitleComponent.builder().text("Cipher Clue").build());
|
||||||
panelComponent.getChildren().add(LineComponent.builder().left("NPC:").build());
|
panelComponent.getChildren().add(LineComponent.builder().left("NPC:").build());
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
.left(getNpc())
|
.left(getNpc())
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import static net.runelite.client.plugins.cluescrolls.ClueScrollPlugin.SPADE_IMA
|
|||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -46,7 +47,7 @@ public class CoordinateClue extends ClueScroll implements TextClueScroll, Locati
|
|||||||
@Override
|
@Override
|
||||||
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin)
|
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin)
|
||||||
{
|
{
|
||||||
panelComponent.setTitle("Coordinate Clue");
|
panelComponent.getChildren().add(TitleComponent.builder().text("Coordinate Clue").build());
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
.left("Travel to the marked out destination to see a marker for where you should dig.")
|
.left("Travel to the marked out destination to see a marker for where you should dig.")
|
||||||
.build());
|
.build());
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.IMA
|
|||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueScroll, ObjectClueScroll
|
public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueScroll, ObjectClueScroll
|
||||||
@@ -338,7 +339,7 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc
|
|||||||
@Override
|
@Override
|
||||||
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin)
|
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin)
|
||||||
{
|
{
|
||||||
panelComponent.setTitle("Cryptic Clue");
|
panelComponent.getChildren().add(TitleComponent.builder().text("Cryptic Clue").build());
|
||||||
panelComponent.getChildren().add(LineComponent.builder().left("Clue:").build());
|
panelComponent.getChildren().add(LineComponent.builder().left("Clue:").build());
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
.left(getText())
|
.left(getText())
|
||||||
|
|||||||
@@ -415,6 +415,7 @@ import net.runelite.client.plugins.cluescrolls.clues.emote.SlotLimitationRequire
|
|||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClueScroll
|
public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClueScroll
|
||||||
@@ -582,8 +583,7 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
|
|||||||
@Override
|
@Override
|
||||||
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin)
|
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin)
|
||||||
{
|
{
|
||||||
panelComponent.setTitle("Emote Clue");
|
panelComponent.getChildren().add(TitleComponent.builder().text("Emote Clue").build());
|
||||||
|
|
||||||
panelComponent.getChildren().add(LineComponent.builder().left("Emotes:").build());
|
panelComponent.getChildren().add(LineComponent.builder().left("Emotes:").build());
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
.left(getFirstEmote().getName())
|
.left(getFirstEmote().getName())
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import static net.runelite.client.plugins.cluescrolls.ClueScrollPlugin.SPADE_IMA
|
|||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class FairyRingClue extends ClueScroll implements TextClueScroll, LocationClueScroll
|
public class FairyRingClue extends ClueScroll implements TextClueScroll, LocationClueScroll
|
||||||
@@ -66,7 +67,7 @@ public class FairyRingClue extends ClueScroll implements TextClueScroll, Locatio
|
|||||||
@Override
|
@Override
|
||||||
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin)
|
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin)
|
||||||
{
|
{
|
||||||
panelComponent.setTitle("Fairy Ring Clue");
|
panelComponent.getChildren().add(TitleComponent.builder().text("Fairy Ring Clue").build());
|
||||||
panelComponent.getChildren().add(LineComponent.builder().left("Code:").build());
|
panelComponent.getChildren().add(LineComponent.builder().left("Code:").build());
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
.left(getText().substring(0, 5))
|
.left(getText().substring(0, 5))
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.IMA
|
|||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class MapClue extends ClueScroll implements ObjectClueScroll
|
public class MapClue extends ClueScroll implements ObjectClueScroll
|
||||||
@@ -103,7 +104,7 @@ public class MapClue extends ClueScroll implements ObjectClueScroll
|
|||||||
@Override
|
@Override
|
||||||
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin)
|
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin)
|
||||||
{
|
{
|
||||||
panelComponent.setTitle("Map Clue");
|
panelComponent.getChildren().add(TitleComponent.builder().text("Map Clue").build());
|
||||||
|
|
||||||
if (objectId != -1)
|
if (objectId != -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ public class FightCaveOverlay extends Overlay
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
BufferedImage prayerImage = getPrayerImage(attack);
|
BufferedImage prayerImage = getPrayerImage(attack);
|
||||||
imagePanelComponent.setTitle("TzTok-Jad");
|
|
||||||
imagePanelComponent.getChildren().add(new ImageComponent(prayerImage));
|
imagePanelComponent.getChildren().add(new ImageComponent(prayerImage));
|
||||||
|
|
||||||
if (!client.isPrayerActive(attack.getPrayer()))
|
if (!client.isPrayerActive(attack.getPrayer()))
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import net.runelite.client.ui.overlay.Overlay;
|
|||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
class FishingOverlay extends Overlay
|
class FishingOverlay extends Overlay
|
||||||
{
|
{
|
||||||
@@ -86,13 +87,17 @@ class FishingOverlay extends Overlay
|
|||||||
if (client.getLocalPlayer().getInteracting() != null && client.getLocalPlayer().getInteracting().getName()
|
if (client.getLocalPlayer().getInteracting() != null && client.getLocalPlayer().getInteracting().getName()
|
||||||
.contains(FISHING_SPOT))
|
.contains(FISHING_SPOT))
|
||||||
{
|
{
|
||||||
panelComponent.setTitle("Fishing");
|
panelComponent.getChildren().add(TitleComponent.builder()
|
||||||
panelComponent.setTitleColor(Color.GREEN);
|
.text("Fishing")
|
||||||
|
.color(Color.GREEN)
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
panelComponent.setTitle("NOT fishing");
|
panelComponent.getChildren().add(TitleComponent.builder()
|
||||||
panelComponent.setTitleColor(Color.RED);
|
.text("NOT fishing")
|
||||||
|
.color(Color.RED)
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
int actions = xpTrackerService.getActions(Skill.FISHING);
|
int actions = xpTrackerService.getActions(Skill.FISHING);
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import net.runelite.client.ui.overlay.Overlay;
|
|||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
public class MotherlodeGemOverlay extends Overlay
|
public class MotherlodeGemOverlay extends Overlay
|
||||||
{
|
{
|
||||||
@@ -72,8 +73,7 @@ public class MotherlodeGemOverlay extends Overlay
|
|||||||
int sapphiresFound = session.getSapphiresFound();
|
int sapphiresFound = session.getSapphiresFound();
|
||||||
|
|
||||||
panelComponent.getChildren().clear();
|
panelComponent.getChildren().clear();
|
||||||
|
panelComponent.getChildren().add(TitleComponent.builder().text("Gems found").build());
|
||||||
panelComponent.setTitle("Gems found");
|
|
||||||
|
|
||||||
if (diamondsFound > 0)
|
if (diamondsFound > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,21 +32,13 @@ import java.time.Duration;
|
|||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_ADAMANT;
|
import static net.runelite.api.AnimationID.*;
|
||||||
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_BLACK;
|
|
||||||
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_BRONZE;
|
|
||||||
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_DRAGON;
|
|
||||||
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_DRAGON_ORN;
|
|
||||||
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_INFERNAL;
|
|
||||||
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_IRON;
|
|
||||||
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_MITHRIL;
|
|
||||||
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_RUNE;
|
|
||||||
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_STEEL;
|
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
class MotherlodeOverlay extends Overlay
|
class MotherlodeOverlay extends Overlay
|
||||||
{
|
{
|
||||||
@@ -100,19 +92,19 @@ class MotherlodeOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
if (MINING_ANIMATION_IDS.contains(client.getLocalPlayer().getAnimation()))
|
if (MINING_ANIMATION_IDS.contains(client.getLocalPlayer().getAnimation()))
|
||||||
{
|
{
|
||||||
panelComponent.setTitle("You are mining");
|
panelComponent.getChildren().add(TitleComponent.builder()
|
||||||
panelComponent.setTitleColor(Color.GREEN);
|
.text("Mining")
|
||||||
|
.color(Color.GREEN)
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
panelComponent.setTitle("You are NOT mining");
|
panelComponent.getChildren().add(TitleComponent.builder()
|
||||||
panelComponent.setTitleColor(Color.RED);
|
.text("NOT mining")
|
||||||
|
.color(Color.RED)
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
panelComponent.setTitle(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
.left("Pay-dirt mined:")
|
.left("Pay-dirt mined:")
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import net.runelite.api.widgets.Widget;
|
|||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.components.BackgroundComponent;
|
import net.runelite.client.ui.overlay.components.ComponentConstants;
|
||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ class MotherlodeSackOverlay extends Overlay
|
|||||||
Widget sack = client.getWidget(WidgetInfo.MOTHERLODE_MINE);
|
Widget sack = client.getWidget(WidgetInfo.MOTHERLODE_MINE);
|
||||||
|
|
||||||
panelComponent.getChildren().clear();
|
panelComponent.getChildren().clear();
|
||||||
panelComponent.setBackgroundColor(BackgroundComponent.DEFAULT_BACKGROUND_COLOR);
|
panelComponent.setBackgroundColor(ComponentConstants.STANDARD_BACKGROUND_COLOR);
|
||||||
|
|
||||||
if (sack != null)
|
if (sack != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import net.runelite.client.ui.overlay.OverlayPosition;
|
|||||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
public class RaidsOverlay extends Overlay
|
public class RaidsOverlay extends Overlay
|
||||||
{
|
{
|
||||||
@@ -66,13 +67,17 @@ public class RaidsOverlay extends Overlay
|
|||||||
|
|
||||||
if (plugin.getRaid() == null || plugin.getRaid().getLayout() == null)
|
if (plugin.getRaid() == null || plugin.getRaid().getLayout() == null)
|
||||||
{
|
{
|
||||||
panelComponent.setTitleColor(Color.RED);
|
panelComponent.getChildren().add(TitleComponent.builder()
|
||||||
panelComponent.setTitle("Unable to scout this raid!");
|
.text("Unable to scout this raid!")
|
||||||
|
.color(Color.RED)
|
||||||
|
.build());
|
||||||
|
|
||||||
return panelComponent.render(graphics);
|
return panelComponent.render(graphics);
|
||||||
}
|
}
|
||||||
|
|
||||||
panelComponent.setTitleColor(Color.WHITE);
|
panelComponent.getChildren().add(TitleComponent.builder()
|
||||||
panelComponent.setTitle("Raid scouter");
|
.text("Raid scouter")
|
||||||
|
.build());
|
||||||
|
|
||||||
Color color = Color.WHITE;
|
Color color = Color.WHITE;
|
||||||
String layout = plugin.getRaid().getLayout().toCode().replaceAll("#", "").replaceAll("¤", "");
|
String layout = plugin.getRaid().getLayout().toCode().replaceAll("#", "").replaceAll("¤", "");
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import net.runelite.client.ui.overlay.Overlay;
|
|||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
class WoodcuttingOverlay extends Overlay
|
class WoodcuttingOverlay extends Overlay
|
||||||
{
|
{
|
||||||
@@ -100,13 +101,17 @@ class WoodcuttingOverlay extends Overlay
|
|||||||
|
|
||||||
if (IntStream.of(animationIds).anyMatch(x -> x == client.getLocalPlayer().getAnimation()))
|
if (IntStream.of(animationIds).anyMatch(x -> x == client.getLocalPlayer().getAnimation()))
|
||||||
{
|
{
|
||||||
panelComponent.setTitle("Woodcutting");
|
panelComponent.getChildren().add(TitleComponent.builder()
|
||||||
panelComponent.setTitleColor(Color.GREEN);
|
.text("Woodcutting")
|
||||||
|
.color(Color.GREEN)
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
panelComponent.setTitle("NOT woodcutting");
|
panelComponent.getChildren().add(TitleComponent.builder()
|
||||||
panelComponent.setTitleColor(Color.RED);
|
.text("NOT woodcutting")
|
||||||
|
.color(Color.RED)
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
int actions = xpTrackerService.getActions(Skill.WOODCUTTING);
|
int actions = xpTrackerService.getActions(Skill.WOODCUTTING);
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ public class XpGlobesOverlay extends Overlay
|
|||||||
String skillCurrentXp = decimalFormat.format(mouseOverSkill.getCurrentXp());
|
String skillCurrentXp = decimalFormat.format(mouseOverSkill.getCurrentXp());
|
||||||
|
|
||||||
xpTooltip.getChildren().clear();
|
xpTooltip.getChildren().clear();
|
||||||
xpTooltip.setPosition(new java.awt.Point(x, y));
|
graphics.translate(x, y);
|
||||||
xpTooltip.setPreferredSize(new Dimension(TOOLTIP_RECT_SIZE_X, 0));
|
xpTooltip.setPreferredSize(new Dimension(TOOLTIP_RECT_SIZE_X, 0));
|
||||||
|
|
||||||
xpTooltip.getChildren().add(LineComponent.builder()
|
xpTooltip.getChildren().add(LineComponent.builder()
|
||||||
@@ -281,5 +281,6 @@ public class XpGlobesOverlay extends Overlay
|
|||||||
}
|
}
|
||||||
|
|
||||||
xpTooltip.render(graphics);
|
xpTooltip.render(graphics);
|
||||||
|
graphics.translate(-x, -y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,10 +35,9 @@ import net.runelite.client.ui.overlay.RenderableEntity;
|
|||||||
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@Setter
|
||||||
public class BackgroundComponent implements RenderableEntity
|
public class BackgroundComponent implements RenderableEntity
|
||||||
{
|
{
|
||||||
public static final Color DEFAULT_BACKGROUND_COLOR = new Color(70, 61, 50, 156);
|
|
||||||
|
|
||||||
private static final int BORDER_OFFSET = 2;
|
private static final int BORDER_OFFSET = 2;
|
||||||
|
|
||||||
private static final int OUTSIDE_STROKE_RED_OFFSET = 14;
|
private static final int OUTSIDE_STROKE_RED_OFFSET = 14;
|
||||||
@@ -51,13 +50,8 @@ public class BackgroundComponent implements RenderableEntity
|
|||||||
private static final int INSIDE_STROKE_BLUE_OFFSET = 19;
|
private static final int INSIDE_STROKE_BLUE_OFFSET = 19;
|
||||||
private static final int INSIDE_STROKE_ALPHA = 255;
|
private static final int INSIDE_STROKE_ALPHA = 255;
|
||||||
|
|
||||||
@Setter
|
private Color backgroundColor = ComponentConstants.STANDARD_BACKGROUND_COLOR;
|
||||||
private Color backgroundColor = DEFAULT_BACKGROUND_COLOR;
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Rectangle rectangle = new Rectangle();
|
private Rectangle rectangle = new Rectangle();
|
||||||
|
|
||||||
@Setter
|
|
||||||
private boolean fill = true;
|
private boolean fill = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.client.ui.overlay.components;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
|
||||||
|
public class ComponentConstants
|
||||||
|
{
|
||||||
|
public static final int STANDARD_BORDER = 4;
|
||||||
|
public static final int STANDARD_WIDTH = 129;
|
||||||
|
public static final Color STANDARD_BACKGROUND_COLOR = new Color(70, 61, 50, 156);
|
||||||
|
}
|
||||||
@@ -32,29 +32,19 @@ import java.awt.Point;
|
|||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import net.runelite.client.ui.overlay.RenderableEntity;
|
import net.runelite.client.ui.overlay.RenderableEntity;
|
||||||
|
|
||||||
|
@Setter
|
||||||
public class InfoBoxComponent implements RenderableEntity
|
public class InfoBoxComponent implements RenderableEntity
|
||||||
{
|
{
|
||||||
private static final int BOX_SIZE = 35;
|
private static final int BOX_SIZE = 35;
|
||||||
private static final int SEPARATOR = 2;
|
private static final int SEPARATOR = 2;
|
||||||
|
|
||||||
@Setter
|
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Color color = Color.WHITE;
|
private Color color = Color.WHITE;
|
||||||
|
private Color backgroundColor = ComponentConstants.STANDARD_BACKGROUND_COLOR;
|
||||||
@Setter
|
|
||||||
private Color backgroundColor = BackgroundComponent.DEFAULT_BACKGROUND_COLOR;
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Point position = new Point();
|
private Point position = new Point();
|
||||||
|
|
||||||
@Setter
|
|
||||||
@Nullable
|
|
||||||
private BufferedImage image;
|
private BufferedImage image;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ import lombok.Setter;
|
|||||||
@Builder
|
@Builder
|
||||||
public class LineComponent implements LayoutableRenderableEntity
|
public class LineComponent implements LayoutableRenderableEntity
|
||||||
{
|
{
|
||||||
private static final int SEPARATOR = 1;
|
|
||||||
|
|
||||||
private String left;
|
private String left;
|
||||||
private String right;
|
private String right;
|
||||||
|
|
||||||
@@ -50,7 +48,7 @@ public class LineComponent implements LayoutableRenderableEntity
|
|||||||
private Color rightColor = Color.WHITE;
|
private Color rightColor = Color.WHITE;
|
||||||
|
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private Dimension preferredSize = new Dimension();
|
private Dimension preferredSize = new Dimension(ComponentConstants.STANDARD_WIDTH, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dimension render(Graphics2D graphics)
|
public Dimension render(Graphics2D graphics)
|
||||||
@@ -107,7 +105,7 @@ public class LineComponent implements LayoutableRenderableEntity
|
|||||||
rightLineComponent.setText(rightText);
|
rightLineComponent.setText(rightText);
|
||||||
rightLineComponent.setColor(rightColor);
|
rightLineComponent.setColor(rightColor);
|
||||||
rightLineComponent.render(graphics);
|
rightLineComponent.render(graphics);
|
||||||
y += metrics.getHeight() + SEPARATOR;
|
y += metrics.getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Dimension(preferredSize.width, y);
|
return new Dimension(preferredSize.width, y);
|
||||||
@@ -124,7 +122,7 @@ public class LineComponent implements LayoutableRenderableEntity
|
|||||||
rightLineComponent.setText(right);
|
rightLineComponent.setText(right);
|
||||||
rightLineComponent.setColor(rightColor);
|
rightLineComponent.setColor(rightColor);
|
||||||
rightLineComponent.render(graphics);
|
rightLineComponent.render(graphics);
|
||||||
y += metrics.getHeight() + SEPARATOR;
|
y += metrics.getHeight();
|
||||||
|
|
||||||
return new Dimension(preferredSize.width, y);
|
return new Dimension(preferredSize.width, y);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.ui.overlay.components;
|
package net.runelite.client.ui.overlay.components;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.FontMetrics;
|
import java.awt.FontMetrics;
|
||||||
@@ -44,26 +43,11 @@ public class PanelComponent implements LayoutableRenderableEntity
|
|||||||
VERTICAL;
|
VERTICAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int TOP_BORDER = 4;
|
@Setter
|
||||||
private static final int LEFT_BORDER = 4;
|
private Color backgroundColor = ComponentConstants.STANDARD_BACKGROUND_COLOR;
|
||||||
private static final int RIGHT_BORDER = 4;
|
|
||||||
private static final int BOTTOM_BORDER = 4;
|
|
||||||
private static final int SEPARATOR = 1;
|
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private String title;
|
private Dimension preferredSize = new Dimension(ComponentConstants.STANDARD_WIDTH, 0);
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Color titleColor = Color.WHITE;
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Color backgroundColor = BackgroundComponent.DEFAULT_BACKGROUND_COLOR;
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Point position = new Point();
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Dimension preferredSize = new Dimension(129, 0);
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private List<LayoutableRenderableEntity> children = new ArrayList<>();
|
private List<LayoutableRenderableEntity> children = new ArrayList<>();
|
||||||
@@ -71,55 +55,52 @@ public class PanelComponent implements LayoutableRenderableEntity
|
|||||||
@Setter
|
@Setter
|
||||||
private Orientation orientation = Orientation.VERTICAL;
|
private Orientation orientation = Orientation.VERTICAL;
|
||||||
|
|
||||||
private final Dimension savedChildrenSize = new Dimension();
|
@Setter
|
||||||
|
private Rectangle border = new Rectangle(
|
||||||
|
ComponentConstants.STANDARD_BORDER,
|
||||||
|
ComponentConstants.STANDARD_BORDER,
|
||||||
|
ComponentConstants.STANDARD_BORDER,
|
||||||
|
ComponentConstants.STANDARD_BORDER);
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
private Point gap = new Point(0, 0);
|
||||||
|
|
||||||
|
private final Dimension childDimensions = new Dimension();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dimension render(Graphics2D graphics)
|
public Dimension render(Graphics2D graphics)
|
||||||
{
|
{
|
||||||
if (Strings.isNullOrEmpty(title) && children.isEmpty())
|
if (children.isEmpty())
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final FontMetrics metrics = graphics.getFontMetrics();
|
final FontMetrics metrics = graphics.getFontMetrics();
|
||||||
|
|
||||||
// Calculate panel dimensions
|
|
||||||
int width = preferredSize.width;
|
|
||||||
int height = preferredSize.height;
|
|
||||||
int x = LEFT_BORDER;
|
|
||||||
int y = TOP_BORDER + metrics.getHeight();
|
|
||||||
|
|
||||||
// Set graphics offset at correct position
|
|
||||||
graphics.translate(position.x, position.y);
|
|
||||||
|
|
||||||
// Render background
|
// Render background
|
||||||
final Dimension dimension = new Dimension(
|
final Dimension dimension = new Dimension(
|
||||||
savedChildrenSize.width + RIGHT_BORDER,
|
border.x + childDimensions.width + border.width,
|
||||||
savedChildrenSize.height + BOTTOM_BORDER);
|
border.y + childDimensions.height + border.height);
|
||||||
|
|
||||||
final BackgroundComponent backgroundComponent = new BackgroundComponent();
|
final BackgroundComponent backgroundComponent = new BackgroundComponent();
|
||||||
backgroundComponent.setRectangle(new Rectangle(dimension));
|
backgroundComponent.setRectangle(new Rectangle(dimension));
|
||||||
backgroundComponent.setBackgroundColor(backgroundColor);
|
backgroundComponent.setBackgroundColor(backgroundColor);
|
||||||
backgroundComponent.render(graphics);
|
backgroundComponent.render(graphics);
|
||||||
|
|
||||||
if (!Strings.isNullOrEmpty(title))
|
// Offset children
|
||||||
{
|
final int baseX = border.x;
|
||||||
// Render title
|
final int baseY = border.y + metrics.getHeight();
|
||||||
final TextComponent titleComponent = new TextComponent();
|
int width = 0;
|
||||||
titleComponent.setText(title);
|
int height = 0;
|
||||||
titleComponent.setColor(titleColor);
|
int x = baseX;
|
||||||
titleComponent.setPosition(new Point((dimension.width - metrics.stringWidth(title)) / 2, y));
|
int y = baseY;
|
||||||
titleComponent.render(graphics);
|
|
||||||
|
|
||||||
// Move children a bit
|
// Create child preferred size
|
||||||
height = y += metrics.getHeight() + SEPARATOR;
|
final Dimension childPreferredSize = new Dimension(
|
||||||
}
|
preferredSize.width - border.x - border.width,
|
||||||
|
preferredSize.height - border.y - border.height);
|
||||||
|
|
||||||
// Render all children
|
// Render all children
|
||||||
final Dimension childPreferredSize = new Dimension(
|
|
||||||
preferredSize.width - RIGHT_BORDER,
|
|
||||||
preferredSize.height - BOTTOM_BORDER);
|
|
||||||
|
|
||||||
for (final LayoutableRenderableEntity child : children)
|
for (final LayoutableRenderableEntity child : children)
|
||||||
{
|
{
|
||||||
child.setPreferredSize(childPreferredSize);
|
child.setPreferredSize(childPreferredSize);
|
||||||
@@ -130,24 +111,25 @@ public class PanelComponent implements LayoutableRenderableEntity
|
|||||||
switch (orientation)
|
switch (orientation)
|
||||||
{
|
{
|
||||||
case VERTICAL:
|
case VERTICAL:
|
||||||
height = y += childDimension.height + SEPARATOR;
|
height += childDimension.height + gap.y;
|
||||||
width = Math.max(width, x + childDimension.width);
|
y = baseY + height;
|
||||||
|
width = Math.max(width, childDimension.width);
|
||||||
break;
|
break;
|
||||||
case HORIZONTAL:
|
case HORIZONTAL:
|
||||||
width = x += childDimension.width + SEPARATOR;
|
width += childDimension.width + gap.x;
|
||||||
height = Math.max(height, y + childDimension.height);
|
x = baseX + width;
|
||||||
|
height = Math.max(height, childDimension.height);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the padding
|
// Remove last child gap
|
||||||
height -= metrics.getHeight();
|
width -= gap.x;
|
||||||
|
height -= gap.y;
|
||||||
|
|
||||||
// Save children size
|
// Cache children bounds
|
||||||
savedChildrenSize.setSize(width, height);
|
childDimensions.setSize(width, height);
|
||||||
|
|
||||||
// Reset graphics position
|
|
||||||
graphics.translate(-position.x, -position.y);
|
|
||||||
return dimension;
|
return dimension;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,28 +33,16 @@ import java.awt.Point;
|
|||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Setter
|
||||||
public class ProgressBarComponent implements LayoutableRenderableEntity
|
public class ProgressBarComponent implements LayoutableRenderableEntity
|
||||||
{
|
{
|
||||||
@Setter
|
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
@Setter
|
|
||||||
private double progress;
|
private double progress;
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Point position = new Point();
|
private Point position = new Point();
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Color foregroundColor = new Color(82, 161, 82);
|
private Color foregroundColor = new Color(82, 161, 82);
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Color backgroundColor = new Color(255, 255, 255, 127);
|
private Color backgroundColor = new Color(255, 255, 255, 127);
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Color fontColor = Color.WHITE;
|
private Color fontColor = Color.WHITE;
|
||||||
|
private Dimension preferredSize = new Dimension(ComponentConstants.STANDARD_WIDTH, 16);
|
||||||
@Setter
|
|
||||||
private Dimension preferredSize = new Dimension(129, 16);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dimension render(Graphics2D graphics)
|
public Dimension render(Graphics2D graphics)
|
||||||
|
|||||||
@@ -34,25 +34,14 @@ import lombok.Setter;
|
|||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.client.ui.overlay.RenderableEntity;
|
import net.runelite.client.ui.overlay.RenderableEntity;
|
||||||
|
|
||||||
|
@Setter
|
||||||
public class ProgressPieComponent implements RenderableEntity
|
public class ProgressPieComponent implements RenderableEntity
|
||||||
{
|
{
|
||||||
@Setter
|
|
||||||
private int diameter = 25;
|
private int diameter = 25;
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Color borderColor = Color.WHITE;
|
private Color borderColor = Color.WHITE;
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Color fill = Color.WHITE;
|
private Color fill = Color.WHITE;
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Stroke stroke = new BasicStroke(1);
|
private Stroke stroke = new BasicStroke(1);
|
||||||
|
|
||||||
@Setter
|
|
||||||
private double progress;
|
private double progress;
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Point position;
|
private Point position;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -33,19 +33,15 @@ import java.util.regex.Pattern;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import net.runelite.client.ui.overlay.RenderableEntity;
|
import net.runelite.client.ui.overlay.RenderableEntity;
|
||||||
|
|
||||||
|
@Setter
|
||||||
public class TextComponent implements RenderableEntity
|
public class TextComponent implements RenderableEntity
|
||||||
{
|
{
|
||||||
private static final String COL_TAG_REGEX = "(<col=([0-9a-fA-F]){2,6}>)";
|
private static final String COL_TAG_REGEX = "(<col=([0-9a-fA-F]){2,6}>)";
|
||||||
private static final Pattern COL_TAG_PATTERN_W_LOOKAHEAD = Pattern.compile("(?=" + COL_TAG_REGEX + ")");
|
private static final Pattern COL_TAG_PATTERN_W_LOOKAHEAD = Pattern.compile("(?=" + COL_TAG_REGEX + ")");
|
||||||
private static final Pattern COL_TAG_PATTERN = Pattern.compile(COL_TAG_REGEX);
|
private static final Pattern COL_TAG_PATTERN = Pattern.compile(COL_TAG_REGEX);
|
||||||
|
|
||||||
@Setter
|
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Point position = new Point();
|
private Point position = new Point();
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Color color = Color.WHITE;
|
private Color color = Color.WHITE;
|
||||||
|
|
||||||
public static String textWithoutColTags(String text)
|
public static String textWithoutColTags(String text)
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.client.ui.overlay.components;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.FontMetrics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Point;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Builder
|
||||||
|
public class TitleComponent implements LayoutableRenderableEntity
|
||||||
|
{
|
||||||
|
private String text;
|
||||||
|
|
||||||
|
@Builder.Default
|
||||||
|
private Color color = Color.WHITE;
|
||||||
|
|
||||||
|
@Builder.Default
|
||||||
|
private Dimension preferredSize = new Dimension(ComponentConstants.STANDARD_WIDTH, 0);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
final FontMetrics metrics = graphics.getFontMetrics();
|
||||||
|
final TextComponent titleComponent = new TextComponent();
|
||||||
|
titleComponent.setText(text);
|
||||||
|
titleComponent.setColor(color);
|
||||||
|
titleComponent.setPosition(new Point((preferredSize.width - metrics.stringWidth(text)) / 2, 0));
|
||||||
|
final Dimension dimension = titleComponent.render(graphics);
|
||||||
|
return new Dimension(Math.max(preferredSize.width, dimension.width), Math.max(preferredSize.height, dimension.height));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,22 +35,16 @@ import lombok.Setter;
|
|||||||
import net.runelite.api.IndexedSprite;
|
import net.runelite.api.IndexedSprite;
|
||||||
import net.runelite.client.ui.overlay.RenderableEntity;
|
import net.runelite.client.ui.overlay.RenderableEntity;
|
||||||
|
|
||||||
|
@Setter
|
||||||
public class TooltipComponent implements RenderableEntity
|
public class TooltipComponent implements RenderableEntity
|
||||||
{
|
{
|
||||||
private static final Pattern BR = Pattern.compile("</br>");
|
private static final Pattern BR = Pattern.compile("</br>");
|
||||||
private static final int OFFSET = 4;
|
private static final int OFFSET = 4;
|
||||||
private static final int MOD_ICON_WIDTH = 13; // they are generally 13px wide
|
private static final int MOD_ICON_WIDTH = 13; // they are generally 13px wide
|
||||||
|
|
||||||
@Setter
|
|
||||||
private String text;
|
private String text;
|
||||||
|
private Color backgroundColor = ComponentConstants.STANDARD_BACKGROUND_COLOR;
|
||||||
@Setter
|
|
||||||
private Color backgroundColor = BackgroundComponent.DEFAULT_BACKGROUND_COLOR;
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
private Point position = new Point();
|
private Point position = new Point();
|
||||||
|
|
||||||
@Setter
|
|
||||||
private IndexedSprite[] modIcons;
|
private IndexedSprite[] modIcons;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user