RE-SS3D / SS3D

Space Station 3D, another remake of SS13, but with an extra D.
https://ss3d.space/
249 stars 141 forks source link

Stable inventory slot alignment #1365

Open cosmiccoincidence opened 7 months ago

cosmiccoincidence commented 7 months ago

Summary

Stabilize the inventory slot locations.

Current Behavior

Currently the inventory shifts (centers itself) based on size. This results in actual slots themselves shifting which would be annoying during gameplay. The best example of this is equiping/removing your jumpsuit.

Make the inventory UI slots not shift please.

https://github.com/RE-SS3D/SS3D/assets/41941008/bdffd6c5-59fb-45aa-bf4d-fc0cf77af579

jckling commented 7 months ago

Simple solution is to disable layout group component when remove slot, and enable when add slot.

Check HorizontalSlotOrder.Contains(container.Type) && layoutGroup.enabled in HandleInventoryContainerAdded and HandleInventoryContainerRemoved (InventoryView.cs)

Or add a parent, move the layout element component to the parent, and opreate (add/remove) in the child. 🤔

cosmiccoincidence commented 7 months ago

Let's see what @stilnat says on that.

joaoburatto commented 7 months ago

Yeah I agree that this solution if this is just to make it work properly. In the future the ideal way is the UI tweening to the new position or another effect. Easier said than done though.

joaoburatto commented 7 months ago

@cosmiccoincidence we can also ease that transition with a hard alpha 0 and adding a fade in effect in the entire canvas group.

stilnat commented 7 months ago

@jckling @cosmiccoincidence to be honest, I've no idea if jckling solution will work, but if that does, I don't see any issues with it. Worth a try.