The board administrator and developer will be on vacation until the end of July. Therefore replies will be slower than usual.

Modification of the Item details display from Inventory Page

nathanj
Posts: 206
Joined: Sun Sep 25, 2016 5:38 am

Modification of the Item details display from Inventory Page

Postby nathanj » Thu Apr 06, 2017 6:08 am

Hello, Joris

I'm trying to adapt the Item Details display from the Inventory page to a Map page I've created. The map has triggerable icons (with custom item types scripts). I am trying to use OnSelectTriggerButtonUse when the cross hair on the map highlights one of the icons to display some very basic info.

I copied the LoadItemInfo scriptfrom the Inventory page and pasted it to the Map page and copied the Item Details folder from the Inventory/Content folder and pasted it to the Map/Content Folder and reassigned all the connections.

This is basically where I'm at and and nothing is happening. I feel like maybe there is something in the InventoryUI script that connects the LoadItemInfo script to the Inventory Item, but I can't figure out what it is.

If you feel like this is not something that is gonna work just let me know, Or if you have a suggestion I would love to hear it.

Thanks again,
Nathan

User avatar
jjahuijbregts
Site Admin
Posts: 2084
Joined: Wed Apr 22, 2015 7:25 pm
Contact:

Re: Modification of the Item details display from Inventory Page

Postby jjahuijbregts » Thu Apr 06, 2017 9:58 pm

nathanj wrote:Hello, Joris

I'm trying to adapt the Item Details display from the Inventory page to a Map page I've created. The map has triggerable icons (with custom item types scripts). I am trying to use OnSelectTriggerButtonUse when the cross hair on the map highlights one of the icons to display some very basic info.

I copied the LoadItemInfo scriptfrom the Inventory page and pasted it to the Map page and copied the Item Details folder from the Inventory/Content folder and pasted it to the Map/Content Folder and reassigned all the connections.

This is basically where I'm at and and nothing is happening. I feel like maybe there is something in the InventoryUI script that connects the LoadItemInfo script to the Inventory Item, but I can't figure out what it is.

If you feel like this is not something that is gonna work just let me know, Or if you have a suggestion I would love to hear it.

Thanks again,
Nathan


Hm.. The LoadItemInfo component is mostly built for prototyping and demoing so its not very flexible. Could you post a screenshot of your current setup? Maybe something isn't referenced correctly.

nathanj
Posts: 206
Joined: Sun Sep 25, 2016 5:38 am

Re: Modification of the Item details display from Inventory Page

Postby nathanj » Sat Apr 08, 2017 8:05 pm

Hey Joris,


Here is a link to some screen grabs. I hope this helps. https://www.dropbox.com/s/lwoeh8x68jrcwrl/Screengrabs.zip?dl=0

I noticed that I am using the unusableInventoryItem type, but i don't this that would be an issue.

If you need any other info please let me know.

Thanks again,
Nathan

User avatar
jjahuijbregts
Site Admin
Posts: 2084
Joined: Wed Apr 22, 2015 7:25 pm
Contact:

Re: Modification of the Item details display from Inventory Page

Postby jjahuijbregts » Mon Apr 10, 2017 6:22 pm

nathanj wrote:Hey Joris,


Here is a link to some screen grabs. I hope this helps. https://www.dropbox.com/s/lwoeh8x68jrcwrl/Screengrabs.zip?dl=0

I noticed that I am using the unusableInventoryItem type, but i don't this that would be an issue.

If you need any other info please let me know.

Thanks again,
Nathan


Are you triggering the LoadItemInfo in any way? In the demo scenes a "LoadItemInfoHelper" is attached to the collection slots, which call the LoadItemInfo.SetItem() method, which repaints the UI and displays all data.

nathanj
Posts: 206
Joined: Sun Sep 25, 2016 5:38 am

Re: Modification of the Item details display from Inventory Page

Postby nathanj » Tue Apr 11, 2017 12:34 am

Ok, that was the part that I was missing but now I have discovered the error with my method. My map icon is not a wrapper, it is an actual Inventory Item (one that would be found in the game space), hence LoadItemInfoHelper.LoadItemFromCurrentWrapper is returning null. I can trigger the info box but I would prefer to call the info on the page to keep all them consistent - plus, my infobox is small and can only display a small amount of text. I would like to have the option to display more info here. I could make a custom infobox, but again, I would prefer to just display the info through the page display method.

Would you suggest that I figure out how to make the map icons wrappers or would there be a way to modify LoadItemInfoHelper to display Item info?

https://www.dropbox.com/s/xapzj6f7hua8nbv/MapIcon.JPG?dl=0

Thanks again,

Nathan

User avatar
jjahuijbregts
Site Admin
Posts: 2084
Joined: Wed Apr 22, 2015 7:25 pm
Contact:

Re: Modification of the Item details display from Inventory Page

Postby jjahuijbregts » Wed Apr 12, 2017 10:21 am

nathanj wrote:Ok, that was the part that I was missing but now I have discovered the error with my method. My map icon is not a wrapper, it is an actual Inventory Item (one that would be found in the game space), hence LoadItemInfoHelper.LoadItemFromCurrentWrapper is returning null. I can trigger the info box but I would prefer to call the info on the page to keep all them consistent - plus, my infobox is small and can only display a small amount of text. I would like to have the option to display more info here. I could make a custom infobox, but again, I would prefer to just display the info through the page display method.

Would you suggest that I figure out how to make the map icons wrappers or would there be a way to modify LoadItemInfoHelper to display Item info?

https://www.dropbox.com/s/xapzj6f7hua8nbv/MapIcon.JPG?dl=0

Thanks again,

Nathan


I've updated the LoadItemInfo component to now accept a raw item, rather than a wrapper also.
Open the LoadItemInfo script and replace the "SetItem" method with the following 2 methods. You'll now have a method SetItem(myItem); that you can call to load the information of that specific item.

Code: Select all

       
        public void SetItem(ItemCollectionSlotUIBase wrapper)
        {
            SetItem(wrapper.item);
        }

        public void SetItem(InventoryItemBase item)
        {
            if (item != null)
            {
                if (selectedItem != null)
                {
                    // Do out animation on previous
                    onHideActions.Invoke();
                    RemovePreviewItem(selectedItem);
                }

                selectedItem = Instantiate<InventoryItemBase>(item);
                selectedItem.currentStackSize = item.currentStackSize;


                AudioManager.AudioPlayOneShot(onSelectAudioClip);


                itemDetailsRoot.gameObject.SetActive(selectedItem != null);

                onShowActions.Invoke();
                SetPreviewObject(selectedItem);
                Repaint(selectedItem);
            }
        }
 

nathanj
Posts: 206
Joined: Sun Sep 25, 2016 5:38 am

Re: Modification of the Item details display from Inventory Page

Postby nathanj » Thu Apr 13, 2017 1:19 am

Thanks Joris

I have it now printing on the page when I the script triggered by a button. One small thing is I had to make a modification to the LoadItemInfoHelper (made a modified copy) that changed

Code: Select all

 info.SetItem(GetComponent<ItemCollectionSlotUIBase>());
to

Code: Select all

 info.SetItem(GetComponent<InventoryItemBase>());


However, now I'm getting this error, which I can't figure out. I'm guessing it has to do with the change above

NullReferenceException: Object reference not set to an instance of an object
Devdog.SciFiDesign.UI.LoadItemInfo.Repaint (Devdog.InventoryPro.InventoryItemBase item) (at Assets/Devdog/SciFiDesign/FirstVersion/Scripts/Integration/InventoryPro/LoadItemInfo.cs:238)
Devdog.SciFiDesign.UI.LoadItemInfo.SetItem (Devdog.InventoryPro.InventoryItemBase item) (at Assets/Devdog/SciFiDesign/FirstVersion/Scripts/Integration/InventoryPro/LoadItemInfo.cs:127)
Devdog.SciFiDesign.UI.VSLoadItemInfoHelper.LoadItemFromCurrentWrapper () (at Assets/_SharedAssets/Scripts/Iain/VSLoadItemInfoHelper.cs:22)
UnityEngine.Events.InvokableCall.Invoke (System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:154)
UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:637)
UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:773)
UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:52)
UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:35)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:44)
UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.EventSystem:Update()


Sorry I have to ask you more for this.

Thank you though, this is looking so good.

Nathan

User avatar
jjahuijbregts
Site Admin
Posts: 2084
Joined: Wed Apr 22, 2015 7:25 pm
Contact:

Re: Modification of the Item details display from Inventory Page

Postby jjahuijbregts » Thu Apr 13, 2017 10:44 am

nathanj wrote:Thanks Joris

I have it now printing on the page when I the script triggered by a button. One small thing is I had to make a modification to the LoadItemInfoHelper (made a modified copy) that changed

Code: Select all

 info.SetItem(GetComponent<ItemCollectionSlotUIBase>());
to

Code: Select all

 info.SetItem(GetComponent<InventoryItemBase>());


However, now I'm getting this error, which I can't figure out. I'm guessing it has to do with the change above

NullReferenceException: Object reference not set to an instance of an object
Devdog.SciFiDesign.UI.LoadItemInfo.Repaint (Devdog.InventoryPro.InventoryItemBase item) (at Assets/Devdog/SciFiDesign/FirstVersion/Scripts/Integration/InventoryPro/LoadItemInfo.cs:238)
Devdog.SciFiDesign.UI.LoadItemInfo.SetItem (Devdog.InventoryPro.InventoryItemBase item) (at Assets/Devdog/SciFiDesign/FirstVersion/Scripts/Integration/InventoryPro/LoadItemInfo.cs:127)
Devdog.SciFiDesign.UI.VSLoadItemInfoHelper.LoadItemFromCurrentWrapper () (at Assets/_SharedAssets/Scripts/Iain/VSLoadItemInfoHelper.cs:22)
UnityEngine.Events.InvokableCall.Invoke (System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:154)
UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:637)
UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:773)
UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:52)
UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:35)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:44)
UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.EventSystem:Update()


Sorry I have to ask you more for this.

Thank you though, this is looking so good.

Nathan


Our line numbers are a bit out of sync because of the changes, but I'm fairly confident it's because either "isDroppable", "isSellable" or "isStorable" text references are empty.

Line 238 - 240 (roughly).

I'll make these optional in the next update, so it will ignore them if the references arent' set.

nathanj
Posts: 206
Joined: Sun Sep 25, 2016 5:38 am

Re: Modification of the Item details display from Inventory Page

Postby nathanj » Thu Apr 13, 2017 11:33 am

I'm away from my comp. at the moment but those slots are all empty, so that would be it.

Thanks again, hope you have a nice relaxing weekend.


Nathan


Return to “Visuals”

Who is online

Users browsing this forum: No registered users and 1 guest