Posted July 12, 2024 by CG-Tespy
#ui
Among other UI-related things, I decided to redo the Djinn Menu so it handled drag-and-drop the same way another project of mine (Digital Craftsman) did. Of course, it took some doing… Flexalon didn’t have support for that built-in, and it had been a pretty long time since I first implemented this feature in Digital Craftsman ^^; Thankfully, I was able to use that project’s source as reference.
It was mainly with these 3 components:
When a swap or drag starts, the manager keeps track of the swappables’ original parents, positions, etc. It then uses that info to make sure that things get moved and parented to the right stuff. Another thing done at this time is reparenting the relevant entries’ transforms so they’re rendered above the rest of the UI.
And because why not, I made it so that the player can pull off the switcheroos through plain old clicking instead of drag-and-dropping. And just like with the batsys buttons, they change size based on whether or not they’re being hovered over.
It was a mistake for me to have this functionality handled mainly through visual scripting in DC… Not just because of how specific to that project the implementation was, but because of a lack of reusability. Maybe in the future, I’ll release this D&D system to the public.