v1.2.0: buff icons in the full UI now use text to convey state
This commit is contained in:
parent
5fd5205a68
commit
8ce8d485dc
|
@ -67,6 +67,11 @@ public class AdrenalineSurge extends Buff {
|
||||||
return Math.max(0, (DURATION - visualcooldown()) / DURATION);
|
return Math.max(0, (DURATION - visualcooldown()) / DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString((int)visualcooldown());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -87,6 +87,11 @@ public class ArcaneArmor extends Buff {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(level);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -96,6 +96,11 @@ public class ArtifactRecharge extends Buff {
|
||||||
return Math.max(0, (DURATION - left) / DURATION);
|
return Math.max(0, (DURATION - left) / DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString((int)left);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -82,6 +82,11 @@ public class Barkskin extends Buff {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(level);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -82,6 +82,11 @@ public class Barrier extends ShieldBuff {
|
||||||
icon.hardlight(0.5f, 1f, 2f);
|
icon.hardlight(0.5f, 1f, 2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(shielding());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -35,6 +35,8 @@ import com.watabou.noosa.audio.Sample;
|
||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
import com.watabou.utils.GameMath;
|
import com.watabou.utils.GameMath;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
public class Berserk extends Buff {
|
public class Berserk extends Buff {
|
||||||
|
|
||||||
private enum State{
|
private enum State{
|
||||||
|
@ -192,6 +194,15 @@ public class Berserk extends Buff {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String iconTextDisplay(){
|
||||||
|
switch (state){
|
||||||
|
case NORMAL: case BERSERK: default:
|
||||||
|
return (int)(power*100) + "%";
|
||||||
|
case RECOVERING:
|
||||||
|
return new DecimalFormat("#.#").format(levelRecovery);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
switch (state){
|
switch (state){
|
||||||
|
|
|
@ -68,6 +68,11 @@ public class Bleeding extends Buff {
|
||||||
return BuffIndicator.BLEEDING;
|
return BuffIndicator.BLEEDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(Math.round(level));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -103,6 +103,11 @@ public class Buff extends Actor {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//text to display on large buff icons in the desktop UI
|
||||||
|
public String iconTextDisplay(){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
//visual effect usually attached to the sprite of the character the buff is attacked to
|
//visual effect usually attached to the sprite of the character the buff is attacked to
|
||||||
public void fx(boolean on) {
|
public void fx(boolean on) {
|
||||||
//do nothing by default
|
//do nothing by default
|
||||||
|
|
|
@ -182,6 +182,11 @@ public class Burning extends Buff implements Hero.Doom {
|
||||||
return Math.max(0, (DURATION - left) / DURATION);
|
return Math.max(0, (DURATION - left) / DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString((int)left);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fx(boolean on) {
|
public void fx(boolean on) {
|
||||||
if (on) target.sprite.add(CharSprite.State.BURNING);
|
if (on) target.sprite.add(CharSprite.State.BURNING);
|
||||||
|
|
|
@ -77,6 +77,11 @@ public class Combo extends Buff implements ActionIndicator.Action {
|
||||||
return Math.max(0, (initialComboTime - comboTime)/ initialComboTime);
|
return Math.max(0, (initialComboTime - comboTime)/ initialComboTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString((int)comboTime);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -71,6 +71,11 @@ public class Corrosion extends Buff implements Hero.Doom {
|
||||||
icon.hardlight(1f, 0.5f, 0f);
|
icon.hardlight(1f, 0.5f, 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString((int)damage);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -102,6 +102,11 @@ public class Dread extends Buff {
|
||||||
return Math.max(0, (DURATION - left) / DURATION);
|
return Math.max(0, (DURATION - left) / DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(left);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tintIcon(Image icon) {
|
public void tintIcon(Image icon) {
|
||||||
icon.hardlight(1, 0, 0);
|
icon.hardlight(1, 0, 0);
|
||||||
|
|
|
@ -44,6 +44,11 @@ public class Drowsy extends Buff {
|
||||||
return Math.max(0, (DURATION - visualcooldown()) / DURATION);
|
return Math.max(0, (DURATION - visualcooldown()) / DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString((int)visualcooldown());
|
||||||
|
}
|
||||||
|
|
||||||
public boolean attachTo(Char target ) {
|
public boolean attachTo(Char target ) {
|
||||||
if (!target.isImmune(Sleep.class) && super.attachTo(target)) {
|
if (!target.isImmune(Sleep.class) && super.attachTo(target)) {
|
||||||
if (cooldown() == 0) {
|
if (cooldown() == 0) {
|
||||||
|
|
|
@ -91,7 +91,12 @@ public class FireImbue extends Buff {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float iconFadePercent() {
|
public float iconFadePercent() {
|
||||||
return Math.max(0, (DURATION - left+1) / DURATION);
|
return Math.max(0, (DURATION - left) / DURATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString((int)left);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,4 +34,9 @@ public class FlavourBuff extends Buff {
|
||||||
protected String dispTurns() {
|
protected String dispTurns() {
|
||||||
return dispTurns(visualcooldown());
|
return dispTurns(visualcooldown());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString((int)visualcooldown());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,11 @@ public class Healing extends Buff {
|
||||||
return BuffIndicator.HEALING;
|
return BuffIndicator.HEALING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(healingLeft);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -135,6 +135,17 @@ public class Momentum extends Buff implements ActionIndicator.Action {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
if (freerunTurns > 0){
|
||||||
|
return Integer.toString(freerunTurns);
|
||||||
|
} else if (freerunCooldown > 0){
|
||||||
|
return Integer.toString(freerunCooldown);
|
||||||
|
} else {
|
||||||
|
return Integer.toString(momentumStacks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (freerunTurns > 0){
|
if (freerunTurns > 0){
|
||||||
|
|
|
@ -62,6 +62,11 @@ public class Ooze extends Buff {
|
||||||
return Math.max(0, (DURATION - left) / DURATION);
|
return Math.max(0, (DURATION - left) / DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString((int)left);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -75,6 +75,10 @@ public class Poison extends Buff implements Hero.Doom {
|
||||||
icon.hardlight(0.6f, 0.2f, 0.6f);
|
icon.hardlight(0.6f, 0.2f, 0.6f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String iconTextDisplay(){
|
||||||
|
return Integer.toString((int) left);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -195,6 +195,11 @@ public class Preparation extends Buff implements ActionIndicator.Action {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(turnsInvis);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -120,6 +120,11 @@ public class PrismaticGuard extends Buff {
|
||||||
return 1f - HP/(float)maxHP();
|
return 1f - HP/(float)maxHP();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString((int)HP);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -65,6 +65,16 @@ public class ScrollEmpower extends Buff {
|
||||||
icon.hardlight(1, 1, 0);
|
icon.hardlight(1, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float iconFadePercent() {
|
||||||
|
return Math.max(0, (2f - left) / 2f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(left);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -81,6 +81,11 @@ public class ToxicImbue extends Buff {
|
||||||
return Math.max(0, (DURATION - left) / DURATION);
|
return Math.max(0, (DURATION - left) / DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString((int)left);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -47,6 +47,11 @@ public class WandEmpower extends Buff {
|
||||||
return Math.max(0, (3-left) / 3f);
|
return Math.max(0, (3-left) / 3f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(left);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -70,6 +70,11 @@ public class WellFed extends Buff {
|
||||||
return Math.max(0, (Hunger.STARVING - left) / Hunger.STARVING);
|
return Math.max(0, (Hunger.STARVING - left) / Hunger.STARVING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(left);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -128,6 +128,11 @@ public class Viscosity extends Glyph {
|
||||||
return BuffIndicator.DEFERRED;
|
return BuffIndicator.DEFERRED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(damage);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -112,6 +112,11 @@ public class ElixirOfAquaticRejuvenation extends Elixir {
|
||||||
return Math.max(0, (max - left) / max);
|
return Math.max(0, (max - left) / max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(left);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -126,6 +126,11 @@ public class ElixirOfMight extends Elixir {
|
||||||
return (5f - left) / 5f;
|
return (5f - left) / 5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(left);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -97,6 +97,11 @@ public class ScrollOfChallenge extends ExoticScroll {
|
||||||
return Math.max(0, (DURATION - left) / DURATION);
|
return Math.max(0, (DURATION - left) / DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(left);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -258,6 +258,11 @@ public class WandOfLivingEarth extends DamageWand {
|
||||||
return Math.max(0, (armorToGuardian() - armor) / (float)armorToGuardian());
|
return Math.max(0, (armorToGuardian() - armor) / (float)armorToGuardian());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(armor);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -75,6 +75,11 @@ public class Kinetic extends Weapon.Enchantment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(damageBonus());
|
||||||
|
}
|
||||||
|
|
||||||
private float preservedDamage;
|
private float preservedDamage;
|
||||||
|
|
||||||
public void setBonus(int bonus){
|
public void setBonus(int bonus){
|
||||||
|
|
|
@ -127,6 +127,11 @@ public class Earthroot extends Plant {
|
||||||
return Math.max(0, (target.HT - level) / (float) target.HT);
|
return Math.max(0, (target.HT - level) / (float) target.HT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(level);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -131,6 +131,11 @@ public class Sungrass extends Plant {
|
||||||
return Math.max(0, (target.HT - level) / (float)target.HT);
|
return Math.max(0, (target.HT - level) / (float)target.HT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString(level);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
|
|
@ -90,6 +90,11 @@ public class Swiftthistle extends Plant {
|
||||||
return Math.max(0, (6f - left) / 6f);
|
return Math.max(0, (6f - left) / 6f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString((int)left);
|
||||||
|
}
|
||||||
|
|
||||||
public void reset(){
|
public void reset(){
|
||||||
left = 7f;
|
left = 7f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,14 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoBuff;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoBuff;
|
||||||
import com.watabou.gltextures.SmartTexture;
|
import com.watabou.gltextures.SmartTexture;
|
||||||
import com.watabou.gltextures.TextureCache;
|
import com.watabou.gltextures.TextureCache;
|
||||||
|
import com.watabou.noosa.BitmapText;
|
||||||
import com.watabou.noosa.Image;
|
import com.watabou.noosa.Image;
|
||||||
import com.watabou.noosa.TextureFilm;
|
import com.watabou.noosa.TextureFilm;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
|
@ -204,8 +207,8 @@ public class BuffIndicator extends Component {
|
||||||
|
|
||||||
private boolean large;
|
private boolean large;
|
||||||
|
|
||||||
//Todo maybe move into buff icon?
|
public Image grey; //only for small
|
||||||
public Image grey;
|
public BitmapText text; //only for large
|
||||||
|
|
||||||
//TODO for large buffs there is room to have text instead of fading
|
//TODO for large buffs there is room to have text instead of fading
|
||||||
public BuffButton( Buff buff, boolean large ){
|
public BuffButton( Buff buff, boolean large ){
|
||||||
|
@ -214,6 +217,7 @@ public class BuffIndicator extends Component {
|
||||||
this.large = large;
|
this.large = large;
|
||||||
|
|
||||||
bringToFront(grey);
|
bringToFront(grey);
|
||||||
|
bringToFront(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -221,17 +225,31 @@ public class BuffIndicator extends Component {
|
||||||
super.createChildren();
|
super.createChildren();
|
||||||
grey = new Image( TextureCache.createSolid(0xCC666666));
|
grey = new Image( TextureCache.createSolid(0xCC666666));
|
||||||
add( grey );
|
add( grey );
|
||||||
|
|
||||||
|
text = new BitmapText(PixelScene.pixelFont);
|
||||||
|
add( text );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateIcon(){
|
public void updateIcon(){
|
||||||
((BuffIcon)icon).refresh(buff);
|
((BuffIcon)icon).refresh(buff);
|
||||||
//round up to the nearest pixel if <50% faded, otherwise round down
|
//round up to the nearest pixel if <50% faded, otherwise round down
|
||||||
float fadeHeight = buff.iconFadePercent() * icon.height();
|
if (!large) {
|
||||||
float zoom = (camera() != null) ? camera().zoom : 1;
|
text.visible = false;
|
||||||
if (fadeHeight < icon.height()/2f){
|
float fadeHeight = buff.iconFadePercent() * icon.height();
|
||||||
grey.scale.set( icon.width(), (float)Math.ceil(zoom*fadeHeight)/zoom);
|
float zoom = (camera() != null) ? camera().zoom : 1;
|
||||||
} else {
|
if (fadeHeight < icon.height() / 2f) {
|
||||||
grey.scale.set( icon.width(), (float)Math.floor(zoom*fadeHeight)/zoom);
|
grey.scale.set(icon.width(), (float) Math.ceil(zoom * fadeHeight) / zoom);
|
||||||
|
} else {
|
||||||
|
grey.scale.set(icon.width(), (float) Math.floor(zoom * fadeHeight) / zoom);
|
||||||
|
}
|
||||||
|
} else if (!buff.iconTextDisplay().isEmpty()) {
|
||||||
|
grey.visible = false;
|
||||||
|
if (buff.type == Buff.buffType.POSITIVE) text.hardlight(CharSprite.POSITIVE);
|
||||||
|
else if (buff.type == Buff.buffType.NEGATIVE) text.hardlight(CharSprite.NEGATIVE);
|
||||||
|
text.alpha(0.6f);
|
||||||
|
|
||||||
|
text.text(buff.iconTextDisplay());
|
||||||
|
text.measure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,6 +258,14 @@ public class BuffIndicator extends Component {
|
||||||
super.layout();
|
super.layout();
|
||||||
grey.x = icon.x = this.x + (large ? 0 : 1);
|
grey.x = icon.x = this.x + (large ? 0 : 1);
|
||||||
grey.y = icon.y = this.y + (large ? 0 : 2);
|
grey.y = icon.y = this.y + (large ? 0 : 2);
|
||||||
|
|
||||||
|
if (text.width > width()){
|
||||||
|
text.scale.set(PixelScene.align(0.5f));
|
||||||
|
} else {
|
||||||
|
text.scale.set(1f);
|
||||||
|
}
|
||||||
|
text.x = this.x + width() - text.width() - 1;
|
||||||
|
text.y = this.y + width() - text.baseLine() - 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user