Forum rules - please read before posting.

Inventory Click and show larger image in inventory

ok, i'm having issues with an inventory system I'm working on.

What I would like to do is have a two part inventory. 
1. A scrolling view port on the right side. (working)
2. A detail of inventory on the left. This is composed of a larger image area and a text label.

The idea is that the player will tap on the inventory item and then that would fill the left image and label. Also the inventory tapped will have a highlight(lower priority

But I can't seem to figure a way to do this. I've tried a few things out, but I'm just not familiar enough to figure this out. Where would I start looking to be able to do this?


Comments

  • As this is all specific to your game, you'll have to do some custom scripting.  Fortunately, AC does the hard work in that you can define properties for your inventory items that store the data.

    Open up the Inventory Manager and click on the Properties sub-tab.  From there, create a new Property, name it Description and give it the type String.  Going back to the Items tab, you'll see that you can then enter in a description for each item.

    How to use these properties?  The Scripting Guide shows that the InvItem class has a GetProperty function, and you can find out the last-clicked item with the RuntimeInventory class's selectedItem variable.

    So, you're going to want something like this in a C# Update() function:

    AC.InvItem selectedItem = AC.KickStarter.runtimeInventory.selectedItem;
    if (seletedItem != null)
    {
      string description = selectedItem.GetProperty (0).GetValue ();
      // Assign the description to the UI text-box
    }

  • Thanks a lot, and that was quick turn around. Much appreciated. I managed to also do a fill in for the large image in the inventory to. 

    There are few things I would like to follow up on. 

    I need to click on the inventory item twice before anything happens. This only happens the first time I open the inventory. 

    Is there a way in AC to do have a highlight bg image behind the inventory of the current selected inventory or will that need to be custom to? I can do the code, but the less custom code the better.

    I'm also having the issue dragging the inventory. I need to quickly double click and drag to get the item to drag. Otherwise I can't seem to drag the inventory item around. I can't just hold the mouse button down and start dragging.


    Sorry to be a pest in all of this, but I'm really digging the AC engine a lot and am trying to dig into the internals more. But I'm getting a little lost here and there.
  • edited January 2016
    I need to click on the inventory item twice before anything happens. This only happens the first time I open the inventory. 

    I'm also having the issue dragging the inventory. I need to quickly double click and drag to get the item to drag. Otherwise I can't seem to drag the inventory item around. I can't just hold the mouse button down and start dragging.

    Are you using Unity UI for your Inventory menu, and do these problems occur in builds or just the Editor?

    Is there a way in AC to do have a highlight bg image behind the inventory of the current selected inventory or will that need to be custom to? I can do the code, but the less custom code the better.

    You can assign an "Active graphic" for each item in the Inventory Manager.  You can control when this is used under the "Inventory settings" section of the Settings Manager.
  • Are you using Unity UI for your Inventory menu, and do these problems occur in builds or just the Editor?

    Yes, i'm using the Unity UI, after trying your suggestion to build to PC and Mobile. In both cases I need to do the same thing. Quickly do a double click/tap hold and drag on the second click/tap.


    You can assign an "Active graphic" for each item in the Inventory Manager.  You can control when this is used under the "Inventory settings" section of the Settings Manager.

    This works great both on PC and mobile. Thanks.


  • I believe I've managed to fix the UI issue in the v1.50e update.
  • Ok, I updated to 1.50e, no fix. I'm going to go over the settings with you and maybe you can catch what is wrong. 

    SINGLE, Inventory interactions
    TRUE, Include Inventory items in Hotspot Interaction menus?
    FALSE, Combine interactions work in reverse?
    TRUE, Drag and drop Inventory interface?
    0, Minimum drag distance.... I would like this to be at a higher value, 0 is just for what's wrong.
    FALSE, Can drop an Item onto itself to examine it? 
    NONE, Active cursor FX
    FALSE, Show Active FX when an Interaction is unhandled?
    FALSE, Items can be re-order in Menu?
    FALSE,  Show Hover Graphic, Selected item's display
    TRUE, Show Active FX when Cursor hovers over the Item in Menu?

    Here is the prefab to the Inventory

    here is the code that handles the zoom image and the description






  • In future, please wait for me to ask for a prefab/download before posting.

    That said, I downloaded the prefab, and assigned the Canvas + 3 inventory buttons in the Menu Manager.  Dragging-and-dropping worked fine, so it could well be that the problem lies in whatever custom code you have.  I'd recommend doing the same (ie. stripping anything custom) and checking that AC behaves correctly before adding anything custom.
  • My apologies, I was just trying to provide as much information as I could think of. I was so stumped.

    I tried your suggestion and removed the code to isolate the issue. Unfortunately that didn't seem to fix the issue either. So I went to rebuild the inventory. Seems the issue was that I had the Inventory Menu to ignore mouse clicks, I misinterpreted the the information and thought that would relate to other elements. Not necessarily the dragging.  :(

    Sigh. Well I now know more about AC than before. Thank you so much for all your assistance.
  • No problem at all, glad it's sorted now.
  • Hi, I have a question. How did you get the picture to appear in its intended location? I'm trying to do something quite similar, except I want the effect to take place when a slot/button is in its highlighted state, without any clicking (because it's a game intended to be played with Joystick/keyboard only). Anyways, I'm not much of a programmer... so I can't for the life of me figure out how to get a reference from the image, or something, so that I can display the Item's Main Graphic inside a Unity UI Image component...

    Anyway, any advice would be greatly appreciated...
  • Please provide an annotated screenshot to illustrate what you're after - there's a few things we could advise but without enough information it's not possible to know which to give.
  • jayderyu  Hi Jay, don't suppose you'd be willing to write a little tutorial on how you got your inventory to work in the end? I'm a bit of a unity novice (have done some scripting for photoshop / flash and after effects but all java (i'm an artist that hobbies a bit in coding)). But getting my head around certain bits of unity and scripting is a bit tricky. 

    I'm currently just trying to get the inventory item properties to show in the inspector after being clicked (e.g. item has been given weight / cost / size type properties).

    From browsing the forums I get the impression I'm not the only one who would be interested in seeing a tutorial around inventory properties - 

    Anyway, this thread has already been helpful so thank you!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.