public abstract class GaugeUpdater
extends java.lang.Object
GUIGauge
.Modifier and Type | Field and Description |
---|---|
private ExperienceTable |
experienceTable
The experience table to query.
|
private GUIGaugeListener |
gauge
Set the gauge to update.
|
private boolean |
hideIfEmpty
If true then the gauge should be hidden if all values are 0.
|
Modifier | Constructor and Description |
---|---|
protected |
GaugeUpdater(ExperienceTable experienceTable,
boolean hideIfEmpty)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
dispose()
Frees allocated resources.
|
protected long |
getExperienceToNextLevel(int level,
long experience)
Returns the experience needed to reach next level.
|
protected int |
getPercentsToNextLevel(int level,
long experience)
Returns the experience fraction of the current level.
|
void |
setGauge(GUIGaugeListener gauge)
Sets the gauge to update.
|
protected void |
setValues(int curValue,
int minValue,
int maxValue)
Updates the gauge values.
|
protected void |
setValues(int curValue,
int minValue,
int maxValue,
java.lang.String labelText,
java.lang.String tooltipText)
Updates the gauge values.
|
@NotNull private final ExperienceTable experienceTable
@Nullable private GUIGaugeListener gauge
private final boolean hideIfEmpty
protected GaugeUpdater(@NotNull ExperienceTable experienceTable, boolean hideIfEmpty)
experienceTable
- the experience table to queryhideIfEmpty
- if true the gauge will be hidden if all values are 0public abstract void dispose()
protected long getExperienceToNextLevel(int level, long experience)
level
- the levelexperience
- the experienceprotected int getPercentsToNextLevel(int level, long experience)
level
- the levelexperience
- the experiencepublic void setGauge(@NotNull GUIGaugeListener gauge)
gauge
- the gaugeprotected void setValues(int curValue, int minValue, int maxValue)
curValue
- the current valueminValue
- the minimum valuemaxValue
- the maximum valueprotected void setValues(int curValue, int minValue, int maxValue, @NotNull java.lang.String labelText, @NotNull java.lang.String tooltipText)
curValue
- the current valueminValue
- the minimum valuemaxValue
- the maximum valuelabelText
- the text to draw on the gaugetooltipText
- the tooltip suffix