|
|
@ -1,55 +1,48 @@ |
|
|
|
package me.lensferno.dogename.configs; |
|
|
|
package me.lensferno.dogename.configs; |
|
|
|
|
|
|
|
|
|
|
|
import com.google.gson.annotations.Expose; |
|
|
|
import com.google.gson.annotations.Expose; |
|
|
|
import javafx.beans.property.*; |
|
|
|
import javafx.beans.property.SimpleBooleanProperty; |
|
|
|
|
|
|
|
import javafx.beans.property.SimpleIntegerProperty; |
|
|
|
|
|
|
|
import javafx.beans.property.SimpleStringProperty; |
|
|
|
|
|
|
|
|
|
|
|
public class MainConfig { |
|
|
|
public class MainConfig { |
|
|
|
|
|
|
|
|
|
|
|
// ---------------------- Default values ---------------------------------------------------------
|
|
|
|
// ---------------------- Default values ---------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
private final int currentVersion = 3; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Expose |
|
|
|
@Expose |
|
|
|
public static final boolean DEFAULT_NAME_CHOOSE = true; |
|
|
|
public static final boolean DEFAULT_NAME_CHOOSE = true; |
|
|
|
|
|
|
|
|
|
|
|
public static final int METHOD_NAME = 0; // 名字挑选法
|
|
|
|
public static final int METHOD_NAME = 0; // 名字挑选法
|
|
|
|
public static final int METHOD_NUMBER = 1; // 数字挑选法
|
|
|
|
public static final int METHOD_NUMBER = 1; // 数字挑选法
|
|
|
|
|
|
|
|
|
|
|
|
public static final int DEFAULT_MAX_TOTAL_COUNT = 120; // 默认轮回次数:120
|
|
|
|
public static final int DEFAULT_MAX_TOTAL_COUNT = 120; // 默认轮回次数:120
|
|
|
|
public static final int DEFAULT_SPEED = 80; // 默认速度:20ms,对应滑动条80的位置
|
|
|
|
public static final int DEFAULT_SPEED = 80; // 默认速度:20ms,对应滑动条80的位置
|
|
|
|
|
|
|
|
|
|
|
|
public static final boolean DEFAULT_RANDOM_TIMES = true; // 默认挑选轮回次数是否随机:ture
|
|
|
|
public static final boolean DEFAULT_RANDOM_TIMES = true; // 默认挑选轮回次数是否随机:ture
|
|
|
|
|
|
|
|
|
|
|
|
public static final boolean DEFAULT_IGNORE_PAST = true; // 默认忽略已经点过的名字:ture
|
|
|
|
public static final boolean DEFAULT_IGNORE_PAST = true; // 默认忽略已经点过的名字:ture
|
|
|
|
|
|
|
|
|
|
|
|
public static final boolean DEFAULT_EQUAL_MODE = true; // 默认开启"机会均等"
|
|
|
|
public static final boolean DEFAULT_EQUAL_MODE = true; // 默认开启"机会均等"
|
|
|
|
|
|
|
|
|
|
|
|
public static final boolean DEFAULT_NEW_ALGO = true; // 默认使用新算法"Java sec random"
|
|
|
|
public static final boolean DEFAULT_NEW_ALGO = true; // 默认使用新算法"Java sec random"
|
|
|
|
public static final boolean DEFAULT_VOICE_PLAY = true; // 默认使用语音播报
|
|
|
|
public static final boolean DEFAULT_VOICE_PLAY = true; // 默认使用语音播报
|
|
|
|
|
|
|
|
|
|
|
|
public static final boolean DEFAULT_SHOW_SAYING = true; |
|
|
|
public static final boolean DEFAULT_SHOW_SAYING = true; |
|
|
|
|
|
|
|
private final int currentVersion = 3; |
|
|
|
|
|
|
|
|
|
|
|
// ----------------------Properties----------------------------------------------------------------
|
|
|
|
// ----------------------Properties----------------------------------------------------------------
|
|
|
|
|
|
|
|
private final SimpleBooleanProperty nameChoose; |
|
|
|
|
|
|
|
|
|
|
|
private SimpleBooleanProperty nameChoose; |
|
|
|
private final SimpleBooleanProperty randomCount; // 挑选次数是否随机
|
|
|
|
|
|
|
|
private final SimpleBooleanProperty passSelectedResult; // 是否忽略已经被点过的名字/数字
|
|
|
|
private SimpleBooleanProperty randomCount; // 挑选次数是否随机
|
|
|
|
|
|
|
|
private SimpleBooleanProperty passSelectedResult; // 是否忽略已经被点过的名字/数字
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private SimpleIntegerProperty chooseMethod; // 挑选方式: 0->名字挑选法 1->数字挑选法
|
|
|
|
private final SimpleIntegerProperty chooseMethod; // 挑选方式: 0->名字挑选法 1->数字挑选法
|
|
|
|
private SimpleIntegerProperty maxTotalCount; // 挑选轮回次数
|
|
|
|
private final SimpleIntegerProperty maxTotalCount; // 挑选轮回次数
|
|
|
|
|
|
|
|
|
|
|
|
private SimpleIntegerProperty speed; // 速度
|
|
|
|
private final SimpleIntegerProperty speed; // 速度
|
|
|
|
|
|
|
|
|
|
|
|
private SimpleStringProperty minNumber; // 最小值
|
|
|
|
private final SimpleStringProperty minNumber; // 最小值
|
|
|
|
private SimpleStringProperty maxNumber; // 最大值
|
|
|
|
private final SimpleStringProperty maxNumber; // 最大值
|
|
|
|
|
|
|
|
|
|
|
|
private SimpleBooleanProperty equalMode; // 是否开启"机会均等"
|
|
|
|
private final SimpleBooleanProperty equalMode; // 是否开启"机会均等"
|
|
|
|
|
|
|
|
|
|
|
|
private SimpleBooleanProperty secureRandom; // 是否使用secure random
|
|
|
|
private final SimpleBooleanProperty secureRandom; // 是否使用secure random
|
|
|
|
private SimpleBooleanProperty voicePlay; // 是否使用语音播报
|
|
|
|
private final SimpleBooleanProperty voicePlay; // 是否使用语音播报
|
|
|
|
|
|
|
|
|
|
|
|
private SimpleBooleanProperty showSaying; |
|
|
|
private final SimpleBooleanProperty showSaying; |
|
|
|
|
|
|
|
|
|
|
|
// -------------------------- 初始化 --------------------------------------------------------------
|
|
|
|
// -------------------------- 初始化 --------------------------------------------------------------
|
|
|
|
public MainConfig() { |
|
|
|
public MainConfig() { |
|
|
@ -80,146 +73,146 @@ public class MainConfig { |
|
|
|
return nameChoose.get(); |
|
|
|
return nameChoose.get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public SimpleBooleanProperty nameChooseProperty() { |
|
|
|
|
|
|
|
return nameChoose; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setNameChoose(boolean nameChoose) { |
|
|
|
public void setNameChoose(boolean nameChoose) { |
|
|
|
this.nameChoose.set(nameChoose); |
|
|
|
this.nameChoose.set(nameChoose); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean getRandomCount() { |
|
|
|
public SimpleBooleanProperty nameChooseProperty() { |
|
|
|
return randomCount.get(); |
|
|
|
return nameChoose; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public SimpleBooleanProperty randomCountProperty() { |
|
|
|
public boolean getRandomCount() { |
|
|
|
return randomCount; |
|
|
|
return randomCount.get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setRandomCount(boolean randomCount) { |
|
|
|
public void setRandomCount(boolean randomCount) { |
|
|
|
this.randomCount.set(randomCount); |
|
|
|
this.randomCount.set(randomCount); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean getPassSelectedResult() { |
|
|
|
public SimpleBooleanProperty randomCountProperty() { |
|
|
|
return passSelectedResult.get(); |
|
|
|
return randomCount; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public SimpleBooleanProperty passSelectedResultProperty() { |
|
|
|
public boolean getPassSelectedResult() { |
|
|
|
return passSelectedResult; |
|
|
|
return passSelectedResult.get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setPassSelectedResult(boolean passSelectedResult) { |
|
|
|
public void setPassSelectedResult(boolean passSelectedResult) { |
|
|
|
this.passSelectedResult.set(passSelectedResult); |
|
|
|
this.passSelectedResult.set(passSelectedResult); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int getChooseMethod() { |
|
|
|
public SimpleBooleanProperty passSelectedResultProperty() { |
|
|
|
return chooseMethod.get(); |
|
|
|
return passSelectedResult; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public SimpleIntegerProperty chooseMethodProperty() { |
|
|
|
public int getChooseMethod() { |
|
|
|
return chooseMethod; |
|
|
|
return chooseMethod.get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setChooseMethod(int chooseMethod) { |
|
|
|
public void setChooseMethod(int chooseMethod) { |
|
|
|
this.chooseMethod.set(chooseMethod); |
|
|
|
this.chooseMethod.set(chooseMethod); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int getMaxTotalCount() { |
|
|
|
public SimpleIntegerProperty chooseMethodProperty() { |
|
|
|
return maxTotalCount.get(); |
|
|
|
return chooseMethod; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public SimpleIntegerProperty maxTotalCountProperty() { |
|
|
|
public int getMaxTotalCount() { |
|
|
|
return maxTotalCount; |
|
|
|
return maxTotalCount.get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setMaxTotalCount(int maxTotalCount) { |
|
|
|
public void setMaxTotalCount(int maxTotalCount) { |
|
|
|
this.maxTotalCount.set(maxTotalCount); |
|
|
|
this.maxTotalCount.set(maxTotalCount); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int getSpeed() { |
|
|
|
public SimpleIntegerProperty maxTotalCountProperty() { |
|
|
|
return speed.get(); |
|
|
|
return maxTotalCount; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public SimpleIntegerProperty speedProperty() { |
|
|
|
public int getSpeed() { |
|
|
|
return speed; |
|
|
|
return speed.get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setSpeed(int speed) { |
|
|
|
public void setSpeed(int speed) { |
|
|
|
this.speed.set(speed); |
|
|
|
this.speed.set(speed); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String getMinNumber() { |
|
|
|
public SimpleIntegerProperty speedProperty() { |
|
|
|
return minNumber.get(); |
|
|
|
return speed; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public SimpleStringProperty minNumberProperty() { |
|
|
|
public String getMinNumber() { |
|
|
|
return minNumber; |
|
|
|
return minNumber.get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setMinNumber(String minNumber) { |
|
|
|
public void setMinNumber(String minNumber) { |
|
|
|
this.minNumber.set(minNumber); |
|
|
|
this.minNumber.set(minNumber); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String getMaxNumber() { |
|
|
|
public SimpleStringProperty minNumberProperty() { |
|
|
|
return maxNumber.get(); |
|
|
|
return minNumber; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public SimpleStringProperty maxNumberProperty() { |
|
|
|
public String getMaxNumber() { |
|
|
|
return maxNumber; |
|
|
|
return maxNumber.get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setMaxNumber(String maxNumber) { |
|
|
|
public void setMaxNumber(String maxNumber) { |
|
|
|
this.maxNumber.set(maxNumber); |
|
|
|
this.maxNumber.set(maxNumber); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean getEqualMode() { |
|
|
|
public SimpleStringProperty maxNumberProperty() { |
|
|
|
return equalMode.get(); |
|
|
|
return maxNumber; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public SimpleBooleanProperty equalModeProperty() { |
|
|
|
public boolean getEqualMode() { |
|
|
|
return equalMode; |
|
|
|
return equalMode.get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setEqualMode(boolean equalMode) { |
|
|
|
public void setEqualMode(boolean equalMode) { |
|
|
|
this.equalMode.set(equalMode); |
|
|
|
this.equalMode.set(equalMode); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean getSecureRandom() { |
|
|
|
public SimpleBooleanProperty equalModeProperty() { |
|
|
|
return secureRandom.get(); |
|
|
|
return equalMode; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public SimpleBooleanProperty secureRandomProperty() { |
|
|
|
public boolean getSecureRandom() { |
|
|
|
return secureRandom; |
|
|
|
return secureRandom.get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setSecureRandom(boolean secureRandom) { |
|
|
|
public void setSecureRandom(boolean secureRandom) { |
|
|
|
this.secureRandom.set(secureRandom); |
|
|
|
this.secureRandom.set(secureRandom); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean getVoicePlay() { |
|
|
|
public SimpleBooleanProperty secureRandomProperty() { |
|
|
|
return voicePlay.get(); |
|
|
|
return secureRandom; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public SimpleBooleanProperty voicePlayProperty() { |
|
|
|
public boolean getVoicePlay() { |
|
|
|
return voicePlay; |
|
|
|
return voicePlay.get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setVoicePlay(boolean voicePlay) { |
|
|
|
public void setVoicePlay(boolean voicePlay) { |
|
|
|
this.voicePlay.set(voicePlay); |
|
|
|
this.voicePlay.set(voicePlay); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isShowSaying() { |
|
|
|
public SimpleBooleanProperty voicePlayProperty() { |
|
|
|
return showSaying.get(); |
|
|
|
return voicePlay; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public SimpleBooleanProperty showSayingProperty() { |
|
|
|
public boolean isShowSaying() { |
|
|
|
return showSaying; |
|
|
|
return showSaying.get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setShowSaying(boolean showSaying) { |
|
|
|
public void setShowSaying(boolean showSaying) { |
|
|
|
this.showSaying.set(showSaying); |
|
|
|
this.showSaying.set(showSaying); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public SimpleBooleanProperty showSayingProperty() { |
|
|
|
|
|
|
|
return showSaying; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int getCurrentConfigVersion() { |
|
|
|
public int getCurrentConfigVersion() { |
|
|
|
return currentVersion; |
|
|
|
return currentVersion; |
|
|
|
} |
|
|
|
} |
|
|
|