info boxes: sort boxes by priority
add high/med/low priority options and sort boxes by priority
This commit is contained in:
@@ -31,6 +31,7 @@ import net.runelite.api.Client;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBox;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxPriority;
|
||||
|
||||
public class BoostIndicator extends InfoBox
|
||||
{
|
||||
@@ -47,6 +48,7 @@ public class BoostIndicator extends InfoBox
|
||||
this.client = client;
|
||||
this.skill = skill;
|
||||
setTooltip(skill.getName() + " boost");
|
||||
setPriority(InfoBoxPriority.HIGH);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,6 +26,7 @@ package net.runelite.client.plugins.timers;
|
||||
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxPriority;
|
||||
import net.runelite.client.ui.overlay.infobox.Timer;
|
||||
|
||||
public class TimerTimer extends Timer
|
||||
@@ -36,6 +37,7 @@ public class TimerTimer extends Timer
|
||||
{
|
||||
super(timer.getDuration().toMillis(), ChronoUnit.MILLIS, timer.getImage(), plugin);
|
||||
this.timer = timer;
|
||||
setPriority(InfoBoxPriority.MED);
|
||||
}
|
||||
|
||||
public GameTimer getTimer()
|
||||
|
||||
@@ -27,6 +27,7 @@ package net.runelite.client.ui.overlay.infobox;
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
|
||||
public abstract class InfoBox
|
||||
@@ -36,12 +37,17 @@ public abstract class InfoBox
|
||||
@Getter
|
||||
private final Plugin plugin;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private InfoBoxPriority priority;
|
||||
|
||||
private String tooltip;
|
||||
|
||||
public InfoBox(BufferedImage image, Plugin plugin)
|
||||
{
|
||||
this.image = image;
|
||||
this.plugin = plugin;
|
||||
setPriority(InfoBoxPriority.NONE);
|
||||
}
|
||||
|
||||
public BufferedImage getImage()
|
||||
|
||||
@@ -96,6 +96,7 @@ public class InfoBoxManager
|
||||
{
|
||||
Collections.sort(infoBoxes, (b1, b2) -> ComparisonChain
|
||||
.start()
|
||||
.compare(b1.getPriority(), b2.getPriority())
|
||||
.compare(b1.getPlugin().getClass().getAnnotation(PluginDescriptor.class).name(), b2.getPlugin().getClass().getAnnotation(PluginDescriptor.class).name())
|
||||
.result());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Seth <http://github.com/sethtroll>
|
||||
* 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.infobox;
|
||||
|
||||
public enum InfoBoxPriority
|
||||
{
|
||||
HIGH,
|
||||
MED,
|
||||
NONE,
|
||||
LOW
|
||||
}
|
||||
Reference in New Issue
Block a user