v0.4.1: bugfixes to item slots and item sprites
This commit is contained in:
parent
093635c454
commit
3de8225f9b
|
@ -174,7 +174,6 @@ public class ItemSprite extends MovieClip {
|
|||
|
||||
public ItemSprite view(Item item){
|
||||
view(item.image(), item.glowing());
|
||||
if (this.emitter != null) this.emitter.killAndErase();
|
||||
Emitter emitter = item.emitter();
|
||||
if (emitter != null && parent != null) {
|
||||
emitter.pos( this );
|
||||
|
@ -185,7 +184,7 @@ public class ItemSprite extends MovieClip {
|
|||
}
|
||||
|
||||
public ItemSprite view( int image, Glowing glowing ) {
|
||||
if (this.emitter != null) this.emitter.on = false;
|
||||
if (this.emitter != null) this.emitter.killAndErase();
|
||||
emitter = null;
|
||||
frame( film.get( image ) );
|
||||
if ((this.glowing = glowing) == null) {
|
||||
|
|
|
@ -49,6 +49,7 @@ public class ItemSlot extends Button {
|
|||
private static final float DISABLED = 0.3f;
|
||||
|
||||
protected ItemSprite icon;
|
||||
protected Item item;
|
||||
protected BitmapText topLeft;
|
||||
protected BitmapText topRight;
|
||||
protected BitmapText bottomRight;
|
||||
|
@ -84,6 +85,8 @@ public class ItemSlot extends Button {
|
|||
|
||||
public ItemSlot() {
|
||||
super();
|
||||
icon.visible(false);
|
||||
enable(false);
|
||||
}
|
||||
|
||||
public ItemSlot( Item item ) {
|
||||
|
@ -138,24 +141,43 @@ public class ItemSlot extends Button {
|
|||
}
|
||||
|
||||
public void item( Item item ) {
|
||||
if (this.item == item) {
|
||||
updateText();
|
||||
return;
|
||||
}
|
||||
|
||||
this.item = item;
|
||||
|
||||
if (item == null) {
|
||||
|
||||
active = false;
|
||||
icon.visible(false);
|
||||
|
||||
updateText();
|
||||
|
||||
} else {
|
||||
|
||||
active = true;
|
||||
icon.visible(true);
|
||||
|
||||
icon.view( item );
|
||||
updateText();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateText(){
|
||||
|
||||
if (bottomRightIcon != null){
|
||||
remove(bottomRightIcon);
|
||||
bottomRightIcon = null;
|
||||
}
|
||||
|
||||
if (item == null) {
|
||||
|
||||
active = false;
|
||||
if (item == null){
|
||||
topLeft.visible = topRight.visible = bottomRight.visible = false;
|
||||
icon.visible(false);
|
||||
|
||||
return;
|
||||
} else {
|
||||
|
||||
active = true;
|
||||
topLeft.visible = topRight.visible = bottomRight.visible = true;
|
||||
icon.visible(true);
|
||||
|
||||
icon.view( item );
|
||||
}
|
||||
|
||||
topLeft.text( item.status() );
|
||||
|
||||
|
@ -221,7 +243,6 @@ public class ItemSlot extends Button {
|
|||
|
||||
layout();
|
||||
}
|
||||
}
|
||||
|
||||
public void enable( boolean value ) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user