use of betterquesting.api.client.gui.controls.GuiButtonThemed in project BetterQuesting by Funwayguy.
the class GuiQuestEditor method initGui.
@Override
public void initGui() {
super.initGui();
this.setTitle(I18n.format("betterquesting.title.edit_quest", I18n.format(quest.getUnlocalisedName())));
if (lastEdit != null) {
NBTTagCompound prog = new NBTTagCompound();
quest.writeToNBT(prog, EnumSaveType.PROGRESS);
quest.readFromNBT(lastEdit, EnumSaveType.CONFIG);
quest.readFromNBT(prog, EnumSaveType.PROGRESS);
lastEdit = null;
SendChanges();
}
titleField = new GuiTextField(0, this.fontRenderer, width / 2 - 99, height / 2 - 68 + 1, 198, 18);
titleField.setMaxStringLength(Integer.MAX_VALUE);
titleField.setText(quest.getUnlocalisedName());
descField = new GuiBigTextField(this.fontRenderer, width / 2 - 99, height / 2 - 28 + 1, 198, 18).enableBigEdit(this);
descField.setMaxStringLength(Integer.MAX_VALUE);
descField.setText(quest.getUnlocalisedDescription());
GuiButtonThemed btn = new GuiButtonThemed(1, width / 2, height / 2 + 28, 100, 20, I18n.format("betterquesting.btn.rewards"), true);
this.buttonList.add(btn);
btn = new GuiButtonThemed(2, width / 2 - 100, height / 2 + 28, 100, 20, I18n.format("betterquesting.btn.tasks"), true);
this.buttonList.add(btn);
btn = new GuiButtonThemed(3, width / 2 - 100, height / 2 + 48, 100, 20, I18n.format("betterquesting.btn.requirements"), true);
this.buttonList.add(btn);
btn = new GuiButtonThemed(4, width / 2, height / 2 + 68, 100, 20, I18n.format("betterquesting.btn.advanced"), true);
this.buttonList.add(btn);
btnMain = new GuiButtonThemed(5, width / 2 - 100, height / 2 + 8, 200, 20, I18n.format("betterquesting.btn.is_main") + ": " + quest.getProperties().getProperty(NativeProps.MAIN), true);
this.buttonList.add(btnMain);
btnLogic = new GuiButtonThemed(6, width / 2, height / 2 + 48, 100, 20, I18n.format("betterquesting.btn.logic") + ": " + quest.getProperties().getProperty(NativeProps.LOGIC_QUEST), true);
this.buttonList.add(btnLogic);
btnVis = new GuiButtonThemed(7, width / 2 - 100, height / 2 + 68, 100, 20, I18n.format("betterquesting.btn.show") + ": " + quest.getProperties().getProperty(NativeProps.VISIBILITY), true);
this.buttonList.add(btnVis);
}
use of betterquesting.api.client.gui.controls.GuiButtonThemed in project BetterQuesting by Funwayguy.
the class GuiQuestLineDesigner method initGui.
@Override
public void initGui() {
super.initGui();
this.sizeX -= 96;
((GuiButton) this.buttonList.get(0)).x = guiLeft + sizeX / 2 - 100;
GuiQuestLinesEmbedded oldGui = qlGui;
qlGui = new GuiQuestLinesEmbedded(guiLeft + 16, guiTop + 16, sizeX - 32, sizeY - 32);
qlGui.setQuestLine(new QuestLineButtonTree(qLine), true);
if (// Preserve old settings
oldGui != null) {
embedded.remove(oldGui);
qlGui.copySettings(oldGui);
}
qlGui.clampScroll();
embedded.add(qlGui);
this.tabList.clear();
this.tabList.addAll(ToolboxRegistry.INSTANCE.getAllTools());
this.tabIndex = MathHelper.clamp(tabIndex, 0, Math.max(0, tabList.size() - 1));
for (IToolboxTab tab : tabList) {
tab.initTools(this.qlGui);
}
if (tabList.size() > 0) {
toolTab = tabList.get(tabIndex);
tabGui = toolTab.getTabGui(guiLeft + sizeX + 16, guiTop + 32, 64, sizeY - 48);
if (tabGui != null) {
embedded.add(tabGui);
}
}
GuiButtonThemed btnLeft = new GuiButtonThemed(1, guiLeft + sizeX, guiTop + 16, 16, 16, "<", true);
GuiButtonThemed btnRight = new GuiButtonThemed(2, guiLeft + sizeX + 80, guiTop + 16, 16, 16, ">", true);
if (tabList.size() <= 1) {
btnLeft.enabled = false;
btnRight.enabled = false;
}
buttonList.add(btnLeft);
buttonList.add(btnRight);
}
use of betterquesting.api.client.gui.controls.GuiButtonThemed in project BetterQuesting by Funwayguy.
the class GuiQuestLineEditorA method mouseClicked.
/**
* Called when the mouse is clicked.
*/
@Override
protected void mouseClicked(int mx, int my, int click) throws IOException {
lineTitle.mouseClicked(mx, my, click);
lineDesc.mouseClicked(mx, my, click);
if (selected != null) {
boolean flag = false;
if (!lineTitle.isFocused() && !lineTitle.getText().equals(selected.getUnlocalisedName())) {
selected.getProperties().setProperty(NativeProps.NAME, lineTitle.getText());
flag = true;
}
if (!lineDesc.isFocused() && !lineDesc.getText().equals(selected.getUnlocalisedDescription())) {
selected.getProperties().setProperty(NativeProps.DESC, lineDesc.getText());
flag = true;
}
if (flag) {
SendChanges(EnumPacketAction.EDIT, selected);
}
}
super.mouseClicked(mx, my, click);
GuiButtonThemed btn = click != 0 ? null : btnList.getButtonUnderMouse(mx, my);
if (btn != null && btn.mousePressed(mc, mx, my)) {
btn.playPressSound(mc.getSoundHandler());
this.actionPerformed(btn);
}
}
use of betterquesting.api.client.gui.controls.GuiButtonThemed in project BetterQuesting by Funwayguy.
the class GuiQuestLineEditorA method initGui.
@Override
public void initGui() {
super.initGui();
int btnWidth = sizeX / 2 - 16;
int sx = sizeX - 32;
lineTitle = new GuiTextField(0, mc.fontRenderer, guiLeft + sizeX / 2 + 9, guiTop + sizeY / 2 - 59, btnWidth - 18, 18);
lineTitle.setMaxStringLength(Integer.MAX_VALUE);
lineDesc = new GuiBigTextField(mc.fontRenderer, guiLeft + sizeX / 2 + 9, guiTop + sizeY / 2 - 19, btnWidth - 18, 18).enableBigEdit(this);
lineDesc.setMaxStringLength(Integer.MAX_VALUE);
this.buttonList.add(new GuiButtonThemed(1, guiLeft + 16, guiTop + sizeY - 48, (btnWidth - 16) / 2, 20, I18n.format("betterquesting.btn.new"), true));
GuiButtonThemed btnImport = new GuiButtonThemed(3, guiLeft + 16 + (btnWidth - 16) / 2, guiTop + sizeY - 48, (btnWidth - 16) / 2, 20, I18n.format("betterquesting.btn.import"), true);
this.buttonList.add(btnImport);
this.buttonList.add(new GuiButtonThemed(2, guiLeft + 16 + sx / 4 * 3 - 75, guiTop + sizeY / 2 + 20, 150, 20, I18n.format("betterquesting.btn.add_remove_quests"), true));
btnDesign = new GuiButtonThemed(4, guiLeft + 16 + sx / 4 * 3 - 75, guiTop + sizeY / 2 + 40, 150, 20, I18n.format("betterquesting.btn.designer"), true);
this.buttonList.add(btnDesign);
btnList = new GuiScrollingButtons(mc, guiLeft + 16, guiTop + 32, btnWidth - 8, sizeY - 80);
this.embedded.add(btnList);
if (selected != null) {
lineTitle.setText(selected.getUnlocalisedName());
lineDesc.setText(selected.getUnlocalisedDescription());
}
RefreshColumns();
}
use of betterquesting.api.client.gui.controls.GuiButtonThemed in project BetterQuesting by Funwayguy.
the class GuiQuestLineEditorA method RefreshColumns.
public void RefreshColumns() {
questList = QuestLineDatabase.INSTANCE.getAllKeys();
if (btnDesign != null) {
btnDesign.enabled = selected != null;
}
btnList.getEntryList().clear();
for (int qlid : questList) {
IQuestLine line = QuestLineDatabase.INSTANCE.getValue(qlid);
if (line == null) {
continue;
}
int bWidth = btnList.getListWidth();
// Offsets the quest line ID to avoid conflict with existing button IDs and reserves 2 bits for column index
int bID = (5 + qlid) << 2;
GuiButtonThemed btn1 = new GuiButtonThemed(bID + 0, 0, 0, bWidth - 40, 20, I18n.format(line.getUnlocalisedName()));
btn1.enabled = line != selected;
GuiButtonThemed btn2 = new GuiButtonThemed(bID + 1, 0, 0, 20, 20, "" + TextFormatting.RED + TextFormatting.BOLD + "x");
GuiButtonThemed btn3 = new GuiButtonThemed(bID + 2, 0, 0, 20, 20, "" + TextFormatting.YELLOW + TextFormatting.BOLD + "^");
btnList.addButtonRow(btn1, btn2, btn3);
}
}
Aggregations