I have the colors that I want for the game set in my gameinfos.inc.php file as so:
// Colors attributed to players
'player_colors' => array( "#ec008c", "#bcbdc0", "#88c878", "#f1e100", "#00aeef", "#d0a96a", "#f36f21", "#84378b"),
'favorite_colors_support' => false,
And the setup for the colors in the yourgamename.game.php in the setupNewGame method as so:
$gameinfos = self::getGameinfos();
$default_colors = $gameinfos['player_colors'];
$sql = "INSERT INTO player (player_id, player_color, player_canal, player_name, player_avatar) VALUES ";
$values = array();
foreach( $players as $player_id => $player )
{
$color = array_shift( $default_colors );
$values[] = "('".$player_id."','$color','".$player['player_canal']."','".addslashes( $player['player_name'] )."','".addslashes( $player['player_avatar'] )."')";
}
$sql .= implode( $values, ',' );
self::DbQuery( $sql );
self::reattributeColorsBasedOnPreferences( $players, $gameinfos['player_colors'] );
self::reloadPlayersBasicInfos();
The colors still aren't showing up for me. This looked like the documentation recommended by BGA to do this. Is there anything I'm doing wrong or missing to implement colors for players into the game? Thanks!
// Colors attributed to players
'player_colors' => array( "#ec008c", "#bcbdc0", "#88c878", "#f1e100", "#00aeef", "#d0a96a", "#f36f21", "#84378b"),
'favorite_colors_support' => false,
And the setup for the colors in the yourgamename.game.php in the setupNewGame method as so:
$gameinfos = self::getGameinfos();
$default_colors = $gameinfos['player_colors'];
$sql = "INSERT INTO player (player_id, player_color, player_canal, player_name, player_avatar) VALUES ";
$values = array();
foreach( $players as $player_id => $player )
{
$color = array_shift( $default_colors );
$values[] = "('".$player_id."','$color','".$player['player_canal']."','".addslashes( $player['player_name'] )."','".addslashes( $player['player_avatar'] )."')";
}
$sql .= implode( $values, ',' );
self::DbQuery( $sql );
self::reattributeColorsBasedOnPreferences( $players, $gameinfos['player_colors'] );
self::reloadPlayersBasicInfos();
The colors still aren't showing up for me. This looked like the documentation recommended by BGA to do this. Is there anything I'm doing wrong or missing to implement colors for players into the game? Thanks!