This is a documentation for Board Game Arena: play board games online !
Game options and preferences: gameoptions.inc.php : diforc'h etre ar stummoù
(Created page with "In this file, you can define your game options (= game variants). Note: If your game has no variant, you don't have to modify this file. // note: game variant ID sho...") |
Diverradenn ebet eus ar c'hemm |
||
(2 reizhadenn da c'hortoz gant ar memes implijer kuzhet) | |||
Linenn 1: | Linenn 1: | ||
In this file, you can define your game options (= game variants). | |||
In this file, you can define your game options (= game variants) and user preferences. | |||
Note: If your game has no | Note: If your game has no variants or preferences, you don't have to modify this file. | ||
== Game Options == | |||
Game options is something selected by table creator and usually correspond to game variation, for example if game | |||
includes expansion or certain special rule. | |||
<pre> | |||
$game_options = array ( | |||
100 => array ( | |||
'name' => totranslate ( 'my game option' ), | |||
'values' => array ( | |||
// A simple value for this option: | |||
1 => array ( | |||
'name' => totranslate ( 'option 1' ) | |||
), | |||
// A simple value for this option. | |||
// If this value is chosen, the value of "tmdisplay" is displayed in the game lobby | |||
2 => array ( | |||
'name' => totranslate ( 'option 2' ), | |||
'tmdisplay' => totranslate ( 'option 2' ) | |||
), | |||
// Another value, with other options: | |||
// beta=true => this option is in beta version right now. | |||
// nobeginner=true => this option is not recommended for beginners | |||
3 => array ( | |||
'name' => totranslate ( 'option 3' ), | |||
'beta' => true, | |||
'nobeginner' => true | |||
) | |||
) | |||
) | |||
); | |||
</pre> | |||
Note²: All options defined in this file should have a corresponding "game state labels" with the same ID (see "initGameStateLabels" in yourgame.game.php) | Note²: All options defined in this file should have a corresponding "game state labels" with the same ID (see "initGameStateLabels" in yourgame.game.php) | ||
Linenn 29: | Linenn 49: | ||
"my_first_game_variant" => 100, | "my_first_game_variant" => 100, | ||
) ); | ) ); | ||
IMPORTANT: After you edited and deployed this file you have to go to control panel and press "Reload game options configuration" | |||
== User Preferences == | |||
User preferences is something cosmetic about the game interface which however can create user wars, so you can satisfy all user | |||
by giving them individual preferences. Do not use this unless absolutely necessary and usually only after game has been in production | |||
for a while. If you add these currently only admins can apply these settings, so you would have to contact them after editing this file. | |||
<pre> | |||
$game_preferences = array( | |||
100 => array( | |||
'name' => totranslate('Notation style'), | |||
'needReload' => true, // after user changes this preference game interface would auto-reload | |||
'values' => array( | |||
1 => array( 'name' => totranslate( 'Classic' ), 'cssPref' => 'notation_classic' ), | |||
2 => array( 'name' => totranslate( 'Tournament' ), 'cssPref' => 'notation_tournament' ) | |||
) | |||
) | |||
); | |||
</pre> | |||
There is two ways to check/apply this. In java Script | |||
if (this.prefs[100].value == 2) ... | |||
This checks if preferences 100 has selected value 2. | |||
Second, if cssPref specified it will be applied to the body tag. So you can use different css styling for the preference. | |||
As user you have to select them from the Gear menu when game is started. On studio only user0 will have it actually working (bug?). |
Stumm red eus an 8 Eos 2016 da 02:34
In this file, you can define your game options (= game variants) and user preferences.
Note: If your game has no variants or preferences, you don't have to modify this file.
Game Options
Game options is something selected by table creator and usually correspond to game variation, for example if game includes expansion or certain special rule.
$game_options = array ( 100 => array ( 'name' => totranslate ( 'my game option' ), 'values' => array ( // A simple value for this option: 1 => array ( 'name' => totranslate ( 'option 1' ) ), // A simple value for this option. // If this value is chosen, the value of "tmdisplay" is displayed in the game lobby 2 => array ( 'name' => totranslate ( 'option 2' ), 'tmdisplay' => totranslate ( 'option 2' ) ), // Another value, with other options: // beta=true => this option is in beta version right now. // nobeginner=true => this option is not recommended for beginners 3 => array ( 'name' => totranslate ( 'option 3' ), 'beta' => true, 'nobeginner' => true ) ) ) );
Note²: All options defined in this file should have a corresponding "game state labels" with the same ID (see "initGameStateLabels" in yourgame.game.php)
self::initGameStateLabels ( array ( ... "my_first_game_variant" => 100, ) );
IMPORTANT: After you edited and deployed this file you have to go to control panel and press "Reload game options configuration"
User Preferences
User preferences is something cosmetic about the game interface which however can create user wars, so you can satisfy all user by giving them individual preferences. Do not use this unless absolutely necessary and usually only after game has been in production for a while. If you add these currently only admins can apply these settings, so you would have to contact them after editing this file.
$game_preferences = array( 100 => array( 'name' => totranslate('Notation style'), 'needReload' => true, // after user changes this preference game interface would auto-reload 'values' => array( 1 => array( 'name' => totranslate( 'Classic' ), 'cssPref' => 'notation_classic' ), 2 => array( 'name' => totranslate( 'Tournament' ), 'cssPref' => 'notation_tournament' ) ) ) );
There is two ways to check/apply this. In java Script
if (this.prefs[100].value == 2) ...
This checks if preferences 100 has selected value 2.
Second, if cssPref specified it will be applied to the body tag. So you can use different css styling for the preference.
As user you have to select them from the Gear menu when game is started. On studio only user0 will have it actually working (bug?).