• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RedButton类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: WndTradeItem

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndTradeItem( final Item item, WndBag owner ) {
	
	super();
	
	this.owner = owner; 
	
	float pos = createDescription( item, false );
	
	if (item.quantity() == 1) {
		
		RedButton btnSell = new RedButton( Utils.format( TXT_SELL, item.price() ) ) {
			@Override
			protected void onClick() {
				sell( item );
				hide();
			}
		};
		btnSell.setRect( 0, pos + GAP, WIDTH, BTN_HEIGHT );
		add( btnSell );
		
		pos = btnSell.bottom();
		
	} else {
		
		int priceAll= item.price();
		RedButton btnSell1 = new RedButton( Utils.format( TXT_SELL_1, priceAll / item.quantity() ) ) {
			@Override
			protected void onClick() {
				sellOne( item );
				hide();
			}
		};
		btnSell1.setRect( 0, pos + GAP, WIDTH, BTN_HEIGHT );
		add( btnSell1 );
		RedButton btnSellAll = new RedButton( Utils.format( TXT_SELL_ALL, priceAll ) ) {
			@Override
			protected void onClick() {
				sell( item );
				hide();
			}
		};
		btnSellAll.setRect( 0, btnSell1.bottom() + GAP, WIDTH, BTN_HEIGHT );
		add( btnSellAll );
		
		pos = btnSellAll.bottom();
		
	}
	
	RedButton btnCancel = new RedButton( TXT_CANCEL ) {
		@Override
		protected void onClick() {
			hide();
		}
	};
	btnCancel.setRect( 0, pos + GAP, WIDTH, BTN_HEIGHT );
	add( btnCancel );
	
	resize( WIDTH, (int)btnCancel.bottom() );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:60,代码来源:WndTradeItem.java


示例17: StatsTab

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
public StatsTab() {
	
	Hero hero = Dungeon.hero;

          IconTitle title = new IconTitle();
          title.icon( HeroSprite.avatar(hero.heroClass, hero.tier()) );
          title.label(Utils.format( TXT_TITLE, hero.lvl, hero.className() ).toUpperCase( Locale.ENGLISH ), 9);
          title.color(Window.SHPX_COLOR);
          title.setRect( 0, 0, WIDTH, 0 );
	add(title);

	RedButton btnCatalogus = new RedButton( TXT_CATALOGUS ) {
		@Override
		protected void onClick() {
			hide();
			GameScene.show( new WndCatalogus() );
		}
	};
	btnCatalogus.setRect( 0, title.height(), btnCatalogus.reqWidth() + 2, btnCatalogus.reqHeight() + 2 );
	add( btnCatalogus );

	RedButton btnJournal = new RedButton( TXT_JOURNAL ) {
		@Override
		protected void onClick() {
			hide();
			GameScene.show( new WndJournal() );
		}
	};
	btnJournal.setRect(
		btnCatalogus.right() + 1, btnCatalogus.top(),
		btnJournal.reqWidth() + 2, btnJournal.reqHeight() + 2 );
	add( btnJournal );

	pos = btnCatalogus.bottom() + GAP;

	statSlot( TXT_STR, hero.STR() );
	statSlot( TXT_HEALTH, hero.HP + "/" + hero.HT );
	statSlot( TXT_EXP, hero.exp + "/" + hero.maxExp() );

	pos += GAP;

	statSlot( TXT_GOLD, Statistics.goldCollected );
	statSlot( TXT_DEPTH, Statistics.deepestFloor );

	pos += GAP;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:47,代码来源:WndHero.java


示例18: WndBlacksmith

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndBlacksmith( Blacksmith troll, Hero hero ) {
	
	super();
	
	IconTitle titlebar = new IconTitle();
	titlebar.icon( troll.sprite() );
	titlebar.label( Utils.capitalize( troll.name ) );
	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );
	
	BitmapTextMultiline message = PixelScene.createMultiline( TXT_PROMPT, 6 );
	message.maxWidth = WIDTH;
	message.measure();
	message.y = titlebar.bottom() + GAP;
	add( message );
	
	btnItem1 = new ItemButton() {
		@Override
		protected void onClick() {
			btnPressed = btnItem1;
			GameScene.selectItem( itemSelector, WndBag.Mode.UPGRADEABLE, TXT_SELECT );
		}
	};
	btnItem1.setRect( (WIDTH - BTN_GAP) / 2 - BTN_SIZE, message.y + message.height() + BTN_GAP, BTN_SIZE, BTN_SIZE );
	add( btnItem1 );
	
	btnItem2 = new ItemButton() {
		@Override
		protected void onClick() {
			btnPressed = btnItem2;
			GameScene.selectItem( itemSelector, WndBag.Mode.UPGRADEABLE, TXT_SELECT );
		}
	};
	btnItem2.setRect( btnItem1.right() + BTN_GAP, btnItem1.top(), BTN_SIZE, BTN_SIZE );
	add( btnItem2 );
	
	btnReforge = new RedButton( TXT_REFORGE ) {
		@Override
		protected void onClick() {
			Blacksmith.upgrade( btnItem1.item, btnItem2.item );
			hide();
		}
	};
	btnReforge.enable( false );
	btnReforge.setRect( 0, btnItem1.bottom() + BTN_GAP, WIDTH, 20 );
	add( btnReforge );
	
	
	resize( WIDTH, (int)btnReforge.bottom() );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:51,代码来源:WndBlacksmith.java


示例19: WndChooseWay

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndChooseWay( final TomeOfMastery tome, final HeroSubClass way1, final HeroSubClass way2 ) {
	
	super();
	
	IconTitle titlebar = new IconTitle();
	titlebar.icon( new ItemSprite( tome.image(), null ) );
	titlebar.label( tome.name() );
	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );
	
	Highlighter hl = new Highlighter( way1.desc() + "\n\n" + way2.desc() + "\n\n" + TXT_MESSAGE );
	
	BitmapTextMultiline normal = PixelScene.createMultiline( hl.text, 6 );
	normal.maxWidth = WIDTH;
	normal.measure();
	normal.x = titlebar.left();
	normal.y = titlebar.bottom() + GAP;
	add( normal );
	
	if (hl.isHighlighted()) {
		normal.mask = hl.inverted();
		
		BitmapTextMultiline highlighted = PixelScene.createMultiline( hl.text, 6 );
		highlighted.maxWidth = normal.maxWidth;
		highlighted.measure();
		highlighted.x = normal.x;
		highlighted.y = normal.y;
		add( highlighted );

		highlighted.mask = hl.mask;
		highlighted.hardlight( TITLE_COLOR );
	}
	
	RedButton btnWay1 = new RedButton( Utils.capitalize( way1.title() ) ) {
		@Override
		protected void onClick() {
			hide();
			tome.choose( way1 );
		}
	};
	btnWay1.setRect( 0, normal.y + normal.height() + GAP, (WIDTH - GAP) / 2, BTN_HEIGHT );
	add( btnWay1 );
	
	RedButton btnWay2 = new RedButton( Utils.capitalize( way2.title() ) ) {
		@Override
		protected void onClick() {
			hide();
			tome.choose( way2 );
		}
	};
	btnWay2.setRect( btnWay1.right() + GAP, btnWay1.top(), btnWay1.width(), BTN_HEIGHT );
	add( btnWay2 );
	
	RedButton btnCancel = new RedButton( TXT_CANCEL ) {
		@Override
		protected void onClick() {
			hide();
		}
	};
	btnCancel.setRect( 0, btnWay2.bottom() + GAP, WIDTH, BTN_HEIGHT );
	add( btnCancel );
	
	resize( WIDTH, (int)btnCancel.bottom() );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:65,代码来源:WndChooseWay.java


示例20: WndBalance

import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndBalance( final Weapon weapon ) {
    super();

    IconTitle titlebar = new IconTitle( weapon );
    titlebar.setRect( 0, 0, WIDTH, 0 );
    add( titlebar );

    BitmapTextMultiline tfMesage = PixelScene.createMultiline( Utils.format( TXT_CHOICE, weapon.name() ), 8 );
    tfMesage.maxWidth = WIDTH - MARGIN * 2;
    tfMesage.measure();
    tfMesage.x = MARGIN;
    tfMesage.y = titlebar.bottom() + MARGIN;
    add( tfMesage );

    float pos = tfMesage.y + tfMesage.height();

    if (weapon.imbue != Weapon.Imbue.LIGHT) {
        RedButton btnSpeed = new RedButton( TXT_LIGHT ) {
            @Override
            protected void onClick() {
                hide();
                Weightstone.this.apply( weapon, true );
            }
        };
        btnSpeed.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
        add( btnSpeed );

        pos = btnSpeed.bottom();
    }

    if (weapon.imbue != Weapon.Imbue.HEAVY) {
        RedButton btnAccuracy = new RedButton( TXT_HEAVY ) {
            @Override
            protected void onClick() {
                hide();
                Weightstone.this.apply( weapon, false );
            }
        };
        btnAccuracy.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
        add( btnAccuracy );

        pos = btnAccuracy.bottom();
    }

    RedButton btnCancel = new RedButton( TXT_CANCEL ) {
        @Override
        protected void onClick() {
            hide();
        }
    };
    btnCancel.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
    add( btnCancel );

    resize( WIDTH, (int)btnCancel.bottom() + MARGIN );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:56,代码来源:Weightstone.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java INetSystem类代码示例发布时间:2022-05-16
下一篇:
Java Automatons类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap