v1.4.0: Added UI for lore documents in the journal, moved region intros

This commit is contained in:
Evan Debenham
2022-09-02 13:38:31 -04:00
parent 7ff6cdc043
commit 4799bca59b
13 changed files with 262 additions and 95 deletions
@@ -48,6 +48,20 @@ journal.document.alchemy_guide.brews_elixirs.body=Brews and elixirs are advanced
journal.document.alchemy_guide.spells.title=Spells journal.document.alchemy_guide.spells.title=Spells
journal.document.alchemy_guide.spells.body=Spells are contained in crystals and provide a variety of effects with multiple uses. journal.document.alchemy_guide.spells.body=Spells are contained in crystals and provide a variety of effects with multiple uses.
journal.document.intros.title=Region Introductions
journal.document.intros.dungeon.title=Dungeon
journal.document.intros.dungeon.body=Many heroes have ventured into the dungeon before you from the city above, most have never been heard from again.\n\nIt is said that an ancient evil lurks in the depths, guarding the almighty Amulet of Yendor. Even now dark energy radiates from below, making its way up into the city.\n\nWill you conquer the dungeon and claim the amulet? It's time to start your own adventure!
journal.document.intros.sewers.title=Sewers
journal.document.intros.sewers.body=The upper floors of the dungeon actually constitute the City's sewer system.\n\nAs dark energy has crept up from below the usually harmless sewer creatures have become more and more dangerous. The city sends guard patrols down here to try and maintain safety for those above, but they are slowly failing.\n\nThis place is dangerous, but at least the evil magic at work here is weak.
journal.document.intros.prison.title=Prison
journal.document.intros.prison.body=Many years ago a prison was built here to house dangerous criminals. Tightly regulated and secure, convicts from all over the land were brought here to serve time.\n\nBut soon dark miasma started to creep from below, twisting the minds of guard and prisoner alike.\n\nIn response to the mounting chaos, the city sealed off the entire prison. Nobody knows what became of those who were left for dead within these walls...
journal.document.intros.caves.title=Caves
journal.document.intros.caves.body=These sparsely populated caves stretch down under the abandoned prison. Rich in minerals, they were once a center of bustling trade and industry for the dwarven society below, but they were abandoned as the dwarves became obsessed with dark magic.\n\nThe caves are now mostly inhabited by subterranean wildlife, gnolls, and derelict machinery; likely corrupted by the same power that has affected the regions above.
journal.document.intros.city.title=Dwarven Metropolis
journal.document.intros.city.body=The Dwarven Metropolis was once the greatest of all dwarven city-states. In its heyday the dwarves built wondrous machines of metal and magic that allowed their city to expand rapidly.\n\nThen, one day, the city gates were barred and nobody heard from the dwarves again. The few who escaped the city as it closed told stories of a mad warlock who stole the throne, and the terrible magic he had learned to harness.
journal.document.intros.halls.title=Demon Halls
journal.document.intros.halls.body=These deep halls of the Dwarven Metropolis have been twisted by dark magic. In the past these regions played host to the Dwarf King's court of elite warlocks, but now they seem to have been taken over by something even more sinister...\n\nAll sorts of horrific demonic creatures inhabit these halls, being led by some terrible dark power. If the King of Dwarves wasn't the source of the spreading corruption, whatever is down here must be.\n\nTread carefully, very few adventurers have ever descended this far...
journal.notes$landmark.well_of_health=well of health journal.notes$landmark.well_of_health=well of health
journal.notes$landmark.well_of_awareness=well of awareness journal.notes$landmark.well_of_awareness=well of awareness
journal.notes$landmark.alchemy=alchemy pot journal.notes$landmark.alchemy=alchemy pot
@@ -76,8 +76,6 @@ scenes.interlevelscene.install=Install the Game
scenes.interlevelscene.file_not_found=Save file not found. If this error persists after restarting, it may mean this save game is corrupted. Sorry about that. scenes.interlevelscene.file_not_found=Save file not found. If this error persists after restarting, it may mean this save game is corrupted. Sorry about that.
scenes.interlevelscene.io_error=Cannot read save file. If this error persists after restarting, it may mean this save game is corrupted. Sorry about that. scenes.interlevelscene.io_error=Cannot read save file. If this error persists after restarting, it may mean this save game is corrupted. Sorry about that.
scenes.introscene.text=Many heroes have ventured into the dungeon before you from the city above, most have never been heard from again.\n\nIt is said that an ancient evil lurks in the depths, guarding the almighty Amulet of Yendor. Even now dark energy radiates from below, making its way up into the city.\n\nWill you conquer the dungeon and claim the amulet? It's time to start your own adventure!
scenes.newsscene.title=Game News scenes.newsscene.title=Game News
scenes.newsscene.read_more=Read More scenes.newsscene.read_more=Read More
scenes.newsscene$newsinfo.english_warn=News posts are written by the developer and are only available in English. scenes.newsscene$newsinfo.english_warn=News posts are written by the developer and are only available in English.
@@ -97,6 +97,7 @@ windows.wndjournal$guidetab.title=Guidebooks
windows.wndjournal$guidetab.missing=page missing windows.wndjournal$guidetab.missing=page missing
windows.wndjournal$notestab.keys=Keys windows.wndjournal$notestab.keys=Keys
windows.wndjournal$notestab.landmarks=Landmarks windows.wndjournal$notestab.landmarks=Landmarks
windows.wndjournal$loretab.title=Lore Documents
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
@@ -275,12 +276,6 @@ windows.wndsettings$langstab.credits=credits
windows.wndsettings$langstab.reviewers=reviewers windows.wndsettings$langstab.reviewers=reviewers
windows.wndsettings$langstab.translators=translators windows.wndsettings$langstab.translators=translators
windows.wndstory.sewers=The upper floors of the dungeon actually constitute the City's sewer system.\n\nAs dark energy has crept up from below the usually harmless sewer creatures have become more and more dangerous. The city sends guard patrols down here to try and maintain safety for those above, but they are slowly failing.\n\nThis place is dangerous, but at least the evil magic at work here is weak.
windows.wndstory.prison=Many years ago a prison was built here to house dangerous criminals. Tightly regulated and secure, convicts from all over the land were brought here to serve time.\n\nBut soon dark miasma started to creep from below, twisting the minds of guard and prisoner alike.\n\nIn response to the mounting chaos, the city sealed off the entire prison. Nobody knows what became of those who were left for dead within these walls...
windows.wndstory.caves=These sparsely populated caves stretch down under the abandoned prison. Rich in minerals, they were once a center of bustling trade and industry for the dwarven society below, but they were abandoned as the dwarves became obsessed with dark magic.\n\nThe caves are now mostly inhabited by subterranean wildlife, gnolls, and derelict machinery; likely corrupted by the same power that has affected the regions above.
windows.wndstory.city=The Dwarven Metropolis was once the greatest of all dwarven city-states. In its heyday the dwarves built wondrous machines of metal and magic that allowed their city to expand rapidly.\n\nThen, one day, the city gates were barred and nobody heard from the dwarves again. The few who escaped the city as it closed told stories of a mad warlock who stole the throne, and the terrible magic he had learned to harness.
windows.wndstory.halls=These deep halls of the Dwarven Metropolis have been twisted by dark magic. In the past these regions played host to the Dwarf King's court of elite warlocks, but now they seem to have been taken over by something even more sinister...\n\nAll sorts of horrific demonic creatures inhabit these halls, being led by some terrible dark power. If the King of Dwarves wasn't the source of the spreading corruption, whatever is down here must be.\n\nTread carefully, very few adventurers have ever descended this far...
windows.wndsupportprompt.title=A Message From The Developer windows.wndsupportprompt.title=A Message From The Developer
windows.wndsupportprompt.intro=Hello, I hope you're enjoying Shattered Pixel Dungeon! windows.wndsupportprompt.intro=Hello, I hope you're enjoying Shattered Pixel Dungeon!
windows.wndsupportprompt.close=Close windows.wndsupportprompt.close=Close
@@ -22,7 +22,10 @@
package com.shatteredpixel.shatteredpixeldungeon.journal; package com.shatteredpixel.shatteredpixeldungeon.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.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.watabou.noosa.Image;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
import com.watabou.utils.DeviceCompat; import com.watabou.utils.DeviceCompat;
@@ -31,11 +34,21 @@ import java.util.LinkedHashMap;
public enum Document { public enum Document {
ADVENTURERS_GUIDE(ItemSpriteSheet.GUIDE_PAGE), ADVENTURERS_GUIDE(ItemSpriteSheet.GUIDE_PAGE, false),
ALCHEMY_GUIDE(ItemSpriteSheet.ALCH_PAGE); ALCHEMY_GUIDE(ItemSpriteSheet.ALCH_PAGE, false),
Document( int sprite ){ INTROS(Icons.STAIRS, true);
Document( int sprite, boolean lore ){
pageIcon = null;
pageSprite = sprite; pageSprite = sprite;
loreDocument = lore;
}
Document( Icons icon, boolean lore ){
pageIcon = icon;
pageSprite = 0;
loreDocument = lore;
} }
public static final int NOT_FOUND = 0; public static final int NOT_FOUND = 0;
@@ -64,8 +77,17 @@ public enum Document {
return isPageFound( pagesStates.keySet().toArray(new String[0])[pageIdx] ); return isPageFound( pagesStates.keySet().toArray(new String[0])[pageIdx] );
} }
public boolean anyPagesFound(){
for( Integer val : pagesStates.values()){
if (val != NOT_FOUND){
return true;
}
}
return false;
}
public boolean readPage( String page ) { public boolean readPage( String page ) {
if (pagesStates.containsKey(page) && pagesStates.get(page) == FOUND){ if (pagesStates.containsKey(page)){
pagesStates.put(page, READ); pagesStates.put(page, READ);
Journal.saveNeeded = true; Journal.saveNeeded = true;
return true; return true;
@@ -101,8 +123,18 @@ public enum Document {
} }
private int pageSprite; private int pageSprite;
public int pageSprite(){ private Icons pageIcon;
return pageSprite; public Image pageSprite(){
if (pageIcon != null){
return Icons.get(pageIcon);
} else {
return new ItemSprite(pageSprite);
}
}
private boolean loreDocument;
public boolean isLoreDoc(){
return loreDocument;
} }
public String title(){ public String title(){
@@ -153,17 +185,25 @@ public enum Document {
ADVENTURERS_GUIDE.pagesStates.put("Magic", debug ? READ : NOT_FOUND); ADVENTURERS_GUIDE.pagesStates.put("Magic", debug ? READ : NOT_FOUND);
//given in sewers //given in sewers
ALCHEMY_GUIDE.pagesStates.put("Potions", debug ? READ : NOT_FOUND); ALCHEMY_GUIDE.pagesStates.put("Potions", debug ? READ : NOT_FOUND);
ALCHEMY_GUIDE.pagesStates.put("Stones", debug ? READ : NOT_FOUND); ALCHEMY_GUIDE.pagesStates.put("Stones", debug ? READ : NOT_FOUND);
ALCHEMY_GUIDE.pagesStates.put("Energy_Food", debug ? READ : NOT_FOUND); ALCHEMY_GUIDE.pagesStates.put("Energy_Food", debug ? READ : NOT_FOUND);
ALCHEMY_GUIDE.pagesStates.put("Exotic_Potions", debug ? READ : NOT_FOUND); ALCHEMY_GUIDE.pagesStates.put("Exotic_Potions", debug ? READ : NOT_FOUND);
ALCHEMY_GUIDE.pagesStates.put("Exotic_Scrolls", debug ? READ : NOT_FOUND); ALCHEMY_GUIDE.pagesStates.put("Exotic_Scrolls", debug ? READ : NOT_FOUND);
//given in prison //given in prison
ALCHEMY_GUIDE.pagesStates.put("Bombs", debug ? READ : NOT_FOUND); ALCHEMY_GUIDE.pagesStates.put("Bombs", debug ? READ : NOT_FOUND);
ALCHEMY_GUIDE.pagesStates.put("Weapons", debug ? READ : NOT_FOUND); ALCHEMY_GUIDE.pagesStates.put("Weapons", debug ? READ : NOT_FOUND);
ALCHEMY_GUIDE.pagesStates.put("Catalysts", debug ? READ : NOT_FOUND); ALCHEMY_GUIDE.pagesStates.put("Catalysts", debug ? READ : NOT_FOUND);
ALCHEMY_GUIDE.pagesStates.put("Brews_Elixirs", debug ? READ : NOT_FOUND); ALCHEMY_GUIDE.pagesStates.put("Brews_Elixirs", debug ? READ : NOT_FOUND);
ALCHEMY_GUIDE.pagesStates.put("Spells", debug ? READ : NOT_FOUND); ALCHEMY_GUIDE.pagesStates.put("Spells", debug ? READ : NOT_FOUND);
INTROS.pagesStates.put("Dungeon", debug ? READ : NOT_FOUND);
INTROS.pagesStates.put("Sewers", debug ? READ : NOT_FOUND);
INTROS.pagesStates.put("Prison", debug ? READ : NOT_FOUND);
INTROS.pagesStates.put("Caves", debug ? READ : NOT_FOUND);
INTROS.pagesStates.put("City", debug ? READ : NOT_FOUND);
INTROS.pagesStates.put("Halls", debug ? READ : NOT_FOUND);
} }
private static final String DOCUMENTS = "documents"; private static final String DOCUMENTS = "documents";
@@ -406,22 +406,16 @@ public class GameScene extends PixelScene {
break; break;
case DESCEND: case DESCEND:
case FALL: case FALL:
switch (Dungeon.depth) { if (Dungeon.depth == Statistics.deepestFloor){
case 1: switch (Dungeon.depth) {
WndStory.showChapter( WndStory.ID_SEWERS ); case 1: case 6: case 11: case 16: case 21:
break; int region = (Dungeon.depth+4)/5;
case 6: if (!Document.INTROS.isPageRead(region)) {
WndStory.showChapter( WndStory.ID_PRISON ); add(new WndStory(Document.INTROS.pageBody(region)).setDelays(0.6f, 1.4f));
break; Document.INTROS.readPage(region);
case 11: }
WndStory.showChapter( WndStory.ID_CAVES ); break;
break; }
case 16:
WndStory.showChapter( WndStory.ID_CITY );
break;
case 21:
WndStory.showChapter( WndStory.ID_HALLS );
break;
} }
if (Dungeon.hero.isAlive()) { if (Dungeon.hero.isAlive()) {
Badges.validateNoKilling(); Badges.validateNoKilling();
@@ -1204,7 +1198,6 @@ public class GameScene extends PixelScene {
StyledButton restart = new StyledButton(Chrome.Type.GREY_BUTTON_TR, Messages.get(StartScene.class, "new"), 9){ StyledButton restart = new StyledButton(Chrome.Type.GREY_BUTTON_TR, Messages.get(StartScene.class, "new"), 9){
@Override @Override
protected void onClick() { protected void onClick() {
InterlevelScene.noStory = true;
GamesInProgress.selectedClass = Dungeon.hero.heroClass; GamesInProgress.selectedClass = Dungeon.hero.heroClass;
GamesInProgress.curSlot = GamesInProgress.firstEmpty(); GamesInProgress.curSlot = GamesInProgress.firstEmpty();
ShatteredPixelDungeon.switchScene(HeroSelectScene.class); ShatteredPixelDungeon.switchScene(HeroSelectScene.class);
@@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Rankings;
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings; import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
import com.shatteredpixel.shatteredpixeldungeon.journal.Journal; import com.shatteredpixel.shatteredpixeldungeon.journal.Journal;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.ActionIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.ActionIndicator;
@@ -129,8 +130,7 @@ public class HeroSelectScene extends PixelScene {
ActionIndicator.action = null; ActionIndicator.action = null;
InterlevelScene.mode = InterlevelScene.Mode.DESCEND; InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
if (SPDSettings.intro()) { if (!Document.INTROS.isPageRead(0)) {
SPDSettings.intro( false );
Game.switchScene( IntroScene.class ); Game.switchScene( IntroScene.class );
} else { } else {
Game.switchScene( InterlevelScene.class ); Game.switchScene( InterlevelScene.class );
@@ -82,8 +82,6 @@ public class InterlevelScene extends PixelScene {
public static int returnBranch; public static int returnBranch;
public static int returnPos; public static int returnPos;
public static boolean noStory = false;
public static boolean fallIntoPit; public static boolean fallIntoPit;
private enum Phase { private enum Phase {
@@ -376,10 +374,6 @@ public class InterlevelScene extends PixelScene {
if (Dungeon.hero == null) { if (Dungeon.hero == null) {
Mob.clearHeldAllies(); Mob.clearHeldAllies();
Dungeon.init(); Dungeon.init();
if (noStory) {
Dungeon.chapters.add( WndStory.ID_SEWERS );
noStory = false;
}
GameLog.wipe(); GameLog.wipe();
Level level = Dungeon.newLevel(); Level level = Dungeon.newLevel();
@@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.scenes; package com.shatteredpixel.shatteredpixeldungeon.scenes;
import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs; import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndStory; import com.shatteredpixel.shatteredpixeldungeon.windows.WndStory;
@@ -28,6 +29,8 @@ import com.watabou.noosa.Camera;
import com.watabou.noosa.ColorBlock; import com.watabou.noosa.ColorBlock;
import com.watabou.noosa.Game; import com.watabou.noosa.Game;
import javax.print.Doc;
public class IntroScene extends PixelScene { public class IntroScene extends PixelScene {
{ {
@@ -48,13 +51,14 @@ public class IntroScene extends PixelScene {
//darkens the arches //darkens the arches
add(new ColorBlock(w, h, 0x88000000)); add(new ColorBlock(w, h, 0x88000000));
add( new WndStory( Messages.get(this, "text") ) { add( new WndStory( Document.INTROS.pageBody(0) ) {
@Override @Override
public void hide() { public void hide() {
super.hide(); super.hide();
Document.INTROS.readPage(0);
Game.switchScene( InterlevelScene.class ); Game.switchScene( InterlevelScene.class );
} }
} ); }.setDelays(0f, 2f) );
fadeIn(); fadeIn();
} }
@@ -0,0 +1,73 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2022 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollingListPane;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
public class WndDocument extends Window {
private ScrollingListPane list;
public WndDocument(Document doc){
list = new ScrollingListPane();
add( list );
list.addTitle(doc.title());
for (String page : doc.pageNames()){
boolean found = doc.isPageFound(page);
ScrollingListPane.ListItem item = new ScrollingListPane.ListItem(
doc.pageSprite(),
null,
found ? Messages.titleCase(doc.pageTitle(page)) : Messages.titleCase(Messages.get( this, "missing" ))
){
@Override
public boolean onClick(float x, float y) {
if (inside( x, y ) && found) {
ShatteredPixelDungeon.scene().addToFront( new WndStory(
doc.pageSprite(),
doc.pageTitle(page),
doc.pageBody(page) ));
doc.readPage(page);
return true;
} else {
return false;
}
}
};
if (!found){
item.hardlight(0x999999);
item.hardlightIcon(0x999999);
}
list.addItem(item);
}
resize(120, Math.min(144, (int)list.content().height()));
list.setRect(0, 0, width, height);
}
}
@@ -91,7 +91,6 @@ public class WndGame extends Window {
addButton( curBtn = new RedButton( Messages.get(this, "start") ) { addButton( curBtn = new RedButton( Messages.get(this, "start") ) {
@Override @Override
protected void onClick() { protected void onClick() {
InterlevelScene.noStory = true;
GamesInProgress.selectedClass = Dungeon.hero.heroClass; GamesInProgress.selectedClass = Dungeon.hero.heroClass;
GamesInProgress.curSlot = GamesInProgress.firstEmpty(); GamesInProgress.curSlot = GamesInProgress.firstEmpty();
ShatteredPixelDungeon.switchScene(HeroSelectScene.class); ShatteredPixelDungeon.switchScene(HeroSelectScene.class);
@@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.windows; package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
@@ -53,6 +54,8 @@ import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import javax.print.Doc;
public class WndJournal extends WndTabbed { public class WndJournal extends WndTabbed {
public static final int WIDTH_P = 126; public static final int WIDTH_P = 126;
@@ -67,6 +70,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 LoreTab loreTab;
public static int last_index = 0; public static int last_index = 0;
@@ -96,8 +100,13 @@ public class WndJournal extends WndTabbed {
catalogTab.setRect(0, 0, width, height); catalogTab.setRect(0, 0, width, height);
catalogTab.updateList(); catalogTab.updateList();
loreTab = new LoreTab();
add(loreTab);
loreTab.setRect(0, 0, width, height);
loreTab.updateList();
Tab[] tabs = { Tab[] tabs = {
new IconTab( new ItemSprite(ItemSpriteSheet.GUIDE_PAGE, null) ) { new IconTab( new ItemSprite(ItemSpriteSheet.MASTERY, null) ) {
protected void select( boolean value ) { protected void select( boolean value ) {
super.select( value ); super.select( value );
guideTab.active = guideTab.visible = value; guideTab.active = guideTab.visible = value;
@@ -124,6 +133,13 @@ public class WndJournal extends WndTabbed {
catalogTab.active = catalogTab.visible = value; catalogTab.active = catalogTab.visible = value;
if (value) last_index = 3; if (value) last_index = 3;
} }
},
new IconTab( new ItemSprite(ItemSpriteSheet.GUIDE_PAGE, null) ) {
protected void select( boolean value ) {
super.select( value );
loreTab.active = loreTab.visible = value;
if (value) last_index = 4;
}
} }
}; };
@@ -141,8 +157,9 @@ public class WndJournal extends WndTabbed {
super.offset(xOffset, yOffset); super.offset(xOffset, yOffset);
guideTab.layout(); guideTab.layout();
alchemyTab.layout(); alchemyTab.layout();
catalogTab.layout();
notesTab.layout(); notesTab.layout();
catalogTab.layout();
loreTab.layout();
} }
public static class GuideTab extends Component { public static class GuideTab extends Component {
@@ -624,4 +641,54 @@ public class WndJournal extends WndTabbed {
} }
public static class LoreTab extends Component{
private ScrollingListPane list;
@Override
protected void createChildren() {
list = new ScrollingListPane();
add( list );
}
@Override
protected void layout() {
super.layout();
list.setRect( 0, 0, width, height);
}
private void updateList(){
list.addTitle(Messages.get(this, "title"));
for (Document doc : Document.values()){
if (!doc.isLoreDoc()) continue;
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);
}
}
} }
@@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
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.journal.Document;
import com.shatteredpixel.shatteredpixeldungeon.journal.Journal; import com.shatteredpixel.shatteredpixeldungeon.journal.Journal;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene;
@@ -98,8 +99,7 @@ public class WndStartGame extends Window {
ActionIndicator.action = null; ActionIndicator.action = null;
InterlevelScene.mode = InterlevelScene.Mode.DESCEND; InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
if (SPDSettings.intro()) { if (Document.INTROS.isPageRead(0)) {
SPDSettings.intro( false );
Game.switchScene( IntroScene.class ); Game.switchScene( IntroScene.class );
} else { } else {
Game.switchScene( InterlevelScene.class ); Game.switchScene( InterlevelScene.class );
@@ -39,30 +39,17 @@ public class WndStory extends Window {
private static final int WIDTH_L = 160; private static final int WIDTH_L = 160;
private static final int MARGIN = 2; private static final int MARGIN = 2;
private static final float bgR = 0.77f;
private static final float bgG = 0.73f;
private static final float bgB = 0.62f;
public static final int ID_SEWERS = 0; public static final int ID_SEWERS = 0;
public static final int ID_PRISON = 1; public static final int ID_PRISON = 1;
public static final int ID_CAVES = 2; public static final int ID_CAVES = 2;
public static final int ID_CITY = 3; public static final int ID_CITY = 3;
public static final int ID_HALLS = 4; public static final int ID_HALLS = 4;
private static final SparseArray<String> CHAPTERS = new SparseArray<>();
static {
CHAPTERS.put( ID_SEWERS, "sewers" );
CHAPTERS.put( ID_PRISON, "prison" );
CHAPTERS.put( ID_CAVES, "caves" );
CHAPTERS.put( ID_CITY, "city" );
CHAPTERS.put( ID_HALLS, "halls" );
}
private IconTitle ttl; private IconTitle ttl;
private RenderedTextBlock tf; private RenderedTextBlock tf;
private float delay; private float appearDelay;
private float disappearDelay;
public WndStory( String text ) { public WndStory( String text ) {
this( null, null, text ); this( null, null, text );
@@ -100,33 +87,36 @@ public class WndStory extends Window {
resize( (int)(tf.width() + MARGIN * 2), (int)Math.min( tf.bottom()+MARGIN, 180 ) ); resize( (int)(tf.width() + MARGIN * 2), (int)Math.min( tf.bottom()+MARGIN, 180 ) );
} }
public WndStory setDelays(float appearDelay, float disappearDelay){
this.appearDelay = appearDelay;
if (appearDelay > 0){
shadow.visible = chrome.visible = tf.visible = false;
if (ttl != null) ttl.visible = false;
}
this.disappearDelay = disappearDelay;
return this;
}
@Override
public void onBackPressed() {
if (appearDelay <= 0 && disappearDelay <= 0) {
super.onBackPressed();
}
}
@Override @Override
public void update() { public void update() {
super.update(); super.update();
if (delay > 0 && (delay -= Game.elapsed) <= 0) { if (appearDelay > 0) {
shadow.visible = chrome.visible = tf.visible = true; appearDelay -= Game.elapsed;
if (ttl != null) ttl.visible = true; if (appearDelay <= 0) {
} shadow.visible = chrome.visible = tf.visible = true;
} if (ttl != null) ttl.visible = true;
public static void showChapter( int id ) {
if (Dungeon.chapters.contains( id )) {
return;
}
String text = Messages.get(WndStory.class, CHAPTERS.get( id ));
if (text != null) {
WndStory wnd = new WndStory( text );
if ((wnd.delay = 0.6f) > 0) {
wnd.shadow.visible = wnd.chrome.visible = wnd.tf.visible = false;
if (wnd.ttl != null) wnd.ttl.visible = false;
} }
} else if (disappearDelay > 0){
Game.scene().add( wnd ); disappearDelay -= Game.elapsed;
Dungeon.chapters.add( id );
} }
} }
} }