Please excuse my unilateral action, but I hate sliders. Use a ComboBox for
player count selection and for any range parameter of less than 16 elements. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@497 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -61,13 +61,29 @@ public class EZGameConfigurator extends FlexGameConfigurator
|
|||||||
for each (var param :Parameter in params) {
|
for each (var param :Parameter in params) {
|
||||||
if (param is RangeParameter) {
|
if (param is RangeParameter) {
|
||||||
var range :RangeParameter = (param as RangeParameter);
|
var range :RangeParameter = (param as RangeParameter);
|
||||||
var slider :HSlider = new HSlider();
|
if ((range.maximum - range.minimum) < 16) {
|
||||||
slider.minimum = range.minimum;
|
var combo :ComboBox = new ComboBox();
|
||||||
slider.maximum = range.maximum;
|
var values :Array = [];
|
||||||
slider.value = range.start;
|
var startDex :int = 0;
|
||||||
slider.liveDragging = true;
|
for (var ii :int = range.minimum; ii <= range.maximum; ii++) {
|
||||||
slider.snapInterval = 1;
|
if (ii == range.start) {
|
||||||
addLabeledControl(param, new LabeledSlider(slider));
|
startDex = ii;
|
||||||
|
}
|
||||||
|
values.push(ii);
|
||||||
|
}
|
||||||
|
combo.dataProvider = values;
|
||||||
|
combo.selectedIndex = startDex;
|
||||||
|
addLabeledControl(param, combo);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
var slider :HSlider = new HSlider();
|
||||||
|
slider.minimum = range.minimum;
|
||||||
|
slider.maximum = range.maximum;
|
||||||
|
slider.value = range.start;
|
||||||
|
slider.liveDragging = true;
|
||||||
|
slider.snapInterval = 1;
|
||||||
|
addLabeledControl(param, new LabeledSlider(slider));
|
||||||
|
}
|
||||||
|
|
||||||
} else if (param is ChoiceParameter) {
|
} else if (param is ChoiceParameter) {
|
||||||
var choice :ChoiceParameter = (param as ChoiceParameter);
|
var choice :ChoiceParameter = (param as ChoiceParameter);
|
||||||
|
|||||||
@@ -24,11 +24,10 @@ package com.threerings.parlor.client {
|
|||||||
import mx.containers.Grid;
|
import mx.containers.Grid;
|
||||||
|
|
||||||
import mx.controls.CheckBox;
|
import mx.controls.CheckBox;
|
||||||
import mx.controls.HSlider;
|
import mx.controls.ComboBox;
|
||||||
import mx.controls.Label;
|
import mx.controls.Label;
|
||||||
|
|
||||||
import com.threerings.flex.GridUtil;
|
import com.threerings.flex.GridUtil;
|
||||||
import com.threerings.flex.LabeledSlider;
|
|
||||||
|
|
||||||
import com.threerings.parlor.data.TableConfig;
|
import com.threerings.parlor.data.TableConfig;
|
||||||
import com.threerings.parlor.util.ParlorContext;
|
import com.threerings.parlor.util.ParlorContext;
|
||||||
@@ -51,25 +50,28 @@ public class DefaultFlexTableConfigurator extends TableConfigurator
|
|||||||
allowWatchable :Boolean = true, playersXlate :String = "Players: ",
|
allowWatchable :Boolean = true, playersXlate :String = "Players: ",
|
||||||
watchableXlate :String = "Watchable: ", privateXlate :String = "Private: ")
|
watchableXlate :String = "Watchable: ", privateXlate :String = "Private: ")
|
||||||
{
|
{
|
||||||
var partyGame :Boolean = minPlayers < 0 && maxPlayers < 0;
|
var partyGame :Boolean = (minPlayers < 0) && (maxPlayers < 0);
|
||||||
|
|
||||||
if (minPlayers < 0) {
|
if (minPlayers < 0) {
|
||||||
minPlayers = desiredPlayers;
|
minPlayers = desiredPlayers;
|
||||||
}
|
}
|
||||||
if (maxPlayers < 0) {
|
if (maxPlayers < 0) {
|
||||||
maxPlayers = desiredPlayers;
|
maxPlayers = desiredPlayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
_config.minimumPlayerCount = minPlayers;
|
_config.minimumPlayerCount = minPlayers;
|
||||||
|
|
||||||
// create a slider for players, if applicable
|
// create a slider for players, if applicable
|
||||||
if (minPlayers != maxPlayers) {
|
if (minPlayers != maxPlayers) {
|
||||||
_playerSlider = new HSlider();
|
_players = new ComboBox();
|
||||||
_playerSlider.value = desiredPlayers;
|
var values :Array = [];
|
||||||
_playerSlider.minimum = minPlayers;
|
var startDex :int = 0;
|
||||||
_playerSlider.maximum = maxPlayers;
|
for (var ii :int = minPlayers; ii <= maxPlayers; ii++) {
|
||||||
_playerSlider.liveDragging = true;
|
if (ii == desiredPlayers) {
|
||||||
_playerSlider.snapInterval = 1;
|
startDex = ii;
|
||||||
|
}
|
||||||
|
values.push(ii);
|
||||||
|
}
|
||||||
|
_players.dataProvider = values;
|
||||||
|
_players.selectedIndex = startDex;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_config.desiredPlayerCount = desiredPlayers;
|
_config.desiredPlayerCount = desiredPlayers;
|
||||||
@@ -98,12 +100,11 @@ public class DefaultFlexTableConfigurator extends TableConfigurator
|
|||||||
var gconf :FlexGameConfigurator =
|
var gconf :FlexGameConfigurator =
|
||||||
(_gameConfigurator as FlexGameConfigurator);
|
(_gameConfigurator as FlexGameConfigurator);
|
||||||
|
|
||||||
if (_playerSlider != null) {
|
if (_players != null) {
|
||||||
var playerLabel :Label = new Label();
|
var playerLabel :Label = new Label();
|
||||||
playerLabel.text = _playersXlate;
|
playerLabel.text = _playersXlate;
|
||||||
playerLabel.styleName = "lobbyLabel";
|
playerLabel.styleName = "lobbyLabel";
|
||||||
|
gconf.addControl(playerLabel, _players);
|
||||||
gconf.addControl(playerLabel, new LabeledSlider(_playerSlider));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_watchableCheck != null) {
|
if (_watchableCheck != null) {
|
||||||
@@ -122,7 +123,7 @@ public class DefaultFlexTableConfigurator extends TableConfigurator
|
|||||||
// documentation inherited
|
// documentation inherited
|
||||||
override public function isEmpty () :Boolean
|
override public function isEmpty () :Boolean
|
||||||
{
|
{
|
||||||
return (_playerSlider == null) && (_watchableCheck == null);
|
return (_players == null) && (_watchableCheck == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
@@ -130,8 +131,8 @@ public class DefaultFlexTableConfigurator extends TableConfigurator
|
|||||||
{
|
{
|
||||||
super.flushTableConfig();
|
super.flushTableConfig();
|
||||||
|
|
||||||
if (_playerSlider != null) {
|
if (_players != null) {
|
||||||
_config.desiredPlayerCount = _playerSlider.value;
|
_config.desiredPlayerCount = int(_players.selectedItem);
|
||||||
}
|
}
|
||||||
// TODO - it is wacky for the TableConfig.privateTable to mean two different things.
|
// TODO - it is wacky for the TableConfig.privateTable to mean two different things.
|
||||||
// It should be extended to have separate privateTable and watchableTable options.
|
// It should be extended to have separate privateTable and watchableTable options.
|
||||||
@@ -142,8 +143,8 @@ public class DefaultFlexTableConfigurator extends TableConfigurator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A slider for configuring the number of players at the table. */
|
/** A component for configuring the number of players at the table. */
|
||||||
protected var _playerSlider :HSlider;
|
protected var _players :ComboBox;
|
||||||
|
|
||||||
/** A checkbox to allow the table creator to specify if the table is watchable */
|
/** A checkbox to allow the table creator to specify if the table is watchable */
|
||||||
protected var _watchableCheck :CheckBox;
|
protected var _watchableCheck :CheckBox;
|
||||||
|
|||||||
Reference in New Issue
Block a user