예제 #1
0
 /// <summary>
 ///     Creates a new <see cref="APatch" /> at the specified address.
 /// </summary>
 /// <param name="address">The address to begin the patch.</param>
 /// <param name="patchWith">The bytes to be written as the patch.</param>
 /// <param name="name">The name of the patch.</param>
 /// <returns>A patch object that exposes the required methods to apply and remove the patch.</returns>
 public APatch Create(IntPtr address, byte[] patchWith, string name)
 {
     if (InternalItems.ContainsKey(name))
     {
         return(InternalItems[name]);
     }
     InternalItems.Add(name, new APatch(address, patchWith, name, MemoryBase));
     return(InternalItems[name]);
 }
예제 #2
0
        protected void AddItem(ItemT item)
        {
            if (item == null)
            {
                throw new ArgumentException("Invalid argument");
            }

            if (InternalItems is null)
            {
                InternalItems = new List <ItemT>();
            }

            InternalItems.Add((ItemT)item.Clone());
        }
예제 #3
0
        /// <inheritdoc />
        public Task ExpandAsync()
        {
            if (InternalItems == null)
            {
                throw new InvalidOperationException("InternalItems is nukk");
            }
            InternalItems.Clear();
            var count = VisualTreeHelper.GetChildrenCount(Visual);

            for (int i = 0; i < count; i++)
            {
                InternalItems.Add(new VisualTreeNode {
                    Visual = VisualTreeHelper.GetChild(Visual, i) as Visual, TransformToSource = this.TransformToSource
                });
            }

            IsExpanded = true;
            return(Task.CompletedTask);
        }
예제 #4
0
 public void AddItem(IItem item, bool updateUI)
 {
     if (CheckIfExists(item.Data.UniqueUUID) == false) // We dont have the item when false
     {
         if (CanAddItem)
         {
             EventSystem.EventMessenger.Instance.Raise(new Events.EventBeforeAddInventoryItem(InventoryUUID, item, updateUI));
             InternalItems.Add(item);
             EventSystem.EventMessenger.Instance.Raise(new Events.EventAfterAddInventoryItem(InventoryUUID, item, updateUI));
         }
         else
         {
             Debug.LogWarning("The inventory is full with [" + InventoryMaxItems + "] items.");
         }
     }
     else
     {
         Debug.LogError("The item with the unique uuid of [" + item.Data.UniqueUUID + "] is already in the inventory.");
     }
 }