This is a documentation for Board Game Arena: play board games online !

Game options and preferences: gameoptions.inc.php: Perbezaan antara semakan

Daripada Board Game Arena
Pergi ke pandu arah Pergi ke carian
(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...")
 
Tiada ringkasan suntingan
 
(2 semakan pertengahan oleh pengguna yang sama tidak dipaparkan)
Baris 1: Baris 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 variant, you don't have to modify this file.
Note: If your game has no variants or preferences, you don't have to modify this file.


== Game Options ==


    // note: game variant ID should start at 100 (ie: 100, 101, 102, ...). The maximum is 199.
Game options is something selected by table creator and usually correspond to game variation, for example if game
    100 => array(
includes expansion or certain special rule.
                '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>
$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)
Baris 29: Baris 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?).

Semakan semasa pada 02:34, 8 Ogos 2016

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?).