修复“迷你模式”下名字/数字不能正确显示的问题

main
lensfrex 3 years ago
parent d884edbe11
commit 5df2f9c7f6
Signed by: lensfrex
GPG Key ID: 947ADABD8533C476
  1. 21
      Dogename/src/main/java/me/lensferno/dogename/DataReleaser.java
  2. 6
      Dogename/src/main/java/me/lensferno/dogename/Main.java
  3. 2
      Dogename/src/main/java/me/lensferno/dogename/controllers/MainInterfaceController.java
  4. 21
      Dogename/src/main/java/me/lensferno/dogename/controllers/MiniPaneController.java
  5. 10
      Dogename/src/main/java/me/lensferno/dogename/controllers/ProgramInfoPaneController.java
  6. 5
      Dogename/src/main/java/me/lensferno/dogename/resources/MainInterfaceImage.java
  7. 5
      Dogename/src/main/java/me/lensferno/dogename/resources/dogename.java
  8. 8
      Dogename/src/main/java/me/lensferno/dogename/select/Selector.java
  9. 4
      Dogename/src/main/java/me/lensferno/dogename/select/core/Worker.java
  10. BIN
      Dogename/src/main/resources/images/banner.png
  11. BIN
      Dogename/src/main/resources/images/doge.png

@ -1,21 +0,0 @@
package me.lensferno.dogename;
import me.lensferno.dogename.resources.MainInterfaceImage;
import me.lensferno.dogename.resources.dogename;
import org.apache.commons.codec.binary.Base64;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
public class DataReleaser {
public static InputStream getDogenameStream(){
return new ByteArrayInputStream(Base64.decodeBase64(dogename.data));
}
public static InputStream getMainPicStream(){
return new ByteArrayInputStream(Base64.decodeBase64(MainInterfaceImage.data));
}
}

@ -65,7 +65,11 @@ public class Main extends Application {
mainInterfaceController.bindProperties();
mainInterfaceController.setImg(DataReleaser.getMainPicStream());
try {
mainInterfaceController.setImg(getClass().getResourceAsStream("/images/doge.png"));
} catch (Exception e) {
e.printStackTrace();
}
mainInterfaceController.init();

@ -151,7 +151,7 @@ public final class MainInterfaceController {
miniPaneController.setBase(data, mainConfig, selector);
Stage currentStage=(Stage)anPaiBtn.getScene().getWindow();
miniPaneController.setForwStage(currentStage);
miniPaneController.setOldStage(currentStage);
miniPaneController.setCurrentStage(miniStage);
miniPaneController.setCurrentScene(miniScene);

@ -1,6 +1,7 @@
package me.lensferno.dogename.controllers;
import com.jfoenix.controls.JFXButton;
import javafx.beans.property.StringProperty;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
@ -28,14 +29,14 @@ public class MiniPaneController {
@FXML
private JFXButton miniModeBtn;
Stage forwStage;
Stage oldStage;
public Stage getForwStage() {
return forwStage;
public Stage getOldStage() {
return oldStage;
}
public void setForwStage(Stage forwStage) {
this.forwStage = forwStage;
public void setOldStage(Stage oldStage) {
this.oldStage = oldStage;
}
private Random random = new Random();
@ -52,15 +53,23 @@ public class MiniPaneController {
this.currentStage = currentStage;
}
StringProperty[] oldTextProperties = null;
public void setBase(Data data, MainConfig mainConfig, Selector selector) {
this.data = data;
this.mainConfig = mainConfig;
this.selector = selector;
this.selector.setLabelTexts(chosenNameLabel.textProperty());
this.oldTextProperties = oldTextProperties;
}
@FXML
void recoverMode(ActionEvent event) {
this.forwStage.show();
this.oldStage.setOnShown((e) -> {
selector.setLabelTexts(oldTextProperties);
});
this.oldStage.show();
currentStage.close();
}

@ -12,7 +12,6 @@ import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import me.lensferno.dogename.DataReleaser;
import me.lensferno.dogename.utils.DialogMaker;
import me.lensferno.dogename.utils.IOUtil;
@ -38,8 +37,13 @@ public class ProgramInfoPaneController extends VBox {
}catch(Exception e){
e.printStackTrace();
}
Image dogeImage=new Image(DataReleaser.getDogenameStream());
dogeView.setImage(dogeImage);
try {
dogeView.setImage(new Image(getClass().getResourceAsStream("/images/banner.png")));
} catch (Exception e) {
e.printStackTrace();
}
this.rootPane=rootPane;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -55,6 +55,10 @@ public final class Selector {
processor.stoppedIndicatorProperty().addListener(listener);
}
public void setLabelTexts(StringProperty... labelTexts) {
processor.setWorkerLabelTexts(labelTexts);
}
// ---------------------------------------------------
static class Processor extends AnimationTimer {
@ -67,6 +71,10 @@ public final class Selector {
this.config = config;
}
protected void setWorkerLabelTexts(StringProperty... labelTexts) {
coreWorker.setLabelTexts(labelTexts);
}
protected void updateNewValue() {
coreWorker.setSpeed(100 - config.getSpeed());
coreWorker.setMaxTotalCount(config.getMaxTotalCount());

@ -60,6 +60,10 @@ public final class Worker {
this.voicePlayer = voicePlayer;
}
public void setLabelTexts(StringProperty[] labelTexts) {
this.labelTexts = labelTexts;
}
private void select() {
// try的位置待定(前面or后面)
// 延时用,用于调整挑选速度

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Loading…
Cancel
Save