Cleanup; splash story on first run.
This commit is contained in:
@@ -3,7 +3,6 @@ package mightypork.gamecore.gui.screens;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
import mightypork.gamecore.core.AppAccess;
|
||||
import mightypork.gamecore.core.AppSubModule;
|
||||
|
||||
@@ -16,7 +16,7 @@ public class LayerColor extends ScreenLayer {
|
||||
{
|
||||
super(screen);
|
||||
|
||||
QuadPainter qp = new QuadPainter(color);
|
||||
final QuadPainter qp = new QuadPainter(color);
|
||||
qp.setRect(root);
|
||||
root.add(qp);
|
||||
this.zIndex = zIndex;
|
||||
|
||||
@@ -9,7 +9,6 @@ import mightypork.gamecore.core.events.MainLoopRequest;
|
||||
import mightypork.gamecore.core.events.UserQuitRequest;
|
||||
import mightypork.gamecore.eventbus.BusEvent;
|
||||
import mightypork.gamecore.gui.screens.ScreenRegistry;
|
||||
import mightypork.gamecore.gui.screens.impl.CrossfadeRequest;
|
||||
import mightypork.gamecore.input.InputSystem;
|
||||
import mightypork.gamecore.input.KeyStroke.Edge;
|
||||
import mightypork.gamecore.render.DisplaySystem;
|
||||
@@ -129,8 +128,12 @@ public final class RogueApp extends BaseApp implements ViewportChangeListener, S
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
//getEventBus().send(new RogueStateRequest(RogueState.MAIN_MENU));
|
||||
getEventBus().send(new CrossfadeRequest("story", true));
|
||||
if (Config.getValue("opt.show_story")) {
|
||||
Config.setValue("opt.show_story", false);
|
||||
getEventBus().send(new RogueStateRequest(RogueState.STORY, true));
|
||||
} else {
|
||||
getEventBus().send(new RogueStateRequest(RogueState.MAIN_MENU, true));
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ public class RogueConfig implements ConfigSetup {
|
||||
prop.putBoolean("display.fullscreen", false, "Start in fullscreen (remembers state at exit)");
|
||||
prop.putInteger("display.width", 1024, "Initial width (remembers from last time)");
|
||||
prop.putInteger("display.height", 768, "Initial height (remembers from last time)");
|
||||
|
||||
prop.putBoolean("opt.show_story", true, "Show story on start-up.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,23 +20,23 @@ public class RogueStateManager extends AppModule {
|
||||
}
|
||||
|
||||
|
||||
public void triggerAction(RogueState state)
|
||||
public void triggerAction(RogueState state, boolean fromDark)
|
||||
{
|
||||
switch (state) {
|
||||
case MAIN_MENU:
|
||||
getEventBus().send(new CrossfadeRequest("main_menu"));
|
||||
getEventBus().send(new CrossfadeRequest("main_menu", fromDark));
|
||||
break;
|
||||
|
||||
case SELECT_WORLD:
|
||||
getEventBus().send(new CrossfadeRequest("select_world"));
|
||||
getEventBus().send(new CrossfadeRequest("select_world", fromDark));
|
||||
break;
|
||||
|
||||
case PLAY_WORLD:
|
||||
getEventBus().send(new CrossfadeRequest("game"));
|
||||
getEventBus().send(new CrossfadeRequest("game", fromDark));
|
||||
break;
|
||||
|
||||
case STORY:
|
||||
getEventBus().send(new CrossfadeRequest("story"));
|
||||
getEventBus().send(new CrossfadeRequest("story", fromDark));
|
||||
break;
|
||||
|
||||
case EXIT:
|
||||
|
||||
@@ -14,17 +14,26 @@ import mightypork.rogue.RogueStateManager.RogueState;
|
||||
public class RogueStateRequest extends BusEvent<RogueStateManager> {
|
||||
|
||||
final private RogueState requested;
|
||||
private final boolean fromDark;
|
||||
|
||||
|
||||
public RogueStateRequest(RogueState requested)
|
||||
{
|
||||
this.requested = requested;
|
||||
this.fromDark = false;
|
||||
}
|
||||
|
||||
|
||||
public RogueStateRequest(RogueState requested, boolean fromDark)
|
||||
{
|
||||
this.requested = requested;
|
||||
this.fromDark = fromDark;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void handleBy(RogueStateManager handler)
|
||||
{
|
||||
handler.triggerAction(requested);
|
||||
handler.triggerAction(requested, fromDark);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,21 +8,18 @@ import mightypork.gamecore.gui.AlignX;
|
||||
import mightypork.gamecore.gui.components.layout.RowLayout;
|
||||
import mightypork.gamecore.gui.components.layout.linear.LinearLayout;
|
||||
import mightypork.gamecore.gui.components.painters.ImagePainter;
|
||||
import mightypork.gamecore.gui.components.painters.QuadPainter;
|
||||
import mightypork.gamecore.gui.components.painters.TextPainter;
|
||||
import mightypork.gamecore.gui.screens.Screen;
|
||||
import mightypork.gamecore.gui.screens.ScreenLayer;
|
||||
import mightypork.gamecore.gui.screens.impl.FadingLayer;
|
||||
import mightypork.gamecore.gui.screens.impl.LayerColor;
|
||||
import mightypork.gamecore.input.KeyStroke;
|
||||
import mightypork.gamecore.input.Keys;
|
||||
import mightypork.gamecore.input.KeyStroke.Edge;
|
||||
import mightypork.gamecore.input.Keys;
|
||||
import mightypork.gamecore.input.events.MouseButtonEvent;
|
||||
import mightypork.gamecore.input.events.MouseButtonHandler;
|
||||
import mightypork.gamecore.resources.Res;
|
||||
import mightypork.gamecore.util.math.Easing;
|
||||
import mightypork.gamecore.util.math.color.Color;
|
||||
import mightypork.gamecore.util.math.color.pal.RGB;
|
||||
import mightypork.gamecore.util.math.constraints.num.Num;
|
||||
import mightypork.gamecore.util.math.constraints.num.mutable.NumAnimated;
|
||||
import mightypork.gamecore.util.math.constraints.rect.Rect;
|
||||
@@ -36,16 +33,16 @@ public class ScreenStory extends RogueScreen implements MouseButtonHandler {
|
||||
|
||||
private class LayerSlide extends ScreenLayer {
|
||||
|
||||
private TextPainter tp1;
|
||||
private TextPainter tp2;
|
||||
private ImagePainter img;
|
||||
private NumAnimated layerAlpha = new NumAnimated(0, Easing.LINEAR, 0.8);
|
||||
private NumAnimated tx1alpha = new NumAnimated(0, Easing.LINEAR, 1);
|
||||
private NumAnimated tx2alpha = new NumAnimated(0, Easing.LINEAR, 1);
|
||||
private final TextPainter tp1;
|
||||
private final TextPainter tp2;
|
||||
private final ImagePainter img;
|
||||
private final NumAnimated layerAlpha = new NumAnimated(0, Easing.LINEAR, 0.8);
|
||||
private final NumAnimated tx1alpha = new NumAnimated(0, Easing.LINEAR, 1);
|
||||
private final NumAnimated tx2alpha = new NumAnimated(0, Easing.LINEAR, 1);
|
||||
|
||||
private String nextImg, nextT1, nextT2;
|
||||
|
||||
private TimedTask ttNextSlide = new TimedTask() {
|
||||
private final TimedTask ttNextSlide = new TimedTask() {
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
@@ -63,7 +60,7 @@ public class ScreenStory extends RogueScreen implements MouseButtonHandler {
|
||||
}
|
||||
};
|
||||
|
||||
private TimedTask ttText1 = new TimedTask() {
|
||||
private final TimedTask ttText1 = new TimedTask() {
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
@@ -77,7 +74,7 @@ public class ScreenStory extends RogueScreen implements MouseButtonHandler {
|
||||
}
|
||||
};
|
||||
|
||||
private TimedTask ttText2 = new TimedTask() {
|
||||
private final TimedTask ttText2 = new TimedTask() {
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
@@ -91,7 +88,7 @@ public class ScreenStory extends RogueScreen implements MouseButtonHandler {
|
||||
}
|
||||
};
|
||||
|
||||
private TimedTask ttFinish = new TimedTask() {
|
||||
private final TimedTask ttFinish = new TimedTask() {
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
@@ -107,12 +104,12 @@ public class ScreenStory extends RogueScreen implements MouseButtonHandler {
|
||||
{
|
||||
super(screen);
|
||||
|
||||
Rect contentRect = root.shrink(Num.ZERO, root.height().perc(3));
|
||||
RowLayout rl = new RowLayout(root, 9);
|
||||
final Rect contentRect = root.shrink(Num.ZERO, root.height().perc(3));
|
||||
final RowLayout rl = new RowLayout(root, 9);
|
||||
rl.setRect(contentRect);
|
||||
root.add(rl);
|
||||
|
||||
LinearLayout ll = new LinearLayout(root, AlignX.CENTER);
|
||||
final LinearLayout ll = new LinearLayout(root, AlignX.CENTER);
|
||||
rl.add(ll, 7);
|
||||
img = new ImagePainter(Res.getTxQuad("story_1"));
|
||||
ll.add(img);
|
||||
@@ -158,7 +155,8 @@ public class ScreenStory extends RogueScreen implements MouseButtonHandler {
|
||||
layerAlpha.fadeOut();
|
||||
ttNextSlide.start(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void reset()
|
||||
{
|
||||
ttFinish.stop();
|
||||
@@ -172,7 +170,7 @@ public class ScreenStory extends RogueScreen implements MouseButtonHandler {
|
||||
|
||||
private LayerSlide slideLayer;
|
||||
|
||||
private Action next = new Action() {
|
||||
private final Action next = new Action() {
|
||||
|
||||
@Override
|
||||
protected void execute()
|
||||
@@ -181,7 +179,7 @@ public class ScreenStory extends RogueScreen implements MouseButtonHandler {
|
||||
}
|
||||
};
|
||||
|
||||
private Action prev = new Action() {
|
||||
private final Action prev = new Action() {
|
||||
|
||||
@Override
|
||||
protected void execute()
|
||||
@@ -191,7 +189,7 @@ public class ScreenStory extends RogueScreen implements MouseButtonHandler {
|
||||
}
|
||||
};
|
||||
|
||||
private Action close = new Action() {
|
||||
private final Action close = new Action() {
|
||||
|
||||
@Override
|
||||
protected void execute()
|
||||
|
||||
Reference in New Issue
Block a user