Example #1
0
        private void render()
        {
            equipped = new EquipedItems(ApplicationState.Model.GetInventory(Character).Where(i => i.inventoryId != "MainInventory"));
            davinci.Children.Clear();
            Dictionary<string, Item> itemsAtPosition = equipped.GetItems();

            foreach (string key in itemsAtPosition.Keys)
            {
                Grid childGrid = new Grid();
                childGrid.Margin = new Thickness(1);

                Item gearAtLocation = itemsAtPosition[key];
                if (gearAtLocation == null)
                    continue;

                if (key.Contains("Weapon") || key.Contains("Offhand"))
                {
                    bool isAlt = key.StartsWith("Alt");
                    childGrid.Height = 187;
                    childGrid.Width = 93;
                    childGrid.VerticalAlignment = System.Windows.VerticalAlignment.Center;
                    childGrid.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;

                    if (!showAlts && isAlt)
                        continue;

                    if (showAlts && !isAlt)
                        continue;
                }

                Border border = getBorder();
                childGrid.Children.Add(border);

                childGrid.Children.Add(getImage(gearAtLocation));

                Canvas.SetTop(childGrid, absolutely[key].Item1);
                Canvas.SetLeft(childGrid, absolutely[key].Item2);

                davinci.Children.Add(childGrid);
            }
            this.davinci.Focus();
        }
Example #2
0
        //-----------------------------------------------------------------
        private void render()
        {
            itemViews = new Dictionary<string, UIElement>();
            var equippedGear = ApplicationState.Inventory[Character].Where(i => i.inventoryId != "MainInventory");
            equipped = new EquipedItems(equippedGear);
            equipped.PropertyChanged += equipped_PropertyChanged;
            //cashedEquipped = new EquipedItems(equippedGear);
            OnEquippedGearChanged(true);
            davinci.Children.Clear();
            Dictionary<string, Item> itemsAtPosition = equipped.GetItems();

            foreach (string key in itemsAtPosition.Keys)
            {
                Grid childGrid = new Grid();
                childGrid.Margin = new Thickness(1);

                Item gearAtLocation = itemsAtPosition[key];
                if (gearAtLocation == null)
                    continue;

                if (key.Contains("Weapon") || key.Contains("Offhand"))
                {
                    bool isAlt = key.StartsWith("Alt");
                    childGrid.Height = 187;
                    childGrid.Width = 93;
                    childGrid.VerticalAlignment = System.Windows.VerticalAlignment.Center;
                    childGrid.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;

                    if (!showAlts && isAlt)
                        continue;

                    if (showAlts && !isAlt)
                        continue;
                }

                Border border = getBorder();
                childGrid.Children.Add(border);

                UIElement itemView = getImage(gearAtLocation);
                childGrid.Children.Add(itemView);

                if (itemViews.ContainsKey(key))
                    itemViews[key] = childGrid;
                else
                    itemViews.Add(key, childGrid);

                Canvas.SetTop(childGrid, absolutely[key].Item1);
                Canvas.SetLeft(childGrid, absolutely[key].Item2);

                davinci.Children.Add(childGrid);
            }
            this.davinci.Focus();
        }