本文整理汇总了Java中com.watabou.utils.Callback类的典型用法代码示例。如果您正苦于以下问题:Java Callback类的具体用法?Java Callback怎么用?Java Callback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Callback类属于com.watabou.utils包,在下文中一共展示了Callback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: attack
import com.watabou.utils.Callback; //导入依赖的package包/类
@Override
public void attack(int cell) {
if (!Dungeon.level.adjacent(cell, ch.pos)) {
((MissileSprite) parent.recycle(MissileSprite.class)).reset(ch.pos,
cell, new CurareDart(), new Callback() {
@Override
public void call() {
ch.onAttackComplete();
}
});
play(cast);
turnTo(ch.pos, cell);
} else {
super.attack(cell);
}
}
示例2: onComplete
import com.watabou.utils.Callback; //导入依赖的package包/类
@Override
public void onComplete(Animation anim) {
if (anim == zap) {
idle();
((MissileSprite) parent.recycle(MissileSprite.class)).reset(ch.pos,
cellToAttack, new Dart(), new Callback() {
@Override
public void call() {
ch.onAttackComplete();
}
});
} else {
super.onComplete(anim);
}
}
示例3: attack
import com.watabou.utils.Callback; //导入依赖的package包/类
@Override
public void attack(int cell) {
if (!Dungeon.level.adjacent(cell, ch.pos)) {
((MissileSprite) parent.recycle(MissileSprite.class)).reset(ch.pos,
cell, new Dart(), new Callback() {
@Override
public void call() {
ch.onAttackComplete();
}
});
play(cast);
turnTo(ch.pos, cell);
} else {
super.attack(cell);
}
}
示例4: attack
import com.watabou.utils.Callback; //导入依赖的package包/类
@Override
public void attack(int cell) {
if (!Dungeon.level.adjacent(cell, ch.pos)) {
//Char enemy = Actor.findChar(cell);
((MissileSprite) parent.recycle(MissileSprite.class)).reset(ch.pos,
cell, new Skull(), new Callback() {
@Override
public void call() {
ch.onAttackComplete();
}
});
play(cast);
turnTo(ch.pos, cell);
explode(cell);
} else {
super.attack(cell);
}
}
示例5: onComplete
import com.watabou.utils.Callback; //导入依赖的package包/类
@Override
public void onComplete( Animation anim ) {
if (anim == zap) {
idle();
((MissileSprite)parent.recycle( MissileSprite.class )).
reset( ch.pos, cellToAttack, new Dart(), new Callback() {
@Override
public void call() {
ch.onAttackComplete();
}
} );
} else {
super.onComplete( anim );
}
}
示例6: attack
import com.watabou.utils.Callback; //导入依赖的package包/类
@Override
public void attack( int cell ) {
if (!Level.adjacent( cell, ch.pos )) {
((MissileSprite)parent.recycle( MissileSprite.class )).
reset( ch.pos, cell, new Shuriken(), new Callback() {
@Override
public void call() {
ch.onAttackComplete();
}
} );
play( cast );
turnTo( ch.pos , cell );
} else {
super.attack( cell );
}
}
示例7: fx
import com.watabou.utils.Callback; //导入依赖的package包/类
@Override
protected void fx(Ballistica bolt, Callback callback) {
affected.clear();
arcs.clear();
arcs.add(new Lightning.Arc(bolt.sourcePos, bolt.collisionPos));
int cell = bolt.collisionPos;
Char ch = Actor.findChar(cell);
if (ch != null) {
arc(ch);
} else {
CellEmitter.center(cell).burst(SparkParticle.FACTORY, 3);
}
//don't want to wait for the effect before processing damage.
curUser.sprite.parent.add(new Lightning(arcs, null));
callback.call();
}
示例8: onComplete
import com.watabou.utils.Callback; //导入依赖的package包/类
@Override
public void onComplete( Animation anim ) {
if (anim == zap) {
idle();
((MissileSprite)parent.recycle( MissileSprite.class )).
reset( ch.pos, cellToAttack, new Dart(), new Callback() {
@Override
public void call() {
ch.onAttackComplete();
}
} );
} else {
super.onComplete( anim );
}
}
示例9: attack
import com.watabou.utils.Callback; //导入依赖的package包/类
@Override
public void attack( int cell ) {
if (!Dungeon.level.adjacent( cell, ch.pos )) {
final Char enemy = Actor.findChar(cell);
((MissileSprite)parent.recycle( MissileSprite.class )).
reset( ch.pos, cell, new Shuriken(), new Callback() {
@Override
public void call() {
ch.next();
if (enemy != null) ch.attack(enemy);
}
} );
play( cast );
turnTo( ch.pos , cell );
} else {
super.attack( cell );
}
}
示例10: onComplete
import com.watabou.utils.Callback; //导入依赖的package包/类
@Override
public void onComplete( Animation anim ) {
if (anim == attack) {
Sample.INSTANCE.play( Assets.SND_ZAP );
MagicMissile.shadow( parent, ch.pos, posToShoot,
new Callback() {
@Override
public void call() {
ch.onAttackComplete();
}
} );
idle();
} else {
super.onComplete( anim );
}
}
示例11: reset
import com.watabou.utils.Callback; //导入依赖的package包/类
public void reset( int from, int to, float velocity, Callback callback ) {
this.callback = callback;
revive();
PointF pf = DungeonTilemap.tileCenterToWorld( from );
PointF pt = DungeonTilemap.tileCenterToWorld( to );
x = pf.x;
y = pf.y;
width = 0;
height = 0;
PointF d = PointF.diff( pt, pf );
PointF speed = new PointF( d ).normalize().scale( velocity );
sx = speed.x;
sy = speed.y;
time = d.length() / velocity;
}
示例12: zap
import com.watabou.utils.Callback; //导入依赖的package包/类
@Override
public void zap(int cell) {
turnTo(ch.pos, cell);
play(zap);
MagicMissile.poison(parent, ch.pos, cell, new Callback() {
@Override
public void call() {
((VioletDragon) ch).onZapComplete();
}
});
Sample.INSTANCE.play(Assets.SND_ZAP);
}
示例13: zap
import com.watabou.utils.Callback; //导入依赖的package包/类
@Override
public void zap(int cell) {
turnTo(ch.pos, cell);
play(zap);
MagicMissile.shadow(parent, ch.pos, cell, new Callback() {
@Override
public void call() {
((SpectralRat) ch).onZapComplete();
}
});
Sample.INSTANCE.play(Assets.SND_ZAP);
}
示例14: attack
import com.watabou.utils.Callback; //导入依赖的package包/类
@Override
public void attack(int cell) {
if (!Dungeon.level.adjacent(cell, ch.pos)) {
Char enemy = Actor.findChar(cell);
((MissileSprite) parent.recycle(MissileSprite.class)).reset(ch.pos,
cell, new Dart(), new Callback() {
@Override
public void call() {
ch.onAttackComplete();
}
});
if (Random.Int(10) == 0) {
Buff.affect(enemy, Slow.class, Slow.duration(enemy) / 2);
}
if (Random.Int(10) == 0) {
Buff.affect(enemy, Poison.class).set(Random.Int(7, 9) * Poison.durationFactor(enemy));
}
play(cast);
turnTo(ch.pos, cell);
} else {
super.attack(cell);
}
}
示例15: cast
import com.watabou.utils.Callback; //导入依赖的package包/类
public void cast( final Hero user, int dst ) {
final int cell = Ballistica.cast( user.pos, dst, false, true );
user.sprite.zap( cell );
user.busy();
Sample.INSTANCE.play( Assets.SND_MISS, 0.6f, 0.6f, 1.5f );
Char enemy = Actor.findChar( cell );
QuickSlot.target( this, enemy );
// FIXME!!!
float delay = TIME_TO_THROW;
if (this instanceof MissileWeapon) {
delay *= ((MissileWeapon)this).speedFactor( user );
if (enemy != null) {
SnipersMark mark = user.buff( SnipersMark.class );
if (mark != null) {
if (mark.object == enemy.id()) {
delay *= 0.5f;
}
user.remove( mark );
}
}
}
final float finalDelay = delay;
((MissileSprite)user.sprite.parent.recycle( MissileSprite.class )).
reset( user.pos, cell, this, new Callback() {
@Override
public void call() {
Item.this.detach( user.belongings.backpack ).onThrow( cell );
user.spendAndNext( finalDelay );
}
} );
}