public Persistence( Resource resource, Attributes.AttributesPersistence attributes, Actions.SkillInventoryPersistence skills, ARPG.Items.ItemInventoryPersistence items) : base(resource) { _resource = resource; _attributes = attributes; _skills = skills; _items = items; }
public override void Open() { if (_inventory == _context.Character.CharacterPersistence.Items) { return; } _inventory = _context.Character.CharacterPersistence.Items; Clear(); _slots = new ItemSlot[_inventory.Items.Length]; for (int i = 0; i < _inventory.Items.Length; i++) // in _inventory.Items) { _slots[i] = _slotTemplate.Create(_slotsParent, i); //, vslot); _slots[i].OnObjectBeginDragHandler += _context.OnObjectBeginDrag; _slots[i].OnObjectBeginDragHandler += OnObjectBeginDrag; _slots[i].OnObjectEndDragHandler += OnObjectEndDrag; _slots[i].OnObjectEndDragHandler += _context.OnInventoryObjectDragEnd; _slots[i].OnObjectUsed += OnObjectUsed; _slots[i].OnInventoryObjectDroppedHandler += OnObjectDropped; _slots[i].OnPointerEnterHandler += OnSlotPointerEnter; _slots[i].OnPointerExitHandler += OnSlotPointerExit; if (_inventory.Items[i] != null && !_inventory.Items[i].IsEmpty) { var obj = _objectTemplate.Create(_slots[i], _inventory.Items[i], _inventory); _slots[i].Store(obj); } } _height = _slots.Length / _width; if (_currentSlot == null) { SelectSlot(0); } }