EZYBNJFUNOS3LIU6ILXN7MFKLVW4SDXW6K5T4YFKFZ2R4UWSFUXAC
M74RMZSTQLQHMG5PGM6DMM7JJFUHHNBS7QPNGJNXCSB4WHQVBTFAC
OPI6W7BO4V3R5WGEVN4USOHVPUV5PVWGKYBMCRU4VQOI7F7RCF5QC
ZXBDOUETFSXTFY6J5LIMXBCNMDW6NTUTZ7HZZ6ND7BNUKISR74FAC
NRK37A4NNGLF53STW5RJDHUEP6OKKJORJZL3HYVOKD7OW4QBO5XAC
4LMTBPV7JT446YP5RLF6HT7246BY75U5V35JTEIK4PT5NEPKNNKAC
2KCPYEJPVD4GH2WZIVQY5MY6DSVHGQ2IOZ3V7WQ5Q267B4L6KBUQC
/*
Example of CSS sprites (a black token and a white token, 20x20px each, embedded in the same "tokens.png" 40x20px image):
.white_token {
background-image: url('img/tokens.png');
background-position: 0px 0px;
}
.black_token {
background-image: url('img/tokens.png');
background-position: -20px 0px;
}
.token {
width: 20px;
height: 20px;
background-repeat: none;
}
*/
return 0;
$max = self::getGameStateValue("minigame") * 33;
// Very naive, but we rarely should exhaust the deck in one minigame, so
// let's treat the drawn cards as an indicator.
$progress = ($this->cards->countCardInLocation('discard')
+ $this->cards->countCardInLocation('player_display')) / $this->constants['EVIDENCE_DECK_SIZE'];
$progress *= $max;
return floor($progress);
// Get all tiles, shuffle them in two decks, associate them with
// location slots. Decks are called "cri_tile_d" (crime tile deck) and
// "sus_tile_d" (suspect tile deck). VARCHAR(16) ftw!
$this->cards->moveCards(array_pluck($this->cards->getCardsOfType('tile_crime'), 'id'), 'cri_tile_d');
$this->cards->moveCards(array_pluck($this->cards->getCardsOfType('tile_suspect'), 'id'), 'sus_tile_d');
$this->cards->shuffle('cri_tile_d');
$this->cards->shuffle('sus_tile_d');
foreach($this->locations as $loc_id => $loc) {
$this->cards->pickCardForLocation('cri_tile_d', 'locslot', $loc['slots']['crime']['id']);
$this->cards->pickCardForLocation('sus_tile_d', 'locslot', $loc['slots']['suspect']['id']);
}
function getCardNames($ids)
{
return array_pluck(
array_filter($this->cardBasis, function($k) {
return in_array($k, $ids);
}, ARRAY_FILTER_USE_KEY),
'name'
);
/**
* Return if it is the last turn for this minigame.
*
* It's the last turn if all other players have already solved their cases.
*/
function isLastTurn() {
// TODO
console.log(this.gamedatas.tiles);
// // Setup tiles
// for( var id in gamedatas.intersections )
// {
// var intersection = gamedatas.intersections[id];
for (i in this.gamedatas.tiles) {
var tile = this.gamedatas.tiles[i];
dojo.place(
this.format_block('jstpl_tile', {tile: tile, name: this.gamedatas.tileinfos[tile.type_arg].name}),
$('board'));
dojo.place( $('tile_' + tile.id), $('locslot_' + tile.location_arg) );
// this.slideToObject( $('tile_' + tile.id), $('locslot_' + tile.location_arg) ).play();
}
// var slide = this.slideToObject( $( 'stone_' + notif.args.coord_x + '_' + notif.args.coord_y ), $( 'intersection_' + notif.args.coord_x + '_' + notif.args.coord_y ), 1000 );
// var x_pix = this.getXPixelCoordinates(intersection.coord_x);
// var y_pix = this.getYPixelCoordinates(intersection.coord_y);
// if (intersection.stone_color != null) {
// // This intersection is taken, it shouldn't appear as clickable anymore
// dojo.removeClass( 'intersection_' + intersection.coord_x + '_' + intersection.coord_y, 'clickable' );
// }
// }
// // Place it on the player panel
// this.placeOnObject( $( 'stone_' + notif.args.coord_x + '_' + notif.args.coord_y ), $( 'player_board_' + notif.args.player_id ) );
// // Animate a slide from the player panel to the intersection
// dojo.style( 'stone_' + notif.args.coord_x + '_' + notif.args.coord_y, 'zIndex', 1 );
// var slide = this.slideToObject( $( 'stone_' + notif.args.coord_x + '_' + notif.args.coord_y ), $( 'intersection_' + notif.args.coord_x + '_' + notif.args.coord_y ), 1000 );
// dojo.connect( slide, 'onEnd', this, dojo.hitch( this, function() {
// // At the end of the slide, update the intersection
// dojo.removeClass( 'intersection_' + notif.args.coord_x + '_' + notif.args.coord_y, 'no_stone' );
// dojo.addClass( 'intersection_' + notif.args.coord_x + '_' + notif.args.coord_y, 'stone_' + notif.args.color );
// dojo.removeClass( 'intersection_' + notif.args.coord_x + '_' + notif.args.coord_y, 'clickable' );
// // We can now destroy the stone since it is now visible through the change in style of the intersection
// dojo.destroy( 'stone_' + notif.args.coord_x + '_' + notif.args.coord_y );
// }));
// slide.play();
// Connect user actions
console.log( 'onUpdateActionButtons: '+stateName );
if( this.isCurrentPlayerActive() )
{
switch( stateName )
{
/*
Example:
case 'myGameState':
// Add 3 action buttons in the action status bar:
this.addActionButton( 'button_1_id', _('Button 1 label'), 'onMyMethodToCall1' );
this.addActionButton( 'button_2_id', _('Button 2 label'), 'onMyMethodToCall2' );
this.addActionButton( 'button_3_id', _('Button 3 label'), 'onMyMethodToCall3' );
break;
*/
if (this.isCurrentPlayerActive()) {
switch (stateName) {
case "playerTurn":
// TODO: if player.hasInvestigatorsLeft ... else show
// inactive button that simply spits a warning if
// clicked
this.addActionButton(
'btn_send_investigator',
dojo.string.substitute(_('Send investigator (${n} left)'), {n: 99}),
'onSendInvestigatorClicked');
this.addActionButton(
'btn_solve_case',
_('Solve case'),
'onSolveCaseClicked');
break;
onSendInvestigatorClicked: function () {
// TODO
// Alert: "Click on a location to send your investigator (X left)."
console.log('sending investigator')
},
onSolveCaseClicked: function () {
// TODO
// Alert: "Click the correct location, crime, and suspect to solve your case..."
console.log('trying to solve the case')
},
In this method, you associate each of your game notifications with your local method to handle it.
Note: game notification names correspond to "notifyAllPlayers" and "notifyPlayer" calls in
your fabiantest.game.php file.
In this method, you associate each of your game notifications with
your local method to handle it.
<!-- BEGIN locslot -->
<div id="locslot_{STRID}" class="locslot"
style="top:{TOP}px; left:{LEFT}px; transform:rotate({ROTATION}deg);"></div>
<!-- END locslot -->
<!-- <div id="locslot_centralstation_suspect" class="locslot" style="top:50.8%; left:25.8%; transform:rotate(2.5deg);"></div>
<div id="locslot_littleitaly_crime" class="locslot" style="top:30.4%; left:29.7%; transform:rotate(2.5deg);"></div>
<div id="locslot_littleitaly_suspect" class="locslot" style="top:30.8%; left:15.8%; transform:rotate(2.5deg);"></div>
<div id="locslot_mainstreet_crime" class="locslot" style="top:50.4%; left:64.7%; transform:rotate(0deg);"></div>
<div id="locslot_mainstreet_suspect" class="locslot" style="top:50.8%; left:50.8%; transform:rotate(0deg);"></div> -->
// crime
array('strid' => $loc['strid'] . '_crime',
'coords' => array(calcY($this->constants['BOARD_H'] * ($top / 100), $angle, $this->constants['BOARD_H'] * 0.07),
calcX($this->constants['BOARD_W'] * ($left / 100), $angle, $this->constants['BOARD_W'] * 0.07),
$angle)),
// suspect
array('strid' => $loc['strid'] . '_suspect',
'coords' => array(calcY($this->constants['BOARD_H'] * ($top / 100), $angle, $this->constants['BOARD_H'] * -0.07),
calcX($this->constants['BOARD_W'] * ($left / 100), $angle, $this->constants['BOARD_W'] * -0.07),
$angle)),
'crime' => array(
'id' => $loc_id * 100 + 1,
'strid' => $loc['strid'] . '_crime',
'coords' => array(calcY($this->constants['BOARD_H'] * ($top / 100), $angle, $this->constants['BOARD_H'] * 0.07),
calcX($this->constants['BOARD_W'] * ($left / 100), $angle, $this->constants['BOARD_W'] * 0.07),
$angle)),
'suspect' => array(
'id' => $loc_id * 100 + 3,
'strid' => $loc['strid'] . '_suspect',
'coords' => array(calcY($this->constants['BOARD_H'] * ($top / 100), $angle, $this->constants['BOARD_H'] * -0.07),
calcX($this->constants['BOARD_W'] * ($left / 100), $angle, $this->constants['BOARD_W'] * -0.07),
$angle)),
"transitions" => array( "endGame" => 99, "nextPlayer" => 10 )
),
10 => array(
"name" => "playerTurn",
"description" => clienttranslate('${actplayer} must play a card or pass'),
"descriptionmyturn" => clienttranslate('${you} must play a card or pass'),
"type" => "activeplayer",
"possibleactions" => array( "playCard", "pass" ),
"transitions" => array( "playCard" => 2, "pass" => 2 )
"transitions" => array(
"next" => STATE_PLAYER_TURN,
)