v0.6.1: picking up document pages now makes the journal button blink
This commit is contained in:
parent
f500ba87ec
commit
4890b4f19d
|
@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndJournal;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
||||
|
@ -51,6 +52,8 @@ public abstract class DocumentPage extends Item {
|
|||
@Override
|
||||
public final boolean doPickUp(Hero hero) {
|
||||
GameScene.pickUpJournal(this);
|
||||
GameScene.flashJournal();
|
||||
WndJournal.last_index = 0;
|
||||
document().addPage(page);
|
||||
Sample.INSTANCE.play( Assets.SND_ITEM );
|
||||
hero.spendAndNext( TIME_TO_PICK_UP );
|
||||
|
|
|
@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.StatusPane;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndJournal;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
||||
|
@ -49,6 +50,7 @@ public abstract class Key extends Item {
|
|||
@Override
|
||||
public boolean doPickUp(Hero hero) {
|
||||
GameScene.pickUpJournal(this);
|
||||
WndJournal.last_index = 1;
|
||||
Notes.add(this);
|
||||
Sample.INSTANCE.play( Assets.SND_ITEM );
|
||||
hero.spendAndNext( TIME_TO_PICK_UP );
|
||||
|
|
|
@ -727,6 +727,10 @@ public class GameScene extends PixelScene {
|
|||
public static void pickUpJournal( Item item ) {
|
||||
if (scene != null) scene.pane.pickup( item );
|
||||
}
|
||||
|
||||
public static void flashJournal(){
|
||||
if (scene != null) scene.pane.flash();
|
||||
}
|
||||
|
||||
public static void resetMap() {
|
||||
if (scene != null) {
|
||||
|
|
|
@ -227,6 +227,10 @@ public class StatusPane extends Component {
|
|||
btnJournal.icon.y + btnJournal.icon.height()/2f,
|
||||
true );
|
||||
}
|
||||
|
||||
public void flash(){
|
||||
btnJournal.flashing = true;
|
||||
}
|
||||
|
||||
public static boolean needsKeyUpdate = false;
|
||||
|
||||
|
@ -235,6 +239,8 @@ public class StatusPane extends Component {
|
|||
private Image bg;
|
||||
//used to display key state to the player
|
||||
private Image icon;
|
||||
|
||||
private boolean flashing;
|
||||
|
||||
public JournalButton() {
|
||||
super();
|
||||
|
@ -267,11 +273,20 @@ public class StatusPane extends Component {
|
|||
PixelScene.align(icon);
|
||||
}
|
||||
|
||||
private float time;
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (needsKeyUpdate)
|
||||
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() {
|
||||
|
@ -327,6 +342,8 @@ public class StatusPane extends Component {
|
|||
|
||||
@Override
|
||||
protected void onClick() {
|
||||
flashing = false;
|
||||
time = 0;
|
||||
GameScene.show( new WndJournal() );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user