v3.1.0: gold now shows on the toolbar on mobile while buying items
This commit is contained in:
@@ -42,6 +42,7 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ShopkeeperSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ShopkeeperSprite;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.CurrencyIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
|
||||||
@@ -250,6 +251,7 @@ public class Shopkeeper extends NPC {
|
|||||||
if (options[i].length() > maxLen) options[i] = options[i].substring(0, maxLen-3) + "...";
|
if (options[i].length() > maxLen) options[i] = options[i].substring(0, maxLen-3) + "...";
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
CurrencyIndicator.showGold = true;
|
||||||
GameScene.show(new WndOptions(sprite(), Messages.titleCase(name()), description(), options){
|
GameScene.show(new WndOptions(sprite(), Messages.titleCase(name()), description(), options){
|
||||||
@Override
|
@Override
|
||||||
protected void onSelect(int index) {
|
protected void onSelect(int index) {
|
||||||
@@ -290,6 +292,12 @@ public class Shopkeeper extends NPC {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hide() {
|
||||||
|
super.hide();
|
||||||
|
CurrencyIndicator.showGold = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -39,13 +39,21 @@ public class CurrencyIndicator extends Component {
|
|||||||
|
|
||||||
private float goldTime;
|
private float goldTime;
|
||||||
private float energyTime;
|
private float energyTime;
|
||||||
|
|
||||||
|
public static boolean showGold = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
gold = new BitmapText( PixelScene.pixelFont);
|
gold = new BitmapText( PixelScene.pixelFont);
|
||||||
|
gold.text( Integer.toString(lastGold) );
|
||||||
|
gold.measure();
|
||||||
|
gold.hardlight( 0xFFFF00 );
|
||||||
add( gold );
|
add( gold );
|
||||||
|
|
||||||
energy = new BitmapText( PixelScene.pixelFont);
|
energy = new BitmapText( PixelScene.pixelFont);
|
||||||
|
energy.text( Integer.toString(lastEnergy) );
|
||||||
|
energy.measure();
|
||||||
|
energy.hardlight( 0x44CCFF );
|
||||||
add( energy );
|
add( energy );
|
||||||
|
|
||||||
gold.visible = energy.visible = false;
|
gold.visible = energy.visible = false;
|
||||||
@@ -96,7 +104,6 @@ public class CurrencyIndicator extends Component {
|
|||||||
|
|
||||||
gold.text( Integer.toString(lastGold) );
|
gold.text( Integer.toString(lastGold) );
|
||||||
gold.measure();
|
gold.measure();
|
||||||
gold.hardlight( 0xFFFF00 );
|
|
||||||
|
|
||||||
gold.visible = true;
|
gold.visible = true;
|
||||||
goldTime = TIME;
|
goldTime = TIME;
|
||||||
@@ -109,12 +116,20 @@ public class CurrencyIndicator extends Component {
|
|||||||
|
|
||||||
energy.text( Integer.toString(lastEnergy) );
|
energy.text( Integer.toString(lastEnergy) );
|
||||||
energy.measure();
|
energy.measure();
|
||||||
energy.hardlight( 0x44CCFF );
|
|
||||||
|
|
||||||
energy.visible = true;
|
energy.visible = true;
|
||||||
energyTime = TIME;
|
energyTime = TIME;
|
||||||
|
|
||||||
layout();
|
layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (showGold){
|
||||||
|
if (!gold.visible){
|
||||||
|
gold.visible = true;
|
||||||
|
layout();
|
||||||
|
}
|
||||||
|
goldTime = TIME/2;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.CurrencyIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||||
|
|
||||||
public class WndTradeItem extends WndInfoItem {
|
public class WndTradeItem extends WndInfoItem {
|
||||||
@@ -121,6 +122,7 @@ public class WndTradeItem extends WndInfoItem {
|
|||||||
super(heap);
|
super(heap);
|
||||||
|
|
||||||
selling = false;
|
selling = false;
|
||||||
|
CurrencyIndicator.showGold = true;
|
||||||
|
|
||||||
Item item = heap.peek();
|
Item item = heap.peek();
|
||||||
|
|
||||||
@@ -207,6 +209,7 @@ public class WndTradeItem extends WndInfoItem {
|
|||||||
public void hide() {
|
public void hide() {
|
||||||
|
|
||||||
super.hide();
|
super.hide();
|
||||||
|
CurrencyIndicator.showGold = false;
|
||||||
|
|
||||||
if (owner != null) {
|
if (owner != null) {
|
||||||
owner.hide();
|
owner.hide();
|
||||||
|
|||||||
Reference in New Issue
Block a user