Page 1 of 1

Temporary reattributeColorsBasedOnPreferences for the Studio

Posted: 03 December 2015, 11:20
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'");
    }
  }
}

Re: Temporary reattributeColorsBasedOnPreferences for the Studio

Posted: 11 December 2015, 14:07
by sourisdudesert
Hi,

Fortunatly BGA Studio has been updated :)