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


Java Game.switchScene方法代码示例

本文整理汇总了Java中com.watabou.noosa.Game.switchScene方法的典型用法代码示例。如果您正苦于以下问题:Java Game.switchScene方法的具体用法?Java Game.switchScene怎么用?Java Game.switchScene使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.watabou.noosa.Game的用法示例。


在下文中一共展示了Game.switchScene方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actDescend

import com.watabou.noosa.Game; //导入方法依赖的package包/类
private boolean actDescend( HeroAction.Descend action ) {
	int stairs = action.dst;
	if (pos == stairs && pos == Dungeon.level.exit) {
		
		curAction = null;
		
		Hunger hunger = buff( Hunger.class );
		if (hunger != null && !hunger.isStarving()) {
			hunger.satisfy( -Hunger.STARVING / 10 );
		}
		
		InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
		Game.switchScene( InterlevelScene.class );
		
		return false;
		
	} else if (getCloser( stairs )) {
		
		return true;
		
	} else {
		ready();
		return false;
	}
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:26,代码来源:Hero.java

示例2: heroFall

import com.watabou.noosa.Game; //导入方法依赖的package包/类
public static void heroFall( int pos ) {
	
	jumpConfirmed = false;
			
	Sample.INSTANCE.play( Assets.SND_FALLING );

	Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class);
	if (buff != null) buff.detach();

	for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] ))
		if (mob instanceof DriedRose.GhostHero) mob.destroy();
	
	if (Dungeon.hero.isAlive()) {
		Dungeon.hero.interrupt();
		InterlevelScene.mode = InterlevelScene.Mode.FALL;
		if (Dungeon.level instanceof RegularLevel) {
			Room room = ((RegularLevel)Dungeon.level).room( pos );
			InterlevelScene.fallIntoPit = room != null && room.type == Room.Type.WEAK_FLOOR;
		} else {
			InterlevelScene.fallIntoPit = false;
		}
		Game.switchScene( InterlevelScene.class );
	} else {
		Dungeon.hero.sprite.visible = false;
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:27,代码来源:Chasm.java

示例3: activate

import com.watabou.noosa.Game; //导入方法依赖的package包/类
@Override
public void activate() {
	InterlevelScene.returnDepth = Dungeon.depth;
	Belongings belongings = Dungeon.hero.belongings;
	belongings.ironKeys[Dungeon.depth] = 0;
	belongings.specialKeys[Dungeon.depth] = 0;
	for (Item i : belongings){
		if (i instanceof LloydsBeacon && ((LloydsBeacon) i).returnDepth == Dungeon.depth)
				((LloydsBeacon) i).returnDepth = -1;
	}

	for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] ))
		if (mob instanceof DriedRose.GhostHero) mob.destroy();

	InterlevelScene.mode = InterlevelScene.Mode.RESET;
	Game.switchScene(InterlevelScene.class);
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:18,代码来源:DistortionTrap.java

示例4: execute

import com.watabou.noosa.Game; //导入方法依赖的package包/类
@Override
public void execute(Hero hero, String action) {

	if (action == AC_RETURN) {


		Buff buff = Dungeon.hero
				.buff(TimekeepersHourglass.timeFreeze.class);
		if (buff != null)
			buff.detach();

		Buff buffinv = Dungeon.hero.buff(Invisibility.class);
		if (buffinv != null)
			buffinv.detach();
		Invisibility.dispel();
		Dungeon.hero.invisible = 0;

		for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0]))
			if (mob instanceof DriedRose.GhostHero)
				mob.destroy();

		InterlevelScene.mode = InterlevelScene.Mode.RETURNSAVE;
		InterlevelScene.returnDepth = 1;
		InterlevelScene.returnPos = 1;
		Game.switchScene(InterlevelScene.class);


	} else {

		super.execute(hero, action);

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

示例5: showAmuletScene

import com.watabou.noosa.Game; //导入方法依赖的package包/类
private void showAmuletScene(boolean showText) {
	try {
		Dungeon.saveAll();
		AmuletScene.noText = !showText;
		Game.switchScene(AmuletScene.class);
	} catch (IOException e) {
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:9,代码来源:Amulet.java

示例6: actAscend

import com.watabou.noosa.Game; //导入方法依赖的package包/类
private boolean actAscend( HeroAction.Ascend action ) {
	int stairs = action.dst;
	if (pos == stairs && pos == Dungeon.level.entrance) {
		
		if (Dungeon.depth == 1) {
			
			if (belongings.getItem( Amulet.class ) == null) {
				GameScene.show( new WndMessage( TXT_LEAVE ) );
				ready();
			} else {
				Dungeon.win( ResultDescriptions.WIN );
				Dungeon.deleteGame( Dungeon.hero.heroClass, true );
				Game.switchScene( SurfaceScene.class );
			}
			
		} else {
			
			curAction = null;
			
			Hunger hunger = buff( Hunger.class );
			if (hunger != null && !hunger.isStarving()) {
				hunger.satisfy( -Hunger.STARVING / 10 );
			}
			
			InterlevelScene.mode = InterlevelScene.Mode.ASCEND;
			Game.switchScene( InterlevelScene.class );
		}
		
		return false;
		
	} else if (getCloser( stairs )) {
		
		return true;
		
	} else {
		ready();
		return false;
	}
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:40,代码来源:Hero.java

示例7: startNewGame

import com.watabou.noosa.Game; //导入方法依赖的package包/类
private void startNewGame() {

		Dungeon.hero = null;
		InterlevelScene.mode = InterlevelScene.Mode.DESCEND;

		if (UNISTPixelDungeon.intro()) {
			UNISTPixelDungeon.intro( false );
			Game.switchScene( IntroScene.class );
		} else {
			Game.switchScene( InterlevelScene.class );
		}
	}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:13,代码来源:StartScene.java

示例8: showAmuletScene

import com.watabou.noosa.Game; //导入方法依赖的package包/类
private void showAmuletScene( boolean showText ) {
	try {
		Dungeon.saveAll();
		AmuletScene.noText = !showText;
		Game.switchScene( AmuletScene.class );
	} catch (IOException e) {
		UNISTPixelDungeon.reportException(e);
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:10,代码来源:Amulet.java

示例9: actDescend

import com.watabou.noosa.Game; //导入方法依赖的package包/类
private boolean actDescend(HeroAction.Descend action) {
	int stairs = action.dst;

	if (!Dungeon.level.forcedone && !Dungeon.level.cleared
			&& !Dungeon.notClearableLevel(Dungeon.depth)) {

		GameScene.show(new WndDescend());
		ready();
		return false;
	}


	if (pos == stairs && pos == Dungeon.level.exit && !Dungeon.level.sealedlevel) {

		curAction = null;

		if (!Dungeon.level.cleared && !Dungeon.notClearableLevel(Dungeon.depth)) {
			Dungeon.level.cleared = true;
			Statistics.prevfloormoves = 0;
		}

		PET pet = checkpet();
		if (pet != null && checkpetNear()) {
			Dungeon.hero.petType = pet.type;
			Dungeon.hero.petLevel = pet.level;
			Dungeon.hero.petKills = pet.kills;
			Dungeon.hero.petHP = pet.HP;
			Dungeon.hero.petExperience = pet.experience;
			Dungeon.hero.petCooldown = pet.cooldown;
			pet.destroy();
			petfollow = true;
		} else petfollow = Dungeon.hero.haspet && Dungeon.hero.petfollow;

		Buff buff = buff(TimekeepersHourglass.timeFreeze.class);
		if (buff != null) buff.detach();

		Buff buffinv = Dungeon.hero.buff(Invisibility.class);
		if (buffinv != null)
			buffinv.detach();
		Invisibility.dispel();
		Dungeon.hero.invisible = 0;

		for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0]))
			if (mob instanceof DriedRose.GhostHero)
				mob.destroy();

		InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
		Game.switchScene(InterlevelScene.class);

		return false;

	} else if (getCloser(stairs)) {

		return true;

	} else {
		ready();
		return false;
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:61,代码来源:Hero.java

示例10: create

import com.watabou.noosa.Game; //导入方法依赖的package包/类
@Override
public void create() {
	super.create();

	RenderedTextMultiline text = null;
	if (!noText) {
		text = renderMultiline(Messages.get(this, "text"), 7);
		text.maxWidth(WIDTH);
		add(text);
	}

	amulet = new Image(Assets.AMULET);
	add(amulet);

	NewRedButton btnExit = new NewRedButton(TXT_EXIT) {
		@Override
		protected void onClick() {
			Dungeon.win(ResultDescriptions.WIN);
			Dungeon.deleteGame(Dungeon.hero.heroClass, true);
			Game.switchScene(noText ? TitleScene.class
					: RankingsScene.class);
		}
	};
	btnExit.setSize(WIDTH, BTN_HEIGHT);
	add(btnExit);

	NewRedButton btnStay = new NewRedButton(TXT_STAY) {
		@Override
		protected void onClick() {
			onBackPressed();
		}
	};
	btnStay.setSize(WIDTH, BTN_HEIGHT);
	add(btnStay);

	float height;
	if (noText) {
		height = amulet.height + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();

		amulet.x = (Camera.main.width - amulet.width) / 2;
		amulet.y = (Camera.main.height - height) / 2;
		align(amulet);

		btnExit.setPos((Camera.main.width - btnExit.width()) / 2, amulet.y + amulet.height + LARGE_GAP);
		btnStay.setPos(btnExit.left(), btnExit.bottom() + SMALL_GAP);

	} else {
		height = amulet.height + LARGE_GAP + text.height() + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();

		amulet.x = (Camera.main.width - amulet.width) / 2;
		amulet.y = (Camera.main.height - height) / 2;
		align(amulet);

		text.setPos((Camera.main.width - text.width()) / 2, amulet.y + amulet.height + LARGE_GAP);
		align(text);

		btnExit.setPos((Camera.main.width - btnExit.width()) / 2, text.top() + text.height() + LARGE_GAP);
		btnStay.setPos(btnExit.left(), btnExit.bottom() + SMALL_GAP);
	}

	new Flare(8, 48).color(0xFFDDBB, true).show(amulet, 0).angularSpeed = +30;

	fadeIn();
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:65,代码来源:AmuletScene.java

示例11: onBackPressed

import com.watabou.noosa.Game; //导入方法依赖的package包/类
@Override
protected void onBackPressed() {
	InterlevelScene.mode = InterlevelScene.Mode.CONTINUE;
	Game.switchScene(InterlevelScene.class);
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:6,代码来源:AmuletScene.java

示例12: update

import com.watabou.noosa.Game; //导入方法依赖的package包/类
@Override
public void update() {
	super.update();

	waitingTime += Game.elapsed;

	float p = timeLeft / TIME_TO_FADE;

	switch (phase) {

		case FADE_IN:
			message.alpha(1 - p);
			if ((timeLeft -= Game.elapsed) <= 0) {
				if (!thread.isAlive() && error == null) {
					phase = Phase.FADE_OUT;
					timeLeft = TIME_TO_FADE;
				} else {
					phase = Phase.STATIC;
				}
			}
			break;

		case FADE_OUT:
			message.alpha(p);

			if (mode == Mode.CONTINUE
					|| (mode == Mode.DESCEND && Dungeon.depth == 1)) {
				Music.INSTANCE.volume(p);
			}
			if ((timeLeft -= Game.elapsed) <= 0) {
				Game.switchScene(GameScene.class);
			}
			break;

		case STATIC:
			if (error != null) {
				String errorMsg;
				if (error instanceof FileNotFoundException)
					errorMsg = ERR_FILE_NOT_FOUND;
				else if (error instanceof IOException)
					errorMsg = ERR_IO;

				else throw new RuntimeException("fatal error occured while moving between floors", error);

				add(new WndError(errorMsg) {
					@Override
					public void onBackPressed() {
						super.onBackPressed();
						Game.switchScene(StartScene.class);
					}
				});
				error = null;
			} else if ((int)waitingTime == 10){
				waitingTime = 11f;
				Throwable t = new Throwable();
				t.setStackTrace(thread.getStackTrace());
				throw new RuntimeException("waited more than 10 seconds on levelgen.", t);
			}
			break;
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:62,代码来源:InterlevelScene.java

示例13: update

import com.watabou.noosa.Game; //导入方法依赖的package包/类
@Override
public void update() {
	super.update();
	
	float p = timeLeft / TIME_TO_FADE;
	
	switch (phase) {
	
	case FADE_IN:
		message.alpha( 1 - p );
		if ((timeLeft -= Game.elapsed) <= 0) {
			if (!thread.isAlive() && error == null) {
				phase = Phase.FADE_OUT;
				timeLeft = TIME_TO_FADE;
			} else {
				phase = Phase.STATIC;
			}
		}
		break;
		
	case FADE_OUT:
		message.alpha( p );
		if (mode == Mode.CONTINUE || (mode == Mode.DESCEND && Dungeon.depth == 1)) {
			Music.INSTANCE.volume( p );
		}
		if ((timeLeft -= Game.elapsed) <= 0) {
			Game.switchScene( GameScene.class );
		}
		break;
		
	case STATIC:
		if (error != null) {
			add( new WndError( error ) {
				public void onBackPressed() {
					super.onBackPressed();
					Game.switchScene( StartScene.class );
				};
			} );
			error = null;
		}
		break;
	}
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:44,代码来源:InterlevelScene.java

示例14: create

import com.watabou.noosa.Game; //导入方法依赖的package包/类
@Override
public void create() {
	super.create();
	
	BitmapTextMultiline text = null;
	if (!noText) {
		text = createMultiline( TXT, 8 );
		text.maxWidth = WIDTH;
		text.measure();
		add( text );
	}
	
	amulet = new Image( Assets.AMULET );
	add( amulet );
	
	RedButton btnExit = new RedButton( TXT_EXIT ) {
		@Override
		protected void onClick() {
			Dungeon.win( ResultDescriptions.WIN );
			Dungeon.deleteGame( Dungeon.hero.heroClass, true );
			Game.switchScene( noText ? TitleScene.class : RankingsScene.class );
		}
	};
	btnExit.setSize( WIDTH, BTN_HEIGHT );
	add( btnExit );
	
	RedButton btnStay = new RedButton( TXT_STAY ) {
		@Override
		protected void onClick() {
			onBackPressed();
		}
	};
	btnStay.setSize( WIDTH, BTN_HEIGHT );
	add( btnStay );
	
	float height;
	if (noText) {
		height = amulet.height + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();
		
		amulet.x = align( (Camera.main.width - amulet.width) / 2 );
		amulet.y = align( (Camera.main.height - height) / 2 );
		
		btnExit.setPos( (Camera.main.width - btnExit.width()) / 2, amulet.y + amulet.height + LARGE_GAP );
		btnStay.setPos( btnExit.left(), btnExit.bottom() + SMALL_GAP );
		
	} else {
		height = amulet.height + LARGE_GAP + text.height() + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();
		
		amulet.x = align( (Camera.main.width - amulet.width) / 2 );
		amulet.y = align( (Camera.main.height - height) / 2 );
		
		text.x =  align( (Camera.main.width - text.width()) / 2 );
		text.y = amulet.y + amulet.height + LARGE_GAP;
		
		btnExit.setPos( (Camera.main.width - btnExit.width()) / 2, text.y + text.height() + LARGE_GAP );
		btnStay.setPos( btnExit.left(), btnExit.bottom() + SMALL_GAP );
	}

	new Flare( 8, 48 ).color( 0xFFDDBB, true ).show( amulet, 0 ).angularSpeed = +30;
	
	fadeIn();
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:63,代码来源:AmuletScene.java

示例15: onBackPressed

import com.watabou.noosa.Game; //导入方法依赖的package包/类
@Override
protected void onBackPressed() {
	InterlevelScene.mode = InterlevelScene.Mode.CONTINUE;
	Game.switchScene( InterlevelScene.class );
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:6,代码来源:AmuletScene.java


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