Customize the order of player boards

Game development with Board Game Arena Studio
Post Reply
User avatar
Tabaskov
Posts: 24
Joined: 18 July 2016, 10:18

Customize the order of player boards

Post by Tabaskov »

Hello,
I was wondering if it is possible to change the order of the overall_player_board_nnnnnn elements that are in the <div id="player_boards".
This is because the game runs on multiple rounds and the order of the players should reverse at the end of each round. I manage to modify the main game screen to reorder the elements needed for proper understanding, but the little player boards keep the starting order and it's misleading...
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: Customize the order of player boards

Post by Tisaac »

Tabaskov wrote: 26 October 2022, 22:51 Hello,
I was wondering if it is possible to change the order of the overall_player_board_nnnnnn elements that are in the <div id="player_boards".
This is because the game runs on multiple rounds and the order of the players should reverse at the end of each round. I manage to modify the main game screen to reorder the elements needed for proper understanding, but the little player boards keep the starting order and it's misleading...
Sure, you can do anything you want but you will need to do it yourself.
So, store that order somewhere in DB, send that to the front, and change player panel orders either using js or in a easier fashion with display:flex + order css properties.
User avatar
Tabaskov
Posts: 24
Joined: 18 July 2016, 10:18

Re: Customize the order of player boards

Post by Tabaskov »

Thanks,
but I was asking the question because using a loop like dojo.place(player_area_N+1, player_area_N, 'after') in my *.js works fine at the main screen level, but not at all with overall_player_board_xxx blocks.
So I was wondering if there is any restriction that prevents manipulating inside the <div id="player_boards"/>
There may be a sorting rule that overrides dojo.place. And if so, I'm not sure how it works...
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: Customize the order of player boards

Post by Tisaac »

Tabaskov wrote: 27 October 2022, 11:05 Thanks,
but I was asking the question because using a loop like dojo.place(player_area_N+1, player_area_N, 'after') in my *.js works fine at the main screen level, but not at all with overall_player_board_xxx blocks.
So I was wondering if there is any restriction that prevents manipulating inside the <div id="player_boards"/>
There may be a sorting rule that overrides dojo.place. And if so, I'm not sure how it works...
Yep, the framework auto-reorder them all the time, so you can't just replace them like that using dojo.
Either overwrite the framework function to prevent auto-reorder, or just use the easy css solution.
User avatar
Tabaskov
Posts: 24
Joined: 18 July 2016, 10:18

Re: Customize the order of player boards

Post by Tabaskov »

Ok, thank you very much, I will try with the css order property :)

Subsidiary question (I'm relatively new to bga dev and I discover more every day): many answers on this forum talk about overwriting functions, but is the framework source code available somewhere?
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: Customize the order of player boards

Post by Tisaac »

Tabaskov wrote: 27 October 2022, 13:25 Ok, thank you very much, I will try with the css order property :)

Subsidiary question (I'm relatively new to bga dev and I discover more every day): many answers on this forum talk about overwriting functions, but is the framework source code available somewhere?
Nope, but since it's js everyone can just look at the minified version of it used in any game page.
User avatar
SwHawk
Posts: 133
Joined: 23 August 2015, 16:45

Re: Customize the order of player boards

Post by SwHawk »

Tisaac wrote: 27 October 2022, 11:34 Yep, the framework auto-reorder them all the time, so you can't just replace them like that using dojo.
Either overwrite the framework function to prevent auto-reorder, or just use the easy css solution.
Or why not take advantage of it ? Since it relies on

Code: Select all

this.gamedatas.playerorder
which is an array with the player_ids ordered as the turn order. You could have a state arg or a notification update this array when needed, and then call

Code: Select all

this.updatePlayerOrdering()
Post Reply

Return to “Developers”