当前位置: 首页>>代码示例>>Java>>正文


Java Callback类代码示例

本文整理汇总了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);

	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:22,代码来源:GnollTricksterSprite.java

示例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);
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:17,代码来源:ScorpioSprite.java

示例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);

	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:22,代码来源:GnollArcherSprite.java

示例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);

	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:24,代码来源:ZotSprite.java

示例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 );
	}
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:17,代码来源:ScorpioSprite.java

示例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 );
		
	}
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:22,代码来源:TenguSprite.java

示例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();
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:21,代码来源:WandOfLightning.java

示例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 );
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:17,代码来源:ScorpioSprite.java

示例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 );
		
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:25,代码来源:TenguSprite.java

示例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 );
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:20,代码来源:BurningFistSprite.java

示例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;
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:20,代码来源:MagicMissile.java

示例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);
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:15,代码来源:VioletDragonSprite.java

示例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);
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:15,代码来源:SpectralRatSprite.java

示例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);

	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:31,代码来源:ThiefKingSprite.java

示例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 );
			}
		} );
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:37,代码来源:Item.java


注:本文中的com.watabou.utils.Callback类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。