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 ); content.setSize( width, pos );
list.setSize( list.width(), list.height() );
} }
private static class ListItem extends Component { 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.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.HighlightedText;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
public class WndClass extends WndTabbed { public class WndClass extends WndTabbed {
@@ -148,56 +149,35 @@ public class WndClass extends WndTabbed {
private static final int MARGIN = 4; private static final int MARGIN = 4;
private BitmapTextMultiline normal;
private BitmapTextMultiline highlighted;
public float height; public float height;
public float width; public float width;
public MasteryTab() { public MasteryTab() {
super(); super();
String text = null; String message = null;
switch (cl) { switch (cl) {
case WARRIOR: case WARRIOR:
text = HeroSubClass.GLADIATOR.desc() + "\n\n" + HeroSubClass.BERSERKER.desc(); message = HeroSubClass.GLADIATOR.desc() + "\n\n" + HeroSubClass.BERSERKER.desc();
break; break;
case MAGE: case MAGE:
text = HeroSubClass.BATTLEMAGE.desc() + "\n\n" + HeroSubClass.WARLOCK.desc(); message = HeroSubClass.BATTLEMAGE.desc() + "\n\n" + HeroSubClass.WARLOCK.desc();
break; break;
case ROGUE: case ROGUE:
text = HeroSubClass.FREERUNNER.desc() + "\n\n" + HeroSubClass.ASSASSIN.desc(); message = HeroSubClass.FREERUNNER.desc() + "\n\n" + HeroSubClass.ASSASSIN.desc();
break; break;
case HUNTRESS: case HUNTRESS:
text = HeroSubClass.SNIPER.desc() + "\n\n" + HeroSubClass.WARDEN.desc(); message = HeroSubClass.SNIPER.desc() + "\n\n" + HeroSubClass.WARDEN.desc();
break; 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 ); height = text.bottom() + MARGIN;
normal.maxWidth = WIDTH - MARGIN * 2; width = text.right() + MARGIN;
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;
} }
} }
} }
@@ -67,9 +67,9 @@ public class WndInfoItem extends Window {
Item item = heap.peek(); Item item = heap.peek();
int color = TITLE_COLOR; int color = TITLE_COLOR;
if (item.levelKnown && item.level > 0) { if (item.levelKnown && item.level() > 0) {
color = ItemSlot.UPGRADED; color = ItemSlot.UPGRADED;
} else if (item.levelKnown && item.level < 0) { } else if (item.levelKnown && item.level() < 0) {
color = ItemSlot.DEGRADED; color = ItemSlot.DEGRADED;
} }
fillFields( item.image(), item.glowing(), color, item.toString(), item.info() ); fillFields( item.image(), item.glowing(), color, item.toString(), item.info() );
@@ -116,9 +116,9 @@ public class WndInfoItem extends Window {
super(); super();
int color = TITLE_COLOR; int color = TITLE_COLOR;
if (item.levelKnown && item.level > 0) { if (item.levelKnown && item.level() > 0) {
color = ItemSlot.UPGRADED; color = ItemSlot.UPGRADED;
} else if (item.levelKnown && item.level < 0) { } else if (item.levelKnown && item.level() < 0) {
color = ItemSlot.DEGRADED; color = ItemSlot.DEGRADED;
} }
@@ -47,9 +47,9 @@ public class WndItem extends Window {
titlebar.setRect( 0, 0, WIDTH, 0 ); titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar ); add( titlebar );
if (item.levelKnown && item.level > 0) { if (item.levelKnown && item.level() > 0) {
titlebar.color( ItemSlot.UPGRADED ); titlebar.color( ItemSlot.UPGRADED );
} else if (item.levelKnown && item.level < 0) { } else if (item.levelKnown && item.level() < 0) {
titlebar.color( ItemSlot.DEGRADED ); titlebar.color( ItemSlot.DEGRADED );
} }
@@ -21,10 +21,9 @@
package com.shatteredpixel.shatteredpixeldungeon.windows; package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; 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.Image;
import com.watabou.noosa.ui.Component; import com.watabou.noosa.ui.Component;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
public class WndTitledMessage extends Window { public class WndTitledMessage extends Window {
@@ -46,31 +45,13 @@ public class WndTitledMessage extends Window {
int width = ShatteredPixelDungeon.landscape() ? WIDTH_L : WIDTH_P; int width = ShatteredPixelDungeon.landscape() ? WIDTH_L : WIDTH_P;
titlebar.setRect( 0, 0, width, 0 ); titlebar.setRect( 0, 0, width, 0 );
add( titlebar ); add(titlebar);
Highlighter hl = new Highlighter( message ); HighlightedText text = new HighlightedText( 6 );
text.text( message, width );
text.setPos( titlebar.left(), titlebar.bottom() + GAP );
add( text );
BitmapTextMultiline normal = PixelScene.createMultiline(hl.text, 6); resize( width, (int)text.bottom() );
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);
}
resize( width, (int)(normal.y + normal.height()) );
} }
} }
@@ -216,10 +216,12 @@ public class WndTradeItem extends Window {
add( titlebar ); add( titlebar );
// Upgraded / degraded // Upgraded / degraded
if (item.levelKnown && item.level > 0) { if (item.levelKnown) {
titlebar.color( ItemSlot.UPGRADED ); if (item.level() < 0) {
} else if (item.levelKnown && item.level < 0) { titlebar.color( ItemSlot.DEGRADED );
titlebar.color( ItemSlot.DEGRADED ); } else if (item.level() > 0) {
titlebar.color( ItemSlot.UPGRADED );
}
} }
// Description // Description