Add an option to disable animations
This commit is contained in:
@@ -162,7 +162,7 @@ public abstract class AbstractMinecraftLoader implements IMinecraftLoader {
|
||||
String serverIp = v.getServerIp();
|
||||
if (lr.getServerIp() != null) serverIp = lr.getServerIp();
|
||||
if (StrUtils.isNotBlank(serverIp)) {
|
||||
String[] args = v.getServerIp().split(":");
|
||||
String[] args = serverIp.split(":");
|
||||
res.add("--server");
|
||||
res.add(args[0]);
|
||||
res.add("--port");
|
||||
|
||||
@@ -38,6 +38,11 @@ public abstract class IMinecraftProvider {
|
||||
this.profile = profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* To download mod packs.
|
||||
*/
|
||||
public abstract void initializeMiencraft();
|
||||
|
||||
/**
|
||||
* Get the run directory of given version.
|
||||
*
|
||||
|
||||
@@ -43,6 +43,9 @@ public final class Config {
|
||||
private String proxyHost, proxyPort, proxyUserName, proxyPassword;
|
||||
@SerializedName("enableShadow")
|
||||
private boolean enableShadow;
|
||||
|
||||
@SerializedName("enableAnimation")
|
||||
private boolean enableAnimation;
|
||||
@SerializedName("theme")
|
||||
private int theme;
|
||||
@SerializedName("java")
|
||||
@@ -87,6 +90,14 @@ public final class Config {
|
||||
this.bgpath = bgpath;
|
||||
Settings.save();
|
||||
}
|
||||
public boolean isEnableAnimation() {
|
||||
return enableAnimation;
|
||||
}
|
||||
|
||||
public void setEnableAnimation(boolean enableAnimation) {
|
||||
this.enableAnimation = enableAnimation;
|
||||
Settings.save();
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
@@ -151,7 +162,7 @@ public final class Config {
|
||||
clientToken = UUID.randomUUID().toString();
|
||||
username = "";
|
||||
logintype = downloadtype = 0;
|
||||
enableShadow = false;
|
||||
enableShadow = false; enableAnimation = true;
|
||||
theme = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,8 +93,10 @@ public final class Profile {
|
||||
}
|
||||
|
||||
public IMinecraftProvider getMinecraftProvider() {
|
||||
if (minecraftProvider == null)
|
||||
if (minecraftProvider == null) {
|
||||
minecraftProvider = new MinecraftVersionManager(this);
|
||||
minecraftProvider.initializeMiencraft();
|
||||
}
|
||||
return minecraftProvider;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.zip.ZipFile;
|
||||
import org.jackhuang.hellominecraft.C;
|
||||
import org.jackhuang.hellominecraft.HMCLog;
|
||||
import org.jackhuang.hellominecraft.utils.StrUtils;
|
||||
import org.jackhuang.hellominecraft.utils.SwingUtils;
|
||||
import org.jackhuang.hellominecraft.views.SwingUtils;
|
||||
import org.jackhuang.hellominecraft.utils.system.FileUtils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package org.jackhuang.hellominecraft.launcher.version;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -27,6 +28,7 @@ import org.jackhuang.hellominecraft.HMCLog;
|
||||
import org.jackhuang.hellominecraft.launcher.launch.IMinecraftModService;
|
||||
import org.jackhuang.hellominecraft.launcher.settings.Profile;
|
||||
import org.jackhuang.hellominecraft.launcher.utils.ModInfo;
|
||||
import org.jackhuang.hellominecraft.utils.code.DigestUtils;
|
||||
import org.jackhuang.hellominecraft.utils.system.FileUtils;
|
||||
|
||||
/**
|
||||
@@ -109,4 +111,12 @@ public class MinecraftModService extends IMinecraftModService {
|
||||
recacheMods();
|
||||
}
|
||||
|
||||
public String checkMd5s() throws IOException {
|
||||
String res = "";
|
||||
for (ModInfo i : getMods()) {
|
||||
res += DigestUtils.md5Hex(new FileInputStream(i.location));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@ import org.jackhuang.hellominecraft.utils.system.FileUtils;
|
||||
import org.jackhuang.hellominecraft.launcher.utils.MCUtils;
|
||||
import org.jackhuang.hellominecraft.launcher.utils.auth.UserProfileProvider;
|
||||
import org.jackhuang.hellominecraft.launcher.settings.Profile;
|
||||
import org.jackhuang.hellominecraft.tasks.DecompressTask;
|
||||
import org.jackhuang.hellominecraft.tasks.TaskWindow;
|
||||
import org.jackhuang.hellominecraft.tasks.download.FileDownloadTask;
|
||||
import org.jackhuang.hellominecraft.utils.system.IOUtils;
|
||||
import org.jackhuang.hellominecraft.utils.MessageBox;
|
||||
import org.jackhuang.hellominecraft.utils.Utils;
|
||||
@@ -302,4 +305,14 @@ public final class MinecraftVersionManager extends IMinecraftProvider {
|
||||
public IMinecraftAssetService getAssetService() {
|
||||
return mas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeMiencraft() {
|
||||
|
||||
}
|
||||
|
||||
private void downloadModpack(String url) throws IOException {
|
||||
File tmp = File.createTempFile("hmcl", ".zip");
|
||||
TaskWindow.getInstance().addTask(new FileDownloadTask(url, tmp)).addTask(new DecompressTask(tmp, baseFolder)).start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.awt.image.BufferedImage;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.Timer;
|
||||
import org.jackhuang.hellominecraft.launcher.settings.Settings;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -51,14 +52,16 @@ public class AnimatedPanel extends JPanel {
|
||||
Timer timer;
|
||||
|
||||
public void animate() {
|
||||
if (Settings.getInstance().isEnableAnimation()) {
|
||||
offsetX = 0;
|
||||
timer.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
double pgs = 1 - Math.sin(Math.PI / 2 / ANIMATION_LENGTH * offsetX);
|
||||
if(Math.abs(ANIMATION_LENGTH - offsetX) < 0.1) {
|
||||
if (Math.abs(ANIMATION_LENGTH - offsetX) < 0.1) {
|
||||
super.paint(g);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ import org.jackhuang.hellominecraft.utils.MessageBox;
|
||||
import org.jackhuang.hellominecraft.version.MinecraftVersionRequest;
|
||||
import org.jackhuang.hellominecraft.utils.system.OS;
|
||||
import org.jackhuang.hellominecraft.utils.StrUtils;
|
||||
import org.jackhuang.hellominecraft.utils.SwingUtils;
|
||||
import org.jackhuang.hellominecraft.views.SwingUtils;
|
||||
import org.jackhuang.hellominecraft.utils.system.Java;
|
||||
import org.jackhuang.hellominecraft.views.LogWindow;
|
||||
import rx.Observable;
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.jackhuang.hellominecraft.tasks.TaskWindow;
|
||||
import org.jackhuang.hellominecraft.tasks.communication.DefaultPreviousResult;
|
||||
import org.jackhuang.hellominecraft.utils.MessageBox;
|
||||
import org.jackhuang.hellominecraft.utils.StrUtils;
|
||||
import org.jackhuang.hellominecraft.utils.SwingUtils;
|
||||
import org.jackhuang.hellominecraft.views.SwingUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -55,15 +55,21 @@
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="chkEnableShadow" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="chkEnableAnimation" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="chkEnableShadow" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btnCheckUpdate" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@@ -100,7 +106,10 @@
|
||||
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="chkEnableShadow" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="chkEnableShadow" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="chkEnableAnimation" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnCheckUpdate" min="-2" pref="26" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="71" max="32767" attributes="0"/>
|
||||
@@ -255,5 +264,13 @@
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="chkEnableAnimation">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="启用动态效果"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="chkEnableAnimationFocusLost"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
||||
@@ -53,6 +53,7 @@ public class LauncherSettingsPanel extends AnimatedPanel {
|
||||
cboDownloadSource.setSelectedIndex(Settings.getInstance().getDownloadType());
|
||||
cboTheme.setSelectedIndex(Settings.getInstance().getTheme());
|
||||
chkEnableShadow.setSelected(Settings.getInstance().isEnableShadow());
|
||||
chkEnableAnimation.setSelected(Settings.getInstance().isEnableAnimation());
|
||||
|
||||
setBackground(Color.white);
|
||||
setOpaque(true);
|
||||
@@ -86,6 +87,7 @@ public class LauncherSettingsPanel extends AnimatedPanel {
|
||||
txtProxyUsername = new javax.swing.JTextField();
|
||||
txtProxyPassword = new javax.swing.JTextField();
|
||||
jLabel8 = new javax.swing.JLabel();
|
||||
chkEnableAnimation = new javax.swing.JCheckBox();
|
||||
|
||||
cboDownloadSource.addItemListener(new java.awt.event.ItemListener() {
|
||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
||||
@@ -172,6 +174,13 @@ public class LauncherSettingsPanel extends AnimatedPanel {
|
||||
|
||||
jLabel8.setText(bundle.getString("proxy.password")); // NOI18N
|
||||
|
||||
chkEnableAnimation.setText("启用动态效果");
|
||||
chkEnableAnimation.addFocusListener(new java.awt.event.FocusAdapter() {
|
||||
public void focusLost(java.awt.event.FocusEvent evt) {
|
||||
chkEnableAnimationFocusLost(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@@ -210,12 +219,16 @@ public class LauncherSettingsPanel extends AnimatedPanel {
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtProxyPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, Short.MAX_VALUE))))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(chkEnableShadow)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(chkEnableAnimation))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(chkEnableShadow)
|
||||
.addComponent(btnCheckUpdate))
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addGap(0, 0, Short.MAX_VALUE))))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
@@ -246,7 +259,9 @@ public class LauncherSettingsPanel extends AnimatedPanel {
|
||||
.addComponent(txtProxyPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel8))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(chkEnableShadow)
|
||||
.addComponent(chkEnableAnimation))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnCheckUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 71, Short.MAX_VALUE)
|
||||
@@ -315,11 +330,16 @@ public class LauncherSettingsPanel extends AnimatedPanel {
|
||||
Settings.getInstance().setProxyPassword(txtProxyPassword.getText());
|
||||
}//GEN-LAST:event_txtProxyPasswordFocusLost
|
||||
|
||||
private void chkEnableAnimationFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_chkEnableAnimationFocusLost
|
||||
Settings.getInstance().setEnableAnimation(chkEnableAnimation.isSelected());
|
||||
}//GEN-LAST:event_chkEnableAnimationFocusLost
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnCheckUpdate;
|
||||
private javax.swing.JButton btnSelBackgroundPath;
|
||||
private javax.swing.JComboBox cboDownloadSource;
|
||||
private javax.swing.JComboBox cboTheme;
|
||||
private javax.swing.JCheckBox chkEnableAnimation;
|
||||
private javax.swing.JCheckBox chkEnableShadow;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel14;
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Hello Minecraft! Launcher.
|
||||
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.tasks;
|
||||
|
||||
import java.io.File;
|
||||
import org.jackhuang.hellominecraft.utils.system.Compressor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class DecompressTask extends Task {
|
||||
|
||||
File src, dest;
|
||||
|
||||
public DecompressTask(File src, File dest) {
|
||||
this.src = src;
|
||||
this.dest = dest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeTask() throws Throwable {
|
||||
Compressor.unzip(src, dest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInfo() {
|
||||
return "Decompress: " + src.getAbsolutePath() + " to " + dest.getAbsolutePath();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import org.jackhuang.hellominecraft.C;
|
||||
import org.jackhuang.hellominecraft.HMCLog;
|
||||
import org.jackhuang.hellominecraft.utils.MessageBox;
|
||||
import org.jackhuang.hellominecraft.utils.StrUtils;
|
||||
import org.jackhuang.hellominecraft.utils.SwingUtils;
|
||||
import org.jackhuang.hellominecraft.views.SwingUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.utils;
|
||||
|
||||
import org.jackhuang.hellominecraft.views.SwingUtils;
|
||||
import javax.swing.JOptionPane;
|
||||
import org.jackhuang.hellominecraft.C;
|
||||
|
||||
|
||||
@@ -28,8 +28,6 @@ import org.jackhuang.hellominecraft.logging.Level;
|
||||
import org.jackhuang.hellominecraft.utils.functions.NonFunction;
|
||||
import org.jackhuang.hellominecraft.utils.DoubleOutputStream;
|
||||
import org.jackhuang.hellominecraft.utils.LauncherPrintStream;
|
||||
import org.jackhuang.hellominecraft.utils.LogWindowOutputStream;
|
||||
import org.jackhuang.hellominecraft.utils.SwingUtils;
|
||||
import org.jackhuang.hellominecraft.utils.Utils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.utils;
|
||||
package org.jackhuang.hellominecraft.views;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.util.Timer;
|
||||
@@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.utils;
|
||||
package org.jackhuang.hellominecraft.views;
|
||||
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.FontMetrics;
|
||||
@@ -29,6 +29,7 @@ import javax.swing.JTable;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import org.jackhuang.hellominecraft.HMCLog;
|
||||
import org.jackhuang.hellominecraft.utils.StrUtils;
|
||||
import org.jackhuang.hellominecraft.utils.functions.NonFunction;
|
||||
|
||||
/**
|
||||
@@ -84,7 +84,7 @@ import org.jackhuang.hellominecraft.svrmgr.threads.MonitorThread;
|
||||
import org.jackhuang.hellominecraft.svrmgr.utils.FolderOpener;
|
||||
import org.jackhuang.hellominecraft.svrmgr.utils.IPGet;
|
||||
import org.jackhuang.hellominecraft.svrmgr.utils.Utilities;
|
||||
import org.jackhuang.hellominecraft.utils.SwingUtils;
|
||||
import org.jackhuang.hellominecraft.views.SwingUtils;
|
||||
import org.jackhuang.hellominecraft.version.MinecraftRemoteVersion;
|
||||
import org.jackhuang.hellominecraft.lookandfeel.components.ConstomButton;
|
||||
import org.jackhuang.hellominecraft.utils.Event;
|
||||
|
||||
Reference in New Issue
Block a user