示例#1
0
 private void ItemRow_OnSelected(UCEItemRow itemRow)
 {
     if (itemRow.Selected)
     {
         SelectedItemRow?.Deselect();
         SelectedItemRow = itemRow;
         OnItemSelected?.Invoke(itemRow);
     }
     else
     {
         SelectedItemRow = null;
         OnItemSelected?.Invoke(null);
     }
 }
示例#2
0
        /* *** */

        public void Refresh()
        {
            spSpells.Children.Clear();

            if (Character == null)
            {
                return;
            }

            foreach (Object spell in Character.Spells)
            {
                UCEItemRow row = new UCEItemRow(spell, null, false);
                row.OnSelected += ItemRow_OnSelected;
                spSpells.Children.Add(row);
            }
        }
示例#3
0
        private void OnSpellSelected(UCEItemRow itemRow)
        {
            map.DeselectAll();

            inventoryPanel.DeselectAll();

            if (itemRow != null && itemRow.Selected)
            {
                SelectedObject = itemRow.Item;
            }
            else
            {
                SelectedObject = null;
            }

            Refresh();
        }
示例#4
0
        private void ItemRow_OnMoveClicked(UCEItemRow itemRow)
        {
            var slotSelectorDialog = new SlotSelectorDialog(itemRow.Item, Game);

            if (slotSelectorDialog.ShowDialog() == true)
            {
                if (slotSelectorDialog.SelectedSlot == SpecialSlots.Bag)
                {
                    Game.CurrentPlayer.Character.MoveItemToBag(itemRow.Item, Game.Config);
                }
                else
                {
                    Game.CurrentPlayer.Character.MoveItemToSlot(itemRow.Item, slotSelectorDialog.SelectedSlot, Game.Config);
                }

                Refresh();
            }
        }
示例#5
0
        /* *** */

        public void Refresh()
        {
            spSlotItems.Children.Clear();
            spBagItems.Children.Clear();

            if (Character == null)
            {
                return;
            }

            List <Object> slotItems = new List <Object>();

            foreach (var slot in Game.Config.CharacterConfig.InventorySlots)
            {
                string slotName = slot.Name;
                var    slotItem = Character.GetItemBySlot(slotName, Game.Config);

                if (slotItem != null)
                {
                    slotItems.Add(slotItem);
                    UCEItemRow row = new UCEItemRow(slotItem, slotName);
                    row.OnSelected    += ItemRow_OnSelected;
                    row.OnMoveClicked += ItemRow_OnMoveClicked;
                    spSlotItems.Children.Add(row);
                }
            }

            foreach (Object item in Character.Items)
            {
                if (!slotItems.Contains(item))
                {
                    UCEItemRow row = new UCEItemRow(item);
                    row.OnSelected    += ItemRow_OnSelected;
                    row.OnMoveClicked += ItemRow_OnMoveClicked;
                    spBagItems.Children.Add(row);
                }
            }
        }
示例#6
0
 public void DeselectAll()
 {
     SelectedItemRow?.Deselect();
     SelectedItemRow = null;
 }