v0.6.1: picking up document pages now makes the journal button blink

This commit is contained in:
Evan Debenham 2017-08-01 19:59:42 -04:00
parent f500ba87ec
commit 4890b4f19d
4 changed files with 26 additions and 0 deletions

View File

@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.journal.Document; import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndJournal;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
@ -51,6 +52,8 @@ public abstract class DocumentPage extends Item {
@Override @Override
public final boolean doPickUp(Hero hero) { public final boolean doPickUp(Hero hero) {
GameScene.pickUpJournal(this); GameScene.pickUpJournal(this);
GameScene.flashJournal();
WndJournal.last_index = 0;
document().addPage(page); document().addPage(page);
Sample.INSTANCE.play( Assets.SND_ITEM ); Sample.INSTANCE.play( Assets.SND_ITEM );
hero.spendAndNext( TIME_TO_PICK_UP ); hero.spendAndNext( TIME_TO_PICK_UP );

View File

@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.StatusPane; import com.shatteredpixel.shatteredpixeldungeon.ui.StatusPane;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndJournal;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
@ -49,6 +50,7 @@ public abstract class Key extends Item {
@Override @Override
public boolean doPickUp(Hero hero) { public boolean doPickUp(Hero hero) {
GameScene.pickUpJournal(this); GameScene.pickUpJournal(this);
WndJournal.last_index = 1;
Notes.add(this); Notes.add(this);
Sample.INSTANCE.play( Assets.SND_ITEM ); Sample.INSTANCE.play( Assets.SND_ITEM );
hero.spendAndNext( TIME_TO_PICK_UP ); hero.spendAndNext( TIME_TO_PICK_UP );

View File

@ -727,6 +727,10 @@ public class GameScene extends PixelScene {
public static void pickUpJournal( Item item ) { public static void pickUpJournal( Item item ) {
if (scene != null) scene.pane.pickup( item ); if (scene != null) scene.pane.pickup( item );
} }
public static void flashJournal(){
if (scene != null) scene.pane.flash();
}
public static void resetMap() { public static void resetMap() {
if (scene != null) { if (scene != null) {

View File

@ -227,6 +227,10 @@ public class StatusPane extends Component {
btnJournal.icon.y + btnJournal.icon.height()/2f, btnJournal.icon.y + btnJournal.icon.height()/2f,
true ); true );
} }
public void flash(){
btnJournal.flashing = true;
}
public static boolean needsKeyUpdate = false; public static boolean needsKeyUpdate = false;
@ -235,6 +239,8 @@ public class StatusPane extends Component {
private Image bg; private Image bg;
//used to display key state to the player //used to display key state to the player
private Image icon; private Image icon;
private boolean flashing;
public JournalButton() { public JournalButton() {
super(); super();
@ -267,11 +273,20 @@ public class StatusPane extends Component {
PixelScene.align(icon); PixelScene.align(icon);
} }
private float time;
@Override @Override
public void update() { public void update() {
super.update(); super.update();
if (needsKeyUpdate) if (needsKeyUpdate)
updateKeyDisplay(); updateKeyDisplay();
if (flashing){
icon.am = (float)Math.abs(Math.cos( 3 * (time += Game.elapsed) ));
if (time >= 0.333f*Math.PI) {
time = 0;
}
}
} }
public void updateKeyDisplay() { public void updateKeyDisplay() {
@ -327,6 +342,8 @@ public class StatusPane extends Component {
@Override @Override
protected void onClick() { protected void onClick() {
flashing = false;
time = 0;
GameScene.show( new WndJournal() ); GameScene.show( new WndJournal() );
} }