Temporary reattributeColorsBasedOnPreferences for the Studio

Game development with Board Game Arena Studio
Post Reply
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Temporary reattributeColorsBasedOnPreferences for the Studio

Post by pikiou »

If you want to test for the use of reattributeColorsBasedOnPreferences() in the Studio, since the function isn't available on the Studio yet (and I'm afraid won't be for quite some time).

Code: Select all

//Compensate the absence of reattributeColorsBasedOnPreferences
public function __call($method, $args) {
  if ($method == 'reattributeColorsBasedOnPreferences' && !method_exists($this, 'reattributeColorsBasedOnPreferences')) {
    list($players, $colors) = $args;
    foreach ($players as $playerId => $player) {
      //Set player colors from last color to the first so it gets a chance to mess up with the default first to last color assignment
      self::DbQuery("UPDATE player SET player_color='" . array_pop($colors) . "' WHERE player_id='$playerId'");
    }
  }
}
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: Temporary reattributeColorsBasedOnPreferences for the Studio

Post by sourisdudesert »

Hi,

Fortunatly BGA Studio has been updated :)
Post Reply

Return to “Developers”