Enhanced configuration configuration.

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@512 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2007-11-27 21:00:56 +00:00
parent 55926ab3ea
commit 7be5c32548
2 changed files with 73 additions and 50 deletions
@@ -48,11 +48,23 @@ import com.threerings.ezgame.data.ToggleParameter;
*/
public class EZGameConfigurator extends FlexGameConfigurator
{
public function EZGameConfigurator (ratedParam :ToggleParameter = null)
{
_ratedParam = ratedParam;
}
// from GameConfigurator
override protected function gotGameConfig () :void
{
super.gotGameConfig();
// add an interface for checking ratedness
if (_ratedParam != null) {
_ratedCheck = new CheckBox();
_ratedCheck.selected = _ratedParam.start;
addLabeledControl(_ratedParam, _ratedCheck);
}
var params :Array = (_config as EZGameConfig).getGameDefinition().params;
if (params == null) {
return;
@@ -113,6 +125,11 @@ public class EZGameConfigurator extends FlexGameConfigurator
{
super.flushGameConfig();
// flush ratedness
if (_ratedCheck != null) {
_config.rated = _ratedCheck.selected;
}
// if there were any custom XML configs, flush those as well.
if (_customConfigs.length > 0) {
var params :StreamableHashMap = new StreamableHashMap();
@@ -151,7 +168,7 @@ public class EZGameConfigurator extends FlexGameConfigurator
}
var lbl :Label = new Label();
lbl.text = param.name + ":";
lbl.text = param.name;
lbl.styleName = "lobbyLabel";
lbl.toolTip = param.tip;
control.toolTip = param.tip;
@@ -160,6 +177,12 @@ public class EZGameConfigurator extends FlexGameConfigurator
_customConfigs.push(param.ident, control);
}
/** The parameter to use for whether the game is rated, or null. */
protected var _ratedParam :ToggleParameter;
/** A toggle indicating whether the game should be rated. */
protected var _ratedCheck :CheckBox;
/** Contains pairs of identString, control, identString, control.. */
protected var _customConfigs :Array = [];
}