diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndCatalogus.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndCatalogus.java index a8991dcf9..943b06e44 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndCatalogus.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndCatalogus.java @@ -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 { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndClass.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndClass.java index c1643601d..fa25d5b51 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndClass.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndClass.java @@ -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; } } } \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java index 6f6f1ace5..09e002241 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java @@ -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; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java index 64600df7b..965557bc9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java @@ -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 ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTitledMessage.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTitledMessage.java index 196c34f4e..0e70c3fe0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTitledMessage.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTitledMessage.java @@ -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() ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTradeItem.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTradeItem.java index 639ff0353..5d7d4f6f8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTradeItem.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTradeItem.java @@ -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