Merging 1.9.1 source: window changes

This commit is contained in:
Evan Debenham
2015-11-10 02:15:11 -05:00
parent 46a0f2b319
commit e35573883b
6 changed files with 33 additions and 69 deletions
@@ -145,6 +145,7 @@ public class WndCatalogus extends WndTabbed {
}
content.setSize( width, pos );
list.setSize( list.width(), list.height() );
}
private static class ListItem extends Component {
@@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.HighlightedText;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
public class WndClass extends WndTabbed {
@@ -148,56 +149,35 @@ public class WndClass extends WndTabbed {
private static final int MARGIN = 4;
private BitmapTextMultiline normal;
private BitmapTextMultiline highlighted;
public float height;
public float width;
public MasteryTab() {
super();
String text = null;
String message = null;
switch (cl) {
case WARRIOR:
text = HeroSubClass.GLADIATOR.desc() + "\n\n" + HeroSubClass.BERSERKER.desc();
message = HeroSubClass.GLADIATOR.desc() + "\n\n" + HeroSubClass.BERSERKER.desc();
break;
case MAGE:
text = HeroSubClass.BATTLEMAGE.desc() + "\n\n" + HeroSubClass.WARLOCK.desc();
message = HeroSubClass.BATTLEMAGE.desc() + "\n\n" + HeroSubClass.WARLOCK.desc();
break;
case ROGUE:
text = HeroSubClass.FREERUNNER.desc() + "\n\n" + HeroSubClass.ASSASSIN.desc();
message = HeroSubClass.FREERUNNER.desc() + "\n\n" + HeroSubClass.ASSASSIN.desc();
break;
case HUNTRESS:
text = HeroSubClass.SNIPER.desc() + "\n\n" + HeroSubClass.WARDEN.desc();
message = HeroSubClass.SNIPER.desc() + "\n\n" + HeroSubClass.WARDEN.desc();
break;
}
Highlighter hl = new Highlighter( text );
HighlightedText text = new HighlightedText( 6 );
text.text( message, WIDTH - MARGIN * 2 );
text.setPos( MARGIN, MARGIN );
add( text );
normal = PixelScene.createMultiline( hl.text, 6 );
normal.maxWidth = WIDTH - MARGIN * 2;
normal.measure();
normal.x = MARGIN;
normal.y = MARGIN;
add( normal );
if (hl.isHighlighted()) {
normal.mask = hl.inverted();
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 );
}
height = normal.y + normal.height() + MARGIN;
width = normal.x + normal.width() + MARGIN;
height = text.bottom() + MARGIN;
width = text.right() + MARGIN;
}
}
}
@@ -67,9 +67,9 @@ public class WndInfoItem extends Window {
Item item = heap.peek();
int color = TITLE_COLOR;
if (item.levelKnown && item.level > 0) {
if (item.levelKnown && item.level() > 0) {
color = ItemSlot.UPGRADED;
} else if (item.levelKnown && item.level < 0) {
} else if (item.levelKnown && item.level() < 0) {
color = ItemSlot.DEGRADED;
}
fillFields( item.image(), item.glowing(), color, item.toString(), item.info() );
@@ -116,9 +116,9 @@ public class WndInfoItem extends Window {
super();
int color = TITLE_COLOR;
if (item.levelKnown && item.level > 0) {
if (item.levelKnown && item.level() > 0) {
color = ItemSlot.UPGRADED;
} else if (item.levelKnown && item.level < 0) {
} else if (item.levelKnown && item.level() < 0) {
color = ItemSlot.DEGRADED;
}
@@ -47,9 +47,9 @@ public class WndItem extends Window {
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
if (item.levelKnown && item.level > 0) {
if (item.levelKnown && item.level() > 0) {
titlebar.color( ItemSlot.UPGRADED );
} else if (item.levelKnown && item.level < 0) {
} else if (item.levelKnown && item.level() < 0) {
titlebar.color( ItemSlot.DEGRADED );
}
@@ -21,10 +21,9 @@
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.watabou.noosa.BitmapTextMultiline;
import com.shatteredpixel.shatteredpixeldungeon.ui.HighlightedText;
import com.watabou.noosa.Image;
import com.watabou.noosa.ui.Component;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
public class WndTitledMessage extends Window {
@@ -40,37 +39,19 @@ public class WndTitledMessage extends Window {
}
public WndTitledMessage( Component titlebar, String message ) {
super();
int width = ShatteredPixelDungeon.landscape() ? WIDTH_L : WIDTH_P;
titlebar.setRect( 0, 0, width, 0 );
add( titlebar );
Highlighter hl = new Highlighter( message );
add(titlebar);
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();
HighlightedText text = new HighlightedText( 6 );
text.text( message, width );
text.setPos( titlebar.left(), titlebar.bottom() + GAP );
add( text );
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);
}
resize( width, (int)(normal.y + normal.height()) );
resize( width, (int)text.bottom() );
}
}
@@ -216,10 +216,12 @@ public class WndTradeItem extends Window {
add( titlebar );
// Upgraded / degraded
if (item.levelKnown && item.level > 0) {
titlebar.color( ItemSlot.UPGRADED );
} else if (item.levelKnown && item.level < 0) {
titlebar.color( ItemSlot.DEGRADED );
if (item.levelKnown) {
if (item.level() < 0) {
titlebar.color( ItemSlot.DEGRADED );
} else if (item.level() > 0) {
titlebar.color( ItemSlot.UPGRADED );
}
}
// Description