예제 #1
0
 internal override void OnLoad()
 {
     // init code here..
     guiFuel = CreateAndBindGuiSlot(furnace.Fuel, 0, 5);
     guiInput = CreateAndBindGuiSlot(furnace.Input, 0, 7);
     guiProduct = CreateAndBindGuiSlot(furnace.Product, 2, 6);
     furnace.Progress += new EventHandler(furnace_Progress);
     furnace.Changed += new EventHandler(furnace_Changed);
     base.OnLoad();
 }
예제 #2
0
        private void Initialize()
        {
            buttonCreate = new GuiButton() { Size = new Vector2(130,10), Location = new Vector2(0,10), Text = "New Game" };
            buttonCreate.OnClick += new EventHandler<EventArgs>(button_OnClick);
            AddControl(buttonCreate);

            GuiPanel panel = new GuiPanel() { Size = new Vector2(110, 10), Location = new Vector2(20, 30) };
            label = new GuiLabel() { Size = new Vector2(0, 0), Location = new Vector2(0, 0), Center = true, Text = "", Color = new Vector4(0.7f, 0.7f, 0.7f, 1) };
            panel.AddControl(label);
            AddControl(panel);
            buttonGenerator = new GuiButton() { Size = new Vector2(10, 10), Location = new Vector2(0, 30), Text = "=" };
            buttonGenerator.OnClick += new EventHandler<EventArgs>(buttonGenerator_OnClick);
            AddControl(buttonGenerator);

            DataBind();
        }
예제 #3
0
        protected GuiPanel CreateAndBindGuiSlot(Slot slot, int x, int y)
        {
            GuiPanel panel = new GuiPanel()
            {
                Location = new SlimDX.Vector2(x * slotSize, y * slotSize),
                Size = new SlimDX.Vector2(slotSize, slotSize),
                Text = "",
                Tag = slot

            };
            panel.OnClick += new EventHandler<EventArgs>(slot_OnClick);
            AddControl(panel);

            // add moveable control...
            GuiStackControl guiStack = new GuiStackControl();
            guiStack.Size = new SlimDX.Vector2(GuiScaling.ItemSize, GuiScaling.ItemSize);
            guiStack.Tag = slot.Content;
            panel.AddControl(guiStack);
            guiStack.CenterInParent();
            BindControl(guiStack);

            return panel;
        }
예제 #4
0
 protected virtual void OnAfterPickUp(GuiPanel guiSlot, GuiStackControl guiStack, Slot slot)
 {
 }
예제 #5
0
 private void BindControl(GuiPanel guiCraftingProduct)
 {
     BindControl((GuiStackControl)guiCraftingProduct.Controls[0]);
 }
예제 #6
0
 protected virtual bool OnPickUp(GuiPanel guiSlot, GuiStackControl guiStack, Slot slot)
 {
     return false;
 }
예제 #7
0
 protected virtual bool OnBeforeTransfer(GuiPanel guiSlot, GuiStackControl guiStack, Slot slot)
 {
     return false;
 }
예제 #8
0
 protected virtual void OnAfterTransfer(GuiPanel guiSlot, GuiStackControl guiStack, Slot slot)
 {
 }
예제 #9
0
        private void Initialize()
        {
            for (int i = 0; i < 9; i++)
            {
                int x = i % 3;
                int y = i / 3;

                guiCraftingSlots[i] = CreateAndBindGuiSlot(craftingTable.Grid[y * 3 + x], x, 7 - y);
            }
            guiProduct = CreateAndBindGuiSlot(craftingTable.Product, 4, 6);
        }
예제 #10
0
        private void Initialize()
        {
            for (int i = 0; i < 4; i++)
            {
                int x = i % 2;
                int y = i / 2;

                guiCraftingSlots[i] = CreateAndBindGuiSlot(craftingTable.Grid[y * 3 + x], x, 6 - y);
            }
            guiProduct = CreateAndBindGuiSlot(craftingTable.Product, 3, 5);
        }