brave-frontier-godot
brave-frontier-godot copied to clipboard
Display Real Units on Units Page
Now that the database has real units/teams, we need to display them on the unit page. This should be fairly easy to implement.
The relevant files are res://Menu/SubMenu/Unit/Display/view_units.gd
and its scene. We currently preload vargas and selena and display them.
Instead, we will need to use the Database
class to select all units that have an account id that matches the current account. The current account info can be gained via Account.get_account_info()
. The id is in the returned array. Once we have the units, we will need to use ResourceLookups.get_unit_by_unit_number(id)
to get the unit info and associated thumbnail. create_thumbnail(unit)
can be used to create the scene. Add it to the $Unitlist. The current implementation provides an example of this.
Having res://Menu/SubMenu/Unit/Display/unit_display.tscn
display the unit that was just selected would be nice, but isn't a requirement yet.
Hello aMytho !
I'm trying to take this task for now. And as I'm looking to how to do it, I'm questionning about the return of get_account_info. It returns every data of the account, but you don't know which data correspond to whom.
Isn't it possible to do something like
return ["ID" : id, "player_name" : player_name, etc ....]
? Maybe you've already tried, but using it that way may help the development if we couple that with an Enumerator.
Also, this is already used in some files, so maybe update it now would broke some features, so it's just a wandering thought.
Hello @aMytho ! I've started the implementation ! You can review it here https://github.com/aMytho/brave-frontier-godot/pull/15 There are still some point that need to be fix, but I believe the code itself works fine.
Hello aMytho !
I'm trying to take this task for now. And as I'm looking to how to do it, I'm questionning about the return of get_account_info. It returns every data of the account, but you don't know which data correspond to whom.
Isn't it possible to do something like
return ["ID" : id, "player_name" : player_name, etc ....]
? Maybe you've already tried, but using it that way may help the development if we couple that with an Enumerator.Also, this is already used in some files, so maybe update it now would broke some features, so it's just a wandering thought.
Meant to respond to this earlier.
I agree that an enum or direct access would be easier. #18 uses the ActiveAccount.property
syntax which is a lot better than using the array! I think that is the preferred method to use.
I'm not sure if exported variables are meant for gdscript use, or just for the editor. Either way, it is a lot better than trying to remember which value is which in the array so I'll make a PR to remove that and replace it with Account.x
.
I've fixed the error that prevented loading the specific unit res://Menu/SubMenu/Unit/Display/unit_display.tscn
. There is still some data missing, but we will have to do a DB migration and add the necessary properties to all units.