convert game
This commit is contained in:
@@ -334,7 +334,13 @@ public class DisplayContainer implements ErrorDumpable, KeyListener, MouseListen
|
||||
}
|
||||
|
||||
public void switchStateNow(Class<? extends OpsuState> newState) {
|
||||
switchState(newState, EmptyTransitionState.class, 0, EmptyTransitionState.class, 0);
|
||||
switchState(newState, EmptyTransitionState.class, 0, FadeInTransitionState.class, 300);
|
||||
}
|
||||
|
||||
public void switchStateInstantly(Class<? extends OpsuState> newState) {
|
||||
state.leave();
|
||||
state = instanceContainer.provide(newState);
|
||||
state.enter();
|
||||
}
|
||||
|
||||
public void switchState(Class<? extends OpsuState> newState, Class<? extends TransitionState> outTransition, int outTime, Class<? extends TransitionState> inTransition, int inTime) {
|
||||
|
||||
@@ -57,6 +57,8 @@ public class OpsuDanceInjector extends Injector {
|
||||
bind(ButtonMenu.class).asEagerSingleton();
|
||||
bind(SongMenu.class).asEagerSingleton();
|
||||
bind(DownloadsMenu.class).asEagerSingleton();
|
||||
bind(GameRanking.class).asEagerSingleton();
|
||||
bind(Game.class).asEagerSingleton();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,8 +26,13 @@ public abstract class OverlayOpsuState implements OpsuState {
|
||||
protected boolean active;
|
||||
protected boolean acceptInput;
|
||||
|
||||
public abstract void hide();
|
||||
public abstract void show();
|
||||
public void hide() {
|
||||
acceptInput = active = false;
|
||||
}
|
||||
|
||||
public void show() {
|
||||
acceptInput = active = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void update() {
|
||||
|
||||
@@ -25,6 +25,8 @@ import itdelatrisu.opsu.ui.animations.AnimationEquation;
|
||||
import org.newdawn.slick.Color;
|
||||
import org.newdawn.slick.GameContainer;
|
||||
import org.newdawn.slick.Graphics;
|
||||
import yugecin.opsudance.core.DisplayContainer;
|
||||
import yugecin.opsudance.core.state.OverlayOpsuState;
|
||||
import yugecin.opsudance.sbv2.movers.CubicStoryboardMover;
|
||||
import yugecin.opsudance.sbv2.movers.LinearStoryboardMover;
|
||||
import yugecin.opsudance.sbv2.movers.QuadraticStoryboardMover;
|
||||
@@ -34,20 +36,20 @@ import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
public class MoveStoryboard {
|
||||
public class MoveStoryboard extends OverlayOpsuState{
|
||||
|
||||
private final SimpleButton btnAddLinear;
|
||||
private final SimpleButton btnAddQuadratic;
|
||||
private final SimpleButton btnAddCubic;
|
||||
private final DisplayContainer displayContainer;
|
||||
|
||||
private final SimpleButton btnAnimLin;
|
||||
private final SimpleButton btnAnimMid;
|
||||
private final SimpleButton btnAnimCub;
|
||||
private SimpleButton btnAddLinear;
|
||||
private SimpleButton btnAddQuadratic;
|
||||
private SimpleButton btnAddCubic;
|
||||
|
||||
private SimpleButton btnAnimLin;
|
||||
private SimpleButton btnAnimMid;
|
||||
private SimpleButton btnAnimCub;
|
||||
|
||||
private final StoryboardMove dummyMove;
|
||||
|
||||
private int width;
|
||||
|
||||
private StoryboardMove[] moves;
|
||||
|
||||
private GameObject[] gameObjects;
|
||||
@@ -55,14 +57,8 @@ public class MoveStoryboard {
|
||||
|
||||
private int trackPosition;
|
||||
|
||||
public MoveStoryboard(GameContainer container) {
|
||||
this.width = container.getWidth();
|
||||
btnAddLinear = new SimpleButton(width - 205, 50, 200, 25, Fonts.SMALL, "add linear", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
|
||||
btnAddQuadratic = new SimpleButton(width - 205, 80, 200, 25, Fonts.SMALL, "add quadratic", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
|
||||
btnAddCubic = new SimpleButton(width - 205, 110, 200, 25, Fonts.SMALL, "add cubic", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
|
||||
btnAnimLin = new SimpleButton(width - 250, 50, 40, 25, Fonts.SMALL, "lin", Color.blue, Color.white, Color.white, Color.orange);
|
||||
btnAnimMid = new SimpleButton(width - 250, 80, 40, 25, Fonts.SMALL, "mid", Color.blue, Color.white, Color.white, Color.orange);
|
||||
btnAnimCub = new SimpleButton(width - 250, 110, 40, 25, Fonts.SMALL, "cub", Color.blue, Color.white, Color.white, Color.orange);
|
||||
public MoveStoryboard(DisplayContainer displayContainer) {
|
||||
this.displayContainer = displayContainer;
|
||||
dummyMove = (StoryboardMove) Proxy.newProxyInstance(StoryboardMove.class.getClassLoader(), new Class<?>[]{StoryboardMove.class}, new InvocationHandler() {
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
@@ -71,6 +67,16 @@ public class MoveStoryboard {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revalidate() {
|
||||
btnAddLinear = new SimpleButton(displayContainer.width - 205, 50, 200, 25, Fonts.SMALL, "add linear", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
|
||||
btnAddQuadratic = new SimpleButton(displayContainer.width - 205, 80, 200, 25, Fonts.SMALL, "add quadratic", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
|
||||
btnAddCubic = new SimpleButton(displayContainer.width - 205, 110, 200, 25, Fonts.SMALL, "add cubic", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
|
||||
btnAnimLin = new SimpleButton(displayContainer.width - 250, 50, 40, 25, Fonts.SMALL, "lin", Color.blue, Color.white, Color.white, Color.orange);
|
||||
btnAnimMid = new SimpleButton(displayContainer.width - 250, 80, 40, 25, Fonts.SMALL, "mid", Color.blue, Color.white, Color.white, Color.orange);
|
||||
btnAnimCub = new SimpleButton(displayContainer.width - 250, 110, 40, 25, Fonts.SMALL, "cub", Color.blue, Color.white, Color.white, Color.orange);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the point at the current time
|
||||
* @param trackPosition current time in ms
|
||||
@@ -88,7 +94,33 @@ public class MoveStoryboard {
|
||||
return moves[objectIndex].getPointAt(t);
|
||||
}
|
||||
|
||||
public void render(Graphics g) {
|
||||
@Override
|
||||
public void hide() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreRenderUpdate() {
|
||||
int x = displayContainer.mouseX;
|
||||
int y = displayContainer.mouseY;
|
||||
btnAddLinear.update(x, y);
|
||||
btnAddQuadratic.update(x, y);
|
||||
btnAddCubic.update(x, y);
|
||||
btnAnimLin.update(x, y);
|
||||
btnAnimMid.update(x, y);
|
||||
btnAnimCub.update(x, y);
|
||||
if (moves[objectIndex] != null) {
|
||||
moves[objectIndex].update(displayContainer.renderDelta, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(Graphics g) {
|
||||
btnAddLinear.render(g);
|
||||
btnAddQuadratic.render(g);
|
||||
btnAddCubic.render(g);
|
||||
@@ -100,13 +132,31 @@ public class MoveStoryboard {
|
||||
}
|
||||
}
|
||||
|
||||
public void mousePressed(int x, int y) {
|
||||
@Override
|
||||
protected boolean onKeyPressed(int key, char c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onKeyReleased(int key, char c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onMouseWheelMoved(int delta) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onMousePressed(int button, int x, int y) {
|
||||
if (moves[objectIndex] != null) {
|
||||
moves[objectIndex].mousePressed(x, y);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void mouseReleased(int x, int y) {
|
||||
@Override
|
||||
protected boolean onMouseReleased(int button, int x, int y) {
|
||||
if (moves[objectIndex] != null) {
|
||||
moves[objectIndex].mouseReleased(x, y);
|
||||
if (moves[objectIndex].getAmountOfMovers() == 0) {
|
||||
@@ -114,7 +164,7 @@ public class MoveStoryboard {
|
||||
}
|
||||
}
|
||||
if (objectIndex == 0) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
if (btnAddLinear.isHovered()) {
|
||||
getCurrentMoveOrCreateNew().add(new LinearStoryboardMover());
|
||||
@@ -134,6 +184,12 @@ public class MoveStoryboard {
|
||||
if (btnAnimCub.isHovered()) {
|
||||
getCurrentMoveOrDummy().setAnimationEquation(AnimationEquation.IN_OUT_EASE_MIDDLE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onMouseDragged(int oldx, int oldy, int newx, int newy) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private StoryboardMove getCurrentMoveOrCreateNew() {
|
||||
@@ -142,7 +198,7 @@ public class MoveStoryboard {
|
||||
return dummyMove;
|
||||
}
|
||||
if (moves[objectIndex] == null) {
|
||||
return moves[objectIndex] = new StoryboardMoveImpl(gameObjects[objectIndex - 1].end, gameObjects[objectIndex].start, width);
|
||||
return moves[objectIndex] = new StoryboardMoveImpl(gameObjects[objectIndex - 1].end, gameObjects[objectIndex].start, displayContainer.width);
|
||||
}
|
||||
return moves[objectIndex];
|
||||
}
|
||||
@@ -154,18 +210,6 @@ public class MoveStoryboard {
|
||||
return moves[objectIndex];
|
||||
}
|
||||
|
||||
public void update(int delta, int x, int y) {
|
||||
btnAddLinear.update(x, y);
|
||||
btnAddQuadratic.update(x, y);
|
||||
btnAddCubic.update(x, y);
|
||||
btnAnimLin.update(x, y);
|
||||
btnAnimMid.update(x, y);
|
||||
btnAnimCub.update(x, y);
|
||||
if (moves[objectIndex] != null) {
|
||||
moves[objectIndex].update(delta, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
public void setGameObjects(GameObject[] gameObjects) {
|
||||
this.gameObjects = gameObjects;
|
||||
this.moves = new StoryboardMove[gameObjects.length];
|
||||
|
||||
@@ -35,9 +35,10 @@ import yugecin.opsudance.core.state.OverlayOpsuState;
|
||||
|
||||
public class OptionsOverlay extends OverlayOpsuState {
|
||||
|
||||
private final ComplexOpsuState parent;
|
||||
private final DisplayContainer displayContainer;
|
||||
|
||||
private Listener listener;
|
||||
|
||||
private Image sliderBallImg;
|
||||
private Image checkOnImg;
|
||||
private Image checkOffImg;
|
||||
@@ -81,8 +82,7 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
|
||||
private int sliderSoundDelay;
|
||||
|
||||
public OptionsOverlay(ComplexOpsuState parent, DisplayContainer displayContainer, OptionTab[] tabs, int defaultSelectedTabIndex) {
|
||||
this.parent = parent;
|
||||
public OptionsOverlay(DisplayContainer displayContainer, OptionTab[] tabs, int defaultSelectedTabIndex) {
|
||||
this.displayContainer = displayContainer;
|
||||
|
||||
this.tabs = tabs;
|
||||
@@ -91,6 +91,10 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
listHoverIndex = -1;
|
||||
}
|
||||
|
||||
public void setListener(Listener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revalidate() {
|
||||
super.revalidate();
|
||||
@@ -399,7 +403,9 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
if (isListOptionOpen) {
|
||||
if (y > optionStartY && listStartX <= x && x < listStartX + listWidth && listStartY <= y && y < listStartY + listHeight) {
|
||||
hoverOption.clickListItem(listHoverIndex);
|
||||
// TODO d parent.onSaveOption(hoverOption);
|
||||
if (listener != null) {
|
||||
listener.onSaveOption(hoverOption);
|
||||
}
|
||||
SoundController.playSound(SoundEffect.MENUCLICK);
|
||||
}
|
||||
isListOptionOpen = false;
|
||||
@@ -431,8 +437,8 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
@Override
|
||||
public boolean onMouseReleased(int button, int x, int y) {
|
||||
selectedOption = null;
|
||||
if (isAdjustingSlider) {
|
||||
// TODO d parent.onSaveOption(hoverOption);
|
||||
if (isAdjustingSlider && listener != null) {
|
||||
listener.onSaveOption(hoverOption);
|
||||
}
|
||||
isAdjustingSlider = false;
|
||||
sliderOptionLength = 0;
|
||||
@@ -445,7 +451,9 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
if (hoverOption != null) {
|
||||
if (hoverOption.getType() == OptionType.BOOLEAN) {
|
||||
hoverOption.click();
|
||||
// TODO d parent.onSaveOption(hoverOption);
|
||||
if (listener != null) {
|
||||
listener.onSaveOption(hoverOption);
|
||||
}
|
||||
SoundController.playSound(SoundEffect.MENUHIT);
|
||||
return true;
|
||||
} else if (hoverOption == GameOption.KEY_LEFT) {
|
||||
@@ -466,6 +474,11 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
tScrollOffset += Fonts.MEDIUM.getLineHeight() * 2;
|
||||
tScrollOffset += tab.options.length * optionHeight;
|
||||
}
|
||||
|
||||
if (UI.getBackButton().contains(x, y) && listener != null) {
|
||||
listener.onLeaveOptionsMenu();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -500,16 +513,19 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
case Input.KEY_ESCAPE:
|
||||
if (isListOptionOpen) {
|
||||
isListOptionOpen = false;
|
||||
listHoverIndex = -1;
|
||||
return true;
|
||||
}
|
||||
hide();
|
||||
if (key == Input.KEY_ESCAPE) {
|
||||
if (isListOptionOpen) {
|
||||
isListOptionOpen = false;
|
||||
listHoverIndex = -1;
|
||||
return true;
|
||||
}
|
||||
hide();
|
||||
if (listener != null) {
|
||||
listener.onLeaveOptionsMenu();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -570,9 +586,9 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
|
||||
}
|
||||
|
||||
public interface Parent {
|
||||
public interface Listener {
|
||||
|
||||
void onLeave();
|
||||
void onLeaveOptionsMenu();
|
||||
void onSaveOption(GameOption option);
|
||||
|
||||
}
|
||||
|
||||
@@ -22,86 +22,27 @@ import itdelatrisu.opsu.Options.GameOption;
|
||||
import itdelatrisu.opsu.audio.MusicController;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import itdelatrisu.opsu.states.Game;
|
||||
import itdelatrisu.opsu.states.OptionsMenu;
|
||||
import itdelatrisu.opsu.ui.Fonts;
|
||||
import org.newdawn.slick.Color;
|
||||
import org.newdawn.slick.GameContainer;
|
||||
import org.newdawn.slick.Graphics;
|
||||
import org.newdawn.slick.Input;
|
||||
import yugecin.opsudance.ObjectColorOverrides;
|
||||
import yugecin.opsudance.core.DisplayContainer;
|
||||
import yugecin.opsudance.core.state.OverlayOpsuState;
|
||||
import yugecin.opsudance.sbv2.MoveStoryboard;
|
||||
import yugecin.opsudance.ui.OptionsOverlay.OptionTab;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class SBOverlay implements OptionsOverlay.Parent {
|
||||
|
||||
private static final OptionTab[] options = new OptionsOverlay.OptionTab[]{
|
||||
new OptionTab("Gameplay", new GameOption[] {
|
||||
GameOption.BACKGROUND_DIM,
|
||||
GameOption.DANCE_REMOVE_BG,
|
||||
GameOption.SNAKING_SLIDERS,
|
||||
GameOption.SHRINKING_SLIDERS,
|
||||
GameOption.SHOW_HIT_LIGHTING,
|
||||
GameOption.SHOW_HIT_ANIMATIONS,
|
||||
GameOption.SHOW_COMBO_BURSTS,
|
||||
GameOption.SHOW_PERFECT_HIT,
|
||||
GameOption.SHOW_FOLLOW_POINTS,
|
||||
}),
|
||||
new OptionTab("Input", new GameOption[] {
|
||||
GameOption.CURSOR_SIZE,
|
||||
GameOption.NEW_CURSOR,
|
||||
GameOption.DISABLE_CURSOR
|
||||
}),
|
||||
new OptionTab("Dance", new GameOption[] {
|
||||
GameOption.DANCE_MOVER,
|
||||
GameOption.DANCE_EXGON_DELAY,
|
||||
GameOption.DANCE_QUAD_BEZ_AGGRESSIVENESS,
|
||||
GameOption.DANCE_QUAD_BEZ_SLIDER_AGGRESSIVENESS_FACTOR,
|
||||
GameOption.DANCE_QUAD_BEZ_USE_CUBIC_ON_SLIDERS,
|
||||
GameOption.DANCE_QUAD_BEZ_CUBIC_AGGRESSIVENESS_FACTOR,
|
||||
GameOption.DANCE_MOVER_DIRECTION,
|
||||
GameOption.DANCE_SLIDER_MOVER_TYPE,
|
||||
GameOption.DANCE_SPINNER,
|
||||
GameOption.DANCE_SPINNER_DELAY,
|
||||
GameOption.DANCE_LAZY_SLIDERS,
|
||||
GameOption.DANCE_CIRCLE_STREAMS,
|
||||
GameOption.DANCE_ONLY_CIRCLE_STACKS,
|
||||
GameOption.DANCE_CIRLCE_IN_SLOW_SLIDERS,
|
||||
GameOption.DANCE_CIRLCE_IN_LAZY_SLIDERS,
|
||||
GameOption.DANCE_MIRROR,
|
||||
}),
|
||||
new OptionTab("Dance display", new GameOption[] {
|
||||
GameOption.DANCE_DRAW_APPROACH,
|
||||
GameOption.DANCE_OBJECT_COLOR_OVERRIDE,
|
||||
GameOption.DANCE_OBJECT_COLOR_OVERRIDE_MIRRORED,
|
||||
GameOption.DANCE_RGB_OBJECT_INC,
|
||||
GameOption.DANCE_CURSOR_COLOR_OVERRIDE,
|
||||
GameOption.DANCE_CURSOR_MIRROR_COLOR_OVERRIDE,
|
||||
GameOption.DANCE_CURSOR_ONLY_COLOR_TRAIL,
|
||||
GameOption.DANCE_RGB_CURSOR_INC,
|
||||
GameOption.DANCE_CURSOR_TRAIL_OVERRIDE,
|
||||
GameOption.DANCE_HIDE_OBJECTS,
|
||||
GameOption.DANCE_HIDE_UI,
|
||||
GameOption.DANCE_HIDE_WATERMARK,
|
||||
}),
|
||||
new OptionTab ("Pippi", new GameOption[] {
|
||||
GameOption.PIPPI_ENABLE,
|
||||
GameOption.PIPPI_RADIUS_PERCENT,
|
||||
GameOption.PIPPI_ANGLE_INC_MUL,
|
||||
GameOption.PIPPI_ANGLE_INC_MUL_SLIDER,
|
||||
GameOption.PIPPI_SLIDER_FOLLOW_EXPAND,
|
||||
GameOption.PIPPI_PREVENT_WOBBLY_STREAMS,
|
||||
})
|
||||
};
|
||||
public class StoryboardOverlay extends OverlayOpsuState implements OptionsOverlay.Listener {
|
||||
|
||||
private final static List<GameOption> optionList = new ArrayList<>();
|
||||
|
||||
private boolean hide;
|
||||
private boolean menu;
|
||||
private final DisplayContainer displayContainer;
|
||||
|
||||
private int width;
|
||||
private int height;
|
||||
private boolean hide;
|
||||
|
||||
private int speed;
|
||||
private GameObject[] gameObjects;
|
||||
@@ -112,43 +53,42 @@ public class SBOverlay implements OptionsOverlay.Parent {
|
||||
|
||||
private final Game game;
|
||||
private final MoveStoryboard msb;
|
||||
private OptionsOverlay overlay;
|
||||
private final OptionsOverlay optionsOverlay;
|
||||
|
||||
static {
|
||||
for (OptionTab tab : options) {
|
||||
for (OptionTab tab : OptionsMenu.storyboardOptions) {
|
||||
optionList.addAll(Arrays.asList(tab.options));
|
||||
}
|
||||
}
|
||||
|
||||
public SBOverlay(Game game, MoveStoryboard msb, GameContainer container) {
|
||||
this.game = game;
|
||||
public StoryboardOverlay(DisplayContainer displayContainer, MoveStoryboard msb, OptionsOverlay optionsOverlay, Game game) {
|
||||
this.displayContainer = displayContainer;
|
||||
this.msb = msb;
|
||||
this.optionsOverlay = optionsOverlay;
|
||||
this.game = game;
|
||||
initialOptions = new HashMap<>();
|
||||
//overlay = new OptionsOverlay(this, options, 2, container);
|
||||
this.width = container.getWidth();
|
||||
this.height = container.getHeight();
|
||||
speed = 10;
|
||||
gameObjects = new GameObject[0];
|
||||
}
|
||||
|
||||
public void render(GameContainer container, Graphics g) {
|
||||
@Override
|
||||
public void onRender(Graphics g) {
|
||||
if (!Options.isEnableSB() || hide) {
|
||||
return;
|
||||
}
|
||||
msb.render(g);
|
||||
int lh = Fonts.SMALL.getLineHeight();
|
||||
Fonts.SMALL.drawString(10, height - 50 + lh, "save position: ctrl+s, load position: ctrl+l", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, height - 50, "speed: C " + (speed / 10f) + " V", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, height - 50 - lh, "Menu: N", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, height - 50 - lh * 2, "HIDE: H", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, height - 50 - lh * 3, "obj: J " + index + " K", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, displayContainer.height - 50 + lh, "save position: ctrl+s, load position: ctrl+l", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, displayContainer.height - 50, "speed: C " + (speed / 10f) + " V", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, displayContainer.height - 50 - lh, "Menu: N", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, displayContainer.height - 50 - lh * 2, "HIDE: H", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, displayContainer.height - 50 - lh * 3, "obj: J " + index + " K", Color.cyan);
|
||||
g.setColor(Color.red);
|
||||
if (index < optionsMap.length && optionsMap[index] != null) {
|
||||
int i = 0;
|
||||
for (Object o : optionsMap[index].entrySet()) {
|
||||
Map.Entry<Options.GameOption, String> option = (Map.Entry<Options.GameOption, String>) o;
|
||||
Fonts.SMALL.drawString(10, 50 + i * lh, option.getKey().getName(), Color.cyan);
|
||||
Fonts.SMALL.drawString(width / 5, 50 + i * lh, option.getKey().getValueString(), Color.cyan);
|
||||
Fonts.SMALL.drawString(displayContainer.width / 5, 50 + i * lh, option.getKey().getValueString(), Color.cyan);
|
||||
g.fillRect(0, 50 + i * lh + lh / 4, 10, 10);
|
||||
i++;
|
||||
}
|
||||
@@ -157,27 +97,16 @@ public class SBOverlay implements OptionsOverlay.Parent {
|
||||
int start = gameObjects[0].getTime();
|
||||
int end = gameObjects[gameObjects.length - 1].getEndTime();
|
||||
float curtime = (float) (MusicController.getPosition() - start) / (end - start);
|
||||
g.fillRect(curtime * width, height - 10f, 10f, 10f);
|
||||
}
|
||||
if (menu) {
|
||||
//overlay.render(g, container.getInput().getMouseX(), container.getInput().getMouseY());
|
||||
g.fillRect(curtime * displayContainer.width, displayContainer.height - 10f, 10f, 10f);
|
||||
}
|
||||
}
|
||||
|
||||
public void update(int delta, int mouseX, int mouseY) {
|
||||
if (Options.isEnableSB() && menu) {
|
||||
//overlay.update(delta, mouseX, mouseY);
|
||||
}
|
||||
msb.update(delta, mouseX, mouseY);
|
||||
@Override
|
||||
public void onPreRenderUpdate() {
|
||||
}
|
||||
|
||||
public boolean keyPressed(int key, char c) {
|
||||
if (!Options.isEnableSB()) {
|
||||
return false;
|
||||
}
|
||||
if (menu && overlay.keyPressed(key, c)) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onKeyPressed(int key, char c) {
|
||||
if (key == Input.KEY_C) {
|
||||
if (speed > 0) {
|
||||
speed -= 1;
|
||||
@@ -196,11 +125,9 @@ public class SBOverlay implements OptionsOverlay.Parent {
|
||||
} else if (key == Input.KEY_H) {
|
||||
hide = !hide;
|
||||
} else if (key == Input.KEY_N) {
|
||||
menu = !menu;
|
||||
if (menu && speed != 0) {
|
||||
optionsOverlay.show();
|
||||
if (speed != 0) {
|
||||
MusicController.pause();
|
||||
} else if (!menu && speed != 0) {
|
||||
MusicController.resume();
|
||||
}
|
||||
} else if (key == Input.KEY_J && index > 0) {
|
||||
index--;
|
||||
@@ -214,6 +141,11 @@ public class SBOverlay implements OptionsOverlay.Parent {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onKeyReleased(int key, char c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void goBackOneSBIndex() {
|
||||
if (index + 1 < optionsMap.length) {
|
||||
// new options on previous index, so to revert then we have to reload them all to this point..
|
||||
@@ -252,20 +184,13 @@ public class SBOverlay implements OptionsOverlay.Parent {
|
||||
this.gameObjects = gameObjects;
|
||||
}
|
||||
|
||||
public boolean mousePressed(int button, int x, int y) {
|
||||
msb.mousePressed(x, y);
|
||||
if (!menu) {
|
||||
return false;
|
||||
}
|
||||
overlay.mousePressed(button, x, y);
|
||||
@Override
|
||||
public boolean onMousePressed(int button, int x, int y) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean mouseDragged(int oldx, int oldy, int newx, int newy) {
|
||||
if (!menu) {
|
||||
return false;
|
||||
}
|
||||
overlay.mouseDragged(oldx, oldy, newx, newy);
|
||||
@Override
|
||||
public boolean onMouseDragged(int oldx, int oldy, int newx, int newy) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -293,12 +218,8 @@ public class SBOverlay implements OptionsOverlay.Parent {
|
||||
this.index--;
|
||||
}
|
||||
|
||||
public boolean mouseReleased(int button, int x, int y) {
|
||||
if (menu) {
|
||||
overlay.mouseReleased(button, x, y);
|
||||
return true;
|
||||
}
|
||||
msb.mouseReleased(x, y);
|
||||
@Override
|
||||
public boolean onMouseReleased(int button, int x, int y) {
|
||||
if (x > 10 || index >= optionsMap.length || optionsMap[index] == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -318,15 +239,12 @@ public class SBOverlay implements OptionsOverlay.Parent {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean mouseWheelMoved(int delta) {
|
||||
if (!menu) {
|
||||
return false;
|
||||
}
|
||||
overlay.mouseWheelMoved(delta);
|
||||
@Override
|
||||
public boolean onMouseWheelMoved(int delta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void enter() {
|
||||
public void onEnter() {
|
||||
// enter, save current settings
|
||||
for (Options.GameOption o : optionList) {
|
||||
initialOptions.put(o, o.write());
|
||||
@@ -334,7 +252,7 @@ public class SBOverlay implements OptionsOverlay.Parent {
|
||||
speed = 10;
|
||||
}
|
||||
|
||||
public void leave() {
|
||||
public void onLeave() {
|
||||
// leave, revert the settings saved before entering
|
||||
for (Options.GameOption o : optionList) {
|
||||
if (initialOptions.containsKey(o)) {
|
||||
@@ -358,13 +276,8 @@ public class SBOverlay implements OptionsOverlay.Parent {
|
||||
}
|
||||
}
|
||||
|
||||
public float[] getPoint(int trackPosition) {
|
||||
return msb.getPoint(trackPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeave() {
|
||||
menu = false;
|
||||
public void onLeaveOptionsMenu() {
|
||||
if (speed != 0) {
|
||||
MusicController.resume();
|
||||
}
|
||||
Reference in New Issue
Block a user