Added Core Mod to redirect the Enchantment Rendering getSystemTime() calls to a the EnchantmentTimer (glow now slows down)
This commit is contained in:
@@ -39,4 +39,7 @@ public class GuiConstants {
|
||||
public static final int REPLAY_EDITOR_SAVEMODE_BUTTON = 5003;
|
||||
public static final int REPLAY_EDITOR_SAVE_BUTTON = 5004;
|
||||
public static final int REPLAY_EDITOR_BACK_BUTTON = 5005;
|
||||
|
||||
public static final int REPLAY_EDITOR_UP_BUTTON = 5006;
|
||||
public static final int REPLAY_EDITOR_DOWN_BUTTON = 5007;
|
||||
}
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
package eu.crushedpixel.replaymod.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
|
||||
public class GuiEntryList extends GuiTextField {
|
||||
|
||||
private int selectionIndex = -1;
|
||||
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private int visibleElements;
|
||||
public final static int elementHeight = 14;
|
||||
|
||||
private int upperIndex = 0;
|
||||
|
||||
public GuiEntryList(int id, FontRenderer fontRenderer,
|
||||
int xPos, int yPos, int width, int visibleEntries) {
|
||||
super(id, fontRenderer, xPos, yPos, width, elementHeight*visibleEntries-1);
|
||||
this.visibleElements = visibleEntries;
|
||||
}
|
||||
|
||||
public void setVisibleElements(int rows) {
|
||||
this.visibleElements = rows;
|
||||
this.height = elementHeight*visibleElements-1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTextBox() {
|
||||
super.drawTextBox();
|
||||
//drawing the entries
|
||||
for(int i=0; i-upperIndex<visibleElements; i++) {
|
||||
if(i<upperIndex) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(i == selectionIndex) {
|
||||
drawRect(xPosition, yPosition+(i-upperIndex)*elementHeight, xPosition+width,
|
||||
yPosition+(i+1-upperIndex)*elementHeight-1, Color.GRAY.getRGB());
|
||||
}
|
||||
|
||||
drawRect(xPosition, yPosition+(i+1-upperIndex)*elementHeight-1, xPosition+width,
|
||||
yPosition+(i+1-upperIndex)*elementHeight, -6250336);
|
||||
drawString(mc.fontRendererObj, mc.fontRendererObj.trimStringToWidth(elements.get(i).toString(), width-4),
|
||||
xPosition+2, yPosition+(i-upperIndex)*elementHeight+3, Color.WHITE.getRGB());
|
||||
}
|
||||
|
||||
//drawing the scroll bar
|
||||
if(elements.size() > visibleElements) {
|
||||
//handle scroll events
|
||||
int dw = Mouse.getDWheel();
|
||||
if(dw > 0) {
|
||||
dw = -1;
|
||||
} else if(dw < 0) {
|
||||
dw = 1;
|
||||
}
|
||||
|
||||
upperIndex = Math.max(Math.min(upperIndex+dw, elements.size()-visibleElements), 0);
|
||||
|
||||
float visiblePerc = ((float)visibleElements)/elements.size();
|
||||
int barHeight = (int)(visiblePerc*(height-1));
|
||||
|
||||
float posPerc = ((float)upperIndex)/elements.size();
|
||||
int barY = (int)(posPerc*(height-1));
|
||||
|
||||
drawRect(xPosition+width-3, yPosition, xPosition+width, yPosition+height, Color.DARK_GRAY.getRGB());
|
||||
drawRect(xPosition+width-3, yPosition+barY, xPosition+width, yPosition+1+barY+barHeight, -6250336);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int xPos, int yPos, int mouseButton) {
|
||||
int clickedIndex = (int)Math.floor((yPos-yPosition) / elementHeight) + upperIndex;
|
||||
if(clickedIndex < elements.size()) selectionIndex = clickedIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setText(String text) {}
|
||||
|
||||
private List<Object> elements = new ArrayList<Object>();
|
||||
|
||||
private void select(int index) {
|
||||
this.selectionIndex = index;
|
||||
if(selectionIndex < 0) selectionIndex = -1;
|
||||
}
|
||||
|
||||
public void setElements(List<Object> elements) {
|
||||
this.elements = elements;
|
||||
if(selectionIndex == -1 && elements.size() > 0) {
|
||||
selectionIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void clearElements() {
|
||||
this.elements = new ArrayList<Object>();
|
||||
selectionIndex = -1;
|
||||
}
|
||||
|
||||
public void addElement(Object element) {
|
||||
this.elements.add(element);
|
||||
if(selectionIndex == -1) {
|
||||
selectionIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Object getElement(int index) {
|
||||
return elements.get(index);
|
||||
}
|
||||
|
||||
public int getSelectionIndex() {
|
||||
return selectionIndex;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package eu.crushedpixel.replaymod.gui;
|
||||
|
||||
import eu.crushedpixel.replaymod.ReplayMod;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiMouseInput;
|
||||
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package eu.crushedpixel.replaymod.gui.elements;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
public class GuiArrowButton extends GuiButton {
|
||||
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private boolean upwards = false;
|
||||
|
||||
public GuiArrowButton(int buttonId, int x, int y, String buttonText, boolean upwards) {
|
||||
super(buttonId, x, y, buttonText);
|
||||
|
||||
this.upwards = upwards;
|
||||
width = 20;
|
||||
height = 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
try {
|
||||
super.drawButton(mc, mouseX, mouseY);
|
||||
if(upwards) {
|
||||
for(int i=0; i<=Math.ceil(height/2)-5; i++) {
|
||||
drawHorizontalLine(xPosition+width-height+i+4, xPosition+width-i-6, yPosition+height-((height/3)+i+2), Color.BLACK.getRGB());
|
||||
}
|
||||
} else {
|
||||
for(int i=0; i<=Math.ceil(height/2)-5; i++) {
|
||||
drawHorizontalLine(xPosition+width-height+i+4, xPosition+width-i-6, yPosition+(height/3)+i+2, Color.BLACK.getRGB());
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package eu.crushedpixel.replaymod.gui;
|
||||
package eu.crushedpixel.replaymod.gui.elements;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
@@ -6,26 +6,31 @@ import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import eu.crushedpixel.replaymod.gui.elements.listeners.SelectionListener;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
|
||||
public class GuiDropdown extends GuiTextField {
|
||||
public class GuiDropdown<T> extends GuiTextField {
|
||||
|
||||
private int selectionIndex = -1;
|
||||
private boolean open = false;
|
||||
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private final int visibleDropout = 5;
|
||||
private final int visibleDropout;
|
||||
private final int dropoutElementHeight = 14;
|
||||
private final int maxDropoutHeight = dropoutElementHeight*visibleDropout;
|
||||
private final int maxDropoutHeight;
|
||||
|
||||
private List<SelectionListener> selectionListeners = new ArrayList<SelectionListener>();
|
||||
|
||||
private int upperIndex = 0;
|
||||
|
||||
public GuiDropdown(int id, FontRenderer fontRenderer,
|
||||
int xPos, int yPos, int width) {
|
||||
int xPos, int yPos, int width, int visibleDropout) {
|
||||
super(id, fontRenderer, xPos, yPos, width, 20);
|
||||
this.visibleDropout = visibleDropout;
|
||||
this.maxDropoutHeight = dropoutElementHeight*visibleDropout;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +72,7 @@ public class GuiDropdown extends GuiTextField {
|
||||
//The elements
|
||||
int y = 0;
|
||||
int i = 0;
|
||||
for(Object obj : elements) {
|
||||
for(T obj : elements) {
|
||||
if(i<upperIndex) {
|
||||
i++;
|
||||
continue;
|
||||
@@ -117,6 +122,7 @@ public class GuiDropdown extends GuiTextField {
|
||||
if(yPos > yPosition+height && yPos < yPosition+height+requiredHeight) {
|
||||
int clickedIndex = (int)Math.floor((yPos - (yPosition+height)) / dropoutElementHeight) + upperIndex;
|
||||
this.selectionIndex = clickedIndex;
|
||||
fireSelectionChangeEvent();
|
||||
}
|
||||
open = false;
|
||||
} else {
|
||||
@@ -132,14 +138,15 @@ public class GuiDropdown extends GuiTextField {
|
||||
}
|
||||
}
|
||||
|
||||
private List<Object> elements = new ArrayList<Object>();
|
||||
private List<T> elements = new ArrayList<T>();
|
||||
|
||||
private void select(int index) {
|
||||
public void setSelectionIndex(int index) {
|
||||
this.selectionIndex = index;
|
||||
if(selectionIndex < 0) selectionIndex = -1;
|
||||
fireSelectionChangeEvent();
|
||||
}
|
||||
|
||||
public void setElements(List<Object> elements) {
|
||||
public void setElements(List<T> elements) {
|
||||
this.elements = elements;
|
||||
if(selectionIndex == -1 && elements.size() > 0) {
|
||||
selectionIndex = 0;
|
||||
@@ -147,23 +154,40 @@ public class GuiDropdown extends GuiTextField {
|
||||
}
|
||||
|
||||
public void clearElements() {
|
||||
this.elements = new ArrayList<Object>();
|
||||
this.elements = new ArrayList<T>();
|
||||
selectionIndex = -1;
|
||||
}
|
||||
|
||||
public void addElement(Object element) {
|
||||
public void addElement(T element) {
|
||||
this.elements.add(element);
|
||||
if(selectionIndex == -1) {
|
||||
selectionIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Object getElement(int index) {
|
||||
public T getElement(int index) {
|
||||
return elements.get(index);
|
||||
}
|
||||
|
||||
public List<T> getAllElements() {
|
||||
return elements;
|
||||
}
|
||||
|
||||
public int getSelectionIndex() {
|
||||
return selectionIndex;
|
||||
}
|
||||
|
||||
private void fireSelectionChangeEvent() {
|
||||
for(SelectionListener listener : selectionListeners) {
|
||||
listener.onSelectionChanged(selectionIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public void addSelectionListener(SelectionListener listener) {
|
||||
this.selectionListeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeSelectionListener(SelectionListener listener) {
|
||||
this.selectionListeners.remove(listener);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package eu.crushedpixel.replaymod.gui.elements;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import eu.crushedpixel.replaymod.gui.elements.listeners.SelectionListener;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
|
||||
public class GuiEntryList<T> extends GuiTextField {
|
||||
|
||||
private int selectionIndex = -1;
|
||||
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private int visibleElements;
|
||||
public final static int elementHeight = 14;
|
||||
|
||||
private int upperIndex = 0;
|
||||
|
||||
private List<SelectionListener> selectionListeners = new ArrayList<SelectionListener>();
|
||||
|
||||
public GuiEntryList(int id, FontRenderer fontRenderer,
|
||||
int xPos, int yPos, int width, int visibleEntries) {
|
||||
super(id, fontRenderer, xPos, yPos, width, elementHeight*visibleEntries-1);
|
||||
this.visibleElements = visibleEntries;
|
||||
}
|
||||
|
||||
public void setVisibleElements(int rows) {
|
||||
this.visibleElements = rows;
|
||||
this.height = elementHeight*visibleElements-1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTextBox() {
|
||||
try {
|
||||
super.drawTextBox();
|
||||
//drawing the entries
|
||||
for(int i=0; i-upperIndex<visibleElements; i++) {
|
||||
if(i<upperIndex) continue;
|
||||
|
||||
if(i >= elements.size()) break;
|
||||
|
||||
if(i == selectionIndex) {
|
||||
drawRect(xPosition, yPosition+(i-upperIndex)*elementHeight, xPosition+width,
|
||||
yPosition+(i+1-upperIndex)*elementHeight-1, Color.GRAY.getRGB());
|
||||
}
|
||||
|
||||
drawRect(xPosition, yPosition+(i+1-upperIndex)*elementHeight-1, xPosition+width,
|
||||
yPosition+(i+1-upperIndex)*elementHeight, -6250336);
|
||||
drawString(mc.fontRendererObj, mc.fontRendererObj.trimStringToWidth(elements.get(i).toString(), width-4),
|
||||
xPosition+2, yPosition+(i-upperIndex)*elementHeight+3, Color.WHITE.getRGB());
|
||||
}
|
||||
|
||||
//drawing the scroll bar
|
||||
if(elements.size() > visibleElements) {
|
||||
//handle scroll events
|
||||
int dw = Mouse.getDWheel();
|
||||
if(dw > 0) {
|
||||
dw = -1;
|
||||
} else if(dw < 0) {
|
||||
dw = 1;
|
||||
}
|
||||
|
||||
upperIndex = Math.max(Math.min(upperIndex+dw, elements.size()-visibleElements), 0);
|
||||
|
||||
float visiblePerc = ((float)visibleElements)/elements.size();
|
||||
int barHeight = (int)(visiblePerc*(height-1));
|
||||
|
||||
float posPerc = ((float)upperIndex)/elements.size();
|
||||
int barY = (int)(posPerc*(height-1));
|
||||
|
||||
drawRect(xPosition+width-3, yPosition, xPosition+width, yPosition+height, Color.DARK_GRAY.getRGB());
|
||||
drawRect(xPosition+width-3, yPosition+barY, xPosition+width, yPosition+1+barY+barHeight, -6250336);
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int xPos, int yPos, int mouseButton) {
|
||||
int clickedIndex = (int)Math.floor((yPos-yPosition) / elementHeight) + upperIndex;
|
||||
if(clickedIndex < elements.size() && clickedIndex >= 0) {
|
||||
selectionIndex = clickedIndex;
|
||||
fireSelectionChangeEvent();
|
||||
}
|
||||
}
|
||||
|
||||
private void fireSelectionChangeEvent() {
|
||||
for(SelectionListener listener : selectionListeners) {
|
||||
listener.onSelectionChanged(selectionIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setText(String text) {}
|
||||
|
||||
private List<T> elements = new ArrayList<T>();
|
||||
|
||||
public void setElements(List<T> elements) {
|
||||
this.elements = elements;
|
||||
if(selectionIndex == -1 && elements.size() > 0) {
|
||||
selectionIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void clearElements() {
|
||||
this.elements = new ArrayList<T>();
|
||||
selectionIndex = -1;
|
||||
}
|
||||
|
||||
public void addElement(T element) {
|
||||
this.elements.add(element);
|
||||
if(selectionIndex == -1) {
|
||||
selectionIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public T getElement(int index) {
|
||||
return elements.get(index);
|
||||
}
|
||||
|
||||
public int getSelectionIndex() {
|
||||
return selectionIndex;
|
||||
}
|
||||
|
||||
public void setSelectionIndex(int index) {
|
||||
this.selectionIndex = index;
|
||||
if(selectionIndex < 0) selectionIndex = -1;
|
||||
fireSelectionChangeEvent();
|
||||
}
|
||||
|
||||
public void addSelectionListener(SelectionListener listener) {
|
||||
this.selectionListeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeSelectionListener(SelectionListener listener) {
|
||||
this.selectionListeners.remove(listener);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package eu.crushedpixel.replaymod.gui;
|
||||
package eu.crushedpixel.replaymod.gui.elements;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package eu.crushedpixel.replaymod.gui;
|
||||
package eu.crushedpixel.replaymod.gui.elements;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
@@ -1,4 +1,4 @@
|
||||
package eu.crushedpixel.replaymod.gui;
|
||||
package eu.crushedpixel.replaymod.gui.elements;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
@@ -1,4 +1,4 @@
|
||||
package eu.crushedpixel.replaymod.gui;
|
||||
package eu.crushedpixel.replaymod.gui.elements;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -0,0 +1,7 @@
|
||||
package eu.crushedpixel.replaymod.gui.elements.listeners;
|
||||
|
||||
public abstract class SelectionListener {
|
||||
|
||||
public abstract void onSelectionChanged(int selectionIndex);
|
||||
|
||||
}
|
||||
@@ -21,7 +21,7 @@ import eu.crushedpixel.replaymod.api.client.SearchPagination;
|
||||
import eu.crushedpixel.replaymod.api.client.SearchQuery;
|
||||
import eu.crushedpixel.replaymod.api.client.holders.FileInfo;
|
||||
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
||||
import eu.crushedpixel.replaymod.gui.GuiReplayListExtended;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiReplayListExtended;
|
||||
import eu.crushedpixel.replaymod.gui.replayviewer.GuiReplayViewer;
|
||||
import eu.crushedpixel.replaymod.online.authentication.AuthenticationHandler;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package eu.crushedpixel.replaymod.gui.online;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import eu.crushedpixel.replaymod.gui.GuiReplayListExtended;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiReplayListExtended;
|
||||
|
||||
public class ReplayFileList extends GuiReplayListExtended {
|
||||
|
||||
|
||||
@@ -1,24 +1,42 @@
|
||||
package eu.crushedpixel.replaymod.gui.replaystudio;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
import eu.crushedpixel.replaymod.gui.GuiEntryList;
|
||||
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiArrowButton;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiDropdown;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiEntryList;
|
||||
import eu.crushedpixel.replaymod.gui.elements.listeners.SelectionListener;
|
||||
import eu.crushedpixel.replaymod.registry.ReplayGuiRegistry;
|
||||
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
||||
|
||||
public class GuiConnectPart extends GuiStudioPart {
|
||||
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private static final String DESCRIPTION = "Connects multiple Replays in the same order as the list.";
|
||||
private static final String TITLE = "Connect Replays";
|
||||
|
||||
private boolean initialized = false;
|
||||
|
||||
private GuiEntryList concatList;
|
||||
private GuiEntryList<String> concatList;
|
||||
private GuiDropdown<String> replayDropdown;
|
||||
|
||||
private GuiButton removeButton, addButton;
|
||||
private GuiArrowButton upButton, downButton;
|
||||
|
||||
private List<File> replayFiles;
|
||||
private List<String> filesToConcat;
|
||||
|
||||
public GuiConnectPart(int yPos) {
|
||||
super(yPos);
|
||||
this.mc = Minecraft.getMinecraft();
|
||||
fontRendererObj = mc.fontRendererObj;
|
||||
}
|
||||
|
||||
@@ -40,21 +58,81 @@ public class GuiConnectPart extends GuiStudioPart {
|
||||
@Override
|
||||
public void initGui() {
|
||||
if(!initialized) {
|
||||
concatList = new GuiEntryList(1, fontRendererObj, 30, yPos, 200, 0);
|
||||
concatList.addElement(FilenameUtils.getBaseName(GuiReplayStudio.instance.getSelectedFile().getAbsolutePath()));
|
||||
|
||||
concatList.addElement("test1");
|
||||
concatList.addElement("test2");
|
||||
concatList.addElement("test3");
|
||||
concatList.addElement("test4");
|
||||
concatList.addElement("test5");
|
||||
concatList.addElement("test6");
|
||||
concatList.addElement("test7");
|
||||
concatList.addElement("test8");
|
||||
concatList.addElement("test9");
|
||||
concatList.addElement("test10");
|
||||
concatList.addElement("test11");
|
||||
concatList = new GuiEntryList(1, fontRendererObj, 30, yPos, 150, 0);
|
||||
filesToConcat = new ArrayList<String>();
|
||||
String selectedName = FilenameUtils.getBaseName(GuiReplayStudio.instance.getSelectedFile().getAbsolutePath());
|
||||
filesToConcat.add(selectedName);
|
||||
concatList.setElements(filesToConcat);
|
||||
|
||||
concatList.setSelectionIndex(0);
|
||||
|
||||
replayDropdown = new GuiDropdown(1, fontRendererObj, 250, yPos+5, 0, 4);
|
||||
|
||||
replayDropdown.clearElements();
|
||||
replayFiles = ReplayFileIO.getAllReplayFiles();
|
||||
int index = -1;
|
||||
int i=0;
|
||||
for(File file : replayFiles) {
|
||||
String name = FilenameUtils.getBaseName(file.getAbsolutePath());
|
||||
replayDropdown.addElement(name);
|
||||
if(name.equals(selectedName)) {
|
||||
index = i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
replayDropdown.setSelectionPos(index);
|
||||
|
||||
replayDropdown.addSelectionListener(new SelectionListener() {
|
||||
|
||||
@Override
|
||||
public void onSelectionChanged(int selectionIndex) {
|
||||
filesToConcat.set(concatList.getSelectionIndex(), (String)replayDropdown.getElement(selectionIndex));
|
||||
concatList.setElements(filesToConcat);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
concatList.addSelectionListener(new SelectionListener() {
|
||||
@Override
|
||||
public void onSelectionChanged(int selectionIndex) {
|
||||
String selName = (String)concatList.getElement(selectionIndex);
|
||||
int i = 0;
|
||||
for(Object s : replayDropdown.getAllElements()) {
|
||||
String str = (String)s;
|
||||
if(str.equals(selName)) {
|
||||
replayDropdown.setSelectionIndex(i);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
upButton = new GuiArrowButton(GuiConstants.REPLAY_EDITOR_UP_BUTTON, 195, yPos+40, "", true);
|
||||
buttonList.add(upButton);
|
||||
|
||||
downButton = new GuiArrowButton(GuiConstants.REPLAY_EDITOR_DOWN_BUTTON, 219, yPos+40, "", false);
|
||||
buttonList.add(downButton);
|
||||
|
||||
int w = GuiReplayStudio.instance.width-243-20-4;
|
||||
|
||||
removeButton = new GuiButton(1, 243, yPos+40, "Remove");
|
||||
buttonList.add(removeButton);
|
||||
|
||||
addButton = new GuiButton(1, 0, yPos+40, "Add");
|
||||
buttonList.add(addButton);
|
||||
|
||||
}
|
||||
|
||||
int w = GuiReplayStudio.instance.width-243-20-4;
|
||||
addButton.xPosition = 243+6+(w/2);
|
||||
|
||||
addButton.width = w/2+2;
|
||||
removeButton.width = w/2+2;
|
||||
|
||||
replayDropdown.width = GuiReplayStudio.instance.width-250-20;
|
||||
|
||||
int h = GuiReplayStudio.instance.height-yPos-20;
|
||||
int rows = (int)(h / (float)GuiEntryList.elementHeight);
|
||||
concatList.setVisibleElements(rows);
|
||||
@@ -65,11 +143,16 @@ public class GuiConnectPart extends GuiStudioPart {
|
||||
@Override
|
||||
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
concatList.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
replayDropdown.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
concatList.drawTextBox();
|
||||
replayDropdown.drawTextBox();
|
||||
|
||||
drawString(fontRendererObj, "Replay:", 200, yPos+5+7, Color.WHITE.getRGB());
|
||||
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
||||
import eu.crushedpixel.replaymod.gui.GuiDropdown;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiDropdown;
|
||||
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
||||
|
||||
public class GuiReplayStudio extends GuiScreen {
|
||||
@@ -93,7 +93,7 @@ public class GuiReplayStudio extends GuiScreen {
|
||||
int modeWidth = tabButtons.get(0).width;
|
||||
|
||||
if(!initialized) {
|
||||
replayDropdown = new GuiDropdown(1, fontRendererObj, 15+2+1+80, 60, this.width-30-8-80-modeWidth-4);
|
||||
replayDropdown = new GuiDropdown(1, fontRendererObj, 15+2+1+80, 60, this.width-30-8-80-modeWidth-4, 5);
|
||||
refreshReplayDropdown();
|
||||
} else {
|
||||
replayDropdown.width = this.width-30-8-80-modeWidth-4;
|
||||
@@ -155,6 +155,7 @@ public class GuiReplayStudio extends GuiScreen {
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
drawDefaultBackground();
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
currentTab.getStudioPart().drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
||||
drawCenteredString(fontRendererObj, "§n"+currentTab.getStudioPart().getTitle(), width/2, 92, Color.WHITE.getRGB());
|
||||
@@ -186,7 +187,7 @@ public class GuiReplayStudio extends GuiScreen {
|
||||
|
||||
drawCenteredString(fontRendererObj, "Replay Studio", this.width / 2, 10, 16777215);
|
||||
drawString(fontRendererObj, "Replay File:", 30, 67, Color.WHITE.getRGB());
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
||||
replayDropdown.drawTextBox();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import net.minecraft.client.Minecraft;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import eu.crushedpixel.replaymod.gui.GuiNumberInput;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiNumberInput;
|
||||
|
||||
public class GuiTrimPart extends GuiStudioPart {
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ import com.google.gson.Gson;
|
||||
import com.mojang.realmsclient.util.Pair;
|
||||
|
||||
import eu.crushedpixel.replaymod.api.client.holders.FileInfo;
|
||||
import eu.crushedpixel.replaymod.gui.GuiReplayListExtended;
|
||||
import eu.crushedpixel.replaymod.gui.GuiReplaySettings;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiReplayListExtended;
|
||||
import eu.crushedpixel.replaymod.gui.online.GuiUploadFile;
|
||||
import eu.crushedpixel.replaymod.online.authentication.AuthenticationHandler;
|
||||
import eu.crushedpixel.replaymod.recording.ConnectionEventHandler;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package eu.crushedpixel.replaymod.gui.replayviewer;
|
||||
|
||||
import eu.crushedpixel.replaymod.gui.GuiReplayListExtended;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiReplayListExtended;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class ReplayList extends GuiReplayListExtended {
|
||||
|
||||
Reference in New Issue
Block a user