Thursday, March 2, 2023

Of Adapters, Listeners and Static Functions

So, not much of a large update, from the last two days, and I can say, I've certainly had less code time in them than I would have liked, but in good news, I've finally got all the parts of the code doing what I need them to do (with caveats). 

Characters can trade nicely with one another, they can buy items from merchants and they can equip and unequip those items. The code nicely handles all the information behind the scenes as well as shuffling the right items about in adapters, scrolling views to where they need to scroll to and adding in all the little details that I would expect an interface to have. I did have to do a rough patch job on something where I've got two listeners applied to one view, and I cannot for the life of me work out how the second one is applied - and I eventually cracked and "fixed" it with a dodgy if statement that solves the crashes rather than finding how the second listener is applied.... but you know what? It works, even if it does also call some static functions in arguable non-elegant ways that do what's needed. Again. It works.

Although the code only functions right now for two slots (given I've only got one item in the game, it really doesn't matter hah!) I will just simply copy/paste/modify different values into what's needed and should have it all working perfectly for all the slots as new items are created. That's likely tomorrow after work.

Guess that also means I need to start working on an editor interface to create new items (and even thinking about that made me find new data I'll want to capture in the items table, so I need to modify that a bit more again and throw in a few extra columns), and probably right after that, I'll add in an interface in the editor to create shop listings. If, by some miracle I get through that over the weekend, I really should look at writing some code to nicely deal with sprite-sheets rather than directly requesting all the resources from the server on the fly. It'll make more sense to load up the data into the app and process it client-side and then just make server requests as needed for the random stuff.

No comments:

Post a Comment

Character and Item Stats

It feels like I've renamed a thousand thousand properties in classes, updated a myriad of methods across the database, the editor and th...