Closed tttppp closed 6 years ago
Issue in android-diplicity: https://github.com/zond/android-diplicity/issues/33
It should be fairly straightforward to add color options to the user config, then each client could solve it individually.
Of course, as you say the map renderer has to honour it also.
TL;DR I agree :)
I had a look at this today, and got a nation changing colour. I haven't done anything about persisting preferences yet.
I also thought it might be worth trying to add an extra feature of "my" colour. A user can decide that, regardless of nation they are playing as, they always want their units to be bright red (for example). This seemed relatively easy to add at the same time by using some well known nation key. I was thinking of using "-me-".
Still a reasonable amount to do to get diplicity working with this, and then there's the problem of updating the Android app too. Maybe we can just use the API UI and keep it as a secret feature! :-P
Not a bad idea. Beginning with a silent launch in the API server only is a good start.
I didn't make much progress on this, except to determine that we can't persist abitrary maps of data - instead we need a new table to persist it. I didn't work out how to create a new table, or which code does crud operations.
Code is pushed here: https://github.com/zond/diplicity/tree/ColorPreferences
Actually, if you just encode it (JSON comes to mind) you can store arbitrary data. But I think it's probably better to have a new entity, like https://github.com/zond/diplicity/blob/master/game/ban.go#L59.
Then you list the endpoints you want it to have, like https://github.com/zond/diplicity/blob/master/game/ban.go#L23 and register it like https://github.com/zond/diplicity/blob/master/game/handler.go#L449.
Note that the entity you create must be possible to render as both JSON and HTML. To make that happen the default way you just provide a function like https://github.com/zond/diplicity/blob/master/game/ban.go#L74. In this function you provide links to other entities, as well as actions for this particular item.
To make it appear in the autogenerated UI you have to add links to it from other Item
functions, of course.
This is now done! What's more I'm using it to make every game feel like a disco.
Screenshots and color settings, please!
I think there's already a ticket for this in the Android client repo, but I think this makes sense to fix in the svg map renderer (in this repo).
As a starting suggestion, each user should be able to pick a preferred colour corresponding to the name of each nation. This would mean that changes to colours in Classical would affect Fleet Rome, Pure and FvA games, but my gut feeling is that is usually what the user would want.
This would still need a change to each UI to expose a colour picker and call the necessary endpoints.