The launching button will disable while launching game.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -378,8 +378,12 @@ public class MainPagePanel extends javax.swing.JPanel {
|
|||||||
if (evt.getKeyCode() == KeyEvent.VK_ENTER) btnRunActionPerformed();
|
if (evt.getKeyCode() == KeyEvent.VK_ENTER) btnRunActionPerformed();
|
||||||
}//GEN-LAST:event_txtPasswordKeyPressed
|
}//GEN-LAST:event_txtPasswordKeyPressed
|
||||||
|
|
||||||
|
boolean isLaunching = false;
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Game Launch">
|
// <editor-fold defaultstate="collapsed" desc="Game Launch">
|
||||||
void genLaunchCode(final Consumer<GameLauncher> listener) {
|
void genLaunchCode(final Consumer<GameLauncher> listener) {
|
||||||
|
if (isLaunching) return;
|
||||||
|
isLaunching = true;
|
||||||
HMCLog.log("Start generating launching command...");
|
HMCLog.log("Start generating launching command...");
|
||||||
File file = getCurrentProfile().getCanonicalGameDirFile();
|
File file = getCurrentProfile().getCanonicalGameDirFile();
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
@@ -394,12 +398,12 @@ public class MainPagePanel extends javax.swing.JPanel {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cboLoginMode.getItemCount() == 0) {
|
final int index = cboLoginMode.getSelectedIndex();
|
||||||
|
if (index < 0 || index >= IAuthenticator.logins.size()) {
|
||||||
HMCLog.warn("There's no login method.");
|
HMCLog.warn("There's no login method.");
|
||||||
MessageBox.Show(C.i18n("login.methods.no_method"));
|
MessageBox.Show(C.i18n("login.methods.no_method"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final int index = cboLoginMode.getSelectedIndex();
|
|
||||||
final IAuthenticator l = IAuthenticator.logins.get(index);
|
final IAuthenticator l = IAuthenticator.logins.get(index);
|
||||||
final LoginInfo li = new LoginInfo(Settings.getInstance().getUsername(), l.isLoggedIn() || l.isHidePasswordBox() ? null : new String(txtPassword.getPassword()));
|
final LoginInfo li = new LoginInfo(Settings.getInstance().getUsername(), l.isLoggedIn() || l.isHidePasswordBox() ? null : new String(txtPassword.getPassword()));
|
||||||
Thread t = new Thread() {
|
Thread t = new Thread() {
|
||||||
@@ -410,6 +414,11 @@ public class MainPagePanel extends javax.swing.JPanel {
|
|||||||
gl.failEvent.register((sender, s) -> {
|
gl.failEvent.register((sender, s) -> {
|
||||||
if (s != null) MessageBox.Show(s);
|
if (s != null) MessageBox.Show(s);
|
||||||
MainFrame.instance.closeMessage();
|
MainFrame.instance.closeMessage();
|
||||||
|
isLaunching = false;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
gl.successEvent.register((sender, s) -> {
|
||||||
|
isLaunching = false;
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
listener.accept(gl);
|
listener.accept(gl);
|
||||||
@@ -431,9 +440,11 @@ public class MainPagePanel extends javax.swing.JPanel {
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
HMCLog.warn("Failed to get login name", ex);
|
HMCLog.warn("Failed to get login name", ex);
|
||||||
}
|
}
|
||||||
if (Settings.getInstance().getLoginType() < list.size()) {
|
int loginType = Settings.getInstance().getLoginType();
|
||||||
|
if (0 <= loginType && loginType < cboLoginMode.getItemCount()) {
|
||||||
preaparingAuth = false;
|
preaparingAuth = false;
|
||||||
cboLoginMode.setSelectedIndex(Settings.getInstance().getLoginType());
|
|
||||||
|
cboLoginMode.setSelectedIndex(loginType);
|
||||||
|
|
||||||
cboLoginModeItemStateChanged(null);
|
cboLoginModeItemStateChanged(null);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user