예제 #1
0
        internal override void OnLoad()
        {
            // Create gui stack in hand and bind it to local variable
            guiStackInHand = new GuiStackControl();
            guiStackInHand.Size = new SlimDX.Vector2(GuiScaling.ItemSize, GuiScaling.ItemSize);
            guiStackInHand.Tag = stackInHand;
            guiStackInHand.AttachToCursor();
            BindControl(guiStackInHand);

            // setup inventory
            GuiPanel panel;
            for (int i = 0; i < inventory.Slots.Length; i++)
            {
                int x = i % 9;
                int y = i / 9;
                if (y > 0) y++;
                panel = CreateAndBindGuiSlot(inventory.Slots[i], x, y);
            }

            // keep stack in hand in the foreground
            AddControl(guiStackInHand);
        }
예제 #2
0
 protected virtual void OnAfterPickUp(GuiPanel guiSlot, GuiStackControl guiStack, Slot slot)
 {
 }
예제 #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 void BindControl(GuiStackControl control)
 {
     EntityStack stack = (EntityStack)control.Tag;
     control.Text = stack.Count.ToString();
     control.Visible = stack.Count > 0;
 }
예제 #5
0
 protected virtual bool OnPickUp(GuiPanel guiSlot, GuiStackControl guiStack, Slot slot)
 {
     return false;
 }
예제 #6
0
 protected virtual bool OnBeforeTransfer(GuiPanel guiSlot, GuiStackControl guiStack, Slot slot)
 {
     return false;
 }
예제 #7
0
 protected virtual void OnAfterTransfer(GuiPanel guiSlot, GuiStackControl guiStack, Slot slot)
 {
 }