2012-11-05 20:29:04 +01:00
|
|
|
package mekanism.client;
|
2012-08-15 22:41:41 +02:00
|
|
|
|
2013-03-11 18:49:01 +01:00
|
|
|
import mekanism.api.EnumColor;
|
2012-11-05 20:29:04 +01:00
|
|
|
import mekanism.common.Mekanism;
|
|
|
|
import mekanism.common.MekanismUtils;
|
2012-12-20 22:53:39 +01:00
|
|
|
import net.minecraft.client.gui.GuiButton;
|
|
|
|
import net.minecraft.client.gui.GuiScreen;
|
2012-08-15 22:41:41 +02:00
|
|
|
|
|
|
|
public class GuiCredits extends GuiScreen {
|
|
|
|
|
|
|
|
private static String updateProgress = "";
|
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-08-15 22:41:41 +02:00
|
|
|
public void initGui()
|
|
|
|
{
|
|
|
|
controlList.clear();
|
2013-01-21 02:15:59 +01:00
|
|
|
controlList.add(new GuiButton(0, width / 2 - 100, height / 4 + 72 + 12, "Update"));
|
2012-08-15 22:41:41 +02:00
|
|
|
controlList.add(new GuiButton(1, width / 2 - 100, height / 4 + 96 + 12, "Cancel"));
|
2013-03-11 18:49:01 +01:00
|
|
|
((GuiButton)controlList.get(0)).enabled = !MekanismUtils.isNotOutdated();
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-08-15 22:41:41 +02:00
|
|
|
public void onGuiClosed()
|
|
|
|
{
|
|
|
|
updateProgress = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void onFinishedDownloading()
|
|
|
|
{
|
|
|
|
updateProgress = "Successfully updated. Restart Minecraft to load.";
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void onErrorDownloading()
|
|
|
|
{
|
2012-11-05 16:52:56 +01:00
|
|
|
updateProgress = EnumColor.DARK_RED + "Error updating.";
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-08-15 22:41:41 +02:00
|
|
|
protected void actionPerformed(GuiButton guibutton)
|
|
|
|
{
|
|
|
|
if(!guibutton.enabled)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2013-01-21 02:15:59 +01:00
|
|
|
if(guibutton.id == 0)
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
2013-03-11 18:49:01 +01:00
|
|
|
if(!MekanismUtils.isNotOutdated())
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
|
|
|
updateProgress = "Downloading latest version...";
|
|
|
|
guibutton.enabled = false;
|
2013-03-11 18:49:01 +01:00
|
|
|
new ThreadClientUpdate("http://dl.dropbox.com/u/90411166/Mekanism-v" + Mekanism.latestVersionNumber + ".jar", 0);
|
|
|
|
new ThreadClientUpdate("http://dl.dropbox.com/u/90411166/MekanismGenerators-v" + Mekanism.latestVersionNumber + ".jar", 1);
|
|
|
|
new ThreadClientUpdate("http://dl.dropbox.com/u/90411166/MekanismTools-v" + Mekanism.latestVersionNumber + ".jar", 2);
|
2012-08-17 22:40:28 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
updateProgress = "You already have the latest version.";
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(guibutton.id == 1)
|
|
|
|
{
|
|
|
|
mc.displayGuiScreen(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void writeText(String text, int yAxis)
|
|
|
|
{
|
|
|
|
drawString(fontRenderer, text, width / 2 - 140, (height / 4 - 60) + 20 + yAxis, 0xa0a0a0);
|
|
|
|
}
|
|
|
|
|
2012-11-23 03:22:11 +01:00
|
|
|
@Override
|
2012-11-07 21:01:46 +01:00
|
|
|
public boolean doesGuiPauseGame()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-08-15 22:41:41 +02:00
|
|
|
public void drawScreen(int i, int j, float f)
|
|
|
|
{
|
|
|
|
drawDefaultBackground();
|
2012-11-05 20:29:04 +01:00
|
|
|
drawCenteredString(fontRenderer, EnumColor.DARK_BLUE + "Mekanism" + EnumColor.GREY + " by aidancbrady", width / 2, (height / 4 - 60) + 20, 0xffffff);
|
2013-03-11 18:49:01 +01:00
|
|
|
writeText(EnumColor.GREY + "Your version: " + (MekanismUtils.isNotOutdated() ? Mekanism.versionNumber : EnumColor.DARK_RED + Mekanism.versionNumber.toString() + EnumColor.GREY + " -- OUTDATED"), 36);
|
2012-11-05 20:29:04 +01:00
|
|
|
writeText(EnumColor.GREY + "Newest version: " + Mekanism.latestVersionNumber, 45);
|
2012-11-05 16:52:56 +01:00
|
|
|
writeText(EnumColor.GREY + "*Developed on Mac OS X 10.8 Mountain Lion", 63);
|
|
|
|
writeText(EnumColor.GREY + "*Code, textures, and ideas by aidancbrady", 72);
|
2013-03-11 18:49:01 +01:00
|
|
|
writeText(EnumColor.GREY + "Recent news: " + EnumColor.DARK_BLUE + (!Mekanism.recentNews.contains("null") ? Mekanism.recentNews : "couldn't access."), 81);
|
2012-11-05 16:52:56 +01:00
|
|
|
writeText(EnumColor.GREY + updateProgress, 99);
|
2012-08-15 22:41:41 +02:00
|
|
|
super.drawScreen(i, j, f);
|
|
|
|
}
|
|
|
|
}
|