v2.5.0: added a badges tab to the journal window
This commit is contained in:
@@ -139,7 +139,9 @@ windows.wndjournal$catalogtab.enemy_count=You have defeated this enemy a total o
|
|||||||
windows.wndjournal$catalogtab.trap_count=You have triggered this trap a total of _%,d_ times.
|
windows.wndjournal$catalogtab.trap_count=You have triggered this trap a total of _%,d_ times.
|
||||||
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$loretab.title=Documents
|
windows.wndjournal$badgestab.title=Badges
|
||||||
|
windows.wndjournal$badgestab.this_run=This Run
|
||||||
|
windows.wndjournal$badgestab.overall=Overall
|
||||||
|
|
||||||
windows.wndkeybindings.controller_info=The left stick moves your character\nThe right stick controls an on-screen pointer
|
windows.wndkeybindings.controller_info=The left stick moves your character\nThe right stick controls an on-screen pointer
|
||||||
windows.wndkeybindings.ttl_action=Action
|
windows.wndkeybindings.ttl_action=Action
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Tooltip;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Tooltip;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Holiday;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.Holiday;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndJournal;
|
||||||
import com.watabou.gltextures.TextureCache;
|
import com.watabou.gltextures.TextureCache;
|
||||||
import com.watabou.glwrap.Blending;
|
import com.watabou.glwrap.Blending;
|
||||||
import com.watabou.input.ControllerHandler;
|
import com.watabou.input.ControllerHandler;
|
||||||
@@ -383,6 +384,8 @@ public class PixelScene extends Scene {
|
|||||||
left += BadgeBanner.SIZE * BadgeBanner.DEFAULT_SCALE;
|
left += BadgeBanner.SIZE * BadgeBanner.DEFAULT_SCALE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WndJournal.last_index = 4;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -77,19 +77,9 @@ public class BadgesGrid extends Component {
|
|||||||
protected void layout() {
|
protected void layout() {
|
||||||
super.layout();
|
super.layout();
|
||||||
|
|
||||||
//2-5 columns in portrait, 5-8 in landscape
|
//determines roughly how much space each badge will get ideally, determines columns based on that
|
||||||
int nCols;
|
float badgeArea = (float) Math.sqrt(width * height / badgeButtons.size());
|
||||||
if (width() > height()){
|
int nCols = Math.round(width / badgeArea);
|
||||||
if (badgeButtons.size() > 35) nCols = 8;
|
|
||||||
else if (badgeButtons.size() > 24) nCols = 7;
|
|
||||||
else if (badgeButtons.size() > 15) nCols = 6;
|
|
||||||
else nCols = 5;
|
|
||||||
} else {
|
|
||||||
if (badgeButtons.size() > 32) nCols = 5;
|
|
||||||
else if (badgeButtons.size() > 21) nCols = 4;
|
|
||||||
else if (badgeButtons.size() > 10) nCols = 3;
|
|
||||||
else nCols = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
int nRows = (int) Math.ceil(badgeButtons.size()/(float)nCols);
|
int nRows = (int) Math.ceil(badgeButtons.size()/(float)nCols);
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ public enum Icons {
|
|||||||
icon.frame( icon.texture.uvRectBySize( 119, 0, 16, 16 ) );
|
icon.frame( icon.texture.uvRectBySize( 119, 0, 16, 16 ) );
|
||||||
break;
|
break;
|
||||||
case JOURNAL:
|
case JOURNAL:
|
||||||
icon.frame( icon.texture.uvRectBySize( 136, 0, 17, 16 ) );
|
icon.frame( icon.texture.uvRectBySize( 136, 0, 17, 15 ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXIT:
|
case EXIT:
|
||||||
|
|||||||
+1
-1
@@ -703,7 +703,7 @@ public class v0_6_X_Changes {
|
|||||||
"_-_ Added a completely overhauled tutorial experience, which replaces the existing signpost system.\n\n" +
|
"_-_ Added a completely overhauled tutorial experience, which replaces the existing signpost system.\n\n" +
|
||||||
"_-_ Massively expanded the items catalog, now contains every identifiable item in the game."));
|
"_-_ Massively expanded the items catalog, now contains every identifiable item in the game."));
|
||||||
|
|
||||||
changes.addButton( new ChangeButton(BadgeBanner.image(Badges.Badge.ALL_ITEMS_IDENTIFIED.image), "Badge Changes",
|
changes.addButton( new ChangeButton(Icons.BADGES.get(), "Badge Changes",
|
||||||
"_-_ Added new badges for identifying all weapons, armor, wands, and artifacts.\n\n" +
|
"_-_ Added new badges for identifying all weapons, armor, wands, and artifacts.\n\n" +
|
||||||
"_-_ All identification-based badges are now tied to the new item list system, and progress for them will persist between runs.\n\n" +
|
"_-_ All identification-based badges are now tied to the new item list system, and progress for them will persist between runs.\n\n" +
|
||||||
"_-_ Removed the Night Hunter badge\n\n" +
|
"_-_ Removed the Night Hunter badge\n\n" +
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.BadgeBanner;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||||
|
import com.watabou.input.PointerEvent;
|
||||||
import com.watabou.noosa.Image;
|
import com.watabou.noosa.Image;
|
||||||
|
import com.watabou.noosa.PointerArea;
|
||||||
|
|
||||||
public class WndBadge extends Window {
|
public class WndBadge extends Window {
|
||||||
|
|
||||||
@@ -79,5 +81,14 @@ public class WndBadge extends Window {
|
|||||||
resize( (int)w, (int)(info.bottom() + MARGIN) );
|
resize( (int)w, (int)(info.bottom() + MARGIN) );
|
||||||
|
|
||||||
if (unlocked) BadgeBanner.highlight( icon, badge.image );
|
if (unlocked) BadgeBanner.highlight( icon, badge.image );
|
||||||
|
|
||||||
|
PointerArea blocker = new PointerArea( 0, 0, PixelScene.uiCamera.width, PixelScene.uiCamera.height ) {
|
||||||
|
@Override
|
||||||
|
protected void onClick( PointerEvent event ) {
|
||||||
|
onBackPressed();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
blocker.camera = PixelScene.uiCamera;
|
||||||
|
add(blocker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+76
-33
@@ -22,6 +22,7 @@
|
|||||||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||||
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;
|
||||||
@@ -53,6 +54,8 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.tiles.TerrainFeaturesTilemap;
|
import com.shatteredpixel.shatteredpixeldungeon.tiles.TerrainFeaturesTilemap;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BadgesGrid;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BadgesList;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.CustomNoteButton;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.CustomNoteButton;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickRecipe;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickRecipe;
|
||||||
@@ -61,6 +64,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollingGridPane;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollingGridPane;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollingListPane;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollingListPane;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||||
import com.watabou.noosa.BitmapText;
|
import com.watabou.noosa.BitmapText;
|
||||||
import com.watabou.noosa.ColorBlock;
|
import com.watabou.noosa.ColorBlock;
|
||||||
import com.watabou.noosa.Image;
|
import com.watabou.noosa.Image;
|
||||||
@@ -86,6 +90,7 @@ public class WndJournal extends WndTabbed {
|
|||||||
private AlchemyTab alchemyTab;
|
private AlchemyTab alchemyTab;
|
||||||
private NotesTab notesTab;
|
private NotesTab notesTab;
|
||||||
private CatalogTab catalogTab;
|
private CatalogTab catalogTab;
|
||||||
|
private BadgesTab badgesTab;
|
||||||
|
|
||||||
public static int last_index = 0;
|
public static int last_index = 0;
|
||||||
|
|
||||||
@@ -114,6 +119,11 @@ public class WndJournal extends WndTabbed {
|
|||||||
add(catalogTab);
|
add(catalogTab);
|
||||||
catalogTab.setRect(0, 0, width, height);
|
catalogTab.setRect(0, 0, width, height);
|
||||||
catalogTab.updateList();
|
catalogTab.updateList();
|
||||||
|
|
||||||
|
badgesTab = new BadgesTab();
|
||||||
|
add(badgesTab);
|
||||||
|
badgesTab.setRect(0, 0, width, height);
|
||||||
|
badgesTab.updateList();
|
||||||
|
|
||||||
Tab[] tabs = {
|
Tab[] tabs = {
|
||||||
new IconTab( Icons.JOURNAL.get() ) {
|
new IconTab( Icons.JOURNAL.get() ) {
|
||||||
@@ -163,6 +173,18 @@ public class WndJournal extends WndTabbed {
|
|||||||
protected String hoverText() {
|
protected String hoverText() {
|
||||||
return Messages.get(catalogTab, "title");
|
return Messages.get(catalogTab, "title");
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
new IconTab( Icons.BADGES.get() ) {
|
||||||
|
protected void select( boolean value ) {
|
||||||
|
super.select( value );
|
||||||
|
badgesTab.active = badgesTab.visible = value;
|
||||||
|
if (value) last_index = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String hoverText() {
|
||||||
|
return Messages.get(badgesTab, "title");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -993,52 +1015,73 @@ public class WndJournal extends WndTabbed {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class LoreTab extends Component{
|
public static class BadgesTab extends Component {
|
||||||
|
|
||||||
private ScrollingListPane list;
|
private RedButton btnLocal;
|
||||||
|
private RedButton btnGlobal;
|
||||||
|
|
||||||
|
private Component badgesLocal;
|
||||||
|
private Component badgesGlobal;
|
||||||
|
|
||||||
|
private boolean global = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
list = new ScrollingListPane();
|
|
||||||
add( list );
|
btnLocal = new RedButton(Messages.get(this, "this_run")){
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
super.onClick();
|
||||||
|
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 );
|
||||||
|
|
||||||
|
if (Badges.filterReplacedBadges(true).size() <= 8){
|
||||||
|
badgesGlobal = new BadgesList(true);
|
||||||
|
} else {
|
||||||
|
badgesGlobal = new BadgesGrid(true);
|
||||||
|
}
|
||||||
|
add( badgesGlobal );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void layout() {
|
protected void layout() {
|
||||||
super.layout();
|
super.layout();
|
||||||
list.setRect( 0, 0, width, height);
|
|
||||||
|
btnLocal.setRect(0, 0, width/2, 18);
|
||||||
|
btnGlobal.setRect(width/2, 0, width/2, 18);
|
||||||
|
|
||||||
|
badgesLocal.setRect( 0, 20, width, height-20);
|
||||||
|
badgesGlobal.setRect( 0, 20, width, height-20);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateList(){
|
private void updateList(){
|
||||||
list.addTitle(Messages.get(this, "title"));
|
badgesLocal.visible = badgesLocal.active = !global;
|
||||||
|
badgesGlobal.visible = badgesGlobal.active = global;
|
||||||
|
|
||||||
for (Document doc : Document.values()){
|
btnLocal.textColor( global ? Window.WHITE : Window.TITLE_COLOR);
|
||||||
if (!doc.isLoreDoc()) continue;
|
btnGlobal.textColor( global ? Window.TITLE_COLOR : Window.WHITE);
|
||||||
|
|
||||||
boolean found = doc.anyPagesFound();
|
|
||||||
ScrollingListPane.ListItem item = new ScrollingListPane.ListItem(
|
|
||||||
doc.pageSprite(),
|
|
||||||
null,
|
|
||||||
found ? Messages.titleCase(doc.title()) : "???"
|
|
||||||
){
|
|
||||||
@Override
|
|
||||||
public boolean onClick(float x, float y) {
|
|
||||||
if (inside( x, y ) && found) {
|
|
||||||
ShatteredPixelDungeon.scene().addToFront( new WndDocument( doc ));
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (!found){
|
|
||||||
item.hardlight(0x999999);
|
|
||||||
item.hardlightIcon(0x999999);
|
|
||||||
}
|
|
||||||
list.addItem(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
list.setRect(x, y, width, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user