mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 19:59:36 +00:00
Added an info button to the challenges page.
This commit is contained in:
1 parent
734680bac7
commit
0f42db9d20
4 files changed
+75
-23
No files matched your search
@@ -43,6 +43,7 @@ import vazkii.botania.client.gui.GuiBotaniaConfig;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonAchievement;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonBookmark;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonCategory;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonChallengeInfo;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonChallenges;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonHistory;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonInvisible;
|
||||
@@ -257,7 +258,9 @@ public class GuiLexicon extends GuiScreen {
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton.id >= BOOKMARK_START) {
|
||||
if(par1GuiButton.id >= BOOKMARK_START + MAX_BOOKMARK_COUNT) {
|
||||
mc.displayGuiScreen(new GuiLexiconHistory());
|
||||
if(par1GuiButton instanceof GuiButtonChallengeInfo)
|
||||
mc.displayGuiScreen(new GuiLexiconEntry(LexiconData.challenges, this));
|
||||
else mc.displayGuiScreen(new GuiLexiconHistory());
|
||||
ClientTickHandler.notifyPageChange();
|
||||
} else handleBookmark(par1GuiButton);
|
||||
} else if(par1GuiButton instanceof GuiButtonCategory) {
|
||||
@@ -380,6 +383,8 @@ public class GuiLexicon extends GuiScreen {
|
||||
|
||||
if(isMainPage())
|
||||
buttonList.add(new GuiButtonHistory(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, StatCollector.translateToLocal("botaniamisc.history"), this));
|
||||
else if(isChallenge())
|
||||
buttonList.add(new GuiButtonChallengeInfo(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, StatCollector.translateToLocal("botaniamisc.info"), this));
|
||||
}
|
||||
|
||||
public static void startTutorial() {
|
||||
|
||||
@@ -21,24 +21,25 @@ import vazkii.botania.client.challenge.ModChallenges;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonBack;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonChallengeIcon;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonChallengeInfo;
|
||||
|
||||
public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
|
||||
GuiLexicon parent;
|
||||
GuiButton backButton;
|
||||
|
||||
|
||||
public GuiLexiconChallengesList() {
|
||||
parent = new GuiLexicon();
|
||||
title = StatCollector.translateToLocal("botaniamisc.challenges");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onInitGui() {
|
||||
super.onInitGui();
|
||||
title = StatCollector.translateToLocal("botaniamisc.challenges");
|
||||
|
||||
buttonList.add(backButton = new GuiButtonBack(12, left + guiWidth / 2 - 8, top + guiHeight + 2));
|
||||
|
||||
|
||||
int perline = 6;
|
||||
int i = 13;
|
||||
int y = top + 20;
|
||||
@@ -52,11 +53,11 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
y += 44;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
|
||||
|
||||
boolean unicode = fontRendererObj.getUnicodeFlag();
|
||||
fontRendererObj.setUnicodeFlag(true);
|
||||
for(EnumChallengeLevel level : EnumChallengeLevel.class.getEnumConstants()) {
|
||||
@@ -65,12 +66,12 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
for(Challenge c : list)
|
||||
if(c.complete)
|
||||
complete++;
|
||||
|
||||
|
||||
fontRendererObj.drawString(EnumChatFormatting.BOLD + StatCollector.translateToLocal(level.getName()) + EnumChatFormatting.RESET + " (" + complete + "/" + list.size() + ")", left + 20, top + 11 + level.ordinal() * 44, 0);
|
||||
}
|
||||
fontRendererObj.setUnicodeFlag(unicode);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
if(par2 == 14) // Backspace
|
||||
@@ -82,7 +83,7 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
|
||||
super.keyTyped(par1, par2);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int par1, int par2, int par3) {
|
||||
super.mouseClicked(par1, par2, par3);
|
||||
@@ -90,33 +91,32 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
if(par3 == 1)
|
||||
back();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton.id >= BOOKMARK_START)
|
||||
handleBookmark(par1GuiButton);
|
||||
else
|
||||
if(par1GuiButton.id == 12) {
|
||||
mc.displayGuiScreen(parent);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
} else if(par1GuiButton instanceof GuiButtonChallengeIcon) {
|
||||
GuiButtonChallengeIcon cbutton = (GuiButtonChallengeIcon) par1GuiButton;
|
||||
mc.displayGuiScreen(new GuiLexiconChallenge(this, cbutton.challenge));
|
||||
}
|
||||
super.actionPerformed(par1GuiButton);
|
||||
else if(par1GuiButton.id == 12) {
|
||||
mc.displayGuiScreen(parent);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
} else if(par1GuiButton instanceof GuiButtonChallengeIcon) {
|
||||
GuiButtonChallengeIcon cbutton = (GuiButtonChallengeIcon) par1GuiButton;
|
||||
mc.displayGuiScreen(new GuiLexiconChallenge(this, cbutton.challenge));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void back() {
|
||||
if(backButton.enabled) {
|
||||
actionPerformed(backButton);
|
||||
backButton.func_146113_a(mc.getSoundHandler());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setParent(GuiLexicon gui) {
|
||||
parent = gui;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
boolean isMainPage() {
|
||||
return false;
|
||||
@@ -141,5 +141,5 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
public GuiLexicon copy() {
|
||||
return new GuiLexiconChallengesList();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Jun 29, 2015, 7:42:52 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.gui.lexicon.button;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
|
||||
public class GuiButtonChallengeInfo extends GuiButtonLexicon {
|
||||
|
||||
GuiLexicon gui;
|
||||
|
||||
public GuiButtonChallengeInfo(int par1, int par2, int par3, String str, GuiLexicon gui) {
|
||||
super(par1, par2, par3, gui.bookmarkWidth(str) + 5, 11, str);
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int par2, int par3) {
|
||||
gui.drawBookmark(xPosition, yPosition, displayString, false);
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
List<String> tooltip = new ArrayList();
|
||||
tooltip.add(StatCollector.translateToLocal("botaniamisc.challengeInfo"));
|
||||
|
||||
int tooltipY = (tooltip.size() + 1) * 5;
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user