v0.6.2: added support for tinting buff icons
This commit is contained in:
parent
592976b91c
commit
6967ed3586
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.1 KiB |
|
@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal.WarriorShield;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
|
import com.watabou.noosa.Image;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
|
|
||||||
|
@ -136,15 +137,25 @@ public class Berserk extends Buff {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int icon() {
|
public int icon() {
|
||||||
|
return BuffIndicator.BERSERK;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tintIcon(Image icon) {
|
||||||
switch (state){
|
switch (state){
|
||||||
case NORMAL: default:
|
case NORMAL: default:
|
||||||
return BuffIndicator.ANGERED;
|
icon.hardlight(1f, 0.67f, 0.2f);
|
||||||
|
break;
|
||||||
case BERSERK:
|
case BERSERK:
|
||||||
return BuffIndicator.FURY;
|
icon.hardlight(1f, 0.1f, 0.1f);
|
||||||
|
break;
|
||||||
case EXHAUSTED:
|
case EXHAUSTED:
|
||||||
return BuffIndicator.EXHAUSTED;
|
icon.resetColor();
|
||||||
|
break;
|
||||||
case RECOVERING:
|
case RECOVERING:
|
||||||
return BuffIndicator.RECOVERING;
|
//icon.hardlight(0.12f, 0.20f, 0.55f);
|
||||||
|
icon.hardlight(0.35f, 0.45f, 0.75f);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
|
import com.watabou.noosa.Image;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -77,6 +78,10 @@ public class Buff extends Actor {
|
||||||
return BuffIndicator.NONE;
|
return BuffIndicator.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void tintIcon( Image icon ){
|
||||||
|
//do nothing by default
|
||||||
|
}
|
||||||
|
|
||||||
public void fx(boolean on) {
|
public void fx(boolean on) {
|
||||||
//do nothing by default
|
//do nothing by default
|
||||||
};
|
};
|
||||||
|
|
|
@ -58,6 +58,16 @@ public class Combo extends Buff implements ActionIndicator.Action {
|
||||||
return BuffIndicator.COMBO;
|
return BuffIndicator.COMBO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tintIcon(Image icon) {
|
||||||
|
if (count >= 10) icon.hardlight(1f, 0f, 0f);
|
||||||
|
else if (count >= 8)icon.hardlight(1f, 0.8f, 0f);
|
||||||
|
else if (count >= 6)icon.hardlight(1f, 1f, 0f);
|
||||||
|
else if (count >= 4)icon.hardlight(0.8f, 1f, 0f);
|
||||||
|
else if (count >= 2)icon.hardlight(0f, 1f, 0f);
|
||||||
|
else icon.resetColor();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Messages.get(this, "name");
|
return Messages.get(this, "name");
|
||||||
|
@ -68,6 +78,7 @@ public class Combo extends Buff implements ActionIndicator.Action {
|
||||||
count++;
|
count++;
|
||||||
comboTime = 4f;
|
comboTime = 4f;
|
||||||
misses = 0;
|
misses = 0;
|
||||||
|
BuffIndicator.refreshHero();
|
||||||
|
|
||||||
if (count >= 2) {
|
if (count >= 2) {
|
||||||
|
|
||||||
|
|
|
@ -83,9 +83,7 @@ public class BuffIndicator extends Component {
|
||||||
public static final int BLESS = 37;
|
public static final int BLESS = 37;
|
||||||
public static final int RAGE = 38;
|
public static final int RAGE = 38;
|
||||||
public static final int SACRIFICE = 39;
|
public static final int SACRIFICE = 39;
|
||||||
public static final int ANGERED = 40;
|
public static final int BERSERK = 40;
|
||||||
public static final int EXHAUSTED = 41;
|
|
||||||
public static final int RECOVERING = 42;
|
|
||||||
|
|
||||||
public static final int SIZE = 7;
|
public static final int SIZE = 7;
|
||||||
|
|
||||||
|
@ -126,8 +124,8 @@ public class BuffIndicator extends Component {
|
||||||
public synchronized void update() {
|
public synchronized void update() {
|
||||||
super.update();
|
super.update();
|
||||||
if (needsRefresh){
|
if (needsRefresh){
|
||||||
layout();
|
|
||||||
needsRefresh = false;
|
needsRefresh = false;
|
||||||
|
layout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,6 +199,7 @@ public class BuffIndicator extends Component {
|
||||||
|
|
||||||
public void updateIcon(){
|
public void updateIcon(){
|
||||||
icon.frame( film.get( buff.icon() ) );
|
icon.frame( film.get( buff.icon() ) );
|
||||||
|
buff.tintIcon(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -219,7 +218,9 @@ public class BuffIndicator extends Component {
|
||||||
|
|
||||||
public static void refreshHero() {
|
public static void refreshHero() {
|
||||||
if (heroInstance != null) {
|
if (heroInstance != null) {
|
||||||
|
synchronized (heroInstance) {
|
||||||
heroInstance.needsRefresh = true;
|
heroInstance.needsRefresh = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,6 +207,7 @@ public class WndHero extends WndTabbed {
|
||||||
|
|
||||||
icon = new Image( icons );
|
icon = new Image( icons );
|
||||||
icon.frame( film.get( index ) );
|
icon.frame( film.get( index ) );
|
||||||
|
buff.tintIcon(icon);
|
||||||
icon.y = this.y;
|
icon.y = this.y;
|
||||||
add( icon );
|
add( icon );
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class WndInfoBuff extends Window {
|
||||||
|
|
||||||
Image buffIcon = new Image( icons );
|
Image buffIcon = new Image( icons );
|
||||||
buffIcon.frame( film.get(buff.icon()) );
|
buffIcon.frame( film.get(buff.icon()) );
|
||||||
|
buff.tintIcon(buffIcon);
|
||||||
|
|
||||||
titlebar.icon( buffIcon );
|
titlebar.icon( buffIcon );
|
||||||
titlebar.label( Messages.titleCase(buff.toString()), Window.TITLE_COLOR );
|
titlebar.label( Messages.titleCase(buff.toString()), Window.TITLE_COLOR );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user