mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-25 06:24:26 +00:00
Clean Up Analyst Window
This commit is contained in:
1 parent
d2a9e62cb2
commit
ed3cfe12a1
7 files changed
+237
-242
No files matched your search
@@ -22,12 +22,12 @@ public class Control extends Widget implements ITooltipHelp, ITooltip {
|
||||
List<String> helpStrings;
|
||||
List<String> tooltipStrings;
|
||||
|
||||
public Control(IWidget parent, int x, int y, int width, int height) {
|
||||
public Control(IWidget parent, int xPos, int yPos, int width, int height) {
|
||||
super(parent);
|
||||
this.helpStrings = new ArrayList<>();
|
||||
this.tooltipStrings = new ArrayList<>();
|
||||
this.extraLevel = 0;
|
||||
this.setPosition(new Point(x, y));
|
||||
this.setPosition(new Point(xPos, yPos));
|
||||
this.setSize(new Point(width, height));
|
||||
this.initialise();
|
||||
}
|
||||
|
||||
@@ -86,39 +86,6 @@ public class AnalystPageMutations extends ControlAnalystPage {
|
||||
new ControlUnknownMutation(this, ox + dx, y, 44, 16);
|
||||
} else {
|
||||
new ControlResultantMutation(this, ox + dx, y, mutation, specificChance, system, mutation.getAllele0(), mutation.getAllele1());
|
||||
/*new Control(this, ox + dx, y, 44, 16) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
IAlleleSpecies firstSpecies = mutation.getAllele0();
|
||||
IAlleleSpecies secondSpecies = mutation.getAllele1();
|
||||
String comb = firstSpecies.getAlleleName() + " + " + secondSpecies.getAlleleName();
|
||||
addTooltip(comb);
|
||||
String chance = getMutationColour(mutation.getBaseChance()).getCode() + (int) mutation.getBaseChance() + "% " + I18N.localise(AnalystConstants.MUTATIONS_KEY + ".chance");
|
||||
if (specificChance != mutation.getBaseChance()) {
|
||||
chance = chance + getMutationColour(specificChance).getCode() + " (" + (int) specificChance + "% " + I18N.localise(AnalystConstants.MUTATIONS_KEY + ".currently") + ")";
|
||||
}
|
||||
addTooltip(chance);
|
||||
for (String condition : mutation.getSpecialConditions()) {
|
||||
addTooltip(condition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
RenderUtil.drawItem(Point.ZERO, system.getDefaultMember(mutation.getAllele0().getUID()));
|
||||
RenderUtil.drawItem(new Point(28, 0), system.getDefaultMember(mutation.getAllele1().getUID()));
|
||||
if (specificChance != mutation.getBaseChance()) {
|
||||
RenderUtil.setColour(getMutationColour(mutation.getBaseChance()).getColor());
|
||||
drawSprite(ModuleItems.iconAdd0);
|
||||
RenderUtil.setColour(getMutationColour(specificChance).getColor());
|
||||
drawSprite(ModuleItems.iconAdd1);
|
||||
} else {
|
||||
RenderUtil.setColour(getMutationColour(mutation.getBaseChance()).getColor());
|
||||
drawSprite(ModuleItems.iconAdd);
|
||||
}
|
||||
}
|
||||
};*/
|
||||
}
|
||||
dx = 52 - dx;
|
||||
if (dx == 0 || resultant.size() == 1) {
|
||||
@@ -145,41 +112,6 @@ public class AnalystPageMutations extends ControlAnalystPage {
|
||||
new ControlUnknownMutation(this, ox + dx, y, 44, 16);
|
||||
} else {
|
||||
new ControlFurtherMutation(this, ox + dx, y, mutation, specificChance, system, speciesCurrent, (IAlleleSpecies) speciesComb, (IAlleleSpecies) mutation.getTemplate()[0]);
|
||||
/*new Control(this, ox + dx, y, 44, 16) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
IAlleleSpecies firstSpecies = (IAlleleSpecies) speciesComb;
|
||||
IAlleleSpecies secondSpecies = (IAlleleSpecies) mutation.getTemplate()[0];
|
||||
addTooltip(secondSpecies.getAlleleName());
|
||||
String comb = speciesCurrent.getAlleleName() + " + " + firstSpecies.getAlleleName();
|
||||
addTooltip(comb);
|
||||
String chance = getMutationColour(mutation.getBaseChance()).getCode() + (int) mutation.getBaseChance() + "% " + I18N.localise(AnalystConstants.MUTATIONS_KEY + ".chance");
|
||||
if (specificChance2 != mutation.getBaseChance()) {
|
||||
chance = chance + getMutationColour(specificChance2).getCode() + " (" + (int) specificChance2 + "% " + I18N.localise(AnalystConstants.MUTATIONS_KEY + ".currently") + ")";
|
||||
}
|
||||
addTooltip(chance);
|
||||
for (String condition : mutation.getSpecialConditions()) {
|
||||
addTooltip(condition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
RenderUtil.drawItem(Point.ZERO, system.getDefaultMember(speciesComb.getUID()));
|
||||
RenderUtil.drawItem(new Point(28, 0), system.getDefaultMember(mutation.getTemplate()[0].getUID()));
|
||||
RenderUtil.setColour(getMutationColour(mutation.getBaseChance()).getColor());
|
||||
if (specificChance2 != mutation.getBaseChance()) {
|
||||
RenderUtil.setColour(getMutationColour(mutation.getBaseChance()).getColor());
|
||||
drawSprite(ModuleItems.iconArrow0);
|
||||
RenderUtil.setColour(getMutationColour(specificChance2).getColor());
|
||||
drawSprite(ModuleItems.iconArrow1);
|
||||
} else {
|
||||
RenderUtil.setColour(getMutationColour(mutation.getBaseChance()).getColor());
|
||||
drawSprite(ModuleItems.iconArrow);
|
||||
}
|
||||
}
|
||||
};*/
|
||||
}
|
||||
dx = 52 - dx;
|
||||
if (dx == 0 || further.size() == 1) {
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package binnie.genetics.gui.analyst;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.core.gui.CraftGUI;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.controls.scroll.ControlScrollBar;
|
||||
import binnie.core.gui.controls.scroll.ControlScrollableContent;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.minecraft.MinecraftGUI;
|
||||
import binnie.core.gui.renderer.RenderUtil;
|
||||
import binnie.core.gui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.core.gui.window.Panel;
|
||||
|
||||
public class AnalystPanel extends Panel {
|
||||
WindowAnalyst window;
|
||||
|
||||
public AnalystPanel(WindowAnalyst window) {
|
||||
super(window, 16, 54, 280, 164, MinecraftGUI.PanelType.OUTLINE);
|
||||
this.window = window;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
RenderUtil.drawGradientRect(getArea(), 1157627903, 1728053247);
|
||||
super.onRenderBackground(guiWidth, guiHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialise() {
|
||||
setColor(4473924);
|
||||
int sectionWidth = (getWidth() - 8 - 4) / 2;
|
||||
window.leftPage = new ControlScrollableContent<IWidget>(this, 3, 3, sectionWidth + 2, getHeight() - 8 + 2, 0) {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
if (getContent() == null) {
|
||||
return;
|
||||
}
|
||||
RenderUtil.setColour(getContent().getColor());
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.TAB_OUTLINE, getArea());
|
||||
}
|
||||
};
|
||||
new ControlScrollBar(this, sectionWidth + 2 - 3, 6, 3, getHeight() - 8 + 2 - 6, window.leftPage) {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
if (!isEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (window.leftPage.getContent() == null) {
|
||||
return;
|
||||
}
|
||||
RenderUtil.drawGradientRect(getArea(), 1140850688 + window.leftPage.getContent().getColor(), 1140850688 + window.leftPage.getContent().getColor());
|
||||
RenderUtil.drawSolidRect(getRenderArea(), window.leftPage.getContent().getColor());
|
||||
}
|
||||
};
|
||||
window.rightPage = new ControlScrollableContent<IWidget>(this, 3 + sectionWidth + 4, 3, sectionWidth + 2, getHeight() - 8 + 2, 0) {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
if (getContent() == null) {
|
||||
return;
|
||||
}
|
||||
RenderUtil.setColour(getContent().getColor());
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.TAB_OUTLINE, getArea());
|
||||
}
|
||||
};
|
||||
new ControlScrollBar(this, sectionWidth + 2 - 3 + sectionWidth + 4, 6, 3, getHeight() - 8 + 2 - 6, window.rightPage) {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
if (!isEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (window.rightPage.getContent() == null) {
|
||||
return;
|
||||
}
|
||||
RenderUtil.drawGradientRect(getArea(), 1140850688 + window.rightPage.getContent().getColor(), 1140850688 + window.rightPage.getContent().getColor());
|
||||
RenderUtil.drawSolidRect(getRenderArea(), window.rightPage.getContent().getColor());
|
||||
}
|
||||
};
|
||||
window.analystPageSize = new Area(1, 1, sectionWidth, getHeight() - 8);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package binnie.genetics.gui.analyst;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.core.gui.Attribute;
|
||||
import binnie.core.gui.CraftGUI;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.Tooltip;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.events.EventMouse;
|
||||
import binnie.core.gui.renderer.RenderUtil;
|
||||
import binnie.core.gui.resource.minecraft.CraftGUITexture;
|
||||
|
||||
public class ControlAnalystButton extends Control {
|
||||
ControlAnalystPage value;
|
||||
WindowAnalyst window;
|
||||
|
||||
public ControlAnalystButton(IWidget parent, int x, int y, int width, int height, WindowAnalyst window, ControlAnalystPage page) {
|
||||
super(parent, x, y, width, height);
|
||||
this.window = window;
|
||||
addAttribute(Attribute.MOUSE_OVER);
|
||||
this.value = page;
|
||||
addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
List<ControlAnalystPage> pages = window.analystPages;
|
||||
int currentIndex = pages.indexOf(window.rightPage.getContent());
|
||||
int clickedIndex = pages.indexOf(value);
|
||||
if (window.isDatabase) {
|
||||
if (clickedIndex != 0 && clickedIndex != currentIndex) {
|
||||
window.setPage(window.rightPage, value);
|
||||
}
|
||||
} else {
|
||||
if (clickedIndex < 0) {
|
||||
clickedIndex = 0;
|
||||
}
|
||||
if (clickedIndex < currentIndex) {
|
||||
++clickedIndex;
|
||||
}
|
||||
window.setPage(window.rightPage, null);
|
||||
window.setPage(window.leftPage, null);
|
||||
window.setPage(window.rightPage, pages.get(clickedIndex));
|
||||
window.setPage(window.leftPage, pages.get(clickedIndex - 1));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.add(value.getTitle());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
boolean active = value == window.leftPage.getContent() || value == window.rightPage.getContent();
|
||||
RenderUtil.setColour((active ? -16777216 : 1140850688) + value.getColor());
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.TAB_SOLID, getArea().inset(1));
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.popMatrix();
|
||||
RenderUtil.setColour(value.getColor());
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.TAB_OUTLINE, getArea().inset(1));
|
||||
super.onRenderBackground(guiWidth, guiHeight);
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ public abstract class ControlAnalystPage extends Control {
|
||||
|
||||
public abstract String getTitle();
|
||||
|
||||
//TODO: localise
|
||||
protected String getTimeString(int time) {
|
||||
int seconds = time / 20;
|
||||
int minutes = seconds / 60;
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package binnie.genetics.gui.analyst;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import binnie.core.gui.Attribute;
|
||||
import binnie.core.gui.CraftGUI;
|
||||
import binnie.core.gui.Tooltip;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.events.EventMouse;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.renderer.RenderUtil;
|
||||
import binnie.core.gui.resource.minecraft.CraftGUITexture;
|
||||
|
||||
public class ControlSystemButton extends Control {
|
||||
BreedingSystem system;
|
||||
WindowAnalyst window;
|
||||
|
||||
public ControlSystemButton(int xPos, int yPos, WindowAnalyst window, BreedingSystem system) {
|
||||
super(window, xPos, yPos, 20, 20);
|
||||
this.system = system;
|
||||
this.window = window;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialise() {
|
||||
addAttribute(Attribute.MOUSE_OVER);
|
||||
addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
window.setSystem(system);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.add(system.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
RenderUtil.setColour(system.getColour());
|
||||
int outset = (window.getSystem() == system) ? 1 : 0;
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.TAB_OUTLINE, getArea().outset(outset));
|
||||
if (window.getSystem() == system) {
|
||||
RenderUtil.setColour(1140850688 + system.getColour());
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.TAB_SOLID, getArea().outset(outset));
|
||||
}
|
||||
RenderUtil.drawItem(new Point(2, 2), system.getItemStackRepresentitive());
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -24,29 +23,20 @@ import binnie.Binnie;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import binnie.core.gui.Attribute;
|
||||
import binnie.core.gui.CraftGUI;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.Tooltip;
|
||||
import binnie.core.gui.Widget;
|
||||
import binnie.core.gui.controls.ControlTextCentered;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.controls.scroll.ControlScrollBar;
|
||||
import binnie.core.gui.controls.scroll.ControlScrollableContent;
|
||||
import binnie.core.gui.events.EventKey;
|
||||
import binnie.core.gui.events.EventMouse;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.geometry.Position;
|
||||
import binnie.core.gui.minecraft.InventoryType;
|
||||
import binnie.core.gui.minecraft.MinecraftGUI;
|
||||
import binnie.core.gui.minecraft.Window;
|
||||
import binnie.core.gui.minecraft.WindowInventory;
|
||||
import binnie.core.gui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.gui.minecraft.control.ControlSlide;
|
||||
import binnie.core.gui.minecraft.control.ControlSlot;
|
||||
import binnie.core.gui.renderer.RenderUtil;
|
||||
import binnie.core.gui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.core.gui.window.Panel;
|
||||
import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.core.util.I18N;
|
||||
@@ -157,37 +147,7 @@ public class WindowAnalyst extends Window {
|
||||
int y = 28;
|
||||
if (isDatabase) {
|
||||
for (BreedingSystem syst : Binnie.GENETICS.getActiveSystems()) {
|
||||
new Control(this, x, y, 20, 20) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
addAttribute(Attribute.MOUSE_OVER);
|
||||
addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
setSystem(syst);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.add(syst.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
RenderUtil.setColour(syst.getColour());
|
||||
int outset = (getSystem() == syst) ? 1 : 0;
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.TAB_OUTLINE, getArea().outset(outset));
|
||||
if (getSystem() == syst) {
|
||||
RenderUtil.setColour(1140850688 + syst.getColour());
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.TAB_SOLID, getArea().outset(outset));
|
||||
}
|
||||
RenderUtil.drawItem(new Point(2, 2), syst.getItemStackRepresentitive());
|
||||
}
|
||||
};
|
||||
new ControlSystemButton(x, y, this, system);
|
||||
x += 22;
|
||||
}
|
||||
} else {
|
||||
@@ -198,71 +158,7 @@ public class WindowAnalyst extends Window {
|
||||
setupValidators();
|
||||
}
|
||||
tabBar = new Control(this, x, 28, getWidth() - 16 - x, 20);
|
||||
analystPanel = new Panel(this, 16, 54, 280, 164, MinecraftGUI.PanelType.OUTLINE) {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
RenderUtil.drawGradientRect(getArea(), 1157627903, 1728053247);
|
||||
super.onRenderBackground(guiWidth, guiHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialise() {
|
||||
setColor(4473924);
|
||||
int sectionWidth = (getWidth() - 8 - 4) / 2;
|
||||
leftPage = new ControlScrollableContent<IWidget>(this, 3, 3, sectionWidth + 2, getHeight() - 8 + 2, 0) {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
if (getContent() == null) {
|
||||
return;
|
||||
}
|
||||
RenderUtil.setColour(getContent().getColor());
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.TAB_OUTLINE, getArea());
|
||||
}
|
||||
};
|
||||
new ControlScrollBar(this, sectionWidth + 2 - 3, 6, 3, getHeight() - 8 + 2 - 6, leftPage) {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
if (!isEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (leftPage.getContent() == null) {
|
||||
return;
|
||||
}
|
||||
RenderUtil.drawGradientRect(getArea(), 1140850688 + leftPage.getContent().getColor(), 1140850688 + leftPage.getContent().getColor());
|
||||
RenderUtil.drawSolidRect(getRenderArea(), leftPage.getContent().getColor());
|
||||
}
|
||||
};
|
||||
rightPage = new ControlScrollableContent<IWidget>(this, 3 + sectionWidth + 4, 3, sectionWidth + 2, getHeight() - 8 + 2, 0) {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
if (getContent() == null) {
|
||||
return;
|
||||
}
|
||||
RenderUtil.setColour(getContent().getColor());
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.TAB_OUTLINE, getArea());
|
||||
}
|
||||
};
|
||||
new ControlScrollBar(this, sectionWidth + 2 - 3 + sectionWidth + 4, 6, 3, getHeight() - 8 + 2 - 6, rightPage) {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
if (!isEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (rightPage.getContent() == null) {
|
||||
return;
|
||||
}
|
||||
RenderUtil.drawGradientRect(getArea(), 1140850688 + rightPage.getContent().getColor(), 1140850688 + rightPage.getContent().getColor());
|
||||
RenderUtil.drawSolidRect(getRenderArea(), rightPage.getContent().getColor());
|
||||
}
|
||||
};
|
||||
analystPageSize = new Area(1, 1, sectionWidth, getHeight() - 8);
|
||||
}
|
||||
};
|
||||
analystPanel = new AnalystPanel(this);
|
||||
if (!isDatabase) {
|
||||
slideUpInv = new ControlSlide(this, (getSize().xPos() - 244) / 2, getSize().yPos() - 80 + 1, 244, 80, Position.BOTTOM);
|
||||
new ControlPlayerInventory(slideUpInv, true);
|
||||
@@ -307,11 +203,27 @@ public class WindowAnalyst extends Window {
|
||||
analystPages.clear();
|
||||
setPage(leftPage, null);
|
||||
setPage(rightPage, null);
|
||||
createPages(databasePage);
|
||||
tabBar.deleteAllChildren();
|
||||
if (analystPages.size() > 0) {
|
||||
int width = tabBar.getWidth() / analystPages.size();
|
||||
int x = 0;
|
||||
for (ControlAnalystPage page : analystPages) {
|
||||
new ControlAnalystButton(tabBar, x, 0, width, tabBar.getHeight(), this, page);
|
||||
x += width;
|
||||
}
|
||||
setPage(leftPage, analystPages.get((oldLeft >= 0) ? oldLeft : 0));
|
||||
if (analystPages.size() > 1) {
|
||||
setPage(rightPage, analystPages.get((oldRight >= 0) ? oldRight : 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createPages(ControlAnalystPage databasePage){
|
||||
if (isDatabase) {
|
||||
analystPages.add((databasePage != null) ? databasePage : new AnalystPageDatabase(analystPanel, analystPageSize, currentSystem, isMaster));
|
||||
}
|
||||
if (current != null) {
|
||||
analystPanel.setOffset(new Point(0, 00));
|
||||
analystPages.add(new AnalystPageDescription(analystPanel, analystPageSize, current));
|
||||
analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, true, current));
|
||||
if (!isDatabase) {
|
||||
@@ -341,71 +253,6 @@ public class WindowAnalyst extends Window {
|
||||
}
|
||||
analystPages.add(new AnalystPageMutations(analystPanel, analystPageSize, current, isMaster));
|
||||
}
|
||||
tabBar.deleteAllChildren();
|
||||
if (analystPages.size() > 0) {
|
||||
int width = tabBar.getWidth() / analystPages.size();
|
||||
int x = 0;
|
||||
for (ControlAnalystPage page : analystPages) {
|
||||
new ControlTooltip(tabBar, x, 0, width, tabBar.getHeight()) {
|
||||
ControlAnalystPage value;
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.add(value.getTitle());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialise() {
|
||||
super.initialise();
|
||||
addAttribute(Attribute.MOUSE_OVER);
|
||||
value = page;
|
||||
addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
int currentIndex = analystPages.indexOf(rightPage.getContent());
|
||||
int clickedIndex = analystPages.indexOf(value);
|
||||
if (isDatabase) {
|
||||
if (clickedIndex != 0 && clickedIndex != currentIndex) {
|
||||
setPage(rightPage, value);
|
||||
}
|
||||
} else {
|
||||
if (clickedIndex < 0) {
|
||||
clickedIndex = 0;
|
||||
}
|
||||
if (clickedIndex < currentIndex) {
|
||||
++clickedIndex;
|
||||
}
|
||||
setPage(rightPage, null);
|
||||
setPage(leftPage, null);
|
||||
setPage(rightPage, analystPages.get(clickedIndex));
|
||||
setPage(leftPage, analystPages.get(clickedIndex - 1));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
boolean active = value == leftPage.getContent() || value == rightPage.getContent();
|
||||
RenderUtil.setColour((active ? -16777216 : 1140850688) + value.getColor());
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.TAB_SOLID, getArea().inset(1));
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.popMatrix();
|
||||
RenderUtil.setColour(value.getColor());
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.TAB_OUTLINE, getArea().inset(1));
|
||||
super.onRenderBackground(guiWidth, guiHeight);
|
||||
}
|
||||
};
|
||||
x += width;
|
||||
}
|
||||
setPage(leftPage, analystPages.get((oldLeft >= 0) ? oldLeft : 0));
|
||||
if (analystPages.size() > 1) {
|
||||
setPage(rightPage, analystPages.get((oldRight >= 0) ? oldRight : 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void shiftPages(boolean right) {
|
||||
|
||||
Reference in new issue
Block a user