package net.minecraft.src;

import net.minecraft.src.PC_GresWidget.PC_GresAlign;

/**
 * 
 * 
 * @author MightyPork
 * @copy (c) 2012
 *
 */
public class PCma_GuiXPBank implements PC_IGresBase {

	private PCma_TileEntityXPBank xpbank;

	public PCma_GuiXPBank(PCma_TileEntityXPBank tex) {
		xpbank = tex;
	}

	@Override
	public EntityPlayer getPlayer() {
		return PC_Utils.mc().thePlayer;
	}

	@Override
	public void initGui(PC_IGresGui gui) {
		PC_GresWindow w = new PC_GresWindow(PC_Lang.tr("tile.PCmaXPBank.name"));
		w.setAlignH(PC_GresAlign.CENTER);
		
		PC_GresWidget vg, hg, hg1;
		
		hg = new PC_GresLayoutH().setAlignH(PC_GresAlign.CENTER);
		
		vg = new PC_GresLayoutV().setAlignH(PC_GresAlign.LEFT);

		vg.add(new PC_GresLabel(PC_Lang.tr("pc.gui.xpbank.levelsToWithdraw")));
		vg.add(new PC_GresLabel(PC_Lang.tr("pc.gui.xpbank.currentPlayerLevel")));
		vg.add(new PC_GresLabel(PC_Lang.tr("pc.gui.xpbank.levelsToDeposit")));
		hg.add(vg);
		
		// @formatter:off
		
		vg = new PC_GresLayoutV().setAlignH(PC_GresAlign.RIGHT);
		
		hg1 = new PC_GresLayoutH().setAlignH(PC_GresAlign.LEFT);
		hg1.add(new PC_GresLabel(PC_Lang.tr("pc.gui.xpbank.totalXp")).setMinWidth(100));
		hg1.add(new PC_GresLabel(xpbank.xp+"").setColor(PC_GresWidget.textColorEnabled, 0x00cc00));
		hg1.add(new PC_GresLabel(PC_Lang.tr("pc.gui.xpbank.xpUnit")));
		vg.add(hg1);
		
		hg1 = new PC_GresLayoutH().setAlignH(PC_GresAlign.LEFT);
		hg1.add(new PC_GresLabel(PC_Lang.tr("pc.gui.xpbank.currentPlayerPoints")).setMinWidth(100));
		hg1.add(new PC_GresLabel(getPlayer().experienceTotal+"").setColor(PC_GresWidget.textColorEnabled, 0x0000cc));
		hg1.add(new PC_GresLabel(PC_Lang.tr("pc.gui.xpbank.xpUnit")));
		vg.add(hg1);
		
		hg1 = new PC_GresLayoutH().setAlignH(PC_GresAlign.LEFT);
		hg1.add(new PC_GresLabel(PC_Lang.tr("pc.gui.xpbank.currentPlayerLevel")).setMinWidth(100));
		hg1.add(new PC_GresLabel(getPlayer().experienceTotal+"").setColor(PC_GresWidget.textColorEnabled, 0xcc00cc));
		hg1.add(new PC_GresLabel(PC_Lang.tr("pc.gui.xpbank.xpLevels")));
		vg.add(hg1);
		
		hg1 = new PC_GresLayoutH().setAlignH(PC_GresAlign.LEFT);
		hg1.add(new PC_GresLabel(PC_Lang.tr("pc.gui.xpbank.pointsToWithdraw")).setMinWidth(100));
		hg1.add(new PC_GresTextEdit(xpbank.xp+"", 8).setId(10));
		hg1.add(new PC_GresButton(PC_Lang.tr("pc.gui.xpbank.withdrawButton")).setId(11));
		vg.add(hg1);
		
		hg1 = new PC_GresLayoutH().setAlignH(PC_GresAlign.LEFT);
		hg1.add(new PC_GresLabel(PC_Lang.tr("pc.gui.xpbank.pointsToDeposit")).setMinWidth(100));
		hg1.add(new PC_GresTextEdit(xpbank.xp+"", 8).setId(10));
		hg1.add(new PC_GresButton(PC_Lang.tr("pc.gui.xpbank.withdrawButton")).setId(11));
		vg.add(hg1);


		vg.add(
				new PC_GresLayoutH().setAlignH(PC_GresAlign.LEFT).add(
						new PC_GresTextEdit("5", 8)).add(
								));
		
		vg.add(new PC_GresTextEdit(getPlayer().experienceLevel+"",8));
		
		vg.add(
				new PC_GresLayoutH().setAlignH(PC_GresAlign.LEFT).add(
						new PC_GresTextEdit("100", 8).setId(20)).add(
								new PC_GresButton(PC_Lang.tr("pc.gui.xpbank.depositButton")).setId(21)));
		// @formatter:on
		
		hg.add(vg);
		w.add(hg);
		
		gui.add(w);
		
	}

	@Override
	public void onGuiClosed(PC_IGresGui gui) {}

	@Override
	public void actionPerformed(PC_GresWidget widget, PC_IGresGui gui) {
		
	}

	@Override
	public void onEscapePressed(PC_IGresGui gui) {
		gui.close();
	}

	@Override
	public void onReturnPressed(PC_IGresGui gui) {
		gui.close();
	}

	@Override
	public void onCraftMatrixChanged(IInventory iinventory) {}

}
