Add options in the ingame menu
This commit is contained in:
parent
130ee94825
commit
728b2ceb97
|
@ -54,6 +54,8 @@ import org.newdawn.slick.util.ResourceLoader;
|
||||||
import com.sun.jna.platform.win32.Advapi32Util;
|
import com.sun.jna.platform.win32.Advapi32Util;
|
||||||
import com.sun.jna.platform.win32.Win32Exception;
|
import com.sun.jna.platform.win32.Win32Exception;
|
||||||
import com.sun.jna.platform.win32.WinReg;
|
import com.sun.jna.platform.win32.WinReg;
|
||||||
|
import yugecin.opsudance.Dancer;
|
||||||
|
import yugecin.opsudance.movers.factories.AutoMoverFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles all user options.
|
* Handles all user options.
|
||||||
|
@ -538,9 +540,95 @@ public class Options {
|
||||||
ENABLE_WATCH_SERVICE ("Enable Watch Service", "WatchService", "Watch the beatmap directory for changes. Requires a restart.", false),
|
ENABLE_WATCH_SERVICE ("Enable Watch Service", "WatchService", "Watch the beatmap directory for changes. Requires a restart.", false),
|
||||||
|
|
||||||
DANCE_MOVER ("Mover algorithm", "Mover", "Algorithm that decides how to move from note to note" ) {
|
DANCE_MOVER ("Mover algorithm", "Mover", "Algorithm that decides how to move from note to note" ) {
|
||||||
|
@Override
|
||||||
|
public Object[] getListItems() {
|
||||||
|
return Dancer.moverFactories;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clickListItem(int index) {
|
||||||
|
Dancer.instance.setMoverFactoryIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValueString() {
|
||||||
|
return Dancer.moverFactories[Dancer.instance.getMoverFactoryIndex()].toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String write() {
|
||||||
|
return Dancer.instance.getMoverFactoryIndex() + "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(String s) {
|
||||||
|
Dancer.instance.setMoverFactoryIndex(Integer.parseInt(s));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
DANCE_SPINNER ("Spinner", "Spinner", "Spinner style") {
|
||||||
|
@Override
|
||||||
|
public Object[] getListItems() {
|
||||||
|
return Dancer.spinners;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clickListItem(int index) {
|
||||||
|
Dancer.instance.setSpinnerIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValueString() {
|
||||||
|
return Dancer.spinners[Dancer.instance.getSpinnerIndex()].toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String write() {
|
||||||
|
return Dancer.instance.getSpinnerIndex() + "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(String s) {
|
||||||
|
Dancer.instance.setSpinnerIndex(Integer.parseInt(s));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
DANCE_LAZY_SLIDERS ("Lazy sliders", "LazySliders", "Don't do short sliders", true) {
|
||||||
|
@Override
|
||||||
|
public void click(GameContainer container) {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
DANCE_ONLY_CIRCLE_STACKS ("Only circle stacks", "CircleStacks", "Only do circle movement on stacks", true) {
|
||||||
|
@Override
|
||||||
|
public void click(GameContainer container) {
|
||||||
|
bool = !bool;
|
||||||
|
AutoMoverFactory.ONLY_CIRCLE_STACKS = bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(String s) {
|
||||||
|
super.read(s);
|
||||||
|
AutoMoverFactory.ONLY_CIRCLE_STACKS = bool;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
DANCE_CIRCLE_STREAMS ("Circle streams", "CircleStreams", "Make circles while streaming", false) {
|
||||||
|
@Override
|
||||||
|
public void click(GameContainer container) {
|
||||||
|
bool = !bool;
|
||||||
|
AutoMoverFactory.CIRCLE_STREAM = bool ? 58 : 85;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(String s) {
|
||||||
|
super.read(s);
|
||||||
|
AutoMoverFactory.CIRCLE_STREAM = bool ? 58 : 85;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** Option name. */
|
/** Option name. */
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
|
@ -690,7 +778,7 @@ public class Options {
|
||||||
* Fired when an item in the value list has been clicked
|
* Fired when an item in the value list has been clicked
|
||||||
* @param index the itemindex which has been clicked
|
* @param index the itemindex which has been clicked
|
||||||
*/
|
*/
|
||||||
public void clickListItem(int index) { };
|
public void clickListItem(int index) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes a mouse drag action (via override).
|
* Processes a mouse drag action (via override).
|
||||||
|
|
|
@ -105,7 +105,11 @@ public class OptionsMenu extends BasicGameState {
|
||||||
GameOption.ENABLE_WATCH_SERVICE
|
GameOption.ENABLE_WATCH_SERVICE
|
||||||
}),
|
}),
|
||||||
DANCE ("Dance", new GameOption[] {
|
DANCE ("Dance", new GameOption[] {
|
||||||
GameOption.DANCE_MOVER
|
GameOption.DANCE_MOVER,
|
||||||
|
GameOption.DANCE_SPINNER,
|
||||||
|
GameOption.DANCE_LAZY_SLIDERS,
|
||||||
|
GameOption.DANCE_CIRCLE_STREAMS,
|
||||||
|
GameOption.DANCE_ONLY_CIRCLE_STACKS,
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Total number of tabs. */
|
/** Total number of tabs. */
|
||||||
|
|
|
@ -56,6 +56,9 @@ public class Dancer {
|
||||||
private Mover mover;
|
private Mover mover;
|
||||||
private Spinner spinner;
|
private Spinner spinner;
|
||||||
|
|
||||||
|
private int moverFactoryIndex;
|
||||||
|
private int spinnerIndex;
|
||||||
|
|
||||||
public float x;
|
public float x;
|
||||||
public float y;
|
public float y;
|
||||||
|
|
||||||
|
@ -73,6 +76,24 @@ public class Dancer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSpinnerIndex() {
|
||||||
|
return spinnerIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpinnerIndex(int spinnerIndex) {
|
||||||
|
this.spinnerIndex = spinnerIndex;
|
||||||
|
spinner = spinners[spinnerIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMoverFactoryIndex() {
|
||||||
|
return moverFactoryIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMoverFactoryIndex(int moverFactoryIndex) {
|
||||||
|
this.moverFactoryIndex = moverFactoryIndex;
|
||||||
|
moverFactory = moverFactories[moverFactoryIndex];
|
||||||
|
}
|
||||||
|
|
||||||
public void update(int time, GameObject p, GameObject c) {
|
public void update(int time, GameObject p, GameObject c) {
|
||||||
if (this.p != p) {
|
if (this.p != p) {
|
||||||
this.p = p;
|
this.p = p;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user