v2.5.0: game opts are now always visible and explain that you need a win

This commit is contained in:
Evan Debenham
2024-08-21 14:32:50 -04:00
parent e86707bedb
commit aedd3d04bb
2 changed files with 174 additions and 143 deletions

View File

@@ -64,11 +64,14 @@ scenes.heroselectscene.daily_no=No
scenes.heroselectscene.daily_repeat=You have already played today's daily. You can replay it if you like, but only as an unranked practice run.\n\nAfter you complete the replay, you will be able to view it from the daily rankings window for a short time before the record is deleted.\n\nWould you like to replay today's daily with your currently selected hero and challenges?
scenes.heroselectscene.daily_unavailable_long=It seems you've started a daily that's in the future! This can happen if you recently changed timezones, or if you changed your system clock. _Your next daily will be available in %d days._
scenes.heroselectscene.daily_existing=You already have a daily run in progress. You must end that run before starting another daily.
scenes.heroselectscene.daily_nowin=Every day a new game is available that is the same for everyone! This 'daily run' generates the same dungeon for every person who plays it (so long as they are also playing the same game version).\n\n_You must win at least one game before you are able to play daily runs._
scenes.heroselectscene.custom_seed_title=Enter a Custom Seed
scenes.heroselectscene.custom_seed_desc=The same seed and game version always generate the same dungeon! _Custom seed games cannot earn badges or contribute to games played, and appear at the bottom of the rankings page._
scenes.heroselectscene.custom_seed_desc=The game uses a seed code for dungeon generation, the same seed and game version always generate the same dungeon! _Custom seed games cannot earn badges or contribute to games played, and appear at the bottom of the rankings page._
scenes.heroselectscene.custom_seed_duplicate=You already have a regular game in progress with that seed. You must end that game before using that custom seed.
scenes.heroselectscene.custom_seed_nowin=The game uses a seed code for dungeon generation, the same seed and game version always generate the same dungeon!\n\n_You must win at least one game before you are able to enter custom seeds._
scenes.heroselectscene.custom_seed_set=Set
scenes.heroselectscene.custom_seed_clear=Clear
scenes.heroselectscene.challenges_nowin=Challenges are optional modifiers that make the game more difficult. Some challenges make the dungeon more dangerous, others reduce the power of your abilities or items.\n\n_You must win at least one game before you are able to enable challenges._
scenes.interlevelscene$mode.descend=Descending
scenes.interlevelscene$mode.ascend=Ascending

View File

@@ -45,6 +45,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndKeyBindings;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndTextInput;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndTitledMessage;
import com.watabou.gltextures.TextureCache;
import com.watabou.input.PointerEvent;
import com.watabou.noosa.Camera;
@@ -209,9 +210,11 @@ public class HeroSelectScene extends PixelScene {
updateOptionsColor();
btnOptions.visible = false;
if (DeviceCompat.isDebug() || Badges.isUnlocked(Badges.Badge.VICTORY)){
if(!SPDSettings.intro()){
add(btnOptions);
} else {
}
if (!Badges.isUnlocked(Badges.Badge.VICTORY) && !DeviceCompat.isDebug()){
Dungeon.challenges = 0;
SPDSettings.challenges(0);
SPDSettings.customSeed("");
@@ -578,165 +581,190 @@ public class HeroSelectScene extends PixelScene {
buttons = new ArrayList<>();
spacers = new ArrayList<>();
if (DeviceCompat.isDebug() || Badges.isUnlocked(Badges.Badge.VICTORY)){
StyledButton seedButton = new StyledButton(Chrome.Type.BLANK, Messages.get(HeroSelectScene.class, "custom_seed"), 6){
@Override
protected void onClick() {
String existingSeedtext = SPDSettings.customSeed();
ShatteredPixelDungeon.scene().addToFront( new WndTextInput(Messages.get(HeroSelectScene.class, "custom_seed_title"),
Messages.get(HeroSelectScene.class, "custom_seed_desc"),
existingSeedtext,
20,
false,
Messages.get(HeroSelectScene.class, "custom_seed_set"),
Messages.get(HeroSelectScene.class, "custom_seed_clear")){
@Override
public void onSelect(boolean positive, String text) {
text = DungeonSeed.formatText(text);
long seed = DungeonSeed.convertFromText(text);
if (positive && seed != -1){
for (GamesInProgress.Info info : GamesInProgress.checkAll()){
if (info.customSeed.isEmpty() && info.seed == seed){
SPDSettings.customSeed("");
icon.resetColor();
ShatteredPixelDungeon.scene().addToFront(new WndMessage(Messages.get(HeroSelectScene.class, "custom_seed_duplicate")));
return;
}
}
SPDSettings.customSeed(text);
icon.hardlight(1f, 1.5f, 0.67f);
} else {
SPDSettings.customSeed("");
icon.resetColor();
}
updateOptionsColor();
}
});
StyledButton seedButton = new StyledButton(Chrome.Type.BLANK, Messages.get(HeroSelectScene.class, "custom_seed"), 6){
@Override
protected void onClick() {
if (!Badges.isUnlocked(Badges.Badge.VICTORY) && !DeviceCompat.isDebug()){
ShatteredPixelDungeon.scene().addToFront( new WndTitledMessage(
Icons.get(Icons.SEED),
Messages.get(HeroSelectScene.class, "custom_seed"),
Messages.get(HeroSelectScene.class, "custom_seed_nowin"))
);
return;
}
};
seedButton.leftJustify = true;
seedButton.icon(Icons.get(Icons.SEED));
if (!SPDSettings.customSeed().isEmpty()) seedButton.icon().hardlight(1f, 1.5f, 0.67f);;
buttons.add(seedButton);
add(seedButton);
StyledButton dailyButton = new StyledButton(Chrome.Type.BLANK, Messages.get(HeroSelectScene.class, "daily"), 6){
String existingSeedtext = SPDSettings.customSeed();
ShatteredPixelDungeon.scene().addToFront( new WndTextInput(Messages.get(HeroSelectScene.class, "custom_seed_title"),
Messages.get(HeroSelectScene.class, "custom_seed_desc"),
existingSeedtext,
20,
false,
Messages.get(HeroSelectScene.class, "custom_seed_set"),
Messages.get(HeroSelectScene.class, "custom_seed_clear")){
@Override
public void onSelect(boolean positive, String text) {
text = DungeonSeed.formatText(text);
long seed = DungeonSeed.convertFromText(text);
private static final long SECOND = 1000;
private static final long MINUTE = 60 * SECOND;
private static final long HOUR = 60 * MINUTE;
private static final long DAY = 24 * HOUR;
if (positive && seed != -1){
@Override
protected void onClick() {
super.onClick();
for (GamesInProgress.Info info : GamesInProgress.checkAll()){
if (info.customSeed.isEmpty() && info.seed == seed){
SPDSettings.customSeed("");
icon.resetColor();
ShatteredPixelDungeon.scene().addToFront(new WndMessage(Messages.get(HeroSelectScene.class, "custom_seed_duplicate")));
return;
}
}
long diff = (SPDSettings.lastDaily() + DAY) - Game.realTime;
if (diff > 24*HOUR){
ShatteredPixelDungeon.scene().addToFront(new WndMessage(Messages.get(HeroSelectScene.class, "daily_unavailable_long", (diff / DAY)+1)));
SPDSettings.customSeed(text);
icon.hardlight(1f, 1.5f, 0.67f);
} else {
SPDSettings.customSeed("");
icon.resetColor();
}
updateOptionsColor();
}
});
}
};
seedButton.leftJustify = true;
seedButton.icon(Icons.get(Icons.SEED));
if (!SPDSettings.customSeed().isEmpty()) seedButton.icon().hardlight(1f, 1.5f, 0.67f);;
buttons.add(seedButton);
add(seedButton);
StyledButton dailyButton = new StyledButton(Chrome.Type.BLANK, Messages.get(HeroSelectScene.class, "daily"), 6){
private static final long SECOND = 1000;
private static final long MINUTE = 60 * SECOND;
private static final long HOUR = 60 * MINUTE;
private static final long DAY = 24 * HOUR;
@Override
protected void onClick() {
super.onClick();
if (!Badges.isUnlocked(Badges.Badge.VICTORY) && !DeviceCompat.isDebug()){
ShatteredPixelDungeon.scene().addToFront( new WndTitledMessage(
Icons.get(Icons.CALENDAR),
Messages.get(HeroSelectScene.class, "daily"),
Messages.get(HeroSelectScene.class, "daily_nowin"))
);
return;
}
long diff = (SPDSettings.lastDaily() + DAY) - Game.realTime;
if (diff > 24*HOUR){
ShatteredPixelDungeon.scene().addToFront(new WndMessage(Messages.get(HeroSelectScene.class, "daily_unavailable_long", (diff / DAY)+1)));
return;
}
for (GamesInProgress.Info game : GamesInProgress.checkAll()){
if (game.daily){
ShatteredPixelDungeon.scene().addToFront(new WndMessage(Messages.get(HeroSelectScene.class, "daily_existing")));
return;
}
for (GamesInProgress.Info game : GamesInProgress.checkAll()){
if (game.daily){
ShatteredPixelDungeon.scene().addToFront(new WndMessage(Messages.get(HeroSelectScene.class, "daily_existing")));
return;
}
}
Image icon = Icons.get(Icons.CALENDAR);
if (diff <= 0) icon.hardlight(0.5f, 1f, 2f);
else icon.hardlight(1f, 0.5f, 2f);
ShatteredPixelDungeon.scene().addToFront(new WndOptions(
icon,
Messages.get(HeroSelectScene.class, "daily"),
diff > 0 ?
Messages.get(HeroSelectScene.class, "daily_repeat") :
Messages.get(HeroSelectScene.class, "daily_desc"),
Messages.get(HeroSelectScene.class, "daily_yes"),
Messages.get(HeroSelectScene.class, "daily_no")){
@Override
protected void onSelect(int index) {
if (index == 0){
if (diff <= 0) {
long time = Game.realTime - (Game.realTime % DAY);
//earliest possible daily for v2.3.2 is Jan 30 2024
//which is 19,752 days after Jan 1 1970
time = Math.max(time, 19_752 * DAY);
SPDSettings.lastDaily(time);
Dungeon.dailyReplay = false;
} else {
Dungeon.dailyReplay = true;
}
Dungeon.hero = null;
Dungeon.daily = true;
Dungeon.initSeed();
ActionIndicator.clearAction();
InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
Game.switchScene( InterlevelScene.class );
}
}
});
}
private long timeToUpdate = 0;
Image icon = Icons.get(Icons.CALENDAR);
if (diff <= 0) icon.hardlight(0.5f, 1f, 2f);
else icon.hardlight(1f, 0.5f, 2f);
ShatteredPixelDungeon.scene().addToFront(new WndOptions(
icon,
Messages.get(HeroSelectScene.class, "daily"),
diff > 0 ?
Messages.get(HeroSelectScene.class, "daily_repeat") :
Messages.get(HeroSelectScene.class, "daily_desc"),
Messages.get(HeroSelectScene.class, "daily_yes"),
Messages.get(HeroSelectScene.class, "daily_no")){
@Override
protected void onSelect(int index) {
if (index == 0){
if (diff <= 0) {
long time = Game.realTime - (Game.realTime % DAY);
private final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss", Locale.ROOT);
{
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
}
//earliest possible daily for v2.3.2 is Jan 30 2024
//which is 19,752 days after Jan 1 1970
time = Math.max(time, 19_752 * DAY);
@Override
public void update() {
super.update();
if (Game.realTime > timeToUpdate && visible){
long diff = (SPDSettings.lastDaily() + DAY) - Game.realTime;
if (diff > 0){
if (diff > 30*HOUR){
text("30:00:00+");
SPDSettings.lastDaily(time);
Dungeon.dailyReplay = false;
} else {
text(dateFormat.format(new Date(diff)));
Dungeon.dailyReplay = true;
}
timeToUpdate = Game.realTime + SECOND;
} else {
text(Messages.get(HeroSelectScene.class, "daily"));
timeToUpdate = Long.MAX_VALUE;
Dungeon.hero = null;
Dungeon.daily = true;
Dungeon.initSeed();
ActionIndicator.clearAction();
InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
Game.switchScene( InterlevelScene.class );
}
}
});
}
}
};
dailyButton.leftJustify = true;
dailyButton.icon(Icons.get(Icons.CALENDAR));
add(dailyButton);
buttons.add(dailyButton);
private long timeToUpdate = 0;
StyledButton challengeButton = new StyledButton(Chrome.Type.BLANK, Messages.get(WndChallenges.class, "title"), 6){
@Override
protected void onClick() {
ShatteredPixelDungeon.scene().addToFront(new WndChallenges(SPDSettings.challenges(), true) {
public void onBackPressed() {
super.onBackPressed();
icon(Icons.get(SPDSettings.challenges() > 0 ? Icons.CHALLENGE_COLOR : Icons.CHALLENGE_GREY));
updateOptionsColor();
private final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss", Locale.ROOT);
{
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
}
@Override
public void update() {
super.update();
if (Game.realTime > timeToUpdate && visible){
long diff = (SPDSettings.lastDaily() + DAY) - Game.realTime;
if (diff > 0){
if (diff > 30*HOUR){
text("30:00:00+");
} else {
text(dateFormat.format(new Date(diff)));
}
} );
timeToUpdate = Game.realTime + SECOND;
} else {
text(Messages.get(HeroSelectScene.class, "daily"));
timeToUpdate = Long.MAX_VALUE;
}
}
};
challengeButton.leftJustify = true;
challengeButton.icon(Icons.get(SPDSettings.challenges() > 0 ? Icons.CHALLENGE_COLOR : Icons.CHALLENGE_GREY));
add(challengeButton);
buttons.add(challengeButton);
}
}
};
dailyButton.leftJustify = true;
dailyButton.icon(Icons.get(Icons.CALENDAR));
add(dailyButton);
buttons.add(dailyButton);
StyledButton challengeButton = new StyledButton(Chrome.Type.BLANK, Messages.get(WndChallenges.class, "title"), 6){
@Override
protected void onClick() {
if (!Badges.isUnlocked(Badges.Badge.VICTORY) && !DeviceCompat.isDebug()){
ShatteredPixelDungeon.scene().addToFront( new WndTitledMessage(
Icons.get(Icons.CHALLENGE_GREY),
Messages.get(WndChallenges.class, "title"),
Messages.get(HeroSelectScene.class, "challenges_nowin")
));
return;
}
ShatteredPixelDungeon.scene().addToFront(new WndChallenges(SPDSettings.challenges(), true) {
public void onBackPressed() {
super.onBackPressed();
icon(Icons.get(SPDSettings.challenges() > 0 ? Icons.CHALLENGE_COLOR : Icons.CHALLENGE_GREY));
updateOptionsColor();
}
} );
}
};
challengeButton.leftJustify = true;
challengeButton.icon(Icons.get(SPDSettings.challenges() > 0 ? Icons.CHALLENGE_COLOR : Icons.CHALLENGE_GREY));
add(challengeButton);
buttons.add(challengeButton);
for (int i = 1; i < buttons.size(); i++){
ColorBlock spc = new ColorBlock(1, 1, 0xFF000000);