Parlor moves back here.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@559 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// $Id$
|
||||
|
||||
package com.threerings.parlor.data;
|
||||
|
||||
import com.threerings.util.ActionScript;
|
||||
|
||||
/**
|
||||
* Models a parameter that allows the selection of one of a list of choices (specified as strings).
|
||||
*/
|
||||
public class ChoiceParameter extends Parameter
|
||||
{
|
||||
/** The set of choices available for this parameter. */
|
||||
public String[] choices;
|
||||
|
||||
/** The starting selection. */
|
||||
public String start;
|
||||
|
||||
/**
|
||||
* Returns the translation key for the specified choice.
|
||||
*/
|
||||
@ActionScript(omit=true)
|
||||
public String getChoiceLabel (int index)
|
||||
{
|
||||
return "m.choice_" + choices[index];
|
||||
}
|
||||
|
||||
@Override @ActionScript(omit=true) // documentation inherited
|
||||
public String getLabel ()
|
||||
{
|
||||
return "m.choice_" + ident;
|
||||
}
|
||||
|
||||
@Override // documentation inherited
|
||||
public Object getDefaultValue ()
|
||||
{
|
||||
return start;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// $Id$
|
||||
|
||||
package com.threerings.parlor.data;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.io.Streamable;
|
||||
|
||||
/**
|
||||
* Defines a configuration parameter for a game. Various derived classes exist that define
|
||||
* particular types of configuration parameters including choices, toggles, ranges, etc.
|
||||
*/
|
||||
public abstract class Parameter implements Streamable
|
||||
{
|
||||
/** A string identifier that names this parameter. */
|
||||
public String ident;
|
||||
|
||||
/** A human readable name for this configuration parameter. */
|
||||
public String name;
|
||||
|
||||
/** A human readable tooltip to display when the mouse is hovered over this configuration
|
||||
* parameter. */
|
||||
public String tip;
|
||||
|
||||
/** Returns the translation key for this parameter's label. */
|
||||
public abstract String getLabel ();
|
||||
|
||||
/** Returns the default value of this parameter. */
|
||||
public abstract Object getDefaultValue ();
|
||||
|
||||
/** Generates a string representation of this instance. */
|
||||
public String toString ()
|
||||
{
|
||||
return StringUtil.fieldsToString(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// $Id$
|
||||
|
||||
package com.threerings.parlor.data;
|
||||
|
||||
import com.threerings.util.ActionScript;
|
||||
|
||||
/**
|
||||
* Models a parameter that can contain an integer value in a specified range.
|
||||
*/
|
||||
public class RangeParameter extends Parameter
|
||||
{
|
||||
/** The minimum value of this parameter. */
|
||||
public int minimum;
|
||||
|
||||
/** The maximum value of this parameter. */
|
||||
public int maximum;
|
||||
|
||||
/** The starting value for this parameter. */
|
||||
public int start;
|
||||
|
||||
@Override @ActionScript(omit=true) // documentation inherited
|
||||
public String getLabel ()
|
||||
{
|
||||
return "m.range_" + ident;
|
||||
}
|
||||
|
||||
@Override // documentation inherited
|
||||
public Object getDefaultValue ()
|
||||
{
|
||||
return start;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// $Id$
|
||||
|
||||
package com.threerings.parlor.data;
|
||||
|
||||
import com.threerings.util.ActionScript;
|
||||
|
||||
/**
|
||||
* Models a parameter that allows the toggling of a single value.
|
||||
*/
|
||||
public class ToggleParameter extends Parameter
|
||||
{
|
||||
/** The starting state for this parameter. */
|
||||
public boolean start;
|
||||
|
||||
@Override @ActionScript(omit=true) // documentation inherited
|
||||
public String getLabel ()
|
||||
{
|
||||
return "m.toggle_" + ident;
|
||||
}
|
||||
|
||||
@Override // documentation inherited
|
||||
public Object getDefaultValue ()
|
||||
{
|
||||
return start;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user