Today I brought across the road-creation and NPC creation tools to the new UI system. Went really smoothly and easily. Very much looking forward to removing all the old custom code that was required for this stuff.
I also brought across half of the terrain-painting functionality, which has been a little more tricky (and still isn’t quite complete). The problem here is in how one interacts with the action bars. From the end-user’s point of view, the action bars work by clicking a button to activate a function, and then clicking where you want that function to take place in the world. Once you’ve done this, the function is turned off, and you need to click on the button again to do its function again. This is pretty intuitive for buildings and roads.
However, for painting on the terrain, you really want the buttons to act like a Photoshop-style toolbar, where you make a choice and that choice remains active until you select a different choice, no matter how many strokes you draw on the terrain. Doing that is easy enough; the problem is that right now, action bar buttons don’t have any sort of “toggle” functionality; the only way to turn one off is for the button to automatically shut itself off (as, for example, the “place a building” ones do automatically after placing a building), or for the player to select a different button. There’s currently no way for the player to intentionally deactivate a button without activating a different one.
It seems like I’m going to need to add two more things to make this really robust:
- “Toggle” functionality. After being clicked, a button should stay hilighted until its function is used, or until it’s clicked again. (At which point its function is disabled)
- When an action bar is closed/hidden, any button which is currently toggled on should be toggled off again.
Hopefully I can get these things sorted out tomorrow, plus get the rest of the terrain painting functionality converted over to the new system. Once that’s done, I’ll be able to rip out huge amounts of terrible old code. :)