Class GaugeUpdater
java.lang.Object
com.realtime.crossfire.jxclient.gui.gauge.GaugeUpdater
- Direct Known Subclasses:
ActiveSkillGaugeUpdater
,ActiveSkillGaugeUpdater2
,SkillGaugeUpdater
,StatGaugeUpdater
Updates the displayed values in a
GUIGauge
.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
GaugeUpdater
(@NotNull ExperienceTable experienceTable, boolean hideIfEmpty) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionabstract 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
(@NotNull 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, @NotNull String labelText, @NotNull String tooltipText) Updates the gauge values.
-
Constructor Details
-
GaugeUpdater
Creates a new instance.- Parameters:
experienceTable
- the experience table to queryhideIfEmpty
- if true the gauge will be hidden if all values are 0
-
-
Method Details
-
dispose
public abstract void dispose()Frees allocated resources. -
setGauge
Sets the gauge to update.- Parameters:
gauge
- the gauge
-
setValues
protected void setValues(int curValue, int minValue, int maxValue) Updates the gauge values.- Parameters:
curValue
- the current valueminValue
- the minimum valuemaxValue
- the maximum value
-
setValues
protected void setValues(int curValue, int minValue, int maxValue, @NotNull @NotNull String labelText, @NotNull @NotNull String tooltipText) Updates the gauge values.- Parameters:
curValue
- the current valueminValue
- the minimum valuemaxValue
- the maximum valuelabelText
- the text to draw on the gaugetooltipText
- the tooltip suffix
-
getPercentsToNextLevel
protected int getPercentsToNextLevel(int level, long experience) Returns the experience fraction of the current level.- Parameters:
level
- the levelexperience
- the experience- Returns:
- the fraction in percents
-
getExperienceToNextLevel
protected long getExperienceToNextLevel(int level, long experience) Returns the experience needed to reach next level.- Parameters:
level
- the levelexperience
- the experience- Returns:
- the needed experience
-