當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。