OSDN Git Service

chore: increment Version to v1.3.6
[delesterandomselector/DelesteRandomSelector.git] / src / com / ranfa / main / DelesteRandomSelector.java
index cdda4af..9d4b605 100644 (file)
@@ -38,7 +38,7 @@ import com.ranfa.lib.Song;
 import com.ranfa.lib.TwitterIntegration;
 import com.ranfa.lib.Version;
 
-@Version(major = 1, minor = 3, patch = 3)
+@Version(major = 1, minor = 3, patch = 6)
 public class DelesteRandomSelector extends JFrame {
 
        private static ArrayList<Song> selectedSongsList = new ArrayList<Song>();
@@ -67,6 +67,7 @@ public class DelesteRandomSelector extends JFrame {
        private boolean integratorBool = false;
        private JTextArea textArea;
        private JScrollPane scrollPane;
+       private CompletableFuture<Void> softwareUpdateFuture = null;
 
        /**
         * Launch the application.
@@ -125,7 +126,7 @@ public class DelesteRandomSelector extends JFrame {
                                + "\nSaveScoreLog: " + property.isSaveScoreLog()
                                + "\nOutputDebugSentences: " + property.isOutputDebugSentences());
                if(property.isCheckVersion()) {
-                       CompletableFuture<Void> softwareUpdateFuture = CompletableFuture.runAsync(() -> CheckVersion.needToBeUpdated(), es);
+                       softwareUpdateFuture = CompletableFuture.runAsync(() -> CheckVersion.needToBeUpdated(), es);
                }
                BiConsumer<ArrayList<Song>, ArrayList<Song>> updateConsumer = (list1, list2) -> {
                        LimitedLog.println(this.getClass() + ":[INFO]: " + "Checking database updates...");
@@ -281,18 +282,14 @@ public class DelesteRandomSelector extends JFrame {
                btnStart.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                                Random random = new Random(System.currentTimeMillis());
-                               String[] tmp = new String[property.getSongLimit()];
+                               String paneString = "";
                                integratorArray = new String[property.getSongLimit()];
                                for(int i = 0; i < property.getSongLimit(); i++) {
                                        int randomInt = random.nextInt(selectedSongsList.size());
-                                       tmp[i] = (i + 1) + "曲目: " + selectedSongsList.get(randomInt).getAttribute() + " [" + selectedSongsList.get(randomInt).getDifficulty() + "]「" + selectedSongsList.get(randomInt).getName() + "」!(Lv:" + selectedSongsList.get(randomInt).getLevel() + ")\n\n";
+                                       paneString = paneString + (i + 1) + "曲目: " + selectedSongsList.get(randomInt).getAttribute() + " [" + selectedSongsList.get(randomInt).getDifficulty() + "]「" + selectedSongsList.get(randomInt).getName() + "」!(Lv:" + selectedSongsList.get(randomInt).getLevel() + ")\n\n";
                                        integratorArray[i] = selectedSongsList.get(randomInt).getName() + "(Lv" + selectedSongsList.get(randomInt).getLevel() + ")\n";
                                }
-                               String paneString = "";
-                               for (int i = 0; i < tmp.length; i++) {
-                                       paneString = paneString + tmp[i];
-                               }
-                               paneString = paneString + "この" + tmp.length + "曲をプレイしましょう!!!";
+                               paneString = paneString + "この" + property.getSongLimit() + "曲をプレイしましょう!!!";
                                textArea.setText(paneString);
                                integratorBool = true;
                                LimitedLog.println(this.getClass() + ":[INFO]: " + "show up completed.");
@@ -360,8 +357,12 @@ public class DelesteRandomSelector extends JFrame {
                                                                btnExit = new JButton("終了");
                                                                btnExit.addActionListener(new ActionListener() {
                                                                        public void actionPerformed(ActionEvent e) {
-                                                                               LimitedLog.println(this.getClass() + ":[INFO]: " +"Requested Exit by Button");
-                                                                               System.exit(0);
+                                                                               if(softwareUpdateFuture.isDone()) {
+                                                                                       LimitedLog.println(this.getClass() + ":[INFO]: " +"Requested Exit by Button");
+                                                                                       System.exit(0);
+                                                                               } else {
+                                                                                       JOptionPane.showMessageDialog(null, "内部更新処理が完了していません。少し待ってからやり直してください。");
+                                                                               }
                                                                        }
                                                                });
                                                                btnExit.setFont(new Font("UD デジタル 教科書体 NP-B", Font.BOLD, 13));