本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene类的典型用法代码示例。如果您正苦于以下问题:Java PixelScene类的具体用法?Java PixelScene怎么用?Java PixelScene使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PixelScene类属于com.shatteredpixel.shatteredpixeldungeon.scenes包,在下文中一共展示了PixelScene类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayBadge
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; //导入依赖的package包/类
private static void displayBadge( Badge badge ) {
if (badge == null) {
return;
}
if (global.contains( badge )) {
if (!badge.meta) {
GLog.h( "Badge endorsed: %s", badge.description );
}
} else {
global.add( badge );
saveNeeded = true;
if (badge.meta) {
GLog.h( "New super badge: %s", badge.description );
} else {
GLog.h( "New badge: %s", badge.description );
}
PixelScene.showBadge( badge );
}
}
示例2: fillFields
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; //导入依赖的package包/类
private void fillFields( int image, ItemSprite.Glowing glowing, int titleColor, String title, String info ) {
IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite( image, glowing ) );
titlebar.label( Utils.capitalize( title ), titleColor );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
BitmapTextMultiline txtInfo = PixelScene.createMultiline( info, 6 );
txtInfo.maxWidth = WIDTH;
txtInfo.measure();
txtInfo.x = titlebar.left();
txtInfo.y = titlebar.bottom() + GAP;
add( txtInfo );
resize( WIDTH, (int)(txtInfo.y + txtInfo.height()) );
}
示例3: WndChanges
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; //导入依赖的package包/类
public WndChanges() {
super();
resize( WIDTH, HEIGHT );
txtTitle = PixelScene.createText(TXT_TITLE, 9);
txtTitle.hardlight( Window.SHPX_COLOR );
txtTitle.measure();
txtTitle.x = PixelScene.align( PixelScene.uiCamera, (WIDTH - txtTitle.width()) / 2 );
add( txtTitle );
BitmapTextMultiline txtChanges = PixelScene.createMultiline(TXT_CHANGES, 9);
Component content = new Component();
content.add(txtChanges);
text = new ScrollPane( content ) {
};
add( text );
text.setRect( 0, txtTitle.height(), WIDTH, HEIGHT - txtTitle.height() );
}
示例4: WndStory
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; //导入依赖的package包/类
public WndStory( String text ) {
super( 0, 0, Chrome.get( Chrome.Type.SCROLL ) );
tf = PixelScene.createMultiline( text, 7 );
tf.maxWidth = WIDTH - MARGIN * 2;
tf.measure();
tf.ra = bgR;
tf.ga = bgG;
tf.ba = bgB;
tf.rm = -bgR;
tf.gm = -bgG;
tf.bm = -bgB;
tf.x = MARGIN;
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 ) );
}
示例5: MobTitle
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; //导入依赖的package包/类
public MobTitle( Mob mob ) {
hp = (float)mob.HP / mob.HT;
name = PixelScene.createText( Utils.capitalize( mob.name ), 9 );
name.hardlight( TITLE_COLOR );
name.measure();
add( name );
image = mob.sprite();
add( image );
hpBg = new ColorBlock( 1, 1, COLOR_BG );
add( hpBg );
hpLvl = new ColorBlock( 1, 1, COLOR_LVL );
add( hpLvl );
buffs = new BuffIndicator( mob );
add( buffs );
}
示例6: WndInfoPlant
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; //导入依赖的package包/类
public WndInfoPlant( Plant plant ) {
super();
IconTitle titlebar = new IconTitle();
titlebar.icon( new PlantSprite( plant.image ) );
titlebar.label( plant.plantName );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
BitmapTextMultiline info = PixelScene.createMultiline( 6 );
add( info );
info.text( plant.desc() );
info.maxWidth = WIDTH;
info.measure();
info.x = titlebar.left();
info.y = titlebar.bottom() + GAP;
resize( WIDTH, (int)(info.y + info.height()) );
}
示例7: useTargeting
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; //导入依赖的package包/类
private void useTargeting() {
targeting = lastTarget != null && lastTarget.isAlive() && Dungeon.visible[lastTarget.pos];
if (targeting) {
if (Actor.all().contains( lastTarget )) {
lastTarget.sprite.parent.add( crossM );
crossM.point( DungeonTilemap.tileToWorld( lastTarget.pos ) );
crossB.x = PixelScene.align( x + (width - crossB.width) / 2 );
crossB.y = PixelScene.align( y + (height - crossB.height) / 2 );
crossB.visible = true;
} else {
lastTarget = null;
}
}
}
示例8: updateImage
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; //导入依赖的package包/类
private 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) {
}
}
示例9: createChildren
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; //导入依赖的package包/类
@Override
protected void createChildren() {
super.createChildren();
icon = new ItemSprite();
add( icon );
topLeft = new BitmapText( PixelScene.font1x );
add( topLeft );
topRight = new BitmapText( PixelScene.font1x );
add( topRight );
bottomRight = new BitmapText( PixelScene.font1x );
add( bottomRight );
}
示例10: createChildren
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; //导入依赖的package包/类
@Override
protected void createChildren() {
super.createChildren();
bg = Chrome.get( Chrome.Type.TOAST_TR );
add( bg );
close = new SimpleButton( Icons.get( Icons.CLOSE ) ) {
protected void onClick() {
onClose();
};
};
add( close );
text = PixelScene.createText( 8 );
add( text );
}
示例11: layout
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; //导入依赖的package包/类
@Override
protected void layout() {
super.layout();
bg.x = x;
bg.y = y;
bg.size( width, height );
close.setPos(
bg.x + bg.width() - bg.marginHor() / 2 - MARGIN_HOR - close.width(),
y + (height - close.height()) / 2 );
text.x = close.left() - MARGIN_HOR - text.width();
text.y = y + (height - text.height()) / 2;
PixelScene.align( text );
}
示例12: fillFields
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; //导入依赖的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()) );
}
示例13: WndStory
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; //导入依赖的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 ) );
}
示例14: placeTitle
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; //导入依赖的package包/类
protected void placeTitle( Bag bag, int width ){
RenderedText txtTitle = PixelScene.renderText(
title != null ? Messages.titleCase(title) : Messages.titleCase( bag.name() ), 9 );
txtTitle.hardlight( TITLE_COLOR );
txtTitle.x = 1;
txtTitle.y = (int)(TITLE_HEIGHT - txtTitle.baseLine()) / 2f - 1;
PixelScene.align(txtTitle);
add( txtTitle );
ItemSprite gold = new ItemSprite(ItemSpriteSheet.GOLD, null);
gold.x = width - gold.width() - 1;
gold.y = (TITLE_HEIGHT - gold.height())/2f - 1;
PixelScene.align(gold);
add(gold);
BitmapText amt = new BitmapText( Integer.toString(Dungeon.gold), PixelScene.pixelFont );
amt.hardlight(TITLE_COLOR);
amt.measure();
amt.x = width - gold.width() - amt.width() - 2;
amt.y = (TITLE_HEIGHT - amt.baseLine())/2f - 1;
PixelScene.align(amt);
add(amt);
}
示例15: layout
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; //导入依赖的package包/类
@Override
protected void layout() {
health.visible = !Float.isNaN( healthLvl );
imIcon.x = x + (Math.max(0, 8 - imIcon.width()/2));
imIcon.y = y + (Math.max(0, 8 - imIcon.height()/2));
PixelScene.align(imIcon);
int imWidth = (int)Math.max(imIcon.width(), 16);
int imHeight = (int)Math.max(imIcon.height(), 16);
tfLabel.maxWidth((int)(width - (imWidth + GAP)));
tfLabel.setPos(x + imWidth + GAP, imHeight > tfLabel.height() ?
y +(imHeight - tfLabel.height()) / 2 :
y);
PixelScene.align(tfLabel);
if (health.visible) {
health.setRect( tfLabel.left(), tfLabel.bottom(), tfLabel.maxWidth(), 0 );
height = Math.max( imHeight, health.bottom() );
} else {
height = Math.max( imHeight, tfLabel.height() );
}
}