Hey Folks! Working on the trade UI today, in a continued effort to connect systems into at least a crude game loop. I've mostly finished the first draft of the layout, as you can see in today's image. And I've started on the code for it.
The layout isn't anything too surprising. Your usual scrolling list of items for sale/trade, with widgets to control how much you want to buy/sell for each. I'm going to try and use the item's image scaled-down alongside each item name, and we'll see how that looks in practice. I've also made each item name a button in case I want to make them interactive later (such as clicking/rollover to get item details).
The rest of the row are mainly related to how much each person has, how much they'll pay, and how much is being traded, plus a subtotal on the right. I mucked around with this layout a bit, as I wasn't sure how best to arrange it so the information was both clear and complete.
In the end, I settled on showing "us" inventory counts on the right, "them" on the left, and the arrows correspond to moving the items into either of those traders' stockpiles. The amount the subtotal changes depends on which direction the items are flowing. Negative numbers are selling to "them," so we use the price to the left, and buying items uses the price to the right. Basically, use the price that is in the direction the item is moving. (I think that's clear?)
I can probably show/hide the arrow buttons appropriately for cases where the items are not available, and even newcomers to the screen should be able to figure it out once they try a few clicks and see numbers change.
Anyway, you line up all the stuff you want to trade, and the "Balance" at the bottom is the final tally. I think I'll need to do something here to account for leftover change if the trade isn't perfect. Or else make money one of the items in the list so it can be traded to make up a deficit.
I've also been wondering whether it adds anything to have two prices like this, or if I should just make it one. Realistically, each party in a trade has different prices for the same object. But in practice, is that going to matter much? Or is it just unnecessary complexity? We'll have to test and see, I guess.
Anyway, we're into the code now, hooking the logic up. Once that's done, I'll be able to trade food packets for money until I get the zones wired-in to this. And then? Maybe more items to loot, sell, buy?