v2.5.0: added full journal functionality to the badges scene
This commit is contained in:
@@ -2158,6 +2158,7 @@ items.item.ac_drop=DROP
|
|||||||
items.item.ac_throw=THROW
|
items.item.ac_throw=THROW
|
||||||
items.item.rankings_desc=Killed by: %s
|
items.item.rankings_desc=Killed by: %s
|
||||||
items.item.curse=curse
|
items.item.curse=curse
|
||||||
|
items.item.custom_note=This item has a custom note: "_%s_"
|
||||||
|
|
||||||
items.kindofmisc.unequip_title=Unequip one item
|
items.kindofmisc.unequip_title=Unequip one item
|
||||||
items.kindofmisc.unequip_message=You must unequip one of these items first. Select an item to swap with.
|
items.kindofmisc.unequip_message=You must unequip one of these items first. Select an item to swap with.
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ windows.wndjournal$catalogtab.trap_count=You have triggered this trap a total of
|
|||||||
windows.wndjournal$catalogtab.plant_count=You have trampled this plant a total of _%,d_ times.
|
windows.wndjournal$catalogtab.plant_count=You have trampled this plant a total of _%,d_ times.
|
||||||
windows.wndjournal$catalogtab.not_seen_lore=You haven't found this lore text in any of your runs yet.
|
windows.wndjournal$catalogtab.not_seen_lore=You haven't found this lore text in any of your runs yet.
|
||||||
windows.wndjournal$badgestab.title=Badges
|
windows.wndjournal$badgestab.title=Badges
|
||||||
|
windows.wndjournal$badgestab.title_main_menu=Your Badges
|
||||||
windows.wndjournal$badgestab.this_run=This Run
|
windows.wndjournal$badgestab.this_run=This Run
|
||||||
windows.wndjournal$badgestab.overall=Overall
|
windows.wndjournal$badgestab.overall=Overall
|
||||||
|
|
||||||
|
|||||||
@@ -504,16 +504,18 @@ public class Item implements Bundlable {
|
|||||||
|
|
||||||
public String info() {
|
public String info() {
|
||||||
|
|
||||||
Notes.CustomRecord note;
|
if (Dungeon.hero != null) {
|
||||||
if (this instanceof EquipableItem){
|
Notes.CustomRecord note;
|
||||||
note = Notes.findCustomRecord(((EquipableItem) this).customNoteID);
|
if (this instanceof EquipableItem) {
|
||||||
} else {
|
note = Notes.findCustomRecord(((EquipableItem) this).customNoteID);
|
||||||
note = Notes.findCustomRecord(getClass());
|
} else {
|
||||||
|
note = Notes.findCustomRecord(getClass());
|
||||||
|
}
|
||||||
|
if (note != null){
|
||||||
|
return Messages.get(this, "custom_note", note.title()) + "\n\n" + desc();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note != null){
|
|
||||||
return "This item has a custom note: \"_" + note.title() + "_\"\n\n" + desc();
|
|
||||||
}
|
|
||||||
return desc();
|
return desc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -195,6 +195,9 @@ public class Potion extends Item {
|
|||||||
if (handler != null && handler.contains(this)) {
|
if (handler != null && handler.contains(this)) {
|
||||||
image = handler.image(this);
|
image = handler.image(this);
|
||||||
color = handler.label(this);
|
color = handler.label(this);
|
||||||
|
} else {
|
||||||
|
image = ItemSpriteSheet.POTION_CRIMSON;
|
||||||
|
color = "crimson";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,6 +110,9 @@ public class Ring extends KindofMisc {
|
|||||||
if (handler != null && handler.contains(this)){
|
if (handler != null && handler.contains(this)){
|
||||||
image = handler.image(this);
|
image = handler.image(this);
|
||||||
gem = handler.label(this);
|
gem = handler.label(this);
|
||||||
|
} else {
|
||||||
|
image = ItemSpriteSheet.RING_GARNET;
|
||||||
|
gem = "garnet";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,6 +149,9 @@ public abstract class Scroll extends Item {
|
|||||||
if (handler != null && handler.contains(this)) {
|
if (handler != null && handler.contains(this)) {
|
||||||
image = handler.image(this);
|
image = handler.image(this);
|
||||||
rune = handler.label(this);
|
rune = handler.label(this);
|
||||||
|
} else {
|
||||||
|
image = ItemSpriteSheet.SCROLL_KAUNAN;
|
||||||
|
rune = "KAUNAN";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+149
-10
@@ -23,23 +23,39 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
|||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.journal.Journal;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BadgesGrid;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.StyledButton;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndJournal;
|
||||||
import com.watabou.noosa.Camera;
|
import com.watabou.noosa.Camera;
|
||||||
|
import com.watabou.noosa.NinePatch;
|
||||||
import com.watabou.noosa.audio.Music;
|
import com.watabou.noosa.audio.Music;
|
||||||
|
|
||||||
public class BadgesScene extends PixelScene {
|
public class BadgesScene extends PixelScene {
|
||||||
|
|
||||||
|
public static final int WIDTH_P = 126;
|
||||||
|
public static final int WIDTH_L = 216;
|
||||||
|
|
||||||
|
private static int lastIDX = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
|
|
||||||
super.create();
|
super.create();
|
||||||
|
|
||||||
|
Dungeon.hero = null;
|
||||||
|
Badges.loadGlobal();
|
||||||
|
Journal.loadGlobal();
|
||||||
|
|
||||||
Music.INSTANCE.playTracks(
|
Music.INSTANCE.playTracks(
|
||||||
new String[]{Assets.Music.THEME_1, Assets.Music.THEME_2},
|
new String[]{Assets.Music.THEME_1, Assets.Music.THEME_2},
|
||||||
new float[]{1, 1},
|
new float[]{1, 1},
|
||||||
@@ -50,13 +66,9 @@ public class BadgesScene extends PixelScene {
|
|||||||
int w = Camera.main.width;
|
int w = Camera.main.width;
|
||||||
int h = Camera.main.height;
|
int h = Camera.main.height;
|
||||||
|
|
||||||
Archs archs = new Archs();
|
|
||||||
archs.setSize( w, h );
|
|
||||||
add( archs );
|
|
||||||
|
|
||||||
float margin = 5;
|
|
||||||
float top = 20;
|
float top = 20;
|
||||||
|
|
||||||
|
//TODO icon title?
|
||||||
RenderedTextBlock title = PixelScene.renderTextBlock( Messages.get(this, "title"), 9 );
|
RenderedTextBlock title = PixelScene.renderTextBlock( Messages.get(this, "title"), 9 );
|
||||||
title.hardlight(Window.TITLE_COLOR);
|
title.hardlight(Window.TITLE_COLOR);
|
||||||
title.setPos(
|
title.setPos(
|
||||||
@@ -66,10 +78,137 @@ public class BadgesScene extends PixelScene {
|
|||||||
align(title);
|
align(title);
|
||||||
add(title);
|
add(title);
|
||||||
|
|
||||||
Badges.loadGlobal();
|
NinePatch panel = Chrome.get(Chrome.Type.TOAST);
|
||||||
BadgesGrid grid = new BadgesGrid(true);
|
|
||||||
grid.setRect(margin, top, w-(2*margin), h-top-margin);
|
int pw = (landscape() ? WIDTH_L : WIDTH_P) + panel.marginHor();
|
||||||
add(grid);
|
int ph = h - 50 + panel.marginVer();
|
||||||
|
|
||||||
|
panel.size(pw, ph);
|
||||||
|
panel.x = (w - pw) / 2f;
|
||||||
|
panel.y = title.bottom() + 5;
|
||||||
|
add(panel);
|
||||||
|
|
||||||
|
switch (lastIDX){
|
||||||
|
case 0: default:
|
||||||
|
WndJournal.BadgesTab badges = new WndJournal.BadgesTab();
|
||||||
|
add(badges);
|
||||||
|
badges.setRect(panel.x + panel.marginLeft(),
|
||||||
|
panel.y + panel.marginTop(),
|
||||||
|
panel.width() - panel.marginHor(),
|
||||||
|
panel.height() - panel.marginVer());
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
WndJournal.CatalogTab catalog = new WndJournal.CatalogTab();
|
||||||
|
add(catalog);
|
||||||
|
catalog.setRect(panel.x + panel.marginLeft(),
|
||||||
|
panel.y + panel.marginTop(),
|
||||||
|
panel.width() - panel.marginHor(),
|
||||||
|
panel.height() - panel.marginVer());
|
||||||
|
catalog.updateList();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
WndJournal.GuideTab guidebook = new WndJournal.GuideTab();
|
||||||
|
add(guidebook);
|
||||||
|
guidebook.setRect(panel.x + panel.marginLeft(),
|
||||||
|
panel.y + panel.marginTop(),
|
||||||
|
panel.width() - panel.marginHor(),
|
||||||
|
panel.height() - panel.marginVer());
|
||||||
|
guidebook.updateList();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
WndJournal.AlchemyTab alchemy = new WndJournal.AlchemyTab();
|
||||||
|
add(alchemy);
|
||||||
|
alchemy.setRect(panel.x + panel.marginLeft(),
|
||||||
|
panel.y + panel.marginTop(),
|
||||||
|
panel.width() - panel.marginHor(),
|
||||||
|
panel.height() - panel.marginVer());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledButton btnBadges = new StyledButton(Chrome.Type.GREY_BUTTON_TR, ""){
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
if (lastIDX != 0) {
|
||||||
|
lastIDX = 0;
|
||||||
|
}
|
||||||
|
ShatteredPixelDungeon.seamlessResetScene();
|
||||||
|
super.onClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String hoverText() {
|
||||||
|
return Messages.get(WndJournal.BadgesTab.class, "title");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
btnBadges.icon(Icons.BADGES.get());
|
||||||
|
btnBadges.setRect(panel.x, panel.y + ph - 3, pw/4f + 1.5f, lastIDX == 0 ? 25 : 20);
|
||||||
|
align(btnBadges);
|
||||||
|
if (lastIDX != 0) btnBadges.icon().brightness(0.6f);
|
||||||
|
addToBack(btnBadges);
|
||||||
|
|
||||||
|
StyledButton btnCatalog = new StyledButton(Chrome.Type.GREY_BUTTON_TR, ""){
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
if (lastIDX != 1) {
|
||||||
|
lastIDX = 1;
|
||||||
|
}
|
||||||
|
ShatteredPixelDungeon.seamlessResetScene();
|
||||||
|
super.onClick();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected String hoverText() {
|
||||||
|
return Messages.get(WndJournal.CatalogTab.class, "title");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
btnCatalog.icon(Icons.CATALOG.get());
|
||||||
|
btnCatalog.setRect(btnBadges.right()-2, btnBadges.top(), pw/4f + 1.5f, lastIDX == 1 ? 25 : 20);
|
||||||
|
align(btnCatalog);
|
||||||
|
if (lastIDX != 1) btnCatalog.icon().brightness(0.6f);
|
||||||
|
addToBack(btnCatalog);
|
||||||
|
|
||||||
|
StyledButton btnGuide = new StyledButton(Chrome.Type.GREY_BUTTON_TR, ""){
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
if (lastIDX != 2) {
|
||||||
|
lastIDX = 2;
|
||||||
|
}
|
||||||
|
ShatteredPixelDungeon.seamlessResetScene();
|
||||||
|
super.onClick();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected String hoverText() {
|
||||||
|
return Messages.get(WndJournal.GuideTab.class, "title");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
btnGuide.icon(new ItemSprite(ItemSpriteSheet.MASTERY));
|
||||||
|
btnGuide.setRect(btnCatalog.right()-2, btnBadges.top(), pw/4f + 1.5f, lastIDX == 2 ? 25 : 20);
|
||||||
|
align(btnGuide);
|
||||||
|
if (lastIDX != 2) btnGuide.icon().brightness(0.6f);
|
||||||
|
addToBack(btnGuide);
|
||||||
|
|
||||||
|
StyledButton btnAlchemy = new StyledButton(Chrome.Type.GREY_BUTTON_TR, ""){
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
if (lastIDX != 3) {
|
||||||
|
lastIDX = 3;
|
||||||
|
}
|
||||||
|
ShatteredPixelDungeon.seamlessResetScene();
|
||||||
|
super.onClick();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected String hoverText() {
|
||||||
|
return Messages.get(WndJournal.AlchemyTab.class, "title");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
btnAlchemy.icon(Icons.ALCHEMY.get());
|
||||||
|
btnAlchemy.setRect(btnGuide.right()-2, btnBadges.top(), pw/4f + 1.5f, lastIDX == 3 ? 25 : 20);
|
||||||
|
align(btnAlchemy);
|
||||||
|
if (lastIDX != 3) btnAlchemy.icon().brightness(0.6f);
|
||||||
|
addToBack(btnAlchemy);
|
||||||
|
|
||||||
|
Archs archs = new Archs();
|
||||||
|
archs.setSize( w, h );
|
||||||
|
addToBack( archs );
|
||||||
|
|
||||||
ExitButton btnExit = new ExitButton();
|
ExitButton btnExit = new ExitButton();
|
||||||
btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
|
btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ public class ItemSlot extends Button {
|
|||||||
if (item.levelKnown){
|
if (item.levelKnown){
|
||||||
int str = item instanceof Weapon ? ((Weapon)item).STRReq() : ((Armor)item).STRReq();
|
int str = item instanceof Weapon ? ((Weapon)item).STRReq() : ((Armor)item).STRReq();
|
||||||
extra.text( Messages.format( TXT_STRENGTH, str ) );
|
extra.text( Messages.format( TXT_STRENGTH, str ) );
|
||||||
if (str > Dungeon.hero.STR()) {
|
if (Dungeon.hero != null && str > Dungeon.hero.STR()) {
|
||||||
extra.hardlight( DEGRADED );
|
extra.hardlight( DEGRADED );
|
||||||
} else if (item instanceof Weapon && ((Weapon) item).masteryPotionBonus){
|
} else if (item instanceof Weapon && ((Weapon) item).masteryPotionBonus){
|
||||||
extra.hardlight( MASTERED );
|
extra.hardlight( MASTERED );
|
||||||
|
|||||||
+2
-4
@@ -54,7 +54,6 @@ public class ScrollingGridPane extends ScrollPane {
|
|||||||
public void addItem( ScrollingGridPane.GridItem item ){
|
public void addItem( ScrollingGridPane.GridItem item ){
|
||||||
content.add(item);
|
content.add(item);
|
||||||
items.add(item);
|
items.add(item);
|
||||||
layout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addHeader( String text ){
|
public void addHeader( String text ){
|
||||||
@@ -65,7 +64,6 @@ public class ScrollingGridPane extends ScrollPane {
|
|||||||
GridHeader header = new GridHeader(text, size, center);
|
GridHeader header = new GridHeader(text, size, center);
|
||||||
content.add(header);
|
content.add(header);
|
||||||
items.add(header);
|
items.add(header);
|
||||||
layout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -76,7 +74,6 @@ public class ScrollingGridPane extends ScrollPane {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void layout() {
|
protected void layout() {
|
||||||
super.layout();
|
|
||||||
|
|
||||||
float left = 0;
|
float left = 0;
|
||||||
float top = 0;
|
float top = 0;
|
||||||
@@ -122,7 +119,7 @@ public class ScrollingGridPane extends ScrollPane {
|
|||||||
}
|
}
|
||||||
sep.size(1, item.height()+1+ITEM_SIZE);
|
sep.size(1, item.height()+1+ITEM_SIZE);
|
||||||
sep.x = left-1;
|
sep.x = left-1;
|
||||||
sep.y = y+top;
|
sep.y = top;
|
||||||
} else {
|
} else {
|
||||||
left = 0;
|
left = 0;
|
||||||
top += ITEM_SIZE + 2;
|
top += ITEM_SIZE + 2;
|
||||||
@@ -164,6 +161,7 @@ public class ScrollingGridPane extends ScrollPane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
content.setSize(width, top);
|
content.setSize(width, top);
|
||||||
|
super.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class GridItem extends Component {
|
public static class GridItem extends Component {
|
||||||
|
|||||||
+68
-50
@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.windows;
|
|||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
@@ -219,10 +220,10 @@ public class WndJournal extends WndTabbed {
|
|||||||
@Override
|
@Override
|
||||||
protected void layout() {
|
protected void layout() {
|
||||||
super.layout();
|
super.layout();
|
||||||
list.setRect( 0, 0, width, height);
|
list.setRect( x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateList(){
|
public void updateList(){
|
||||||
list.addTitle(Document.ADVENTURERS_GUIDE.title());
|
list.addTitle(Document.ADVENTURERS_GUIDE.title());
|
||||||
|
|
||||||
for (String page : Document.ADVENTURERS_GUIDE.pageNames()){
|
for (String page : Document.ADVENTURERS_GUIDE.pageNames()){
|
||||||
@@ -235,7 +236,7 @@ public class WndJournal extends WndTabbed {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onClick(float x, float y) {
|
public boolean onClick(float x, float y) {
|
||||||
if (inside( x, y ) && found) {
|
if (inside( x, y ) && found) {
|
||||||
GameScene.show( new WndStory( Document.ADVENTURERS_GUIDE.pageSprite(page),
|
ShatteredPixelDungeon.scene().addToFront( new WndStory( Document.ADVENTURERS_GUIDE.pageSprite(page),
|
||||||
Document.ADVENTURERS_GUIDE.pageTitle(page),
|
Document.ADVENTURERS_GUIDE.pageTitle(page),
|
||||||
Document.ADVENTURERS_GUIDE.pageBody(page) ));
|
Document.ADVENTURERS_GUIDE.pageBody(page) ));
|
||||||
Document.ADVENTURERS_GUIDE.readPage(page);
|
Document.ADVENTURERS_GUIDE.readPage(page);
|
||||||
@@ -320,7 +321,7 @@ public class WndJournal extends WndTabbed {
|
|||||||
if (PixelScene.landscape()){
|
if (PixelScene.landscape()){
|
||||||
float buttonWidth = width()/pageButtons.length;
|
float buttonWidth = width()/pageButtons.length;
|
||||||
for (int i = 0; i < NUM_BUTTONS; i++) {
|
for (int i = 0; i < NUM_BUTTONS; i++) {
|
||||||
pageButtons[i].setRect(i*buttonWidth, 0, buttonWidth, ITEM_HEIGHT);
|
pageButtons[i].setRect(x + i*buttonWidth, y, buttonWidth, ITEM_HEIGHT);
|
||||||
PixelScene.align(pageButtons[i]);
|
PixelScene.align(pageButtons[i]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -329,7 +330,7 @@ public class WndJournal extends WndTabbed {
|
|||||||
float y = 0;
|
float y = 0;
|
||||||
float x = 0;
|
float x = 0;
|
||||||
for (int i = 0; i < NUM_BUTTONS; i++) {
|
for (int i = 0; i < NUM_BUTTONS; i++) {
|
||||||
pageButtons[i].setRect(x, y, buttonWidth, ITEM_HEIGHT);
|
pageButtons[i].setRect(this.x + x, this.y + y, buttonWidth, ITEM_HEIGHT);
|
||||||
PixelScene.align(pageButtons[i]);
|
PixelScene.align(pageButtons[i]);
|
||||||
x += buttonWidth;
|
x += buttonWidth;
|
||||||
if (i == 4){
|
if (i == 4){
|
||||||
@@ -340,8 +341,8 @@ public class WndJournal extends WndTabbed {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list.setRect(0, pageButtons[NUM_BUTTONS-1].bottom() + 1, width,
|
list.setRect(x, pageButtons[NUM_BUTTONS-1].bottom() + 1, width,
|
||||||
height - pageButtons[NUM_BUTTONS-1].bottom() - 1);
|
height - pageButtons[NUM_BUTTONS-1].bottom() + y - 1);
|
||||||
|
|
||||||
updateList();
|
updateList();
|
||||||
}
|
}
|
||||||
@@ -587,16 +588,19 @@ public class WndJournal extends WndTabbed {
|
|||||||
float buttonWidth = width()/perRow;
|
float buttonWidth = width()/perRow;
|
||||||
|
|
||||||
for (int i = 0; i < NUM_BUTTONS; i++) {
|
for (int i = 0; i < NUM_BUTTONS; i++) {
|
||||||
itemButtons[i].setRect((i%perRow) * (buttonWidth), (i/perRow) * (ITEM_HEIGHT ),
|
itemButtons[i].setRect(x +(i%perRow) * (buttonWidth),
|
||||||
|
y + (i/perRow) * (ITEM_HEIGHT ),
|
||||||
buttonWidth, ITEM_HEIGHT);
|
buttonWidth, ITEM_HEIGHT);
|
||||||
PixelScene.align(itemButtons[i]);
|
PixelScene.align(itemButtons[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
grid.setRect(0, itemButtons[NUM_BUTTONS-1].bottom() + 1, width,
|
grid.setRect(x,
|
||||||
height - itemButtons[NUM_BUTTONS-1].bottom() - 1);
|
itemButtons[NUM_BUTTONS-1].bottom() + 1,
|
||||||
|
width,
|
||||||
|
height - itemButtons[NUM_BUTTONS-1].height() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateList() {
|
public void updateList() {
|
||||||
|
|
||||||
grid.clear();
|
grid.clear();
|
||||||
|
|
||||||
@@ -701,7 +705,7 @@ public class WndJournal extends WndTabbed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
grid.setRect(x, itemButtons[NUM_BUTTONS-1].bottom() + 1, width,
|
grid.setRect(x, itemButtons[NUM_BUTTONS-1].bottom() + 1, width,
|
||||||
height - itemButtons[NUM_BUTTONS-1].bottom() - 1);
|
height - itemButtons[NUM_BUTTONS-1].height() - 1);
|
||||||
|
|
||||||
grid.scrollTo(0, scrollPositions[currentItemIdx]);
|
grid.scrollTo(0, scrollPositions[currentItemIdx]);
|
||||||
}
|
}
|
||||||
@@ -1020,6 +1024,8 @@ public class WndJournal extends WndTabbed {
|
|||||||
private RedButton btnLocal;
|
private RedButton btnLocal;
|
||||||
private RedButton btnGlobal;
|
private RedButton btnGlobal;
|
||||||
|
|
||||||
|
private RenderedTextBlock title;
|
||||||
|
|
||||||
private Component badgesLocal;
|
private Component badgesLocal;
|
||||||
private Component badgesGlobal;
|
private Component badgesGlobal;
|
||||||
|
|
||||||
@@ -1028,40 +1034,42 @@ public class WndJournal extends WndTabbed {
|
|||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
|
|
||||||
btnLocal = new RedButton(Messages.get(this, "this_run")){
|
if (Dungeon.hero != null) {
|
||||||
@Override
|
btnLocal = new RedButton(Messages.get(this, "this_run")) {
|
||||||
protected void onClick() {
|
@Override
|
||||||
super.onClick();
|
protected void onClick() {
|
||||||
global = false;
|
super.onClick();
|
||||||
updateList();
|
global = false;
|
||||||
|
updateList();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
btnLocal.icon(Icons.BADGES.get());
|
||||||
|
add(btnLocal);
|
||||||
|
|
||||||
|
btnGlobal = new RedButton(Messages.get(this, "overall")) {
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
super.onClick();
|
||||||
|
global = true;
|
||||||
|
updateList();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
btnGlobal.icon(Icons.BADGES.get());
|
||||||
|
add(btnGlobal);
|
||||||
|
|
||||||
|
if (Badges.filterReplacedBadges(false).size() <= 8){
|
||||||
|
badgesLocal = new BadgesList(false);
|
||||||
|
} else {
|
||||||
|
badgesLocal = new BadgesGrid(false);
|
||||||
}
|
}
|
||||||
};
|
add( badgesLocal );
|
||||||
btnLocal.icon(Icons.BADGES.get());
|
|
||||||
add(btnLocal);
|
|
||||||
|
|
||||||
btnGlobal = new RedButton(Messages.get(this, "overall")){
|
|
||||||
@Override
|
|
||||||
protected void onClick() {
|
|
||||||
super.onClick();
|
|
||||||
global = true;
|
|
||||||
updateList();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
btnGlobal.icon(Icons.BADGES.get());
|
|
||||||
add(btnGlobal);
|
|
||||||
|
|
||||||
if (Badges.filterReplacedBadges(false).size() <= 8){
|
|
||||||
badgesLocal = new BadgesList(false);
|
|
||||||
} else {
|
} else {
|
||||||
badgesLocal = new BadgesGrid(false);
|
title = PixelScene.renderTextBlock(Messages.get(this, "title_main_menu"), 9);
|
||||||
|
title.hardlight(Window.TITLE_COLOR);
|
||||||
|
add(title);
|
||||||
}
|
}
|
||||||
add( badgesLocal );
|
|
||||||
|
|
||||||
if (Badges.filterReplacedBadges(true).size() <= 8){
|
badgesGlobal = new BadgesGrid(true);
|
||||||
badgesGlobal = new BadgesList(true);
|
|
||||||
} else {
|
|
||||||
badgesGlobal = new BadgesGrid(true);
|
|
||||||
}
|
|
||||||
add( badgesGlobal );
|
add( badgesGlobal );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1069,19 +1077,29 @@ public class WndJournal extends WndTabbed {
|
|||||||
protected void layout() {
|
protected void layout() {
|
||||||
super.layout();
|
super.layout();
|
||||||
|
|
||||||
btnLocal.setRect(0, 0, width/2, 18);
|
if (btnLocal != null) {
|
||||||
btnGlobal.setRect(width/2, 0, width/2, 18);
|
btnLocal.setRect(x, y, width / 2, 18);
|
||||||
|
btnGlobal.setRect(x + width / 2, y, width / 2, 18);
|
||||||
|
|
||||||
badgesLocal.setRect( 0, 20, width, height-20);
|
badgesLocal.setRect(x, y + 20, width, height-20);
|
||||||
badgesGlobal.setRect( 0, 20, width, height-20);
|
badgesGlobal.setRect( x, y + 20, width, height-20);
|
||||||
|
} else {
|
||||||
|
title.setPos( x + (width - title.width())/2, y + (12-title.height())/2);
|
||||||
|
|
||||||
|
badgesGlobal.setRect( x, y + 14, width, height-14);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateList(){
|
private void updateList(){
|
||||||
badgesLocal.visible = badgesLocal.active = !global;
|
if (btnLocal != null) {
|
||||||
badgesGlobal.visible = badgesGlobal.active = global;
|
badgesLocal.visible = badgesLocal.active = !global;
|
||||||
|
badgesGlobal.visible = badgesGlobal.active = global;
|
||||||
|
|
||||||
btnLocal.textColor( global ? Window.WHITE : Window.TITLE_COLOR);
|
btnLocal.textColor(global ? Window.WHITE : Window.TITLE_COLOR);
|
||||||
btnGlobal.textColor( global ? Window.TITLE_COLOR : Window.WHITE);
|
btnGlobal.textColor(global ? Window.TITLE_COLOR : Window.WHITE);
|
||||||
|
} else {
|
||||||
|
badgesGlobal.visible = badgesGlobal.active = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user