Skip to content

Use input method depending on chart keymode #705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions src/bms/player/beatoraja/PlayerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public class PlayerConfig {

static final Path configpath_old = Paths.get("config.json");
static final Path configpath = Paths.get("config_player.json");
static final Path configpath = Paths.get("config_player.json");

private String id;
/**
Expand Down Expand Up @@ -57,7 +57,7 @@ public class PlayerConfig {
* スコアターゲット
*/
private String targetid = "MAX";

private String[] targetlist = new String[] {"RATE_A-","RATE_A", "RATE_A+","RATE_AA-","RATE_AA", "RATE_AA+", "RATE_AAA-", "RATE_AAA", "RATE_AAA+", "MAX"
,"RANK_NEXT", "IR_NEXT_1", "IR_NEXT_2", "IR_NEXT_3", "IR_NEXT_4", "IR_NEXT_5", "IR_NEXT_10"
, "IR_RANK_1", "IR_RANK_5", "IR_RANK_10", "IR_RANK_20", "IR_RANK_30", "IR_RANK_40", "IR_RANK_50"
Expand All @@ -66,10 +66,10 @@ public class PlayerConfig {
* 判定タイミング
*/
private int judgetiming = 0;

public static final int JUDGETIMING_MAX = 500;
public static final int JUDGETIMING_MIN = -500;

private boolean notesDisplayTimingAutoAdjust = false;

/**
Expand Down Expand Up @@ -172,7 +172,7 @@ public class PlayerConfig {
* Window Hold
*/
private boolean isWindowHold = false;

/**
* Enable folder random select bar
*/
Expand Down Expand Up @@ -202,7 +202,7 @@ public class PlayerConfig {
* 通過ノートを表示するかどうか
*/
private boolean showpastnote = false;

/**
* 選択中の選曲時ソート
*/
Expand All @@ -211,10 +211,10 @@ public class PlayerConfig {
/**
* 選曲時でのキー入力方式
*/
private int musicselectinput = 0;
private MusicSelectKeyProperty musicSelectInputOption = MusicSelectKeyProperty.BEAT_7K;

private IRConfig[] irconfig;

private String twitterConsumerKey;

private String twitterConsumerSecret;
Expand Down Expand Up @@ -477,7 +477,7 @@ public void setMode(Mode m) {
public Mode getMode() {
return mode;
}

public int getSort() {
return this.sort ;
}
Expand All @@ -486,12 +486,12 @@ public void setSort(int sort) {
this.sort = sort;
}

public int getMusicselectinput() {
return musicselectinput;
public MusicSelectKeyProperty getMusicSelectInputOption() {
return musicSelectInputOption;
}

public void setMusicselectinput(int musicselectinput) {
this.musicselectinput = musicselectinput;
public void nextMusicSelectInputOption() {
this.musicSelectInputOption = this.musicSelectInputOption.nextValue();
}

public SkinConfig[] getSkin() {
Expand Down Expand Up @@ -652,11 +652,11 @@ public boolean isWindowHold() {
public void setWindowHold(boolean isWindowHold) {
this.isWindowHold = isWindowHold;
}

public boolean isRandomSelect() {
return isRandomSelect;
}

public void setRandomSelect(boolean isRandomSelect) {
this.isRandomSelect = isRandomSelect;
}
Expand Down Expand Up @@ -724,7 +724,7 @@ public String getTwitterAccessTokenSecret() {
public void setTwitterAccessTokenSecret(String twitterAccessTokenSecret) {
this.twitterAccessTokenSecret = twitterAccessTokenSecret;
}

// --Stream
public boolean getRequestEnable() {
return enableRequest;
Expand Down Expand Up @@ -796,7 +796,7 @@ public void validate() {
mode9.validate(9);
mode24.validate(26);
mode24double.validate(52);

sort = MathUtils.clamp(sort, 0 , BarSorter.values().length - 1);

gauge = MathUtils.clamp(gauge, 0, 5);
Expand All @@ -815,7 +815,7 @@ public void validate() {
scratchJudgeWindowRateGreat = MathUtils.clamp(scratchJudgeWindowRateGreat, 0, 400);
scratchJudgeWindowRateGood = MathUtils.clamp(scratchJudgeWindowRateGood, 0, 400);
hranThresholdBPM = MathUtils.clamp(hranThresholdBPM, 1, 1000);

if(autosavereplay == null) {
autosavereplay = config.autosavereplay != null ? config.autosavereplay.clone() : new int[4];
}
Expand All @@ -842,15 +842,15 @@ public void validate() {
irconfig[i].setIrname(irnames[i]);
}
}

for(int i = 0;i < irconfig.length;i++) {
if(irconfig[i] == null || irconfig[i].getIrname() == null) {
continue;
}
for(int j = i + 1;j < irconfig.length;j++) {
if(irconfig[j] != null && irconfig[i].getIrname().equals(irconfig[j].getIrname())) {
irconfig[j].setIrname(null);
}
}
}
}
irconfig = Validatable.removeInvalidElements(irconfig);
Expand Down Expand Up @@ -940,7 +940,7 @@ public static PlayerConfig readPlayerConfig(String playerpath, String playerid)
}
} catch(Throwable e) {
e.printStackTrace();
}
}
} else if(Files.exists(path_old)) {
try (FileReader reader = new FileReader(path_old.toFile())) {
Json json = new Json();
Expand Down Expand Up @@ -983,7 +983,7 @@ public int getScrollMode() {
public void setScrollMode(int scrollMode) {
this.scrollMode = scrollMode;
}

public int getScrollSection() {
return scrollSection;
}
Expand Down
38 changes: 28 additions & 10 deletions src/bms/player/beatoraja/config/KeyConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class KeyConfiguration extends MainState {
{ "1 KEY", "2 KEY", "3 KEY", "4 KEY", "5 KEY", "6 KEY", "7 KEY", "F-SCR", "R-SCR", "START", "SELECT" },
{ "1 KEY", "2 KEY", "3 KEY", "4 KEY", "5 KEY", "6 KEY", "7 KEY", "8 KEY", "9 KEY", "START", "SELECT" },
{ "1P-1 KEY", "1P-2 KEY", "1P-3 KEY", "1P-4 KEY", "1P-5 KEY", "1P-F-SCR",
"1P-R-SCR", "2P-1 KEY", "2P-2 KEY", "2P-3 KEY", "2P-4 KEY", "2P-5 KEY",
"1P-R-SCR", "2P-1 KEY", "2P-2 KEY", "2P-3 KEY", "2P-4 KEY", "2P-5 KEY",
"2P-F-SCR", "2P-R-SCR", "START", "SELECT" },
{ "1P-1 KEY", "1P-2 KEY", "1P-3 KEY", "1P-4 KEY", "1P-5 KEY", "1P-6 KEY", "1P-7 KEY", "1P-F-SCR",
"1P-R-SCR", "2P-1 KEY", "2P-2 KEY", "2P-3 KEY", "2P-4 KEY", "2P-5 KEY", "2P-6 KEY", "2P-7 KEY",
Expand All @@ -71,8 +71,6 @@ public class KeyConfiguration extends MainState {
-2 } };
private static final int playerOffset = 100;

private static final String[] SELECTKEY = { "2dx sp", "popn", "2dx dp" };

private int cursorpos = 0;
private int scrollpos = 0;
private boolean keyinput = false;
Expand Down Expand Up @@ -112,6 +110,8 @@ public void create() {
titlefont = generator.generateFont(parameter);
shape = new ShapeRenderer();

config = main.getPlayerResource().getPlayerConfig();
reinitializeInputConfigs();
input = main.getInputProcessor();
keyboard = input.getKeyBoardInputProcesseor();
controllers = input.getBMInputProcessor();
Expand Down Expand Up @@ -171,9 +171,10 @@ public void render() {
cursorpos = (cursorpos + 1) % keys.length;
}
if (input.isControlKeyPressed(ControlKeys.NUM1)) {
config.setMusicselectinput((config.getMusicselectinput() + 1) % 3);
config.nextMusicSelectInputOption();
reinitializeInputConfigs();
}
// change contronnler device 1
// change controller device 1
if (input.isControlKeyPressed(ControlKeys.NUM2)) {
if (controllers.length > 0) {
int index = 0;
Expand All @@ -183,11 +184,11 @@ public void render() {
}
}
pc.getController()[0]
.setName(controllers[(index + 1) % controllers.length].getName());
.setName(controllers[(index + 1) % controllers.length].getName());
pc.setController(pc.getController());
}
}
// change contronnler device 2
// change controller device 2
if (input.isControlKeyPressed(ControlKeys.NUM3)) {
if (controllers.length > 0 && pc.getController().length > 1) {
int index = 0;
Expand Down Expand Up @@ -257,7 +258,7 @@ public void render() {
titlefont.draw(sprite, "MIDI", 630 * scaleX, 620 * scaleY);
titlefont.setColor(Color.ORANGE);
titlefont.draw(sprite, "Music Select (press [1] to change) : ", 750 * scaleX, 620 * scaleY);
titlefont.draw(sprite, SELECTKEY[config.getMusicselectinput()], 780 * scaleX, 590 * scaleY);
titlefont.draw(sprite, config.getMusicSelectInputOption().toString(), 780 * scaleX, 590 * scaleY);

titlefont.draw(sprite, "Controller Device 1 (press [2] to change) : ", 750 * scaleX, 500 * scaleY);
titlefont.draw(sprite, pc.getController()[0].getName(), 780 * scaleX, 470 * scaleY);
Expand Down Expand Up @@ -292,7 +293,7 @@ public void render() {
sprite.begin();
titlefont.setColor(Color.WHITE);
titlefont.draw(sprite, keys[i], 50 * scaleX, (y + 22) * scaleY);
titlefont.draw(sprite, getMouseScratchKeyString(keysa[i], getKeyboardKeyAssign(keysa[i]) != -1 ?
titlefont.draw(sprite, getMouseScratchKeyString(keysa[i], getKeyboardKeyAssign(keysa[i]) != -1 ?
Keys.toString(getKeyboardKeyAssign(keysa[i])) : "----"), 202 * scaleX, (y + 22) * scaleY);
titlefont.draw(sprite, getControllerKeyAssign(0, keysa[i]) != -1
? BMControllerInputProcessor.BMKeys.toString(getControllerKeyAssign(0, keysa[i])) : "----",
Expand All @@ -309,9 +310,26 @@ public void render() {
}
}

private void reinitializeInputConfigs() {
BMSPlayerInputProcessor input = main.getInputProcessor();
PlayModeConfig playModeConfig;
switch (config.getMusicSelectInputOption()) {
case POPN_9K:
playModeConfig = config.getMode9();
break;
case BEAT_14K:
playModeConfig = config.getMode14();
break;
case BEAT_7K:
default:
playModeConfig = config.getMode7();
break;
}
input.setAllInputConfigs(playModeConfig);
}

private void setMode(int mode) {
this.mode = mode;
config = main.getPlayerResource().getPlayerConfig();
pc = config.getPlayConfig(MODE_HINT[mode]);
keyboardConfig = pc.getKeyboardConfig();
controllerConfigs = pc.getController();
Expand Down
Loading