Ejemplo n.º 1
0
        public void SetItem(int i, Item item)
        {
            Action <Point2D>      itemTakeHandler     = (p) => ItemTake.Raise(i, p);
            Action <Point2D>      itemTransferHandler = (p) => ItemTransfer.Raise(i, p);
            Action <Point2D>      itemActHandler      = (p) => ItemAct.Raise(i, p);
            Action <KeyModifiers> itemInteractHandler = (mods) => ItemInteract.Raise(i);

            if (items[i] != null)
            {
                items[i].Take     -= itemTakeHandler;
                items[i].Transfer -= itemTransferHandler;
                items[i].Act      -= itemActHandler;
                items[i].Interact -= itemInteractHandler;
                items[i].Remove();
                items[i].Dispose();
            }

            if (item != null)
            {
                items[i]      = new ItemWidget(this, null);
                items[i].Item = item;
                items[i].Move(slotPositions[i].X, slotPositions[i].Y);

                items[i].Take     += itemTakeHandler;
                items[i].Transfer += itemTransferHandler;
                items[i].Act      += itemActHandler;
                items[i].Interact += itemInteractHandler;
            }
        }
Ejemplo n.º 2
0
        public Worship(Widget parent) : base(parent)
        {
            lblTitle           = new Label(this, Fonts.LabelText);
            lblTitle.TextAlign = TextAlign.Center;

            for (int i = 0; i < wishes.Length; i++)
            {
                var inv = new InventoryWidget(this);
                inv.Move(3 + i * 31, 122);
                inv.SetInventorySize(1, 1);
                wishes[i] = new ItemWidget(inv, null);
                wishes[i].Move(1, 1);
                wishes[i].Visible = false;
            }

            var btnForfeit = new Button(this, 80);

            btnForfeit.Text = "Forfeit";
            btnForfeit.Move(10, 160);
            btnForfeit.Click += () => Forfeit.Raise();

            lblNumen      = new Label(this, Fonts.LabelText);
            lblNumen.Text = "0";

            this.Resize(100, 200);
        }
Ejemplo n.º 3
0
        public void AddOutput(Item item)
        {
            var inv = new InventoryWidget(this);

            inv.SetInventorySize(1, 1);
            var itemWidget = new ItemWidget(inv, null);

            itemWidget.Item = item;

            int column = outputLayout.ColumnCount;

            outputLayout.AddWidget(inv, 0, column);
            outputLayout.SetColumnWidth(column, 31);
            outputLayout.UpdateGeometry(50, 65, 0, 0);

            outputs.Add(inv);
        }