mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-27 02:42:55 +00:00
Proper Reformating
This commit is contained in:
1 parent
ce75880aba
commit
180d257024
1179 files changed
+59847
-61583
No files matched your search
@@ -21,23 +21,22 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollData, ISubGuiListener,ICustomScrollListener, IGuiData, GuiYesNoCallback
|
||||
{
|
||||
private GuiCustomScroll catScroll;
|
||||
public GuiCustomScroll dialogScroll;
|
||||
public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollData, ISubGuiListener, ICustomScrollListener, IGuiData, GuiYesNoCallback {
|
||||
private GuiCustomScroll catScroll;
|
||||
public GuiCustomScroll dialogScroll;
|
||||
|
||||
private String prevCatName = "";
|
||||
private String prevDialogName = "";
|
||||
private String prevCatName = "";
|
||||
private String prevDialogName = "";
|
||||
|
||||
public DialogCategory category = new DialogCategory();
|
||||
public Dialog dialog = new Dialog();
|
||||
public String dialogQuestName = "";
|
||||
public DialogCategory category = new DialogCategory();
|
||||
public Dialog dialog = new Dialog();
|
||||
public String dialogQuestName = "";
|
||||
|
||||
private HashMap<String,Integer> catData = new HashMap<String,Integer>();
|
||||
public HashMap<String,Integer> dialogData = new HashMap<String,Integer>();
|
||||
private HashMap<String, Integer> catData = new HashMap<String, Integer>();
|
||||
public HashMap<String, Integer> dialogData = new HashMap<String, Integer>();
|
||||
|
||||
private String catSearch = "";
|
||||
private String diagSearch = "";
|
||||
private String catSearch = "";
|
||||
private String diagSearch = "";
|
||||
|
||||
private boolean isResizing = false;
|
||||
private int initialDragX = 0;
|
||||
@@ -49,14 +48,12 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollData
|
||||
private int dividerLineHeight = 20;
|
||||
private int dividerLineYOffset = 0;
|
||||
|
||||
public GuiNPCManageDialogs(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
public GuiNPCManageDialogs(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
PacketClient.sendClient(new DialogCategoriesGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
// Define overall horizontal region.
|
||||
@@ -88,33 +85,33 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollData
|
||||
addTextField(new GuiNpcTextField(55, this, fontRendererObj, regionLeft, guiTop + 4 + 3 + 185, dividerX - regionLeft, 20, catSearch));
|
||||
addTextField(new GuiNpcTextField(66, this, fontRendererObj, dividerX + dividerWidth, guiTop + 4 + 3 + 185, regionRight - (dividerX + dividerWidth), 20, diagSearch));
|
||||
|
||||
this.addButton(new GuiNpcButton(44,guiLeft + 3, guiTop + 8, 58, 20, "gui.categories"));
|
||||
getButton(44).setEnabled(false);
|
||||
this.addButton(new GuiNpcButton(4,guiLeft + 3, guiTop + 38, 58, 20, "gui.add"));
|
||||
this.addButton(new GuiNpcButton(5,guiLeft + 3, guiTop + 61, 58, 20, "gui.remove"));
|
||||
this.addButton(new GuiNpcButton(6,guiLeft + 3, guiTop + 94, 58, 20, "gui.edit"));
|
||||
this.addButton(new GuiNpcButton(44, guiLeft + 3, guiTop + 8, 58, 20, "gui.categories"));
|
||||
getButton(44).setEnabled(false);
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 3, guiTop + 38, 58, 20, "gui.add"));
|
||||
this.addButton(new GuiNpcButton(5, guiLeft + 3, guiTop + 61, 58, 20, "gui.remove"));
|
||||
this.addButton(new GuiNpcButton(6, guiLeft + 3, guiTop + 94, 58, 20, "gui.edit"));
|
||||
|
||||
this.addButton(new GuiNpcButton(33,guiLeft + 358, guiTop + 8, 58, 20, "dialog.dialogs"));
|
||||
getButton(33).setEnabled(false);
|
||||
this.addButton(new GuiNpcButton(0,guiLeft + 358, guiTop + 94, 58, 20, "gui.edit"));
|
||||
this.addButton(new GuiNpcButton(1,guiLeft + 358, guiTop + 38, 58, 20, "gui.add"));
|
||||
this.addButton(new GuiNpcButton(2,guiLeft + 358, guiTop + 61, 58, 20, "gui.remove"));
|
||||
this.addButton(new GuiNpcButton(3,guiLeft + 358, guiTop + 117, 58, 20, "gui.copy"));
|
||||
this.addButton(new GuiNpcButton(33, guiLeft + 358, guiTop + 8, 58, 20, "dialog.dialogs"));
|
||||
getButton(33).setEnabled(false);
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 358, guiTop + 94, 58, 20, "gui.edit"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 358, guiTop + 38, 58, 20, "gui.add"));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 358, guiTop + 61, 58, 20, "gui.remove"));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 358, guiTop + 117, 58, 20, "gui.copy"));
|
||||
|
||||
if(dialog != null) {
|
||||
if(dialog.id != -1){
|
||||
addLabel(new GuiNpcLabel(0, "ID", guiLeft + 358, guiTop + 4 + 3 + 185));
|
||||
addLabel(new GuiNpcLabel(1, dialog.id + "", guiLeft + 358, guiTop + 4 + 3 + 195));
|
||||
}
|
||||
}
|
||||
if (dialog != null) {
|
||||
if (dialog.id != -1) {
|
||||
addLabel(new GuiNpcLabel(0, "ID", guiLeft + 358, guiTop + 4 + 3 + 185));
|
||||
addLabel(new GuiNpcLabel(1, dialog.id + "", guiLeft + 358, guiTop + 4 + 3 + 195));
|
||||
}
|
||||
}
|
||||
|
||||
updateButtons();
|
||||
}
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
if(!hasSubGui()){
|
||||
if (!hasSubGui()) {
|
||||
int regionLeft = guiLeft + 64;
|
||||
int dividerX = regionLeft + dividerOffset; // dividerOffset remains your left-scroll width
|
||||
int regionTop = guiTop + 4;
|
||||
@@ -127,7 +124,7 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollData
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
if(!hasSubGui()){
|
||||
if (!hasSubGui()) {
|
||||
int regionLeft = guiLeft + 64;
|
||||
int dividerX = regionLeft + dividerOffset;
|
||||
int regionTop = guiTop + 4;
|
||||
@@ -191,249 +188,241 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollData
|
||||
super.mouseMovedOrUp(mouseX, mouseY, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
super.keyTyped(c, i);
|
||||
if(getTextField(55) != null){
|
||||
if(getTextField(55).isFocused()){
|
||||
if(catSearch.equals(getTextField(55).getText()))
|
||||
return;
|
||||
catSearch = getTextField(55).getText().toLowerCase();
|
||||
@Override
|
||||
public void keyTyped(char c, int i) {
|
||||
super.keyTyped(c, i);
|
||||
if (getTextField(55) != null) {
|
||||
if (getTextField(55).isFocused()) {
|
||||
if (catSearch.equals(getTextField(55).getText()))
|
||||
return;
|
||||
catSearch = getTextField(55).getText().toLowerCase();
|
||||
catScroll.resetScroll();
|
||||
catScroll.setList(getCatSearch());
|
||||
}
|
||||
}
|
||||
if(getTextField(66) != null){
|
||||
if(getTextField(66).isFocused()){
|
||||
if(diagSearch.equals(getTextField(66).getText()))
|
||||
return;
|
||||
diagSearch = getTextField(66).getText().toLowerCase();
|
||||
catScroll.setList(getCatSearch());
|
||||
}
|
||||
}
|
||||
if (getTextField(66) != null) {
|
||||
if (getTextField(66).isFocused()) {
|
||||
if (diagSearch.equals(getTextField(66).getText()))
|
||||
return;
|
||||
diagSearch = getTextField(66).getText().toLowerCase();
|
||||
dialogScroll.resetScroll();
|
||||
dialogScroll.setList(getDiagSearch());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void resetDiagList(){
|
||||
if(dialogScroll != null){
|
||||
diagSearch = "";
|
||||
if(getTextField(66) != null){
|
||||
getTextField(66).setText("");
|
||||
}
|
||||
dialogScroll.setList(getDiagSearch());
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getCatSearch(){
|
||||
if(catSearch.isEmpty()){
|
||||
return new ArrayList<String>(this.catData.keySet());
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String name : this.catData.keySet()){
|
||||
if(name.toLowerCase().contains(catSearch))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<String> getDiagSearch(){
|
||||
if(category != null){
|
||||
if(category.id < 0){
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
else {
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
|
||||
if(diagSearch.isEmpty()){
|
||||
return new ArrayList<String>(this.dialogData.keySet());
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String name : this.dialogData.keySet()){
|
||||
if(name.toLowerCase().contains(diagSearch))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void buttonEvent(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
// Edit Cat
|
||||
if(id == 6){
|
||||
if(category != null && category.id > -1){
|
||||
setSubGui(new SubGuiEditText(category.title));
|
||||
}
|
||||
else {
|
||||
getCategory(false);
|
||||
}
|
||||
dialogScroll.setList(getDiagSearch());
|
||||
}
|
||||
}
|
||||
// Add Cat
|
||||
if(id == 4){
|
||||
String name = "New";
|
||||
while(catData.containsKey(name))
|
||||
name += "_";
|
||||
|
||||
if(catScroll != null){
|
||||
setPrevCatName(name);
|
||||
}
|
||||
DialogCategory category = new DialogCategory();
|
||||
category.title = name;
|
||||
PacketClient.sendClient(new DialogCategorySavePacket(category.writeNBT(new NBTTagCompound())));
|
||||
}
|
||||
// Remove Cat
|
||||
if(id == 5){
|
||||
if(catData.containsKey(catScroll.getSelected())) {
|
||||
GuiYesNo guiyesno = new GuiYesNo(this, catScroll.getSelected(), StatCollector.translateToLocal("gui.delete"), 5);
|
||||
displayGuiScreen(guiyesno);
|
||||
}
|
||||
}
|
||||
if(category != null && category.id >= 0){
|
||||
// Add Dialog
|
||||
if(id == 1){
|
||||
String name = "New";
|
||||
while(dialogData.containsKey(name))
|
||||
name += "_";
|
||||
|
||||
if(dialogScroll != null){
|
||||
setPrevDialogName(name);
|
||||
}
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.title = name;
|
||||
PacketClient.sendClient(new DialogSavePacket(category.id, dialog.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
// Remove Dialog
|
||||
if(id == 2) {
|
||||
if (dialogData.containsKey(dialogScroll.getSelected())) {
|
||||
GuiYesNo guiyesno = new GuiYesNo(this, dialogScroll.getSelected(), StatCollector.translateToLocal("gui.delete"), 2);
|
||||
displayGuiScreen(guiyesno);
|
||||
}
|
||||
}
|
||||
// Edit Dialog
|
||||
if(id == 0) {
|
||||
if (dialogData.containsKey(dialogScroll.getSelected()) && dialog != null && dialog.id >= 0) {
|
||||
setSubGui(new SubGuiNpcDialog(this, dialog, category.id));
|
||||
}
|
||||
}
|
||||
// Clone Dialog
|
||||
if(id == 3) {
|
||||
if (dialogData.containsKey(dialogScroll.getSelected()) && dialog != null && dialog.id >= 0) {
|
||||
String name = dialog.title;
|
||||
while(dialogData.containsKey(name))
|
||||
name += "_";
|
||||
|
||||
if(dialogScroll != null){
|
||||
setPrevDialogName(name);
|
||||
}
|
||||
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.readNBTPartial(this.dialog.writeToNBT(new NBTTagCompound()));
|
||||
dialog.title = name;
|
||||
PacketClient.sendClient(new DialogSavePacket(category.id, dialog.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
public void updateButtons(){
|
||||
boolean enabled = category != null;
|
||||
if(enabled){
|
||||
if(!(category.id >= 0)){
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
public void resetDiagList() {
|
||||
if (dialogScroll != null) {
|
||||
diagSearch = "";
|
||||
if (getTextField(66) != null) {
|
||||
getTextField(66).setText("");
|
||||
}
|
||||
dialogScroll.setList(getDiagSearch());
|
||||
}
|
||||
}
|
||||
|
||||
boolean diagEnabled = dialogData != null;
|
||||
if(diagEnabled){
|
||||
if(dialog == null ||!(dialog.id >= 0)){
|
||||
diagEnabled = false;
|
||||
}
|
||||
}
|
||||
getButton(6).setEnabled(enabled);
|
||||
private List<String> getCatSearch() {
|
||||
if (catSearch.isEmpty()) {
|
||||
return new ArrayList<String>(this.catData.keySet());
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (String name : this.catData.keySet()) {
|
||||
if (name.toLowerCase().contains(catSearch))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
getButton(1).setEnabled(enabled);
|
||||
getButton(2).setEnabled(enabled);
|
||||
private List<String> getDiagSearch() {
|
||||
if (category != null) {
|
||||
if (category.id < 0) {
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
} else {
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
|
||||
getButton(0).setEnabled(enabled && diagEnabled);
|
||||
getButton(3).setEnabled(enabled && diagEnabled);
|
||||
}
|
||||
if (diagSearch.isEmpty()) {
|
||||
return new ArrayList<String>(this.dialogData.keySet());
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (String name : this.dialogData.keySet()) {
|
||||
if (name.toLowerCase().contains(diagSearch))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
if(compound.hasKey("DialogTitle")){
|
||||
dialog.readNBT(compound);
|
||||
if(compound.hasKey("DialogQuestName")){
|
||||
dialogQuestName = compound.getString("DialogQuestName");
|
||||
}
|
||||
else {
|
||||
dialogQuestName = "";
|
||||
}
|
||||
setPrevDialogName(dialog.title);
|
||||
}
|
||||
else {
|
||||
category.readNBT(compound);
|
||||
setPrevCatName(category.title);
|
||||
public void buttonEvent(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
// Edit Cat
|
||||
if (id == 6) {
|
||||
if (category != null && category.id > -1) {
|
||||
setSubGui(new SubGuiEditText(category.title));
|
||||
} else {
|
||||
getCategory(false);
|
||||
}
|
||||
}
|
||||
// Add Cat
|
||||
if (id == 4) {
|
||||
String name = "New";
|
||||
while (catData.containsKey(name))
|
||||
name += "_";
|
||||
|
||||
if (catScroll != null) {
|
||||
setPrevCatName(name);
|
||||
}
|
||||
DialogCategory category = new DialogCategory();
|
||||
category.title = name;
|
||||
PacketClient.sendClient(new DialogCategorySavePacket(category.writeNBT(new NBTTagCompound())));
|
||||
}
|
||||
// Remove Cat
|
||||
if (id == 5) {
|
||||
if (catData.containsKey(catScroll.getSelected())) {
|
||||
GuiYesNo guiyesno = new GuiYesNo(this, catScroll.getSelected(), StatCollector.translateToLocal("gui.delete"), 5);
|
||||
displayGuiScreen(guiyesno);
|
||||
}
|
||||
}
|
||||
if (category != null && category.id >= 0) {
|
||||
// Add Dialog
|
||||
if (id == 1) {
|
||||
String name = "New";
|
||||
while (dialogData.containsKey(name))
|
||||
name += "_";
|
||||
|
||||
if (dialogScroll != null) {
|
||||
setPrevDialogName(name);
|
||||
}
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.title = name;
|
||||
PacketClient.sendClient(new DialogSavePacket(category.id, dialog.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
// Remove Dialog
|
||||
if (id == 2) {
|
||||
if (dialogData.containsKey(dialogScroll.getSelected())) {
|
||||
GuiYesNo guiyesno = new GuiYesNo(this, dialogScroll.getSelected(), StatCollector.translateToLocal("gui.delete"), 2);
|
||||
displayGuiScreen(guiyesno);
|
||||
}
|
||||
}
|
||||
// Edit Dialog
|
||||
if (id == 0) {
|
||||
if (dialogData.containsKey(dialogScroll.getSelected()) && dialog != null && dialog.id >= 0) {
|
||||
setSubGui(new SubGuiNpcDialog(this, dialog, category.id));
|
||||
}
|
||||
}
|
||||
// Clone Dialog
|
||||
if (id == 3) {
|
||||
if (dialogData.containsKey(dialogScroll.getSelected()) && dialog != null && dialog.id >= 0) {
|
||||
String name = dialog.title;
|
||||
while (dialogData.containsKey(name))
|
||||
name += "_";
|
||||
|
||||
if (dialogScroll != null) {
|
||||
setPrevDialogName(name);
|
||||
}
|
||||
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.readNBTPartial(this.dialog.writeToNBT(new NBTTagCompound()));
|
||||
dialog.title = name;
|
||||
PacketClient.sendClient(new DialogSavePacket(category.id, dialog.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
public void updateButtons() {
|
||||
boolean enabled = category != null;
|
||||
if (enabled) {
|
||||
if (!(category.id >= 0)) {
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
boolean diagEnabled = dialogData != null;
|
||||
if (diagEnabled) {
|
||||
if (dialog == null || !(dialog.id >= 0)) {
|
||||
diagEnabled = false;
|
||||
}
|
||||
}
|
||||
getButton(6).setEnabled(enabled);
|
||||
|
||||
getButton(1).setEnabled(enabled);
|
||||
getButton(2).setEnabled(enabled);
|
||||
|
||||
getButton(0).setEnabled(enabled && diagEnabled);
|
||||
getButton(3).setEnabled(enabled && diagEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
if (compound.hasKey("DialogTitle")) {
|
||||
dialog.readNBT(compound);
|
||||
if (compound.hasKey("DialogQuestName")) {
|
||||
dialogQuestName = compound.getString("DialogQuestName");
|
||||
} else {
|
||||
dialogQuestName = "";
|
||||
}
|
||||
setPrevDialogName(dialog.title);
|
||||
} else {
|
||||
category.readNBT(compound);
|
||||
setPrevCatName(category.title);
|
||||
PacketClient.sendClient(new DialogsGetPacket(category.id, true));
|
||||
resetDiagList();
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
resetDiagList();
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui){
|
||||
if(subgui instanceof SubGuiEditText){
|
||||
if(!((SubGuiEditText)subgui).cancelled){
|
||||
if(category != null && category.id > -1){
|
||||
String name = ((SubGuiEditText)subgui).text;
|
||||
if(name != null && !name.equalsIgnoreCase(category.title)){
|
||||
if(!(name.isEmpty() || catData.containsKey(name))){
|
||||
String old = category.title;
|
||||
catData.remove(category.title);
|
||||
category.title = name;
|
||||
catData.put(category.title, category.id);
|
||||
catScroll.replace(old,category.title);
|
||||
}
|
||||
saveType(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
clearCategory();
|
||||
}
|
||||
if(subgui instanceof SubGuiNpcDialog){
|
||||
saveType(true);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
if (subgui instanceof SubGuiEditText) {
|
||||
if (!((SubGuiEditText) subgui).cancelled) {
|
||||
if (category != null && category.id > -1) {
|
||||
String name = ((SubGuiEditText) subgui).text;
|
||||
if (name != null && !name.equalsIgnoreCase(category.title)) {
|
||||
if (!(name.isEmpty() || catData.containsKey(name))) {
|
||||
String old = category.title;
|
||||
catData.remove(category.title);
|
||||
category.title = name;
|
||||
catData.put(category.title, category.id);
|
||||
catScroll.replace(old, category.title);
|
||||
}
|
||||
saveType(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
clearCategory();
|
||||
}
|
||||
if (subgui instanceof SubGuiNpcDialog) {
|
||||
saveType(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPrevCatName(String selectedCat){
|
||||
prevCatName = selectedCat;
|
||||
this.catScroll.setSelected(prevCatName);
|
||||
}
|
||||
public void setPrevCatName(String selectedCat) {
|
||||
prevCatName = selectedCat;
|
||||
this.catScroll.setSelected(prevCatName);
|
||||
}
|
||||
|
||||
public void setPrevDialogName(String selectedCat){
|
||||
prevDialogName = selectedCat;
|
||||
this.dialogScroll.setSelected(prevDialogName);
|
||||
}
|
||||
public void setPrevDialogName(String selectedCat) {
|
||||
prevDialogName = selectedCat;
|
||||
this.dialogScroll.setSelected(prevDialogName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if(guiCustomScroll.id == 0)
|
||||
{
|
||||
getCategory(false);
|
||||
}
|
||||
if(guiCustomScroll.id == 1)
|
||||
{
|
||||
getDialog(false);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if (guiCustomScroll.id == 0) {
|
||||
getCategory(false);
|
||||
}
|
||||
if (guiCustomScroll.id == 1) {
|
||||
getDialog(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void getCategory(boolean override){
|
||||
if(catScroll.selected != -1){
|
||||
String selected = catScroll.getSelected();
|
||||
if(!selected.equals(prevCatName) || override){
|
||||
category = new DialogCategory();
|
||||
public void getCategory(boolean override) {
|
||||
if (catScroll.selected != -1) {
|
||||
String selected = catScroll.getSelected();
|
||||
if (!selected.equals(prevCatName) || override) {
|
||||
category = new DialogCategory();
|
||||
|
||||
dialogScroll.selected = -1;
|
||||
dialogScroll.resetScroll();
|
||||
@@ -442,54 +431,54 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollData
|
||||
getTextField(66).setText("");
|
||||
|
||||
PacketClient.sendClient(new DialogCategoryGetPacket(catData.get(selected)));
|
||||
setPrevCatName(selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
setPrevCatName(selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void getDialog(boolean override){
|
||||
if(dialogScroll.selected != -1){
|
||||
String selected = dialogScroll.getSelected();
|
||||
if(!selected.equals(prevDialogName) || override){
|
||||
dialog = new Dialog();
|
||||
public void getDialog(boolean override) {
|
||||
if (dialogScroll.selected != -1) {
|
||||
String selected = dialogScroll.getSelected();
|
||||
if (!selected.equals(prevDialogName) || override) {
|
||||
dialog = new Dialog();
|
||||
DialogGetPacket.getDialog(dialogData.get(selected));
|
||||
setPrevDialogName(selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
setPrevDialogName(selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clearCategory(){
|
||||
catScroll.setList(getCatSearch());
|
||||
catScroll.selected = -1;
|
||||
prevCatName = "";
|
||||
category = new DialogCategory();
|
||||
this.dialogData.clear();
|
||||
resetDiagList();
|
||||
}
|
||||
public void clearCategory() {
|
||||
catScroll.setList(getCatSearch());
|
||||
catScroll.selected = -1;
|
||||
prevCatName = "";
|
||||
category = new DialogCategory();
|
||||
this.dialogData.clear();
|
||||
resetDiagList();
|
||||
}
|
||||
|
||||
public void saveType(boolean saveDiag){
|
||||
if(saveDiag){
|
||||
if(dialogScroll.selected != -1 && dialog.id >= 0){
|
||||
if(catScroll.selected != -1 && category.id >= 0){
|
||||
public void saveType(boolean saveDiag) {
|
||||
if (saveDiag) {
|
||||
if (dialogScroll.selected != -1 && dialog.id >= 0) {
|
||||
if (catScroll.selected != -1 && category.id >= 0) {
|
||||
PacketClient.sendClient(new DialogSavePacket(category.id, dialog.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(catScroll.selected != -1 && category.id >= 0)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (catScroll.selected != -1 && category.id >= 0)
|
||||
PacketClient.sendClient(new DialogCategorySavePacket(category.writeNBT(new NBTTagCompound())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void save() {}
|
||||
public void save() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
if(type == EnumScrollData.DIALOG_GROUP){
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
if (type == EnumScrollData.DIALOG_GROUP) {
|
||||
String name = dialogScroll.getSelected();
|
||||
this.dialogData = data;
|
||||
dialogScroll.setList(getDiagSearch());
|
||||
if(name != null){
|
||||
if (name != null) {
|
||||
dialogScroll.setSelected(name);
|
||||
getDialog(false);
|
||||
} else {
|
||||
@@ -500,7 +489,7 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollData
|
||||
String name = catScroll.getSelected();
|
||||
this.catData = data;
|
||||
catScroll.setList(getCatSearch());
|
||||
if(name != null){
|
||||
if (name != null) {
|
||||
catScroll.setSelected(name);
|
||||
getCategory(false);
|
||||
} else {
|
||||
@@ -508,24 +497,25 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollData
|
||||
getCategory(true);
|
||||
}
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {}
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmClicked(boolean result, int id) {
|
||||
NoppesUtil.openGUI(player, this);
|
||||
if(!result)
|
||||
if (!result)
|
||||
return;
|
||||
if(id == 5) {
|
||||
if(catData.containsKey(catScroll.getSelected())) {
|
||||
if (id == 5) {
|
||||
if (catData.containsKey(catScroll.getSelected())) {
|
||||
PacketClient.sendClient(new DialogCategoryRemovePacket(category.id));
|
||||
clearCategory();
|
||||
}
|
||||
}
|
||||
if(id == 2) {
|
||||
if (id == 2) {
|
||||
if (dialogData.containsKey(dialogScroll.getSelected())) {
|
||||
PacketClient.sendClient(new DialogRemovePacket(dialog.id, true));
|
||||
dialog = new Dialog();
|
||||
|
||||
Reference in new issue
Block a user