Revamp Sound Selection Menu

This commit is contained in:
Kam committed 2024-03-12 21:36:14 -04:00
1 parent 14b430089e
commit b3846e32c8
8 files changed
+108 -380

No files matched your search

@@ -1,15 +1,13 @@
package noppes.npcs.client.gui.roles;
import net.minecraft.client.gui.GuiButton;
import noppes.npcs.client.NoppesUtil;
import noppes.npcs.client.gui.GuiNpcSoundSelection;
import noppes.npcs.client.gui.select.GuiSoundSelection;
import noppes.npcs.client.gui.util.*;
public class SubGuiNpcConversationLine extends SubGuiInterface implements ITextfieldListener{
public class SubGuiNpcConversationLine extends SubGuiInterface implements ITextfieldListener, ISubGuiListener {
public String line;
public String sound;
private GuiNpcSoundSelection gui;
public SubGuiNpcConversationLine(String line, String sound){
this.line = line;
this.sound = sound;
@@ -21,31 +19,27 @@ public class SubGuiNpcConversationLine extends SubGuiInterface implements ITextf
public void initGui(){
super.initGui();
addLabel(new GuiNpcLabel(0, "Line", guiLeft + 4, guiTop+ 10));
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 4, guiTop + 22, 200, 20, line));
addButton(new GuiNpcButton(1, guiLeft + 4, guiTop + 55, 90, 20, "Select Sound"));
addButton(new GuiNpcButton(2, guiLeft + 96, guiTop + 55, 20, 20, "X"));
addLabel(new GuiNpcLabel(1, sound, guiLeft + 4, guiTop + 81));
addButton(new GuiNpcButton(66, guiLeft + 162, guiTop + 192, 90, 20, "gui.done"));
}
public void unFocused(GuiNpcTextField textfield) {
line = textfield.getText();
}
@Override
public void unFocused(GuiNpcTextField textfield) {
line = textfield.getText();
}
@Override
public void elementClicked(){
sound = gui.getSelected();
}
protected void actionPerformed(GuiButton guibutton){
int id = guibutton.id;
if(id == 1){
gui = new GuiNpcSoundSelection(parent, sound);
NoppesUtil.openGUI(player, gui);
setSubGui(new GuiSoundSelection(sound));
}
if(id == 2){
sound = "";
@@ -56,4 +50,12 @@ public class SubGuiNpcConversationLine extends SubGuiInterface implements ITextf
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
GuiSoundSelection gss = (GuiSoundSelection) subgui;
if(gss.selectedResource != null) {
sound = gss.selectedResource.toString();
}
}
}