Added hover message in GuiUploadFile to tell the user why they can't upload a File

This commit is contained in:
CrushedPixel
2015-07-25 15:15:59 +02:00
parent caf0807e8b
commit 4f69d9e22f
2 changed files with 14 additions and 5 deletions

View File

@@ -62,7 +62,7 @@ public class GuiUploadFile extends GuiScreen implements ProgressUpdateListener {
private ComposedElement content;
private GuiTextField messageTextField;
private GuiButton startUploadButton, cancelUploadButton, backButton;
private GuiAdvancedButton startUploadButton, cancelUploadButton, backButton;
private GuiProgressBar progressBar;
private File replayFile;
@@ -215,14 +215,14 @@ public class GuiUploadFile extends GuiScreen implements ProgressUpdateListener {
List<GuiButton> buttonList = this.buttonList;
if(startUploadButton == null) {
List<GuiButton> bottomBar = new ArrayList<GuiButton>();
startUploadButton = new GuiButton(GuiConstants.UPLOAD_START_BUTTON, 0, 0, I18n.format("replaymod.gui.upload.start"));
startUploadButton = new GuiAdvancedButton(GuiConstants.UPLOAD_START_BUTTON, 0, 0, I18n.format("replaymod.gui.upload.start"));
bottomBar.add(startUploadButton);
cancelUploadButton = new GuiButton(GuiConstants.UPLOAD_CANCEL_BUTTON, 0, 0, I18n.format("replaymod.gui.upload.cancel"));
cancelUploadButton = new GuiAdvancedButton(GuiConstants.UPLOAD_CANCEL_BUTTON, 0, 0, I18n.format("replaymod.gui.upload.cancel"));
cancelUploadButton.enabled = false;
bottomBar.add(cancelUploadButton);
backButton = new GuiButton(GuiConstants.UPLOAD_BACK_BUTTON, 0, 0, I18n.format("replaymod.gui.back"));
backButton = new GuiAdvancedButton(GuiConstants.UPLOAD_BACK_BUTTON, 0, 0, I18n.format("replaymod.gui.back"));
bottomBar.add(backButton);
int i = 0;
@@ -374,6 +374,8 @@ public class GuiUploadFile extends GuiScreen implements ProgressUpdateListener {
progressBar.drawProgressBar();
startUploadButton.drawOverlay(mc, mouseX, mouseY);
content.draw(mc, mouseX, mouseY);
content.drawOverlay(mc, mouseX, mouseY);
}
@@ -413,15 +415,19 @@ public class GuiUploadFile extends GuiScreen implements ProgressUpdateListener {
if(name.getText().trim().length() < 5 || name.getText().trim().length() > 30) {
enabled = false;
name.setTextColor(Color.RED.getRGB());
startUploadButton.hoverText = I18n.format("replaymod.gui.upload.error.name.length");
} else if(!RegexUtils.isValid(RegexUtils.ALPHANUMERIC_SPACE_HYPHEN_UNDERSCORE, name.getText())) {
enabled = false;
name.setTextColor(Color.RED.getRGB());
startUploadButton.hoverText = I18n.format("replaymod.gui.upload.error.name");
} else if(!RegexUtils.isValid(RegexUtils.ALPHANUMERIC_COMMA, tags.getText())) {
enabled = false;
tags.setTextColor(Color.RED.getRGB());
startUploadButton.hoverText = I18n.format("replaymod.gui.upload.error.tags");
} else {
name.setTextColor(Color.WHITE.getRGB());
tags.setTextColor(Color.WHITE.getRGB());
startUploadButton.hoverText = null;
}
if(lockUploadButton) enabled = false;

View File

@@ -133,7 +133,6 @@ replaymod.gui.register.error.invalidname=Username may only contain letters and n
replaymod.gui.register.error.shortpw=Password has to be at least 5 characters long
replaymod.gui.register.error.authfailed=Could not authenticate your Minecraft account
#Replay Viewer GUI
replaymod.gui.viewer.rename.title=Rename Replay
replaymod.gui.viewer.rename.name=Replay Name
@@ -193,6 +192,10 @@ replaymod.gui.upload.canceled=Upload has been canceled
replaymod.gui.upload.hideip=Hide Server IP
replaymod.gui.upload.nothumbnail=Missing Thumbnail. Please create a Thumbnail in the Replay using the %1$s key.
replaymod.gui.upload.error.name.length=The Replay Name has to be between 5 and 30 characters long
replaymod.gui.upload.error.name=The Replay Name may not contain special characters
replaymod.gui.upload.error.tags=Tags may only contain letters and are separated using a comma
#Replay Editor
replaymod.gui.editor.replayfile=Replay File