public BankControl()
        {
            InitializeComponent();

            for (int i = 0; i < bank_Grid.RowDefinitions.Count; i++)
            {
                for (int j = 0; j < bank_Grid.ColumnDefinitions.Count; j++)
                {
                    ItemControl itemControl = new ItemControl();
                    itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Bank[{0}]", (i * 4) + j));

                    Grid.SetRow(itemControl, i);
                    Grid.SetColumn(itemControl, j);
                    bank_Grid.Children.Add(itemControl);
                }
            }

            for (int i = 0; i < safe_Grid.RowDefinitions.Count; i++)
            {
                for (int j = 0; j < safe_Grid.ColumnDefinitions.Count; j++)
                {
                    ItemControl itemControl = new ItemControl();
                    itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Safe[{0}]", (i * 4) + j));

                    Grid.SetRow(itemControl, i);
                    Grid.SetColumn(itemControl, j);
                    safe_Grid.Children.Add(itemControl);
                }
            }
        }
        public EquipmentControl()
        {
            InitializeComponent();

            for (int i = 0; i < vanity_Grid.RowDefinitions.Count; i++)
            {
                ItemControl itemControl = new ItemControl();
                itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Vanity[{0}]", i));

                Grid.SetRow(itemControl, i);
                vanity_Grid.Children.Add(itemControl);
            }

            for (int i = 0; i < armor_Grid.RowDefinitions.Count; i++)
            {
                ItemControl itemControl = new ItemControl();
                itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Armor[{0}]", i));

                Grid.SetRow(itemControl, i);
                armor_Grid.Children.Add(itemControl);
            }

            for (int i = 0; i < accessory_Grid.RowDefinitions.Count; i++)
            {
                ItemControl itemControl = new ItemControl();
                itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Accessories[{0}]", i));

                Grid.SetRow(itemControl, i);
                accessory_Grid.Children.Add(itemControl);
            }
        }
        public InventoryControl()
        {
            InitializeComponent();

            for (int i = 0; i < inv_Grid.RowDefinitions.Count; i++)
            {
                for (int j = 0; j < inv_Grid.ColumnDefinitions.Count; j++)
                {
                    ItemControl itemControl = new ItemControl((i * 10) + j);
                    itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Inventory[{0}]", itemControl.Index));

                    Grid.SetRow(itemControl, i);
                    Grid.SetColumn(itemControl, j);
                    inv_Grid.Children.Add(itemControl);
                }
            }

            for (int i = 0; i < coin_Grid.RowDefinitions.Count; i++)
            {
                ItemControl itemControl = new ItemControl(i);
                itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Coins[{0}]", itemControl.Index));

                Grid.SetRow(itemControl, i);
                coin_Grid.Children.Add(itemControl);
            }

            for (int i = 0; i < ammo_Grid.RowDefinitions.Count; i++)
            {
                ItemControl itemControl = new ItemControl(i);
                itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Ammo[{0}]", itemControl.Index));

                Grid.SetRow(itemControl, i);
                ammo_Grid.Children.Add(itemControl);
            }
        }
Beispiel #4
0
        public BankControl()
        {
            InitializeComponent();

            for (int i = 0; i < bank_Grid.RowDefinitions.Count; i++)
            {
                for (int j = 0; j < bank_Grid.ColumnDefinitions.Count; j++)
                {
                    ItemControl itemControl = new ItemControl((i * 8) + j);
                    itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Bank[{0}]", itemControl.Index));

                    Grid.SetRow(itemControl, i);
                    Grid.SetColumn(itemControl, j);
                    bank_Grid.Children.Add(itemControl);
                }
            }

            for (int i = 0; i < safe_Grid.RowDefinitions.Count; i++)
            {
                for (int j = 0; j < safe_Grid.ColumnDefinitions.Count; j++)
                {
                    ItemControl itemControl = new ItemControl((i * 8) + j);
                    itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Safe[{0}]", itemControl.Index));

                    Grid.SetRow(itemControl, i);
                    Grid.SetColumn(itemControl, j);
                    safe_Grid.Children.Add(itemControl);
                }
            }
        }
Beispiel #5
0
        public EquipmentControl()
        {
            InitializeComponent();

            for (int i = 0; i < vanity_Grid.RowDefinitions.Count; i++)
            {
                ItemControl itemControl = new ItemControl();
                itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Vanity[{0}]", i));

                Grid.SetRow(itemControl, i);
                vanity_Grid.Children.Add(itemControl);
            }

            for (int i = 0; i < armor_Grid.RowDefinitions.Count; i++)
            {
                ItemControl itemControl = new ItemControl();
                itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Armor[{0}]", i));

                Grid.SetRow(itemControl, i);
                armor_Grid.Children.Add(itemControl);
            }

            for (int i = 0; i < accessory_Grid.RowDefinitions.Count; i++)
            {
                ItemControl itemControl = new ItemControl();
                itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Accessories[{0}]", i));

                Grid.SetRow(itemControl, i);
                accessory_Grid.Children.Add(itemControl);
            }
        }
        public InventoryControl()
        {
            InitializeComponent();

            for (int i = 0; i < inv_Grid.RowDefinitions.Count; i++)
            {
                for (int j = 0; j < inv_Grid.ColumnDefinitions.Count; j++)
                {
                    ItemControl itemControl = new ItemControl();
                    itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Inventory[{0}]", (i * 10) + j));

                    Grid.SetRow(itemControl, i);
                    Grid.SetColumn(itemControl, j);
                    inv_Grid.Children.Add(itemControl);
                }
            }

            for (int i = 0; i < coin_Grid.RowDefinitions.Count; i++)
            {
                ItemControl itemControl = new ItemControl();
                itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Coins[{0}]", i));

                Grid.SetRow(itemControl, i);
                coin_Grid.Children.Add(itemControl);
            }

            for (int i = 0; i < ammo_Grid.RowDefinitions.Count; i++)
            {
                ItemControl itemControl = new ItemControl();
                itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Ammo[{0}]", i));

                Grid.SetRow(itemControl, i);
                ammo_Grid.Children.Add(itemControl);
            }
        }
Beispiel #7
0
        protected override void OnDrop(DragEventArgs e)
        {
            base.OnDrop(e);
            if (e.Data.GetDataPresent("Item"))
            {
                ItemControl          itemControl = e.Data.GetData("Object") as ItemControl;
                TerrariaObjects.Item item        = e.Data.GetData("Item") as TerrariaObjects.Item;
                TerrariaObjects.Item tempItem    = MainWindow.player.Inventory[Index];

                MainWindow.player.Inventory[Index]             = item;
                MainWindow.player.Inventory[itemControl.Index] = tempItem;
                this.SetBinding(ItemControl.DataContextProperty, string.Format("Inventory[{0}]", Index));
                itemControl.SetBinding(ItemControl.DataContextProperty, string.Format("Inventory[{0}]", itemControl.Index));
                e.Effects = DragDropEffects.Move;
            }
            e.Handled = true;
        }
 private void Window_Deactivaged(object sender, EventArgs e)
 {
     ItemControl.CloseAllPopups();
     //BuffControl.CloseAllPopups();
 }