buttons and dropdowns

Game development with Board Game Arena Studio
Post Reply
User avatar
ddyer
Posts: 67
Joined: 01 April 2011, 19:55

buttons and dropdowns

Post by ddyer »

None of the sample code has buttons or dropdowns. It would be good to use
site-standard artwork templates for buttons and translatable button text.
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

Re: buttons and dropdowns

Post by Rudolf »

Here is an example of what I used... before erasing button and choose text with 'link' to have uniform behaviour than the other games ;)
For foreign language, you can edit text property of th button in the initdata() (with dojo.byID(buttonname)) to translate the text.
++
Rudolf

game.css:

Code: Select all

.styleNextStepButton
{
	left: 590px;
	top: -24px;
	z-index:6;
	}

#NextStepButton
{
	position:relative;
}
in game.tpl

Code: Select all

<div id="NextStepButton" class="styleNextStepButton">
	<input type="button" value="PASS" onclick="PassClick()" style="background-color:#3cb371" style="color:white; font-weight:bold"> 
in game.js

Code: Select all

function PassClick()
{
	switch (ActiveStep)
	{
		case 40: case 61: NextStep();
		default: return;
	}
}
[/code]
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: buttons and dropdowns

Post by sourisdudesert »

Hello,

You can find the documentation about how to have a standard BGA button here:

http://en.doc.boardgamearena.com/Game_l ... ice_button

Cheers,
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: buttons and dropdowns

Post by sourisdudesert »

Hello,

Concerning dropdown, for now we didn't have the need to have dropdown box in games (as far as I remember). I don't feel it's really "board game interface friendly" :) But if you feel it makes sense in a game, why not ?

All the best,
User avatar
ddyer
Posts: 67
Joined: 01 April 2011, 19:55

Re: buttons and dropdowns

Post by ddyer »

sourisdudesert wrote:Hello,

You can find the documentation about how to have a standard BGA button here:

http://en.doc.boardgamearena.com/Game_l ... ice_button

Cheers,
This led me to add

<a href="#" id="my_button_id" class="button" onClick="PassClick()"><span>Pass</span></a>

which gets me a button with the standard artwork, but it's not clear how to bridge
from the plain javascript environment of "PassClick" to the environment of OnClickInterSection
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

Re: buttons and dropdowns

Post by Rudolf »

In this case, (maybe?) use

Code: Select all

this.addActionButton( 'zebutton', _(' Pass this action'), 'OnClickInterSection');
The text is under translation core


Or you can generate the Onclick when you need?

Code: Select all

dojo.connect ($('zebutton'),'onClick',this,'OnClickInterSection'); 
hope it will help
§Rudolf§
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: buttons and dropdowns

Post by sourisdudesert »

Hello,

The second solution of Rudolf (dojo.connect) is the right one. You can also use "addActionButton", but only for buttons in the main action status bar.

Cheers,
Post Reply

Return to “Developers”