Page 1 of 1

Showing additional counters in the player area

Posted: 17 February 2013, 04:09
by BrianHanechak
I'd like to add some additional information to the player area. I couldn't find any documentation or examples on how to do this -- can someone point me to them?

Also, is it possible to add an extra icon or indicator not associated with a number (such as a 'start player' marker?)

- Brian

Re: Showing additional counters in the player area

Posted: 17 February 2013, 10:38
by sourisdudesert
Hello Brian,

I'm going to add a paragraph on this on documentation.

In the meantime, you can check out how it is working on Gomoku to display an additional counter:

First, you write your HTML template for your game panels at the end of your TPL file:

Code: Select all

var jstpl_player_board = '\<div class="cp_board">\
    <div id="stoneicon_p${id}" class="gmk_stoneicon gmk_stoneicon_${color}"></div><span id="stonecount_p${id}">0</span>\
</div>';
Then, you add this piece of code in your JS file to add this template to each player panel:

Code: Select all

            // Setting up player boards
            for( var player_id in gamedatas.players )
            {
                var player = gamedatas.players[player_id];
                         
                // Setting up players boards if needed
                var player_board_div = $('player_board_'+player_id);
                dojo.place( this.format_block('jstpl_player_board', player ), player_board_div );
            }
And that's it! After that, you can use this HTML part of the game interface as any other part of your HTML interface in the main game area.

Cheers,