Behaviour of inventory grid elemets selection (touchscreen / android)

Poiu

New member
Hello.
So I guees grid elements at inventory are selected onMouseOver.
On touchscreen I need to keep my finger on the screen and swipe over grid elements to select them (mimicing mouse movement). After I click unselected element, action popup is shown, but that element is not selected (highlighted) at this point, but after actions is chosen or popup disappears.
I would like to change this behaviour to fit touchscreen, so I think the best way would be to select grid element after click, so on PointerDown, and on second PointerDown show actions popup.
However I can be wrong with onMouseOver selection, because I can't find it at grid related scripts. I'm not sure if forcing selection after PointerDown will not cause some random issues later at some point if onMouseOver exists somewhere + I would like to get rid of as many mouse events as possible for android build.
 
Last edited:
That's a good catch, it is something I changed in v1.1 which is in development. V1.1 is focused on improving UI options and functionality in will come out in the coming months. There will be a lot of breaking changes, but it will be absolutely worth it.

We want to make sure that the UI is compatible for touch, mouse or controller inputs. So we'll give the option to trigger certain actions on different UI events.

If you want a quick fix for your issue while you wait for v1.1 to come out you can try to select the item before the click action starts.

Find a script called ActionButton.cs
in the "Press" function Add a call to select the button.
You might need to do so through the EventSystem but I'm not sure.

I believe that will fix it but I may be wrong. If you can confirm that it does indeed fix your problem, and does not cause issues then I may make the change in a patch for V1.0.X
 
Thank you for such quick response! I didn't expect it so fast ; ]
I will play with it tomorrow and post my progress, because today I got day for "tidy up" my project.

Will there be post some kind of changelog for v1.1? List of modified scripts will be enough as for me. I'm modifying a lot of scripts so it would be nice to be able just to download and compare new and old ones and to implement only desired functions on my own insted of changing whole scripts.
 
Humm... there will the a changelog but it won't be in a script by script basis, there are too many changes for that. There's a lot of structural UI changes. So things won't be compatible, especially for anything related to displaying inventory Grids/List.

My guess is that you'll need to see the new features and choose whether to make the change or not, You can always move the current scripts out of the Opsive folder and change the namespaces to back them up. The UI scripts are just a module in the Inventory system, there's nothing preventing you from creating your own UI from scratch (or use an old version of the UI in that case).

Of course you'll need to make sure to back up your project before each update in case something blows up. And we can help you out with any issues that come up
 
I was thinking about just list of scripts, I mean only their names. But I believe changes will impact most of scripts anyway.

Im modifying scripts to fit my needs. At my game, player will be able to put his character together from limbs of various creatures, so for example I had to modify Equipper scripts to be able to parent skinned objects to the other objects and to anmiate each limb separately, so player can walk with lets say human or spider legs, having two different arms with different attack animations and so on. Not big changes to be honest, but many of small ones, so it should be possible to re-implement them to scripts from v1.1, because I believe that base logic will not be greatly changed.

Actually there is one thing, that could be implemented to UIS at some point. I've added option to InventoryGrid.cs to be able to handle second ItemDescriptionPanel in order to show two groups of attributes, each basing on different CategoryAttributeBoxSet. This way I can distinguish for example Base Atrributes and Specific Attributes and show them at separate AttributeUIParent.
At this case BaseAttributes (top ones) are common for each limb, and SpecificAttributes (lower ones) are specific for each type of limb.

Two_attribute_parents.png

And at this point I would like to ask, if it is possible, to add maybe something like handle or whatever, to InventoryManager, to change order of attributes? Becuase order in InventoryManager sets up order of displaying attributes at AttributeUIParent.

RearrageAttributes.png


And finally to finish offtopic... Solution for my question:

I managed to achieve desired behaviour, by adding selected lines to ActionButton.cs:

ActionButton.png

So after press, when element is not selected, just select, and at second press button is selected, so invoke actions popup.
I didn't experienced any wierd behaviour by this change so far, so I'm guessing it is safe.
 
Last edited:
@Sangemdoko - I agree it would be excellent if you could move attributes up and down in order in the InventoryManager in editor... ? A nice workflow and use case improvement?
 
Last edited:
Great!

In v1.1 you'll be able to add as many descriptions as you want, instead of having a grid reference the description, the description object will listen to an on select event (I might give options to listen to onclick instead of only select.)

Changing the order of attributes is something I already implemented in v1.0.7 which should be coming out very soon.

I'm glad that selecting the button before clicking works, I'm going to make the change in v1.0.7 right away
 
Im really looking forward for v1.1. Looks like I will not put any major more work on my UI and just wait until it will be realesed. I guess it will take few months as was written on some other threads?

About selecting the button. I just noticed, that for example closing inventory screen needs two clicks. One to select, and second for action to close screen.
I wasn't working on solution yet.
 
@Poiu In the code change above I believe you could just remove the "return" and just have the if not selected -> select. That might solve it.

For v1.1 I'm currently working on the UIBuilder which is an editor that makes creating UIS UI easier by guiding you to the components required to achieve what you wish. Once it is done I'll have to rework the crafting and shop UI and add a new Equipement UI, so it will take some time. We're hoping to finish before the end of the year
 
Top