Open katsoohoo opened 4 years ago
After the discussion today, the solution will be to drag the tile to the center discard box to confirm discard.
Can I install packages to handle drag-and-drop? or is there existing code I'm supposed to build from for this feature?
What package do you have in mind?
Keep in mind, it's not true drag & drag, the user clicks the tile, holds the mouse and lets go in the discard box, but there's no real file transfer here. We only need to detect that the user did the action above and send the tile (idx of tile in the hand) that was "Dragged" to the server.
This can be done via detecting the mouse down event, detecting the mouse up event, transitioning the object at the cursor pos while mouse is down.
I've had the best success with react-beautiful-dnd
in terms of the best animations and fluidity. Mostly used for list DND but probably can be used for games like this example.
Hmm, pretty heavy at 1.39 MB if we only use it for this though. @katsoohoo what do you think?
I'm open to any drag/drop implementation. One concern is that during the discard stage, the player can choose to discard or kong. If we want to do drag/drop to discard, we have to make sure it doesn't conflict with selecting tiles for kong or have a different flow for kong in the hand.
To make it consistent with the other flows, if the player can kong, the UI should show them the possible kong options and allow them to select it.
Probably don't need to manually select tiles for claiming anymore.
Yes, manual select should be phased out once we can determine possible claims and kongs from the server.
Ideally, I would like some hover effect and one-click to discard, but then we would have to change how to select kongs and claims.