Added PathPreviewRenderer to draw a Preview of the current Camera Path into the World
Added KeyframesModifyEvent to be dispatched whenever the ReplayHandler's Keyframe List is changed Refactored Event package Reworked Settings GUI
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
package eu.crushedpixel.replaymod.gui;
|
||||
|
||||
import eu.crushedpixel.replaymod.ReplayMod;
|
||||
import eu.crushedpixel.replaymod.settings.ReplaySettings;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiSettingsOnOffButton;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiToggleButton;
|
||||
import eu.crushedpixel.replaymod.settings.ReplaySettings.RecordingOptions;
|
||||
import eu.crushedpixel.replaymod.settings.ReplaySettings.RenderOptions;
|
||||
import eu.crushedpixel.replaymod.settings.ReplaySettings.ReplayOptions;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -16,20 +15,18 @@ import java.io.IOException;
|
||||
public class GuiReplaySettings extends GuiScreen {
|
||||
|
||||
//TODO: Move to GuiConstants
|
||||
private static final int QUALITY_SLIDER_ID = 9003;
|
||||
private static final int RECORDSERVER_ID = 9004;
|
||||
private static final int RECORDSP_ID = 9005;
|
||||
private static final int SEND_CHAT = 9006;
|
||||
private static final int FORCE_LINEAR = 9007;
|
||||
private static final int ENABLE_LIGHTING = 9008;
|
||||
private static final int FRAMERATE_SLIDER_ID = 9009;
|
||||
private static final int RESOURCEPACK_ID = 9010;
|
||||
private static final int WAITFORCHUNKS_ID = 9011;
|
||||
private static final int INDICATOR_ID = 9012;
|
||||
private static final int PATHPREVIEW_ID = 9013;
|
||||
protected String screenTitle = I18n.format("replaymod.gui.settings.title");
|
||||
private GuiScreen parentGuiScreen;
|
||||
private GuiButton recordServerButton, recordSPButton, sendChatButton, linearButton, lightingButton,
|
||||
resourcePackButton, waitForChunksButton, showIndicatorButton;
|
||||
private GuiToggleButton recordServerButton, recordSPButton, sendChatButton, linearButton, lightingButton,
|
||||
resourcePackButton, showIndicatorButton, pathPreviewButton;
|
||||
|
||||
public GuiReplaySettings(GuiScreen parentGuiScreen) {
|
||||
this.parentGuiScreen = parentGuiScreen;
|
||||
@@ -40,32 +37,31 @@ public class GuiReplaySettings extends GuiScreen {
|
||||
this.buttonList.clear();
|
||||
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height - 27, I18n.format("gui.done")));
|
||||
|
||||
ReplaySettings settings = ReplayMod.replaySettings;
|
||||
|
||||
int k = 0;
|
||||
int i = 0;
|
||||
|
||||
for(RecordingOptions o : RecordingOptions.values()) {
|
||||
|
||||
int xPos = this.width / 2 - 155 + i % 2 * 160;
|
||||
int yPos = this.height / 6 + 24 * (i >> 1);
|
||||
|
||||
if(o == RecordingOptions.notifications) {
|
||||
this.buttonList.add(sendChatButton = new GuiButton(SEND_CHAT,
|
||||
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20,
|
||||
I18n.format("replaymod.gui.settings.notifications")+": " + onOff(settings.isShowNotifications())));
|
||||
sendChatButton = new GuiSettingsOnOffButton(SEND_CHAT, xPos, yPos, 150, 20, o);
|
||||
this.buttonList.add(sendChatButton);
|
||||
|
||||
} else if(o == RecordingOptions.recordServer) {
|
||||
this.buttonList.add(recordServerButton = new GuiButton(RECORDSERVER_ID,
|
||||
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20,
|
||||
I18n.format("replaymod.gui.settings.recordserver")+": "
|
||||
+ onOff(settings.isEnableRecordingServer())));
|
||||
recordServerButton = new GuiSettingsOnOffButton(RECORDSERVER_ID, xPos, yPos, 150, 20, o);
|
||||
this.buttonList.add(recordServerButton);
|
||||
|
||||
} else if(o == RecordingOptions.recordSingleplayer) {
|
||||
this.buttonList.add(recordSPButton = new GuiButton(RECORDSP_ID, this.width / 2 - 155 + i % 2 * 160,
|
||||
this.height / 6 + 24 * (i >> 1), 150, 20, I18n.format("replaymod.gui.settings.recordsingleplayer")+": "
|
||||
+ onOff(settings.isEnableRecordingSingleplayer())));
|
||||
recordSPButton = new GuiSettingsOnOffButton(RECORDSP_ID, xPos, yPos, 150, 20, o);
|
||||
this.buttonList.add(recordSPButton);
|
||||
|
||||
} else if(o == RecordingOptions.indicator) {
|
||||
this.buttonList.add(showIndicatorButton = new GuiButton(INDICATOR_ID, this.width / 2 - 155 + i % 2 * 160,
|
||||
this.height / 6 + 24 * (i >> 1), 150, 20, I18n.format("replaymod.gui.settings.indicator")+": "+ onOff(settings.showRecordingIndicator())));
|
||||
showIndicatorButton = new GuiSettingsOnOffButton(INDICATOR_ID, xPos, yPos, 150, 20, o);
|
||||
this.buttonList.add(showIndicatorButton);
|
||||
}
|
||||
|
||||
++i;
|
||||
++k;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,48 +70,34 @@ public class GuiReplaySettings extends GuiScreen {
|
||||
}
|
||||
|
||||
for(ReplayOptions o : ReplayOptions.values()) {
|
||||
|
||||
int xPos = this.width / 2 - 155 + i % 2 * 160;
|
||||
int yPos = this.height / 6 + 24 * (i >> 1);
|
||||
|
||||
if(o == ReplayOptions.lighting) {
|
||||
this.buttonList.add(lightingButton = new GuiButton(ENABLE_LIGHTING, this.width / 2 - 155 + i % 2 * 160,
|
||||
this.height / 6 + 24 * (i >> 1), 150, 20, I18n.format("replaymod.gui.settings.lighting")+": " + onOff(settings.isLightingEnabled())));
|
||||
lightingButton = new GuiSettingsOnOffButton(ENABLE_LIGHTING, xPos, yPos, 150, 20, o);
|
||||
this.buttonList.add(lightingButton);
|
||||
|
||||
} else if(o == ReplayOptions.linear) {
|
||||
this.buttonList.add(linearButton = new GuiButton(FORCE_LINEAR, this.width / 2 - 155 + i % 2 * 160,
|
||||
this.height / 6 + 24 * (i >> 1), 150, 20, I18n.format("replaymod.gui.settings.interpolation")+": " + linearOnOff(settings.isLinearMovement())));
|
||||
linearButton = new GuiSettingsOnOffButton(FORCE_LINEAR, xPos, yPos, 150, 20, o,
|
||||
I18n.format("replaymod.gui.settings.interpolation.linear"), I18n.format("replaymod.gui.settings.interpolation.cubic"));
|
||||
this.buttonList.add(linearButton);
|
||||
|
||||
} else if(o == ReplayOptions.useResources) {
|
||||
this.buttonList.add(resourcePackButton = new GuiButton(RESOURCEPACK_ID, this.width / 2 - 155 + i % 2 * 160,
|
||||
this.height / 6 + 24 * (i >> 1), 150, 20, I18n.format("replaymod.gui.settings.resources")+": " + onOff(settings.getUseResourcePacks())));
|
||||
resourcePackButton = new GuiSettingsOnOffButton(RESOURCEPACK_ID, xPos, yPos, 150, 20, o);
|
||||
this.buttonList.add(resourcePackButton);
|
||||
|
||||
} else if(o == ReplayOptions.previewPath) {
|
||||
pathPreviewButton = new GuiSettingsOnOffButton(PATHPREVIEW_ID, xPos, yPos, 150, 20, o);
|
||||
this.buttonList.add(pathPreviewButton);
|
||||
}
|
||||
|
||||
++i;
|
||||
++k;
|
||||
}
|
||||
|
||||
if(i % 2 == 1) {
|
||||
++i;
|
||||
}
|
||||
|
||||
for(RenderOptions o : RenderOptions.values()) {
|
||||
if(o == RenderOptions.videoFramerate) {
|
||||
this.buttonList.add(new GuiVideoFramerateSlider(FRAMERATE_SLIDER_ID,
|
||||
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), settings.getVideoFramerate(), I18n.format("replaymod.gui.settings.framerate")));
|
||||
} else if(o == RenderOptions.videoQuality) {
|
||||
this.buttonList.add(new GuiVideoQualitySlider(QUALITY_SLIDER_ID,
|
||||
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), (float) settings.getVideoQuality(), I18n.format("replaymod.gui.settings.quality")));
|
||||
} else if(o == RenderOptions.waitForChunks) {
|
||||
this.buttonList.add(waitForChunksButton = new GuiButton(WAITFORCHUNKS_ID, this.width / 2 - 155 + i % 2 * 160,
|
||||
this.height / 6 + 24 * (i >> 1), 150, 20, I18n.format("replaymod.gui.settings.forcechunks")+": " + onOff(settings.getWaitForChunks())));
|
||||
}
|
||||
|
||||
++i;
|
||||
++k;
|
||||
}
|
||||
}
|
||||
|
||||
private String onOff(boolean on) {
|
||||
return on ? I18n.format("options.on") : I18n.format("options.off");
|
||||
}
|
||||
|
||||
private String linearOnOff(boolean on) {
|
||||
return on ? I18n.format("replaymod.gui.settings.interpolation.linear") : I18n.format("replaymod.gui.settings.interpolation.cubic");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -136,54 +118,10 @@ public class GuiReplaySettings extends GuiScreen {
|
||||
case 200:
|
||||
this.mc.displayGuiScreen(this.parentGuiScreen);
|
||||
break;
|
||||
case RECORDSERVER_ID:
|
||||
boolean enabled = ReplayMod.replaySettings.isEnableRecordingServer();
|
||||
enabled = !enabled;
|
||||
recordServerButton.displayString = I18n.format("replaymod.gui.settings.recordserver")+": " + onOff(enabled);
|
||||
ReplayMod.replaySettings.setEnableRecordingServer(enabled);
|
||||
break;
|
||||
case RECORDSP_ID:
|
||||
enabled = ReplayMod.replaySettings.isEnableRecordingSingleplayer();
|
||||
enabled = !enabled;
|
||||
recordSPButton.displayString = I18n.format("replaymod.gui.settings.recordsingleplayer")+": " + onOff(enabled);
|
||||
ReplayMod.replaySettings.setEnableRecordingSingleplayer(enabled);
|
||||
break;
|
||||
case SEND_CHAT:
|
||||
enabled = ReplayMod.replaySettings.isShowNotifications();
|
||||
enabled = !enabled;
|
||||
sendChatButton.displayString = I18n.format("replaymod.gui.settings.notifications")+": " + onOff(enabled);
|
||||
ReplayMod.replaySettings.setShowNotifications(enabled);
|
||||
break;
|
||||
case FORCE_LINEAR:
|
||||
enabled = ReplayMod.replaySettings.isLinearMovement();
|
||||
enabled = !enabled;
|
||||
linearButton.displayString = I18n.format("replaymod.gui.settings.interpolation")+": " + linearOnOff(enabled);
|
||||
ReplayMod.replaySettings.setLinearMovement(enabled);
|
||||
break;
|
||||
case ENABLE_LIGHTING:
|
||||
enabled = ReplayMod.replaySettings.isLightingEnabled();
|
||||
enabled = !enabled;
|
||||
lightingButton.displayString = I18n.format("replaymod.gui.settings.lighting")+": " + onOff(enabled);
|
||||
ReplayMod.replaySettings.setLightingEnabled(enabled);
|
||||
break;
|
||||
case RESOURCEPACK_ID:
|
||||
enabled = ReplayMod.replaySettings.getUseResourcePacks();
|
||||
enabled = !enabled;
|
||||
resourcePackButton.displayString = I18n.format("replaymod.gui.settings.resources")+": " + onOff(enabled);
|
||||
ReplayMod.replaySettings.setUseResourcePacks(enabled);
|
||||
break;
|
||||
case WAITFORCHUNKS_ID:
|
||||
enabled = ReplayMod.replaySettings.getWaitForChunks();
|
||||
enabled = !enabled;
|
||||
waitForChunksButton.displayString = I18n.format("replaymod.gui.settings.forcechunks")+": " + onOff(enabled);
|
||||
ReplayMod.replaySettings.setWaitForChunks(enabled);
|
||||
break;
|
||||
case INDICATOR_ID:
|
||||
enabled = ReplayMod.replaySettings.showRecordingIndicator();
|
||||
enabled = !enabled;
|
||||
showIndicatorButton.displayString = I18n.format("replaymod.gui.settings.indicator")+": " + onOff(enabled);
|
||||
ReplayMod.replaySettings.setEnableIndicator(enabled);
|
||||
break;
|
||||
}
|
||||
|
||||
if(button instanceof GuiToggleButton) {
|
||||
((GuiToggleButton) button).toggle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user