v0.3.0: added sprite emitter functionality to item sprites in all cases
This commit is contained in:
parent
153328aa86
commit
712df97bed
|
@ -188,7 +188,10 @@ public class Heap implements Bundlable {
|
|||
}
|
||||
|
||||
if (sprite != null) {
|
||||
sprite.view( image(), glowing() );
|
||||
if (type == Type.HEAP || type == Type.FOR_SALE)
|
||||
sprite.view( item );
|
||||
else
|
||||
sprite.view( image(), glowing() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -160,6 +160,7 @@ public class ItemSprite extends MovieClip {
|
|||
}
|
||||
|
||||
public ItemSprite view(Item item){
|
||||
view(item.image(), item.glowing());
|
||||
if (this.emitter != null) this.emitter.on = false;
|
||||
Emitter emitter = item.emitter();
|
||||
if (emitter != null && parent != null) {
|
||||
|
@ -167,10 +168,12 @@ public class ItemSprite extends MovieClip {
|
|||
parent.add( emitter );
|
||||
this.emitter = emitter;
|
||||
}
|
||||
return view(item.image(), item.glowing());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemSprite view( int image, Glowing glowing ) {
|
||||
if (this.emitter != null) this.emitter.on = false;
|
||||
emitter = null;
|
||||
frame( film.get( image ) );
|
||||
if ((this.glowing = glowing) == null) {
|
||||
resetColor();
|
||||
|
@ -178,6 +181,12 @@ public class ItemSprite extends MovieClip {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kill() {
|
||||
super.kill();
|
||||
if (emitter != null) emitter.on = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
|
|
@ -44,10 +44,10 @@ public class IconTitle extends Component {
|
|||
}
|
||||
|
||||
public IconTitle( Item item ) {
|
||||
this(
|
||||
new ItemSprite( item ),
|
||||
Utils.capitalize( item.toString() ) );
|
||||
|
||||
ItemSprite icon = new ItemSprite();
|
||||
icon( icon );
|
||||
label( Utils.capitalize( item.toString() ) );
|
||||
icon.view( item );
|
||||
}
|
||||
|
||||
public IconTitle( Image icon, String label ) {
|
||||
|
|
|
@ -40,9 +40,7 @@ public class WndItem extends Window {
|
|||
|
||||
super();
|
||||
|
||||
IconTitle titlebar = new IconTitle();
|
||||
titlebar.icon( new ItemSprite( item ) );
|
||||
titlebar.label( Utils.capitalize( item.toString() ) );
|
||||
IconTitle titlebar = new IconTitle( item );
|
||||
titlebar.setRect( 0, 0, WIDTH, 0 );
|
||||
add( titlebar );
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user