 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.gui.label;
31 import java.awt.Color;
33 import org.jetbrains.annotations.NotNull;
34 import org.jetbrains.annotations.Nullable;
112 public void resetBefore() {
117 public void resetAfter() {
122 public void statChanged(
final int statNo,
final int value) {
130 public void simpleWeaponSpeedChanged(
final boolean simpleWeaponSpeed) {
135 public void titleChanged(@NotNull
final String title) {
140 public void godNameChanged(@NotNull
final String godName) {
145 public void rangeChanged(@NotNull
final String range) {
150 public void activeSkillChanged(@NotNull
final String activeSkill) {
155 public void experienceChanged(
final long exp) {
160 public void experienceNextLevelChanged(
final long expNextLevel) {
186 public GUILabelStats2(@NotNull
final TooltipManager tooltipManager, @NotNull
final GUIElementListener elementListener, @NotNull
final String
name, @NotNull
final Font font, @NotNull
final Color colorNormal, @NotNull
final Color
colorUpgradable, @NotNull
final Color
colorDepleted, @NotNull
final Color
colorBoosted, @NotNull
final Color
colorBoostedUpgradable, @Nullable
final Color
backgroundColor,
final int statCurrent,
final int statBase,
final int statRace,
final int statApplied, @NotNull
final Alignment alignment, @NotNull
final Stats stats, @NotNull
final GuiFactory guiFactory) {
187 super(
tooltipManager,
elementListener,
name,
null, font, colorNormal, colorNormal,
backgroundColor, alignment,
"",
guiFactory);
209 if (baseValue == 0 && raceValue == 0) {
211 color = super.getTextColor();
212 setText(String.valueOf(currValue));
217 final int currValueWithoutGear = currValue-appliedValue;
218 final Color newColor;
219 if (currValueWithoutGear < baseValue) {
221 }
else if (currValueWithoutGear == baseValue) {
222 newColor = baseValue < raceValue ?
colorUpgradable : super.getTextColor();
226 if (
color != newColor) {
230 setText(String.valueOf(currValue));
241 @SuppressWarnings(
"MethodDoesntCallSuperMethod")
248 @SuppressWarnings(
"MethodDoesntCallSuperMethod")
253 if (baseValue == 0 && raceValue == 0) {
257 final StringBuilder sb =
new StringBuilder();
258 sb.append(
"<html>Current: ").append(currValue);
260 final int currValueWithoutGear = currValue-appliedValue;
261 if (currValueWithoutGear < baseValue) {
262 sb.append(
"<br>Depleted by ").append(baseValue-currValueWithoutGear).append(
" from ").append(baseValue).append(
".");
263 }
else if (currValueWithoutGear > baseValue) {
264 sb.append(
"<br>Increased by ").append(currValueWithoutGear-baseValue).append(
" from ").append(baseValue).append(
".");
266 if (appliedValue > 0) {
267 sb.append(
"<br>Boosted by ").append(appliedValue).append(
" by gear or skills.");
268 }
else if (appliedValue < 0) {
269 sb.append(
"<br>Reduced by ").append(-appliedValue).append(
" by gear or skills.");
271 if (baseValue < raceValue) {
272 sb.append(
"<br>Upgradable to ").append(raceValue).append(
" by drinking stat potions.");
void tooltipChanged()
Must be called whenever the tooltip may have changed.
final int statRace
The race's maximum stat.
final int statCurrent
The current stat.
final Color backgroundColor
If set, the opaque background color.
final Color colorBoostedUpgradable
The color for boosted and upgradable stats.
void setChanged()
Records that the contents have changed and must be repainted.
final Color colorDepleted
The color for depleted stats.
final StatsListener statsListener
The StatsListener registered to be notified about stat changes.
final GUIElementListener elementListener
The GUIElementListener to notify.
GUILabelStats2(@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, @NotNull final Font font, @NotNull final Color colorNormal, @NotNull final Color colorUpgradable, @NotNull final Color colorDepleted, @NotNull final Color colorBoosted, @NotNull final Color colorBoostedUpgradable, @Nullable final Color backgroundColor, final int statCurrent, final int statBase, final int statRace, final int statApplied, @NotNull final Alignment alignment, @NotNull final Stats stats, @NotNull final GuiFactory guiFactory)
Creates a new instance.
void removeCrossfireStatsListener(@NotNull final StatsListener statsListener)
Removes a StatsListener to be notified about stat changes.
void addCrossfireStatsListener(@NotNull final StatsListener statsListener)
Adds a StatsListener to be notified about stat changes.
TooltipText getTooltip()
Returns the current tooltip text.
final Stats stats
The Stats instance to use.
final int statBase
The base stat without applied boosts or depletions.
A GUILabel that displays a value of the last received "stats" command.
void setText(@NotNull final String text)
Sets the label text.
This is the representation of all the statistics of a player, like its speed or its experience.
final GuiFactory guiFactory
The global GuiFactory instance.
TooltipText newTooltipText(@Nullable final String tooltipText)
Creates a TooltipText instance relative to this instance.
final int statApplied
The stat change due to gear or skills.
final Color colorBoosted
The color for boosted stats.
Information for displaying tooltips.
Factory for creating Gui instances.
final String name
The name of this element.
final Color colorUpgradable
The color for upgradable stats.
Color color
The current color.
static final long serialVersionUID
The serial version UID.
void updateStat()
Updates the values to reflect the current stat value.
void dispose()
Releases all allocated resources.
final TooltipManager tooltipManager
The TooltipManager to update.
int getStat(final int statNo)
Returns the numerical value of the given statistic.
A AbstractLabel that renders the text as a plain string.
Interface for listeners interested in changes of Stats instances.
Color getTextColor()
Returns the text color.
Listener for GUIElement related events.