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


Java ShatteredPixelDungeon类代码示例

本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon的典型用法代码示例。如果您正苦于以下问题:Java ShatteredPixelDungeon类的具体用法?Java ShatteredPixelDungeon怎么用?Java ShatteredPixelDungeon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: seed

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static<T extends Blob> T seed( int cell, int amount, Class<T> type ) {
	try {
		
		T gas = (T)Dungeon.level.blobs.get( type );
		if (gas == null) {
			gas = type.newInstance();
			Dungeon.level.blobs.put( type, gas );
		}
		
		gas.seed( cell, amount );
		
		return gas;
		
	} catch (Exception e) {
		ShatteredPixelDungeon.reportException(e);
		return null;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:20,代码来源:Blob.java

示例2: onTouchUp

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入依赖的package包/类
@Override
protected void onTouchUp( Touch t ) {
	if (pinching && (t == touch || t == another)) {
		
		pinching = false;
		
		int zoom = Math.round( camera.zoom );
		camera.zoom( zoom );
		ShatteredPixelDungeon.zoom((int) (zoom - PixelScene.defaultZoom));
		
		dragging = true;
		if (t == touch) {
			touch = another;
		}
		another = null;
		lastPos.set( touch.current );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:19,代码来源:CellSelector.java

示例3: seed

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static<T extends Blob> T seed( int cell, int amount, Class<T> type, Level level ) {
	try {
		
		T gas = (T)level.blobs.get( type );
		if (gas == null) {
			gas = type.newInstance();
			level.blobs.put( type, gas );
		}
		
		gas.seed( level, cell, amount );
		
		return gas;
		
	} catch (Exception e) {
		ShatteredPixelDungeon.reportException(e);
		return null;
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:20,代码来源:Blob.java

示例4: zoom

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入依赖的package包/类
private float zoom( float value ) {

		value = GameMath.gate( PixelScene.minZoom, value, PixelScene.maxZoom );
		ShatteredPixelDungeon.zoom((int) (value - PixelScene.defaultZoom));
		camera.zoom( value );

		//Resets character sprite positions with the new camera zoom
		//This is important as characters are centered on a 16x16 tile, but may have any sprite size
		//This can lead to none-whole coordinate, which need to be aligned with the zoom
		for (Char c : Actor.chars()){
			if (c.sprite != null && !c.sprite.isMoving){
				c.sprite.point(c.sprite.worldToCamera(c.pos));
			}
		}

		return value;
	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:18,代码来源:CellSelector.java

示例5: placeDoors

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入依赖的package包/类
private void placeDoors( Room r ) {
	for (Room n : r.connected.keySet()) {
		Room.Door door = r.connected.get( n );
		if (door == null) {
			
			Rect i = r.intersect( n );
			ArrayList<Point> doorSpots = new ArrayList<>();
			for (Point p : i.getPoints()){
				if (r.canConnect(p) && n.canConnect(p))
					doorSpots.add(p);
			}
			if (doorSpots.isEmpty()){
				ShatteredPixelDungeon.reportException(
						new RuntimeException("Could not place a door! " +
								"r=" + r.getClass().getSimpleName() +
								" n=" + n.getClass().getSimpleName()));
				continue;
			}
			door = new Room.Door(Random.element(doorSpots));
			
			r.connected.put( n, door );
			n.connected.put( r, door );
		}
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon-gdx,代码行数:26,代码来源:RegularPainter.java

示例6: updateVersion

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入依赖的package包/类
private void updateVersion(int previousVersion){
	
	//update rankings, to update any data which may be outdated
	if (previousVersion < LATEST_UPDATE){
		try {
			Rankings.INSTANCE.load();
			Rankings.INSTANCE.save();
		} catch (Exception e) {
			//if we encounter a fatal error, then just clear the rankings
			Game.instance.deleteFile( Rankings.RANKINGS_FILE );
		}
	}
	
	//remove changed badges
	if (previousVersion <= ShatteredPixelDungeon.v0_6_0b){
		Badges.disown(Badges.Badge.ALL_WANDS_IDENTIFIED);
		Badges.disown(Badges.Badge.ALL_RINGS_IDENTIFIED);
		Badges.disown(Badges.Badge.ALL_SCROLLS_IDENTIFIED);
		Badges.disown(Badges.Badge.ALL_POTIONS_IDENTIFIED);
		Badges.disown(Badges.Badge.ALL_ITEMS_IDENTIFIED);
		Badges.saveGlobal();
	}

	ShatteredPixelDungeon.version(ShatteredPixelDungeon.versionCode);
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:26,代码来源:WelcomeScene.java

示例7: saveGlobal

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入依赖的package包/类
public static void saveGlobal(){
	if (!saveNeeded){
		return;
	}
	
	Bundle bundle = new Bundle();
	
	Catalog.store(bundle);
	Document.store(bundle);
	
	try {
		OutputStream output = Game.instance.openFileOutput( JOURNAL_FILE, Game.MODE_PRIVATE );
		Bundle.write( bundle, output );
		output.close();
		saveNeeded = false;
	} catch (IOException e) {
		ShatteredPixelDungeon.reportException(e);
	}
	
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:21,代码来源:Journal.java

示例8: setup

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入依赖的package包/类
public static void setup( Languages lang ){
	strings = new HashMap<>();
	Messages.lang = lang;
	Locale locale = new Locale(lang.code());

	for (String file : prop_files) {
		ResourceBundle bundle = ResourceBundle.getBundle( file, locale);
		Enumeration<String> keys = bundle.getKeys();
		while (keys.hasMoreElements()) {
			String key = keys.nextElement();
			String value = bundle.getString(key);

			//android 2.2 doesn't use UTF-8 by default, need to force it.
			if (android.os.Build.VERSION.SDK_INT == android.os.Build.VERSION_CODES.FROYO) {
				try {
					value = new String(value.getBytes("ISO-8859-1"), "UTF-8");
				} catch (Exception e) {
					ShatteredPixelDungeon.reportException(e);
				}
			}

			strings.put(key, value);
		}
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:26,代码来源:Messages.java

示例9: fillFields

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入依赖的package包/类
private void fillFields( int image, ItemSprite.Glowing glowing, int titleColor, String title, String info ) {

		int width = ShatteredPixelDungeon.landscape() ? WIDTH_L : WIDTH_P;

		IconTitle titlebar = new IconTitle();
		titlebar.icon( new ItemSprite( image, glowing ) );
		titlebar.label( Messages.titleCase( title ), titleColor );
		titlebar.setRect( 0, 0, width, 0 );
		add( titlebar );
		
		RenderedTextMultiline txtInfo = PixelScene.renderMultiline( info, 6 );
		txtInfo.maxWidth(width);
		txtInfo.setPos(titlebar.left(), titlebar.bottom() + GAP);
		add( txtInfo );
		
		resize( width, (int)(txtInfo.top() + txtInfo.height()) );
	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:18,代码来源:WndInfoItem.java

示例10: WndStory

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入依赖的package包/类
public WndStory( String text ) {
	super( 0, 0, Chrome.get( Chrome.Type.SCROLL ) );
	
	tf = PixelScene.renderMultiline( text, 6 );
	tf.maxWidth(ShatteredPixelDungeon.landscape() ?
				WIDTH_L - MARGIN * 2:
				WIDTH_P - MARGIN *2);
	tf.invert();
	tf.setPos(MARGIN, 0);
	add( tf );
	
	add( new TouchArea( chrome ) {
		@Override
		protected void onClick( Touch touch ) {
			hide();
		}
	} );
	
	resize( (int)(tf.width() + MARGIN * 2), (int)Math.min( tf.height(), 180 ) );
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:21,代码来源:WndStory.java

示例11: destroy

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入依赖的package包/类
@Override
public void destroy() {
	super.destroy();
	if (textInput != null){
		ShatteredPixelDungeon.instance.runOnUiThread(new Runnable() {
			@Override
			public void run() {
				//make sure we remove the edit text and soft keyboard
				((ViewGroup) textInput.getParent()).removeView(textInput);

				InputMethodManager imm = (InputMethodManager)ShatteredPixelDungeon
								.instance.getSystemService(Activity.INPUT_METHOD_SERVICE);
				imm.hideSoftInputFromWindow(textInput.getWindowToken(), 0);

				//Soft keyboard sometimes triggers software buttons, so make sure to reassert immersive
				ShatteredPixelDungeon.updateSystemUI();

				textInput = null;
			}
		});
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:23,代码来源:WndTextInput.java

示例12: updateImage

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入依赖的package包/类
private synchronized void updateImage() {
	
	if (sprite != null) {
		sprite.killAndErase();
		sprite = null;
	}
	
	try {
		sprite = lastTarget.spriteClass.newInstance();
		active = true;
		sprite.idle();
		sprite.paused = true;
		add( sprite );

		sprite.x = x + (width - sprite.width()) / 2 + 1;
		sprite.y = y + (height - sprite.height()) / 2;
		PixelScene.align(sprite);
		
	} catch (Exception e) {
		ShatteredPixelDungeon.reportException(e);
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:23,代码来源:AttackIndicator.java

示例13: updateImage

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入依赖的package包/类
private synchronized void updateImage() {
	
	if (sprite != null) {
		sprite.killAndErase();
		sprite = null;
	}
	
	try {
		sprite = lastTarget.spriteClass.newInstance();
		active = true;
		sprite = ClassReflection.newInstance(lastTarget.spriteClass);
		sprite.idle();
		sprite.paused = true;
		add( sprite );

		sprite.x = x + (width - sprite.width()) / 2 + 1;
		sprite.y = y + (height - sprite.height()) / 2;
		PixelScene.align(sprite);
		
	} catch (Exception e) {
		ShatteredPixelDungeon.reportException(e);
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon-gdx,代码行数:24,代码来源:AttackIndicator.java

示例14: random

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入依赖的package包/类
public static Item random( Category cat ) {
	try {
		
		switch (cat) {
		case ARMOR:
			return randomArmor();
		case WEAPON:
			return randomWeapon();
		case ARTIFACT:
			Item item = randomArtifact();
			//if we're out of artifacts, return a ring instead.
			return item != null ? item : random(Category.RING);
		default:
			return ((Item)cat.classes[Random.chances( cat.probs )].newInstance()).random();
		}
		
	} catch (Exception e) {

		ShatteredPixelDungeon.reportException(e);
		return null;
		
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon-gdx,代码行数:24,代码来源:Generator.java

示例15: createRoom

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入依赖的package包/类
public static SecretRoom createRoom(){
	
	SecretRoom r = null;
	int index = runSecrets.size();
	for (int i = 0; i < 4; i++){
		int newidx = Random.Int( runSecrets.size() );
		if (newidx < index) index = newidx;
	}
	try {
		r = runSecrets.get( index ).newInstance();
	} catch (Exception e) {
		ShatteredPixelDungeon.reportException(e);
	}
	
	runSecrets.add(runSecrets.remove(index));
	
	return r;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:19,代码来源:SecretRoom.java


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