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


Java RedButton类代码示例

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


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

示例1: WndImp

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndImp( final Imp imp, final DwarfToken tokens ) {
	
	super();
	
	IconTitle titlebar = new IconTitle();
	titlebar.icon( new ItemSprite( tokens.image(), null ) );
	titlebar.label( Messages.titleCase( tokens.name() ) );
	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );
	
	RenderedTextMultiline message = PixelScene.renderMultiline( Messages.get(this, "message"), 6 );
	message.maxWidth(WIDTH);
	message.setPos(0, titlebar.bottom() + GAP);
	add( message );
	
	RedButton btnReward = new RedButton( Messages.get(this, "reward") ) {
		@Override
		protected void onClick() {
			takeReward( imp, tokens, Imp.Quest.reward );
		}
	};
	btnReward.setRect( 0, message.top() + message.height() + GAP, WIDTH, BTN_HEIGHT );
	add( btnReward );
	
	resize( WIDTH, (int)btnReward.bottom() );
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:27,代码来源:WndImp.java

示例2: WndHardNotification

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndHardNotification(Component titlebar, String message, String btnMessage, int time) {
	super(titlebar, message);

	timeLeft = time;
	this.btnMessage = btnMessage;

	btnOkay = new RedButton(btnMessage + " (" + time +")"){
		@Override
		protected void onClick() {
			hide();
		}
	};
	btnOkay.setRect(0, height + GAP, width, 16);
	btnOkay.enable(false);
	add(btnOkay);

	resize(width, (int) btnOkay.bottom());
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:19,代码来源:WndHardNotification.java

示例3: WndWandmaker

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndWandmaker( final Wandmaker wandmaker, final Item item ) {
	
	super();
	
	IconTitle titlebar = new IconTitle();
	titlebar.icon( new ItemSprite( item.image(), null ) );
	titlebar.label( Utils.capitalize( item.name() ) );
	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );
	
	BitmapTextMultiline message = PixelScene.createMultiline( TXT_MESSAGE, 6 );
	message.maxWidth = WIDTH;
	message.measure();
	message.y = titlebar.bottom() + GAP;
	add( message );
	
	RedButton btnBattle = new RedButton( TXT_BATTLE ) {
		@Override
		protected void onClick() {
			selectReward( wandmaker, item, Wandmaker.Quest.wand1 );
		}
	};
	btnBattle.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT );
	add( btnBattle );
	
	RedButton btnNonBattle = new RedButton( TXT_NON_BATTLE ) {
		@Override
		protected void onClick() {
			selectReward( wandmaker, item, Wandmaker.Quest.wand2 );
		}
	};
	btnNonBattle.setRect( 0, btnBattle.bottom() + GAP, WIDTH, BTN_HEIGHT );
	add( btnNonBattle );
	
	resize( WIDTH, (int)btnNonBattle.bottom() );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:37,代码来源:WndWandmaker.java

示例4: WndImp

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndImp( final Imp imp, final DwarfToken tokens ) {
	
	super();
	
	IconTitle titlebar = new IconTitle();
	titlebar.icon( new ItemSprite( tokens.image(), null ) );
	titlebar.label( Utils.capitalize( tokens.name() ) );
	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );
	
	BitmapTextMultiline message = PixelScene.createMultiline( TXT_MESSAGE, 6 );
	message.maxWidth = WIDTH;
	message.measure();
	message.y = titlebar.bottom() + GAP;
	add( message );
	
	RedButton btnReward = new RedButton( TXT_REWARD ) {
		@Override
		protected void onClick() {
			takeReward( imp, tokens, Imp.Quest.reward );
		}
	};
	btnReward.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT );
	add( btnReward );
	
	resize( WIDTH, (int)btnReward.bottom() );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:28,代码来源:WndImp.java

示例5: WndOptions

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndOptions( String title, String message, String... options ) {
	super();
	
	BitmapTextMultiline tfTitle = PixelScene.createMultiline( title, 9 );
	tfTitle.hardlight( TITLE_COLOR );
	tfTitle.x = tfTitle.y = MARGIN;
	tfTitle.maxWidth = WIDTH - MARGIN * 2;
	tfTitle.measure();
	add( tfTitle );
	
	BitmapTextMultiline tfMesage = PixelScene.createMultiline( message, 8 );
	tfMesage.maxWidth = WIDTH - MARGIN * 2;
	tfMesage.measure();
	tfMesage.x = MARGIN;
	tfMesage.y = tfTitle.y + tfTitle.height() + MARGIN;
	add( tfMesage );
	
	float pos = tfMesage.y + tfMesage.height() + MARGIN;
	
	for (int i=0; i < options.length; i++) {
		final int index = i;
		RedButton btn = new RedButton( options[i] ) {
			@Override
			protected void onClick() {
				hide();
				onSelect( index );
			}
		};
		btn.setRect( MARGIN, pos, WIDTH - MARGIN * 2, BUTTON_HEIGHT );
		add( btn );
		
		pos += BUTTON_HEIGHT + MARGIN;
	}
	
	resize( WIDTH, (int)pos );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:37,代码来源:WndOptions.java

示例6: compare

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
@Override
public int compare(RedButton lhs, RedButton rhs) {
	if (lhs.width() < rhs.width()){
		return -1;
	} else if (lhs.width() == rhs.width()){
		return 0;
	} else {
		return 1;
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:11,代码来源:WndItem.java

示例7: addButtons

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
private void addButtons( RedButton btn1, RedButton btn2 ) {
	add( btn1 );
	btn1.setRect( 0, pos > 0 ? pos += GAP : 0, (WIDTH - GAP) / 2, BTN_HEIGHT );
	add( btn2 );
	btn2.setRect( btn1.right() + GAP, btn1.top(), WIDTH - btn1.right() - GAP, BTN_HEIGHT );
	pos += BTN_HEIGHT;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:8,代码来源:WndGame.java

示例8: WndOptions

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndOptions( String title, String message, String... options ) {
	super();

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

	RenderedTextMultiline tfTitle = PixelScene.renderMultiline( title, 9 );
	tfTitle.hardlight( TITLE_COLOR );
	tfTitle.setPos(MARGIN, MARGIN);
	tfTitle.maxWidth(width - MARGIN * 2);
	add( tfTitle );
	
	RenderedTextMultiline tfMesage = PixelScene.renderMultiline( 6 );
	tfMesage.text(message, width - MARGIN * 2);
	tfMesage.setPos( MARGIN, tfTitle.top() + tfTitle.height() + MARGIN );
	add( tfMesage );
	
	float pos = tfMesage.bottom() + MARGIN;
	
	for (int i=0; i < options.length; i++) {
		final int index = i;
		RedButton btn = new RedButton( options[i] ) {
			@Override
			protected void onClick() {
				hide();
				onSelect( index );
			}
		};
		btn.setRect( MARGIN, pos, width - MARGIN * 2, BUTTON_HEIGHT );
		add( btn );
		
		pos += BUTTON_HEIGHT + MARGIN;
	}
	
	resize( width, (int)pos );
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:36,代码来源:WndOptions.java

示例9: createChildren

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
@Override
protected void createChildren() {
	itemButtons = new RedButton[NUM_BUTTONS];
	for (int i = 0; i < NUM_BUTTONS; i++){
		final int idx = i;
		itemButtons[i] = new RedButton( "" ){
			@Override
			protected void onClick() {
				currentItemIdx = idx;
				updateList();
			}
		};
		itemButtons[i].icon(new ItemSprite(ItemSpriteSheet.WEAPON_HOLDER + i, null));
		add( itemButtons[i] );
	}
	
	list = new ScrollPane( new Component() ) {
		@Override
		public void onClick( float x, float y ) {
			int size = items.size();
			for (int i=0; i < size; i++) {
				if (items.get( i ).onClick( x, y )) {
					break;
				}
			}
		}
	};
	add( list );
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:30,代码来源:WndJournal.java

示例10: WndKeymap

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndKeymap() {

		int ww = Math.min( 160, PixelScene.uiCamera.width - 16 );
		int wh = PixelScene.uiCamera.height - 24;

		resize( ww, wh );

		RedButton btnReset = new RedButton( "Reset To Defaults" ) {
			@Override
			protected void onClick() {
				resetToDefaults();
				populateList();
			}
		};
		btnReset.setRect( 0, height - BTN_HEIGHT, width, BTN_HEIGHT );
		add( btnReset );

		listContent = new Component();
		final ScrollPane list = new ScrollPane(listContent) {
			@Override
			public void onClick( float x, float y ) {
				for (ListItem item : items.values()) {
					if (item.onClick( x, y )) {
						break;
					}
				}
			}
		};

		populateList();

		add(list);

		list.setRect(0, 0, width, btnReset.top() );
	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon-gdx,代码行数:36,代码来源:WndKeymap.java

示例11: create

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的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:wolispace,项目名称:soft-pixel-dungeon,代码行数:63,代码来源:AmuletScene.java

示例12: WndSadGhost

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndSadGhost( final Ghost ghost, final int type ) {
	
	super();
	
	IconTitle titlebar = new IconTitle();
       BitmapTextMultiline message;
       switch (type){
           case 1:default:
               titlebar.icon( new FetidRatSprite() );
               titlebar.label( "DEFEATED FETID RAT" );
               message = PixelScene.createMultiline( TXT_RAT+TXT_GIVEITEM, 6 );
               break;
           case 2:
               titlebar.icon( new GnollTricksterSprite() );
               titlebar.label( "DEFEATED GNOLL TRICKSTER" );
               message = PixelScene.createMultiline( TXT_GNOLL+TXT_GIVEITEM, 6 );
               break;
           case 3:
               titlebar.icon( new GreatCrabSprite());
               titlebar.label( "DEFEATED GREAT CRAB" );
               message = PixelScene.createMultiline( TXT_CRAB+TXT_GIVEITEM, 6 );
               break;

       }


	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );

	message.maxWidth = WIDTH;
	message.measure();
	message.y = titlebar.bottom() + GAP;
	add( message );
	
	RedButton btnWeapon = new RedButton( TXT_WEAPON ) {
		@Override
		protected void onClick() {
			selectReward( ghost, Ghost.Quest.weapon );
		}
	};
	btnWeapon.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT );
	add( btnWeapon );

       if (!Dungeon.isChallenged( Challenges.NO_ARMOR )) {
           RedButton btnArmor = new RedButton(TXT_ARMOR) {
               @Override
               protected void onClick() {
                   selectReward(ghost, Ghost.Quest.armor);
               }
           };
           btnArmor.setRect(0, btnWeapon.bottom() + GAP, WIDTH, BTN_HEIGHT);
           add(btnArmor);

           resize(WIDTH, (int) btnArmor.bottom());
       } else {
           resize(WIDTH, (int) btnWeapon.bottom());
       }
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:59,代码来源:WndSadGhost.java

示例13: WndResurrect

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndResurrect( final Ankh ankh, Object causeOfDeath ) {
	
	super();
	
	instance = this;
	WndResurrect.causeOfDeath = causeOfDeath;
	
	IconTitle titlebar = new IconTitle();
	titlebar.icon( new ItemSprite( ankh.image(), null ) );
	titlebar.label( ankh.name() );
	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );
	
	BitmapTextMultiline message = PixelScene.createMultiline( TXT_MESSAGE, 6 );
	message.maxWidth = WIDTH;
	message.measure();
	message.y = titlebar.bottom() + GAP;
	add( message );
	
	RedButton btnYes = new RedButton( TXT_YES ) {
		@Override
		protected void onClick() {
			hide();
			
			Statistics.ankhsUsed++;
			
			InterlevelScene.mode = InterlevelScene.Mode.RESURRECT;
			Game.switchScene( InterlevelScene.class );
		}
	};
	btnYes.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT );
	add( btnYes );
	
	RedButton btnNo = new RedButton( TXT_NO ) {
		@Override
		protected void onClick() {
			hide();
			
			Rankings.INSTANCE.submit( false );
			Hero.reallyDie( WndResurrect.causeOfDeath );
		}
	};
	btnNo.setRect( 0, btnYes.bottom() + GAP, WIDTH, BTN_HEIGHT );
	add( btnNo );
	
	resize( WIDTH, (int)btnNo.bottom() );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:48,代码来源:WndResurrect.java

示例14: addButton

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
private void addButton( RedButton btn ) {
	add( btn );
	btn.setRect( 0, pos > 0 ? pos += GAP : 0, WIDTH, BTN_HEIGHT );
	pos += BTN_HEIGHT;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:6,代码来源:WndGame.java

示例15: StatsTab

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
public StatsTab() {
	super();
	
	String heroClass = Dungeon.hero.className();
	
	IconTitle title = new IconTitle();
	title.icon( HeroSprite.avatar( Dungeon.hero.heroClass, Dungeon.hero.tier() ) );
	title.label( Utils.format( TXT_TITLE, Dungeon.hero.lvl, heroClass ).toUpperCase( Locale.ENGLISH ) );
          title.color(Window.SHPX_COLOR);
	title.setRect( 0, 0, WIDTH, 0 );
	add( title );
	
	float pos = title.bottom();

          if (Dungeon.challenges > 0) {
              RedButton btnCatalogus = new RedButton( TXT_CHALLENGES ) {
                  @Override
                  protected void onClick() {
                      Game.scene().add( new WndChallenges( Dungeon.challenges, false ) );
                  }
              };
              btnCatalogus.setRect( 0, pos + GAP, btnCatalogus.reqWidth() + 2, btnCatalogus.reqHeight() + 2 );
              add( btnCatalogus );

              pos = btnCatalogus.bottom();
          }

          pos += GAP + GAP;
	
	pos = statSlot( this, TXT_STR, Integer.toString( Dungeon.hero.STR ), pos );
	pos = statSlot( this, TXT_HEALTH, Integer.toString( Dungeon.hero.HT ), pos );
	
	pos += GAP;
	
	pos = statSlot( this, TXT_DURATION, Integer.toString( (int)Statistics.duration ), pos );
	
	pos += GAP;
	
	pos = statSlot( this, TXT_DEPTH, Integer.toString( Statistics.deepestFloor ), pos );
	pos = statSlot( this, TXT_ENEMIES, Integer.toString( Statistics.enemiesSlain ), pos );
	pos = statSlot( this, TXT_GOLD, Integer.toString( Statistics.goldCollected ), pos );
	
	pos += GAP;
	
	pos = statSlot( this, TXT_FOOD, Integer.toString( Statistics.foodEaten ), pos );
	pos = statSlot( this, TXT_ALCHEMY, Integer.toString( Statistics.potionsCooked ), pos );
	pos = statSlot( this, TXT_ANKHS, Integer.toString( Statistics.ankhsUsed ), pos );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:49,代码来源:WndRanking.java


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