Search Unity

The InventorySystem - C# - Unity5 - New UI System (uGUI) - Extremely extensible!

Discussion in 'Works In Progress - Archive' started by jorisshh, Mar 4, 2015.

?

What features should be implemented into the InventorySystem package?

  1. Quest system

    33.3%
  2. Crafting system

    73.3%
  3. Buying/Selling from NPC's

    66.7%
  4. Item effects (healing potions, etc)

    40.0%
  5. Skeletal mesh bindng for models (Equipping items and merging bones on model and character)

    40.0%
  6. Integration with PlayMaker / iCode / etc

    0 vote(s)
    0.0%
  7. Integration with uFPS

    0 vote(s)
    0.0%
  8. Integration with some other package (Leave comment)

    0 vote(s)
    0.0%
Multiple votes are allowed.
Thread Status:
Not open for further replies.
  1. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522


    I launched a new Unity 5 Asset store package, an event driven Inventory system with loads of features build on Unity's new UI system.

    >> Asset store <<
    >> The demo <<



    In development:
    Vendor system (NPC buying selling + buy back)
    Crafting system with blueprints and categories. (Crafting, tailoring, etc...)

    Current features:
    Written in C#
    Mobile ready
    Fully customizable
    Looting
    Multiple inventories (Restrict inventory to categories and items of the category will be placed in it).
    Context menu (Right click item menu)
    Using / equipping items
    Skillbar with references
    Bank storing
    Unique item properties
    Stacking items
    Item categories with category cooldown
    Unstacking items
    Drop dialog
    Unstack dialog
    Item toolips
    Extending with bags (PRO ONLY!)
    Cleanup inventory (PRO ONLY!)
    Editor - Item creator
    Editor - Category creator
    Editor - Rarity creator
    Code - Event driven design
    Code - Extremely extensible
    Code - Well documented
    Code - uGUI (Unity GUI)
    Design - Complete RPG UI design (PRO ONLY!)

    Want to request a feature or report a bug? Please go to https://bitbucket.org/jorisshh/inventorysystemv2/issues

    Don't want to miss a thing?
    Stay updated through the mailing list.

    Completely Unity 5 ready.
     
    Last edited: Mar 14, 2015
  2. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    The PRO package is now also live at https://www.assetstore.unity3d.com/en/#!/content/31226 for those who want collection sorting (cleaning the inventory / bank (or any other collection), by sorting the items and re-stacking) + extensible collections by adding bags & a complete UI design (PSD).
     
  3. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    I hope this will work also on mobiles with drag and drop.
    Is it easy to skin it?
     
  4. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    I've added mobile support to the InventorySystem including unstacking and custom triggers for mobile that can be directly modified from the editor (See image below). (Package should be live in asset store in a few days)



    To answer your second question, yes the UI is completely skinable, items are placed inside the container, you can use uGUI's Grid / Horizontal / Vertical containers, or if you want more flexibility define the collection manually and create a fully flexible UI. And not only the layout can be modified, textures, icons, everything you can think of can be modified.


    Even the GameObjects created with the ItemManager can be edited and support custom components to allow full control.

    Hope this clears things up :).
     
  5. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    An in-depth look about customization

    Collections:
    All windows that can contain items are called "Collections". A collection is basically a glorified array that holds all the items and allows stacking, merging, swapping, etc. The basic collection (class ItemCollectionBase) has some default settings that allow quick and easy tweaking without having to dive into the code.

    • useReferences - This doesn't directly store the items inside the collection. When an item is placed inside the collection a reference is created.
    • InitialCollectionSize - This sets the size of the collection when the game starts. You can change this at run-time but be sure to instantiate UI elements accordingly (check documentation for more info).
    • container - The container is the parent of all inventory slots. You can easily create a grid / horizontal or vertical layout by using uGUI's buildin automatic layouts.
    • onlyAllowItemsOfType - This allows you to block items to a certain type. For example when extending the inventory there are 4 slots to place bags, by using the onlyAllowItemsOfType the collection can easily be limited to items of type bag. Example: This can also be useful if you want to limit a bag to only allow potions or consumable goods.
    • canDropFromCollection - Can you drop directly from the collection? Ignored if useReferences is enabled.
    • canUseFromCollection - Can an item be used directly from the given collection? Example: Can you use a potion directly from the bank?
    • canDragInCollection - Can items be re-arranged inside the collection? Disable if you want to have a static collection that the user cannot modify. For example a loot window.
    • canPutItemsInCollection - Can the user put items inside the collection or is it read only?
    • manuallyDefineCollection - If you don't want your collection to be auto-generated you can manually define it inside the Unity inspector.



    Interface:
    The interface is setup inside uGUI and is therefore completely adjustable to your needs. If you don't want to use certain elements, simply leave them empty, the system will handle the rest :).


    Tooltips
    Tooltips are shown when the user hovers over an item icon. These tooltips can be modified per item type. For example a consumable item might want to show how much health it regenerates while a weapon would likely want to show how much damage it deals.

    By default the tooltip shows some basic information, but you are in no way forced to use these.

    ConsumableInventoryItem (example item in project)

    Code (CSharp):
    1.  
    2.     public override LinkedList<InfoBox.Row[]> GetInfo()
    3.     {
    4.         var basic = base.GetInfo();
    5.         basic.AddFirst(new InfoBox.Row[]{
    6.                 new InfoBox.Row("Restore health", restoreHealth.ToString(), Color.green, Color.green),
    7.                 new InfoBox.Row("Restore mana", restoreMana.ToString(), Color.green, Color.green)
    8.             });
    9.  
    10.         return basic;
    11.     }
    12.  
    Each InfoBox.Row is treated as a row inside the UI, each row is separated by a euh.. separator. Obviously this is also modifiable.

    Inside the UI element you can define the layout and design of the tooltip.


    Extending the code
    (Almost) all classes inside the InventorySystem are marked partial. This means that if you create a class with the exact same name you can add functionality to the core features all without overriding core code. The compiler will auto. merge the files together. I highly encourage you to use this method, because it is the safest way to avoid problems with updates and conflicts.

    Example: So how does it work?
    The core system has 5 default item types.

    Let's say for the sake of this sample that we want to add extra functionality to the Consumable item type.

    All we have to do is create a new C# class and name it "public partial class ConsumableInventoryItem". Check the example below for a simple implementation.

    Code (CSharp):
    1.  
    2. public partial class ConsumableInventoryItem
    3. {
    4.     public int restoreDexterity;
    5.  
    6.     public void DoSomeAction()
    7.     {
    8.  
    9.     }
    10. }
    11.  
    All consumable items now contain a variable restoreDexterity and have an extra method DoSomeAction().
    This works with (almost) all core classes of the InventorySystem.
    Of course you also have the ability to inherit and override core functionality by using the override keyword in you classes.
     
    Last edited: Mar 7, 2015
  6. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    do you have a mobile demo ? ( without drag and drop )
     
  7. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Do you mean an APK to try on a mobile device / emulator?
     
  8. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    not necessary a webbuild would be fine, but currently there is no inventory that have "mobile support" they all support mouse input for drag and drop, i feel mobile inventory works better with buttons like [loot][equip][drop] etc..

    Also how do you manage item types, bonus stats? for example can i have guns weapons type with their own stats like dps, fire rate, bonus health, an other item that we can only loot/drop with no use and no stats, or having vehicle with their own stats, is it possible?
     
    Last edited: Mar 7, 2015
  9. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    I suppose you mean a context menu, something like Guild wars 2 (See screenshot)?

    This is currently not supported, but would be quite easy to create. Methods inside the InventorySystem can be overriden.
    The system uses a wrapper to separate the UI specific code from the actual inventory item logic. This allows you to create a new class lets call it "InventoryUIContextWrapper" which will extend the InventoryUIItemWrapper. Inside the class you can override the OnPointerUp method and add your own functionality such as a context menu.
    If this is a commonly requested feature I can build this into the core. Features and bugs can be reported / requested here: https://bitbucket.org/jorisshh/inventorysystemv2/issues

    For your second question, if I understand correctly, you want to assign specific stats to items? One way to do it would be to add a bunch of standard stats like addHealth addMana, etc. When the value is 0 you simply don't display it inside the UI, this allows a lot of simple editor tweaking and will likely save you a lot of time.

    If you however want to add very specific variables to an object you can create a new item type. Simply create a new class, extend from InventoryItemBase and implement all the variables you want / override the methods you want.

    Tooltip info is retreived through the GetInfo() method, which you can override, so you can manage the information shown per item type.

    If you're looking for the regular demo try this one.

    Hope this helps.
     
    Last edited: Mar 7, 2015
  10. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    If you like I can create a bit of sample code to implement a simple context menu, it can be done in ~50 lines of code.
     
  11. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    thanks that would be nice.

    for the Stats i used one other inventory assets(master inventory) that managed it like that: the stats are only data defined in inspector, so i could add any stat to any type of object, which make object creation really powerful

    only thing is its not easy to extend it for mobile, and even having 1 inventory = one type of items was not possible with this asset for example player inventory, quest inventory
     
  12. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Alright, I've started the creation on the metadata (adding the any stat to any item), this shouldn't take more than a day. For the context menu, I'll just implement it inside the core, it isn't to much work and likely a feature that more people would like.
     
  13. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    I've build the context menu into the core:


    The context menu can be manipulated per item type. You can of course disable the context menu and use the system without it.
    As for the metadata, I'm working on it :)
     
    Last edited: Mar 8, 2015
  14. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    And the metadata is also done. Decided to call them item properties.


    Properties can be added to any item type and you can add as many as you like. If Show? is toggled the item will be shown in the UI tooltip. By default the properties are shown at the bottom but you can of course override this in code and place them wherever you like.

    Properties can also be retrieved through code, I added some convenience properties to cast the editor strings to useful datatypes.


    Should be updated in the asset store in a few days.
     
    Last edited: Mar 8, 2015
  15. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    I will likely start production on the NPC buying & selling with buy back in the upcoming week, as this is a commonly requested feature.

    If anyone wants to make specific requests regarding the buying / selling, please do so now :).
     
  16. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    thats all great, do you have a road map ? like a simple crafting system where we also have a list of blueprint that are item, we can add them to bp list by using them, and craft is simple like item B = item A +C, is it possible?
     
  17. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    I've decided to build in the NPC system as well as the crafting system as these are the most requested features. You can expect these features by the end of next week.

    I'll hold off on the rest of the features for now, and see what will be requested by the community.
     
  18. fishZombie

    fishZombie

    Joined:
    Apr 28, 2014
    Posts:
    8
    Do you have any videos of this in action? Can you choose the layout of the inventory? For example: I want 2 columns of 8 rows, on the right side of the screen, or want 1 row, with 10 columns along the bottom of the screen. Can the size of the boxes be changed? How it appears? Can it slide in from off screen, or just pop up?
     
  19. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Everything you just described is possible and very easy to do. I'll be sure to record a video once I get home, showing all these features in detail.
     
  20. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    i just tested it and im a bit disappointed on how it is currently not generic at all and binded to a specific game type.

    - we cant edit properties of items right now like you shown on your script, items have stats hard written in script, it would be nice to have an inspector tab for Attributes, then we can add any of these attributes+ stats)

    -your consumable have use direct call of function like add health add mana, but what if we dont have those but other stats? it would be better to use something like sendMessage for this like "buffStatxx" float amount, float length. then we decide where we send this

    -you use gold for currency, but what if we use something else and use more than one currency? it would be good to have an inspector to set data like this too.it should not be on InventoryUI but you should have a component for this like CurrencyUI that we could add to any inventory and define its position

    -we can add allowed categories to an inventory ( thats good), but we cant have more than one inventory, else it bug, so its an useless features as we cant loot other items

    -we must have the scene opened with the inventory inside it to edit it, else:
    There is no ItemManager in the scene, attach an ItemManager script to a gameObject.
    UnityEngine.Debug:LogError(Object)

    -if i delete all items/ categories and try to add mine i will have error when i click create new item
    InvalidOperationException: Operation is not valid due to the current state of the object
    System.Collections.Stack.Peek () (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections/Stack.cs:321)
     
    Last edited: Mar 9, 2015
  21. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522

    - we cant edit properties of items right now like you shown on your script, items have stats hard written in script, it would be nice to have an inspector tab for Attributes, then we can add any of these attributes+ stats)
    Do you mean something like global properties that can be defined in an editor (not item specific) and these global properties can then be added to items with a custom value?


    -your consumable have use direct call of function like add health add mana, but what if we dont have those but other stats? it would be better to use something like sendMessage for this like "buffStatxx" float amount, float length. then we decide where we send this
    SendMessage() is extremely slow and should be avoided in most cases, if you want to add custom behaviour when an item is used you can create a new script, extend from the ConsumableInventoryItem or the InventoryItemBase if you want to start from scratch. And override the Use() method. From there you can call your own methods and build your own functionality with compile safety.

    This is a concious decision, if however you want to use SendMessage() anyway you can override the Use method once and use SendMessage() from there.


    -you use gold for currency, but what if we use something else and use more than one currency? it would be good to have an inspector to set data like this too.it should not be on InventoryUI but you should have a component for this like CurrencyUI that we could add to any inventory and define its position
    Currency's can be formatted using the ICurrencyFormatter interface. You can write your own implementation and insert it in the InventorySettingsManager.instance.currencyFormatter. The default is Gold but feel free to implement your own.

    -we can add allowed categories to an inventory ( thats good), but we cant have more than one inventory, else it bug, so its an useless features as we cant loot other items
    You can add multiple Inventory windows, however there is only 1 primary Inventory window, but I realize this might be a heavy work around. I'll make some small modifications to improve the looting of items and enforce categories when looting.
    Example: Assume you have 4 bags, 1 bag only allows quest items, while the others don't. When you pickup and item the item will always be placed in the bag that allows the item. (This is currently possible but requires quite a bit of manual work).
    Does this example match your idea? If you so I'll be sure to create it soon.



    -we must have the scene opened with the inventory inside it to edit it, else:
    There is no ItemManager in the scene, attach an ItemManager script to a gameObject.
    UnityEngine.Debug:LogError(Object)
    True this is because of Unity's serialization, you could create a prefab with the managers attached to it.
     
  22. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    Do you mean something like global properties that can be defined in an editor (not item specific) and these global properties can then be added to items with a custom value?
    Yes


    SendMessage() is extremely slow and should be avoided in most cases.

    this is not true in all case, it will not have performance issue as we send it only one time every xx seconds, if we send it 1 million time per frame yes.


    Currency's can be formatted using the ICurrencyFormatter interface. You can write your own implementation and insert it in the InventorySettingsManager.instance.currencyFormatter. The default is Gold but feel free to implement your own.
    ok, so we have to rewrite it completly


    Example: Assume you have 4 bags, 1 bag only allows quest items, while the others don't. When you pickup and item the item will always be placed in the bag that allows the item. (This is currently possible but requires quite a bit of manual work).
    Does this example match your idea? If you so I'll be sure to create it soon.
    yes exactly like this


    is still have few bug that block me to use your asset whenever i try to create an item:
    i currently have 8 items in the item manager but i can only see one


    if we run the scene while our item manager is open, something wrong happen, look like it rollback the data like it was when i opened the scene
     
  23. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Hi Damien,

    What Unity version are you using? The system uses quite a bit of uints which are only serialized properly in Unity 5+.

    I implemented the multiple Inventories and looting items now respects the onlyAllowTypes filters. Inventories can be given priority to which should be used first (in case multiple inventories can hold the item).


    As for the SendMessage(), if you want to have direct access when an item is used use the events. All items have events OnUsedItem, OnDroppedItem, etc. I do advise you to override the virtual methods on the objects, as events can get dirty quite quickly.

    The currency formatter has only a single line of functional code, so rewriting might be a bit of an overstatement. I could build an editor for this, but assumed a simple interface would give the most implementation possibilities, as well as splitting currency into gold, silver, copper (wow style).

    Code (CSharp):
    1.     public string Format(int val)
    2.     {
    3.         return prefix + val.ToString() + suffix;
    4.     }

    I'll modify the properties and make them global, this should make the properties a lot more useful and consistent.

    Hope this helped :).
     
  24. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    im using unity 5 last version on mac (personal edition), i tried to delete the asset, revert factory setting the window layout, but it still give me an error when i try to create an item.
     
  25. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Items are serialized inside the ItemManager, could you take a look at it and see if slots are empty / corrupted? If you can't find a solution please add me on Skype (jorisshh).
     
  26. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    The demo has been updated, it was very unclear what the purpose of the demo was, so I've added tips, hits and key combinations as well as explanations on all elements. Try the new demo here
     
  27. Rowell

    Rowell

    Joined:
    Sep 22, 2014
    Posts:
    27
    One thing I noticed in the demo: when you run around picking up all the white cubes, you get several small and medium bags. When you click the clean up inventory (brush) icon, your small bags are converted to medium bags.
     
  28. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Rowell you're absolutely right, but this was my own stupid mistake, I duplicated an object, so the ID's didn't get updated.
     
  29. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    I'll create a video demonstrating the editor soon, however because a lot has changed and is still changing due to the rather high demand of features it would be a bit of a waste to make a video now.

    I'll record a video in the upcoming week.
     
  30. fishZombie

    fishZombie

    Joined:
    Apr 28, 2014
    Posts:
    8
    Is it possible to have items take up multiple spaces in the inventory, or would I have to have 2 different inventories for this? What I'm really hoping to have is an inventory of 2x4 =8 spots.
    Where I can put 8 small items, or 4 large items, or 2 very large items (uses 4 spaces).
    This would make deciding to pick up large items, part of the game.

    Also, can the inventory box be scrollable?
    swipe up or down to see the rest of the inventory, instead of the scroll bar on the right.
    If you are using your finger (IOS game) that little scroll bar is difficult.
     
    Last edited: Mar 11, 2015
  31. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    For now no, items are always 1 slot in size, it would be quite a bit of work to rewrite this, so for now I'll leave it as is, if it a commonly requested feature I'll likely build it.

    A swipe could be mistaken for trying to drag an item, limiting it to only empty slots is a possibility, but that would create a big problem when the inventory is full :). If you're working on a mobile platform you could just increase the size of the scroll bar.
     
    Last edited: Mar 11, 2015
  32. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
  33. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    I'm starting on the vendor functionality, any specific requests?
     
  34. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    i would say:

    -options to set something like tabs in vendor window which display only "allowedItemTypes"
    -Having an included function RandomlyRefreshStore(dictionary<Items, weight>, minAmount, MaxAmount)
    -Adding an item in store at runtime.
    -have an optional list to display item we bought with a ratio to rebuy item back for example we sell sword 100, ration is 0.5 we have to spend 150 to buy it back.
     
  35. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    You got it :)
    With RandomlyRefreshStore() you mean, to pick somewhere between minAmount and maxAmount items from the dictionary to display in the shop - If so, consider it done?
     
  36. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    A little update on the character and equipment system. I decided to make it as flexible as possible, to allow an infinite number of use cases.

    Equip types can be defined using a new editor. Certain items might use up multiple slots, or are just not compatible with one another. Once you define an item type you can define the "blocks" these are the in-compatible fields. When you equip an item, the blocks are checked and un-equipped if necessary.


    This allows you to handle various concepts, create equip items for a pet, even add body parts to a car for a racing game :).
    Hope you like it, let me know what you guys think.
     
  37. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    yes min/max to define a random item of number, then using weight we can define the chance to spawn for some items, for example if we want very rare use 0.01 weight, if it has spawn every time use 1 weight.
    the equipment system look solid, what about rename Character stats editor to "Equipment Slots"?
     
  38. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Great I like it I'll be sure to build in the features you've requested.
    Renaming the character stats editor to slots would be rather conflicting, the stats editor allows you to pick the stats of items that you want to show.
     
  39. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Update
    • Mobile UI drawcalls have been reduced, the InventorySystem should now run much faster on mobile devices.
    • The equipment system has had a big update, fields can be defined using the editor for full customization.
    • Item properties are now global and can be created using the editor.
    • Re-factoring to keep it all nice and consistent
    • Multi-inventory support, create multiple inventories and define restrictions and a priority per inventory. This allows you to create consumable only inventories, quest item only, etc. You can also create multiple restrictions such as consumable and equippable only.

    What's next?:
    • Vendor system with buyback.
    • Crafting system
    If you like to see specific features for what's to come, be sure to speak up :)

    The update should be live in the asset store in a few business days.
     
    Last edited: Mar 13, 2015
  40. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    A little update on the vendor (npc) system.

    Items can be defined through the editor, or through code, whichever suits you best.
    A feature to randomly fill the vendor was requested, considering that the loot / treasure system might need something similar I decided to build a generator (check below).


    The generator:
    By default there is the BasicItemGenerator class that can filter and generate based on the item settings, for example.

    Code (CSharp):
    1. var generator = new BasicItemGenerator();
    2. generator.SetItems(InventoryManager.instance.items); // Add all available items (sets default weight to 0.5f / 50%)
    3. generator.onlyOfTypes.Add(typeof(ConsumableInventoryItem)); // Only want consumable items
    4. generator.minRequiredLevel = 5; // Required level needs to be atleast 5
    5. generator.Generate(5); // Generate 5 elements
    6. // generator.Generate(5, 7); // Generate between 5 and 7 items.
    Custom item weights can also be set by creating an array of InventoryItemGeneratorItem and set the weight per item.

    The generator can be used for any collection, this obviously includes the inventory, bank, vendor, looting, or any other collection.

    Hope you like it :)
     
  41. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    A little update :),

    Message center
    Messages and be displayed through the message center. Each message can of-course be fully customized, if you have your own message center / system you can simply hook to the event and transfer them to your own system.


    Item usage override

    The item usage as well as the context menu can be overridden / adjusted based on the collection they're in. For example when using an item directly from the bank it will be stored in the Inventory. When using an item from the inventory while the bank is open, it will be stored in the bank. When using an item while the vendor window is open a sell dialog will be popped.

    Of course this behavior is customizable and can be modified through the editor.


    Vendor system (almost done)
    The vendor system can either generate items or manually define them.

    Also the buy/sell factor can be modified per vendor, by default it's 1, 1.1 would be a 10% increase.
    The close and open animations will be triggered when selecting the vendor, this can be useful to play an animation on a character / the vendor.

    Vendors have a category and buy back can be shared by category. For example when selling to a vendor with the category "Grocer", all other vendors with the same category will have the items available for buy-back.




    Window pages

    Some pages might have tabs or "pages", pages can be defined through the editor.
    Assume you want to make a character window with multiple tabs, pages is what you want to use :). Window pages are backward compatible, so if your windows have no extra pages, just continue as you were.



    Hope you like it and more to come soon :)
     
  42. CathyR

    CathyR

    Joined:
    Feb 23, 2015
    Posts:
    4
    What I would love to see is a way for players to drop an item for use like in a house for furniture etc and edit rotation placement
     
  43. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    i feel this have nothing to do within an inventory, you could have an item dropped on the floor, then you have to code your own logic
     
  44. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Fully agree with Damien, you can hook into events to place items if you like to add your own custom behavior. Another option would be to override the Drop() method on an item.
     
  45. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    A little speed boost:

    A lot more people than I anticipated are working on mobile platforms, and because mobile GC (garbage collection) can cause hickups I decided to go over the system once more to ensure stability and speed.

    • At idle runtime (when no direct actions are performed) no GC cleanups are performed :)
    • Only visible UI elements are updated / called, closed the Inventory? Then it won't update the UI until you open it again
    • Repaint is only triggered when an item changes it's properties (We already had this, but cleaned up some useless repaints)
    • Super fast and mobile ready!


    Crafting system is in development, data structure is laid out, just got to write the code ^^
     
    Last edited: Mar 18, 2015
  46. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Would anyone be interested in a UFPS integration?
     
  47. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
Thread Status:
Not open for further replies.