Worked on armbot gui
This commit is contained in:
parent
aff4a8b6cd
commit
d91af32cd2
7 changed files with 142 additions and 521 deletions
|
@ -4,8 +4,10 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import universalelectricity.core.vector.Vector2;
|
||||
import dark.api.al.coding.args.ArgumentData;
|
||||
import dark.core.common.DarkMain;
|
||||
|
||||
/** @author DarkGuardsman */
|
||||
public interface ITask extends Cloneable
|
||||
|
@ -70,17 +72,22 @@ public interface ITask extends Cloneable
|
|||
/** Used mainly for display purposes in the encoder */
|
||||
public static enum TaskType
|
||||
{
|
||||
DATA("Data"),
|
||||
DEFINEDPROCESS("Defined Process"),
|
||||
PROCESS("Process"),
|
||||
DECISION("Decision"),
|
||||
START("Start"),
|
||||
END("End");
|
||||
public String name;
|
||||
DATA("Data", 4, 2),
|
||||
DEFINEDPROCESS("Defined Process", 2, 1),
|
||||
PROCESS("Process", 2, 2),
|
||||
DECISION("Decision", 2, 3),
|
||||
START("Start", 3, 5),
|
||||
END("End", 3, 5);
|
||||
public final String name;
|
||||
public final int uu, vv;
|
||||
|
||||
private TaskType(String name)
|
||||
public static final ResourceLocation TEXTURE = new ResourceLocation("dark", "textures/gui/gui_coder_icons.png");
|
||||
|
||||
private TaskType(String name, int uu, int vv)
|
||||
{
|
||||
this.name = name;
|
||||
this.uu = uu;
|
||||
this.vv = vv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
92
src/dark/assembly/client/gui/GuiEditTask.java
Normal file
92
src/dark/assembly/client/gui/GuiEditTask.java
Normal file
|
@ -0,0 +1,92 @@
|
|||
package dark.assembly.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import dark.core.common.DarkMain;
|
||||
import dark.core.prefab.invgui.GuiBase;
|
||||
import dark.core.prefab.machine.TileEntityMachine;
|
||||
|
||||
public class GuiEditTask extends GuiBase
|
||||
{
|
||||
public static final ResourceLocation TEXTURE = new ResourceLocation(DarkMain.getInstance().DOMAIN, DarkMain.GUI_DIRECTORY + "gui_base_machine.png");
|
||||
|
||||
int guiID = -1;
|
||||
protected TileEntityMachine tileEntity;
|
||||
protected EntityPlayer entityPlayer;
|
||||
protected Object mod;
|
||||
|
||||
public GuiEditTask(Object mod, int returnGuiID, EntityPlayer player, TileEntityMachine tileEntity)
|
||||
{
|
||||
this.tileEntity = tileEntity;
|
||||
this.entityPlayer = player;
|
||||
this.guiSize.y = 380 / 2;
|
||||
this.mod = mod;
|
||||
this.guiID = returnGuiID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
this.buttonList.clear();
|
||||
|
||||
this.buttonList.add(new GuiButton(0, (this.width - this.guiSize.intX()) / 2 - 22, (this.height - this.guiSize.intY()) / 2 + 0, "Edit"));
|
||||
|
||||
this.buttonList.add(new GuiButton(1, (this.width - this.guiSize.intX()) / 2 - 22, (this.height - this.guiSize.intY()) / 2 + 22, "Cancel"));
|
||||
|
||||
this.buttonList.add(new GuiButton(2, (this.width - this.guiSize.intX()) / 2 - 22, (this.height - this.guiSize.intY()) / 2 + 44, "Del"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button)
|
||||
{
|
||||
switch (button.id)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
//TODO apply changes to task
|
||||
entityPlayer.openGui(mod, guiID, tileEntity.worldObj, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
|
||||
entityPlayer.openGui(mod, guiID, tileEntity.worldObj, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
//TODO remove task from program
|
||||
entityPlayer.openGui(mod, guiID, tileEntity.worldObj, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Draw the foreground layer for the GuiContainer (everything in front of the items) */
|
||||
@Override
|
||||
protected void drawForegroundLayer(int x, int y, float var1)
|
||||
{
|
||||
this.fontRenderer.drawString("\u00a77" + tileEntity.getInvName(), (int) (this.guiSize.intX() / 2 - 7 * 2.5), 4, 4210752);
|
||||
}
|
||||
|
||||
/** Draw the background layer for the GuiContainer (everything behind the items) */
|
||||
@Override
|
||||
protected void drawBackgroundLayer(int x, int y, float var1)
|
||||
{
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
int containerWidth = (this.width - this.guiSize.intX()) / 2;
|
||||
int containerHeight = (this.height - this.guiSize.intY()) / 2;
|
||||
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.guiSize.intX(), this.guiSize.intY());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,178 +1,23 @@
|
|||
package dark.assembly.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.assembly.AssemblyLine;
|
||||
import dark.assembly.CommonProxy;
|
||||
import dark.assembly.machine.encoder.TileEntityEncoder;
|
||||
import dark.core.prefab.invgui.GuiBase;
|
||||
import dark.core.prefab.invgui.GuiButtonImage;
|
||||
import dark.core.client.gui.GuiMachineBase;
|
||||
import dark.core.prefab.machine.TileEntityMachine;
|
||||
|
||||
/** A base class for all ICBM Sentry GUIs.
|
||||
*
|
||||
* @author Calclavia */
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class GuiEncoderBase extends GuiBase
|
||||
public class GuiEncoderBase extends GuiMachineBase
|
||||
{
|
||||
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.instance.DOMAIN, AssemblyLine.GUI_DIRECTORY + "gui_base.png");
|
||||
|
||||
protected static final int MAX_BUTTON_ID = 3;
|
||||
protected TileEntityEncoder tileEntity;
|
||||
protected EntityPlayer entityPlayer;
|
||||
|
||||
public GuiEncoderBase(EntityPlayer player, TileEntityEncoder tileEntity)
|
||||
public GuiEncoderBase(EntityPlayer player, TileEntityMachine tileEntity)
|
||||
{
|
||||
this.tileEntity = tileEntity;
|
||||
this.entityPlayer = player;
|
||||
this.guiSize.y = 380 / 2;
|
||||
super(AssemblyLine.MOD_ID, player, tileEntity);
|
||||
this.guiID = CommonProxy.GUI_ENCODER;
|
||||
this.guiID2 = CommonProxy.GUI_ENCODER_CODE;
|
||||
this.guiID3 = CommonProxy.GUI_ENCODER_HELP;
|
||||
this.invName = "Main";
|
||||
this.invName2 = "Coder";
|
||||
this.invName3 = "Help";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
this.buttonList.clear();
|
||||
// Inventory
|
||||
this.buttonList.add(new GuiButtonImage(0, (this.width - this.guiSize.intX()) / 2 - 22, (this.height - this.guiSize.intY()) / 2 + 0, 3));
|
||||
// Coding
|
||||
this.buttonList.add(new GuiButtonImage(1, (this.width - this.guiSize.intX()) / 2 - 22, (this.height - this.guiSize.intY()) / 2 + 22, 0));
|
||||
// Help
|
||||
this.buttonList.add(new GuiButtonImage(2, (this.width - this.guiSize.intX()) / 2 - 22, (this.height - this.guiSize.intY()) / 2 + 44, 2));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button)
|
||||
{
|
||||
switch (button.id)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
this.entityPlayer.openGui(AssemblyLine.instance, CommonProxy.GUI_ENCODER, this.tileEntity.worldObj, this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
this.entityPlayer.openGui(AssemblyLine.instance, CommonProxy.GUI_ENCODER_CODE, this.tileEntity.worldObj, this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
this.entityPlayer.openGui(AssemblyLine.instance, CommonProxy.GUI_ENCODER_HELP, this.tileEntity.worldObj, this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Draw the foreground layer for the GuiContainer (everything in front of the items) */
|
||||
@Override
|
||||
protected void drawForegroundLayer(int x, int y, float var1)
|
||||
{
|
||||
this.fontRenderer.drawString("\u00a77" + "Encoder", (int) (this.guiSize.intX() / 2 - 7 * 2.5), 4, 4210752);
|
||||
/** Render Tool Tips */
|
||||
if (((GuiButtonImage) this.buttonList.get(0)).isIntersect(x, y))
|
||||
{
|
||||
this.drawTooltip(x - this.guiTopLeftCorner.intX(), y - this.guiTopLeftCorner.intY() + 10, "Inventory");
|
||||
}
|
||||
else if (((GuiButtonImage) this.buttonList.get(1)).isIntersect(x, y))
|
||||
{
|
||||
this.drawTooltip(x - this.guiTopLeftCorner.intX(), y - this.guiTopLeftCorner.intY() + 10, "Coder");
|
||||
}
|
||||
else if (((GuiButtonImage) this.buttonList.get(2)).isIntersect(x, y))
|
||||
{
|
||||
this.drawTooltip(x - this.guiTopLeftCorner.intX(), y - this.guiTopLeftCorner.intY() + 10, "Help");
|
||||
}
|
||||
}
|
||||
|
||||
/** Draw the background layer for the GuiContainer (everything behind the items) */
|
||||
@Override
|
||||
protected void drawBackgroundLayer(int x, int y, float var1)
|
||||
{
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
int containerWidth = (this.width - this.guiSize.intX()) / 2;
|
||||
int containerHeight = (this.height - this.guiSize.intY()) / 2;
|
||||
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.guiSize.intX(), this.guiSize.intY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTooltip(int x, int y, String... toolTips)
|
||||
{
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
if (toolTips != null)
|
||||
{
|
||||
int var5 = 0;
|
||||
int var6;
|
||||
int var7;
|
||||
|
||||
for (var6 = 0; var6 < toolTips.length; ++var6)
|
||||
{
|
||||
var7 = this.fontRenderer.getStringWidth(toolTips[var6]);
|
||||
|
||||
if (var7 > var5)
|
||||
{
|
||||
var5 = var7;
|
||||
}
|
||||
}
|
||||
|
||||
var6 = x + 12;
|
||||
var7 = y - 12;
|
||||
int var9 = 8;
|
||||
|
||||
if (toolTips.length > 1)
|
||||
{
|
||||
var9 += 2 + (toolTips.length - 1) * 10;
|
||||
}
|
||||
|
||||
if (this.guiTopLeftCorner.intY() + var7 + var9 + 6 > this.height)
|
||||
{
|
||||
var7 = this.height - var9 - this.guiTopLeftCorner.intY() - 6;
|
||||
}
|
||||
|
||||
this.zLevel = 300.0F;
|
||||
int var10 = -267386864;
|
||||
this.drawGradientRect(var6 - 3, var7 - 4, var6 + var5 + 3, var7 - 3, var10, var10);
|
||||
this.drawGradientRect(var6 - 3, var7 + var9 + 3, var6 + var5 + 3, var7 + var9 + 4, var10, var10);
|
||||
this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 + var9 + 3, var10, var10);
|
||||
this.drawGradientRect(var6 - 4, var7 - 3, var6 - 3, var7 + var9 + 3, var10, var10);
|
||||
this.drawGradientRect(var6 + var5 + 3, var7 - 3, var6 + var5 + 4, var7 + var9 + 3, var10, var10);
|
||||
int var11 = 1347420415;
|
||||
int var12 = (var11 & 16711422) >> 1 | var11 & -16777216;
|
||||
this.drawGradientRect(var6 - 3, var7 - 3 + 1, var6 - 3 + 1, var7 + var9 + 3 - 1, var11, var12);
|
||||
this.drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, var6 + var5 + 3, var7 + var9 + 3 - 1, var11, var12);
|
||||
this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 - 3 + 1, var11, var11);
|
||||
this.drawGradientRect(var6 - 3, var7 + var9 + 2, var6 + var5 + 3, var7 + var9 + 3, var12, var12);
|
||||
|
||||
for (int var13 = 0; var13 < toolTips.length; ++var13)
|
||||
{
|
||||
String var14 = "\u00a77" + toolTips[var13];
|
||||
|
||||
this.fontRenderer.drawStringWithShadow(var14, var6, var7, -1);
|
||||
|
||||
if (var13 == 0)
|
||||
{
|
||||
var7 += 2;
|
||||
}
|
||||
|
||||
var7 += 10;
|
||||
}
|
||||
|
||||
this.zLevel = 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.lwjgl.opengl.GL11;
|
|||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import dark.assembly.AssemblyLine;
|
||||
import dark.assembly.machine.encoder.TileEntityEncoder;
|
||||
import dark.core.client.gui.GuiMachineBase;
|
||||
|
||||
public class GuiEncoderCoder extends GuiEncoderBase
|
||||
{
|
||||
|
|
|
@ -1,181 +0,0 @@
|
|||
package dark.assembly.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.assembly.AssemblyLine;
|
||||
import dark.assembly.CommonProxy;
|
||||
import dark.assembly.machine.encoder.ContainerEncoder;
|
||||
import dark.assembly.machine.encoder.TileEntityEncoder;
|
||||
import dark.core.prefab.invgui.GuiButtonImage;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class GuiEncoderContainer extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.instance.DOMAIN, AssemblyLine.GUI_DIRECTORY + "gui_base.png");
|
||||
|
||||
protected static final int MAX_BUTTON_ID = 3;
|
||||
protected TileEntityEncoder tileEntity;
|
||||
protected EntityPlayer entityPlayer;
|
||||
|
||||
public GuiEncoderContainer(InventoryPlayer inventoryPlayer, TileEntityEncoder tileEntity)
|
||||
{
|
||||
super(new ContainerEncoder(inventoryPlayer, tileEntity));
|
||||
this.tileEntity = tileEntity;
|
||||
this.entityPlayer = inventoryPlayer.player;
|
||||
this.ySize = 380 / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
this.buttonList.clear();
|
||||
// Terminal
|
||||
this.buttonList.add(new GuiButtonImage(0, (this.width - this.xSize) / 2 - 22, (this.height - this.ySize) / 2 + 0, 3));
|
||||
// Access
|
||||
this.buttonList.add(new GuiButtonImage(1, (this.width - this.xSize) / 2 - 22, (this.height - this.ySize) / 2 + 22, 0));
|
||||
// Ammunition
|
||||
this.buttonList.add(new GuiButtonImage(2, (this.width - this.xSize) / 2 - 22, (this.height - this.ySize) / 2 + 44, 2));
|
||||
// Protection
|
||||
// this.buttonList.add(new GuiButtonImage(3, (this.width - this.xSize) /
|
||||
// 2 - 22,
|
||||
// (this.height - this.ySize) / 2 + 66, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button)
|
||||
{
|
||||
switch (button.id)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
this.entityPlayer.openGui(AssemblyLine.instance, CommonProxy.GUI_ENCODER, this.tileEntity.worldObj, this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
this.entityPlayer.openGui(AssemblyLine.instance, CommonProxy.GUI_ENCODER_CODE, this.tileEntity.worldObj, this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
this.entityPlayer.openGui(AssemblyLine.instance, CommonProxy.GUI_ENCODER_HELP, this.tileEntity.worldObj, this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Draw the foreground layer for the GuiContainer (everything in front of the items) */
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int x, int y)
|
||||
{
|
||||
this.fontRenderer.drawString("\u00a77" + "Encoder", (int) (this.xSize / 2 - 7 * 2.5), 4, 4210752);
|
||||
|
||||
/** Render Tool Tips */
|
||||
if (((GuiButtonImage) this.buttonList.get(0)).isIntersect(x, y))
|
||||
{
|
||||
this.drawTooltip(x - this.guiLeft, y - this.guiTop + 10, "Inventory");
|
||||
}
|
||||
else if (((GuiButtonImage) this.buttonList.get(1)).isIntersect(x, y))
|
||||
{
|
||||
this.drawTooltip(x - this.guiLeft, y - this.guiTop + 10, "Coder");
|
||||
}
|
||||
else if (((GuiButtonImage) this.buttonList.get(2)).isIntersect(x, y))
|
||||
{
|
||||
this.drawTooltip(x - this.guiLeft, y - this.guiTop + 10, "Help");
|
||||
}
|
||||
}
|
||||
|
||||
/** Draw the background layer for the GuiContainer (everything behind the items) */
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int x, int y)
|
||||
{
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
int containerWidth = (this.width - this.xSize) / 2;
|
||||
int containerHeight = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
public void drawTooltip(int x, int y, String... toolTips)
|
||||
{
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
if (toolTips != null)
|
||||
{
|
||||
int var5 = 0;
|
||||
int var6;
|
||||
int var7;
|
||||
|
||||
for (var6 = 0; var6 < toolTips.length; ++var6)
|
||||
{
|
||||
var7 = this.fontRenderer.getStringWidth(toolTips[var6]);
|
||||
|
||||
if (var7 > var5)
|
||||
{
|
||||
var5 = var7;
|
||||
}
|
||||
}
|
||||
|
||||
var6 = x + 12;
|
||||
var7 = y - 12;
|
||||
int var9 = 8;
|
||||
|
||||
if (toolTips.length > 1)
|
||||
{
|
||||
var9 += 2 + (toolTips.length - 1) * 10;
|
||||
}
|
||||
|
||||
if (this.guiTop + var7 + var9 + 6 > this.height)
|
||||
{
|
||||
var7 = this.height - var9 - this.guiTop - 6;
|
||||
}
|
||||
|
||||
this.zLevel = 300.0F;
|
||||
int var10 = -267386864;
|
||||
this.drawGradientRect(var6 - 3, var7 - 4, var6 + var5 + 3, var7 - 3, var10, var10);
|
||||
this.drawGradientRect(var6 - 3, var7 + var9 + 3, var6 + var5 + 3, var7 + var9 + 4, var10, var10);
|
||||
this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 + var9 + 3, var10, var10);
|
||||
this.drawGradientRect(var6 - 4, var7 - 3, var6 - 3, var7 + var9 + 3, var10, var10);
|
||||
this.drawGradientRect(var6 + var5 + 3, var7 - 3, var6 + var5 + 4, var7 + var9 + 3, var10, var10);
|
||||
int var11 = 1347420415;
|
||||
int var12 = (var11 & 16711422) >> 1 | var11 & -16777216;
|
||||
this.drawGradientRect(var6 - 3, var7 - 3 + 1, var6 - 3 + 1, var7 + var9 + 3 - 1, var11, var12);
|
||||
this.drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, var6 + var5 + 3, var7 + var9 + 3 - 1, var11, var12);
|
||||
this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 - 3 + 1, var11, var11);
|
||||
this.drawGradientRect(var6 - 3, var7 + var9 + 2, var6 + var5 + 3, var7 + var9 + 3, var12, var12);
|
||||
|
||||
for (int var13 = 0; var13 < toolTips.length; ++var13)
|
||||
{
|
||||
String var14 = "\u00a77" + toolTips[var13];
|
||||
|
||||
this.fontRenderer.drawStringWithShadow(var14, var6, var7, -1);
|
||||
|
||||
if (var13 == 0)
|
||||
{
|
||||
var7 += 2;
|
||||
}
|
||||
|
||||
var7 += 10;
|
||||
}
|
||||
|
||||
this.zLevel = 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,16 +9,25 @@ import cpw.mods.fml.client.FMLClientHandler;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.assembly.AssemblyLine;
|
||||
import dark.assembly.CommonProxy;
|
||||
import dark.assembly.machine.encoder.ContainerEncoder;
|
||||
import dark.assembly.machine.encoder.TileEntityEncoder;
|
||||
import dark.core.client.gui.GuiMachineContainer;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiEncoderInventory extends GuiEncoderContainer
|
||||
public class GuiEncoderInventory extends GuiMachineContainer
|
||||
{
|
||||
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.instance.DOMAIN, AssemblyLine.GUI_DIRECTORY + "gui_encoder_slot.png");
|
||||
|
||||
public GuiEncoderInventory(InventoryPlayer inventoryPlayer, TileEntityEncoder tileEntity)
|
||||
{
|
||||
super(inventoryPlayer, tileEntity);
|
||||
super(AssemblyLine.instance, new ContainerEncoder(inventoryPlayer, tileEntity), inventoryPlayer, tileEntity);
|
||||
this.guiID = CommonProxy.GUI_ENCODER;
|
||||
this.guiID2 = CommonProxy.GUI_ENCODER_CODE;
|
||||
this.guiID3 = CommonProxy.GUI_ENCODER_HELP;
|
||||
this.invName = "Main";
|
||||
this.invName2 = "Coder";
|
||||
this.invName3 = "Help";
|
||||
}
|
||||
|
||||
/** Draw the background layer for the GuiContainer (everything behind the items) */
|
||||
|
|
|
@ -22,18 +22,16 @@ import dark.assembly.armbot.command.TaskGOTO;
|
|||
import dark.assembly.armbot.command.TaskGive;
|
||||
import dark.assembly.armbot.command.TaskIF;
|
||||
import dark.assembly.armbot.command.TaskStart;
|
||||
import dark.core.common.DarkMain;
|
||||
import dark.core.interfaces.IScroll;
|
||||
|
||||
/** Not a gui itself but a component used to display task as a box inside of a gui
|
||||
*
|
||||
*
|
||||
* @author DarkGuardsman */
|
||||
public class GuiTaskList extends Gui implements IScroll
|
||||
{
|
||||
protected IProgram program;
|
||||
protected int scroll = 0;
|
||||
|
||||
private final int desiredH = 240;
|
||||
private final int desiredW = 427;
|
||||
private final float scale = 0.52f;
|
||||
|
||||
private int color = 14737632;
|
||||
|
@ -41,8 +39,6 @@ public class GuiTaskList extends Gui implements IScroll
|
|||
/** The string displayed on this control. */
|
||||
public String displayString;
|
||||
|
||||
public static final ResourceLocation TEXTURE_PROCESS = new ResourceLocation(AssemblyLine.instance.DOMAIN, AssemblyLine.GUI_DIRECTORY + "PROCESS.png");
|
||||
|
||||
public GuiTaskList()
|
||||
{
|
||||
program = new Program();
|
||||
|
@ -104,124 +100,12 @@ public class GuiTaskList extends Gui implements IScroll
|
|||
|
||||
public void drawConsole(Minecraft minecraft, int x, int y)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
//With everything scaled the gui will not align like a normal one so use a scaled distance from the main GUI
|
||||
ScaledResolution scaledresolution = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight);
|
||||
int scaleH = scaledresolution.getScaledHeight();
|
||||
int scaleW = scaledresolution.getScaledWidth();
|
||||
//this.drawCenteredString(minecraft.fontRenderer, "Scale - " + scaleW + "x " + scaleH + "y", 100, 100, color);
|
||||
|
||||
float sh = (scaleH / desiredH) / scale;
|
||||
float sW = (scaleW / desiredW) / scale;
|
||||
int spacingY = (int) (40 * sh);
|
||||
int spacingX = (int) (40 * sW);
|
||||
|
||||
//Start drawing after everying is scaled down
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
|
||||
//Draw lines between tasks
|
||||
color = Color.BLUE.getRGB();
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
int currentLine = i + this.scroll - 1;
|
||||
if (currentLine <= this.program.getSize().intY() + 1 && currentLine >= -1)
|
||||
{
|
||||
ITask task = this.program.getTaskAt(new Vector2(j, currentLine));
|
||||
if (currentLine == -1 && j == 0)
|
||||
{
|
||||
task = new TaskStart();
|
||||
}
|
||||
if (currentLine == this.program.getSize().intY() + 1 && j == 0)
|
||||
{
|
||||
task = new TaskEnd();
|
||||
}
|
||||
if (task != null)
|
||||
{
|
||||
if (task instanceof IRedirectTask && !((IRedirectTask) task).render())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
int xx = 50;
|
||||
int yy = 39;
|
||||
int uu = 0;
|
||||
int vv = 0;
|
||||
switch (task.getType())
|
||||
{
|
||||
case DATA:
|
||||
break;
|
||||
case PROCESS:
|
||||
break;
|
||||
case DEFINEDPROCESS:
|
||||
xx = 50;
|
||||
yy = 39;
|
||||
uu = 0;
|
||||
vv = 39;
|
||||
break;
|
||||
case DECISION:
|
||||
xx = 50;
|
||||
yy = 50;
|
||||
uu = 0;
|
||||
vv = 78;
|
||||
break;
|
||||
case START:
|
||||
case END:
|
||||
xx = 39;
|
||||
yy = 28;
|
||||
uu = 0;
|
||||
vv = 128;
|
||||
break;
|
||||
}
|
||||
Vector2 center = new Vector2(((x + 35) - xx) * sW + (spacingX / 2), (y + 25 - (yy / 2)) * sh + (spacingY * i));
|
||||
if (task instanceof ILogicTask)
|
||||
{
|
||||
for (Vector2 vec : ((ILogicTask) task).getExits())
|
||||
{
|
||||
//Task must be close so not to waste a shit ton of line rendering, as well it needs to stay on screen, and only be one column over
|
||||
if (vec.distanceTo(task.getPosition()) < 5)
|
||||
{
|
||||
if (vec.x >= task.getPosition().x)
|
||||
{
|
||||
this.drawHorizontalLine(center.intX(), center.intY(), center.intX() + (spacingX / 2), color);
|
||||
if (vec.y >= task.getPosition().y)
|
||||
{
|
||||
this.drawVerticalLine(center.intX() + (spacingX / 2), center.intY(), center.intY() + (spacingY * (vec.intY() - task.getPosition().intY())), color);
|
||||
}
|
||||
else if (vec.y < task.getPosition().y)
|
||||
{
|
||||
this.drawVerticalLine(center.intX() + (spacingX / 2), center.intY(), center.intY() - (spacingY * (task.getPosition().intY() - vec.intY())), color);
|
||||
}
|
||||
}
|
||||
else if (vec.x < task.getPosition().x)
|
||||
{
|
||||
this.drawHorizontalLine(center.intX(), center.intY(), center.intX() - (spacingX / 2), color);
|
||||
if (vec.y >= task.getPosition().y)
|
||||
{
|
||||
this.drawVerticalLine(center.intX() - (spacingX / 2), center.intY(), center.intY() + (spacingY * (vec.intY() - task.getPosition().intY())), color);
|
||||
}
|
||||
else if (vec.y < task.getPosition().y)
|
||||
{
|
||||
this.drawVerticalLine(center.intX() - (spacingX / 2), center.intY(), center.intY() - (spacingY * (task.getPosition().intY() - vec.intY())), color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drawVerticalLine(center.intX(), center.intY(), center.intY() + spacingY, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//Draw icons for task
|
||||
color = 14737632;
|
||||
for (int j = 0; j < 3; j++)
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ITask.TaskType.TEXTURE);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
for (int j = 0; j < 6; j++)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
int currentLine = i + this.scroll - 1;
|
||||
if (currentLine <= this.program.getSize().intY() + 1 && currentLine >= -1)
|
||||
|
@ -235,53 +119,17 @@ public class GuiTaskList extends Gui implements IScroll
|
|||
{
|
||||
task = new TaskEnd();
|
||||
}
|
||||
if (task != null)
|
||||
if (task != null && (!(task instanceof IRedirectTask) || task instanceof IRedirectTask && ((IRedirectTask) task).render()))
|
||||
{
|
||||
if (task instanceof IRedirectTask && !((IRedirectTask) task).render())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
int xx = 50;
|
||||
int yy = 39;
|
||||
int uu = 0;
|
||||
int vv = 0;
|
||||
switch (task.getType())
|
||||
{
|
||||
case DATA:
|
||||
break;
|
||||
case PROCESS:
|
||||
break;
|
||||
case DEFINEDPROCESS:
|
||||
xx = 50;
|
||||
yy = 39;
|
||||
uu = 0;
|
||||
vv = 39;
|
||||
break;
|
||||
case DECISION:
|
||||
xx = 50;
|
||||
yy = 50;
|
||||
uu = 0;
|
||||
vv = 78;
|
||||
break;
|
||||
case START:
|
||||
case END:
|
||||
xx = 39;
|
||||
yy = 28;
|
||||
uu = 0;
|
||||
vv = 128;
|
||||
break;
|
||||
}
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(GuiTaskList.TEXTURE_PROCESS);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Vector2 center = new Vector2((x + 35 - (xx / 2)) * sW + (spacingX * j), (y + 25 - (yy / 2)) * sh + (spacingY * i));
|
||||
this.drawTexturedModalRect(center.intX(), center.intY(), uu, vv, xx, yy);
|
||||
this.drawCenteredString(minecraft.fontRenderer, task.getMethodName(), center.intX() + (xx / 2), center.intY() + ((yy - 8) / 2), color);
|
||||
this.drawTexturedModalRect(x + 10 + (20 * j), y + 10 + (20 * i), 20 * task.getType().vv, 20 * task.getType().uu, 20, 20);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drawTexturedModalRect(x + 10 + (20 * j), y + 10 + (20 * i), 0, 40, 20, 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue