C# Class idTech4.idCvarSystem

Console Variables (CVars) are used to hold scalar or string variables that can be changed or displayed at the console as well as accessed directly in code.
CVars are mostly used to hold settings that can be changed from the console or saved to and loaded from configuration files. CVars are also occasionally used to communicate information between different modules of the program.

CVars are restricted from having the same names as console commands to keep the console interface from being ambiguous.

CVars can be accessed from the console in three ways: cvarName prints the current value cvarName X sets the value to X if the variable exists set cvarName X as above, but creates the CVar if not present

CVars may be declared in classes and in functions. However declarations in classes and functions should always be static to save space and time. Making CVars static does not change their functionality due to their global nature.

CVars should be contructed only through one of the constructors with name, value, flags and description. The name, value and description parameters to the constructor have to be static strings, do not use va() or the like functions returning a string.

CVars may be declared multiple times using the same name string. However, they will all reference the same value and changing the value of one CVar changes the value of all CVars with the same name.

CVars should always be declared with the correct type flag: CVAR_BOOL, CVAR_INTEGER or CVAR_FLOAT. If no such flag is specified the CVar defaults to type string. If the CVAR_BOOL flag is used there is no need to specify an argument auto-completion function because the CVar gets one assigned automatically.

CVars are automatically range checked based on their type and any min/max or valid string set specified in the constructor.

CVars are always considered cheats except when CVAR_NOCHEAT, CVAR_INIT, CVAR_ROM, CVAR_ARCHIVE, CVAR_USERINFO, CVAR_SERVERINFO, CVAR_NETWORKSYNC is set.

显示文件 Open project: iainmckay/idtech4.net

Public Methods

Method Description
ArgCompletion ( string name, string argText ) : string[]
ClearModified ( string name ) : void
Command ( idCmdArgs args ) : bool

Called by the command system when a command is unrecognized.

CommandCompletion ( Predicate filter ) : string[]
CopyCvarsToDictionary ( idDict dict, CvarFlags flags ) : void
Find ( string name ) : idCvar
GetBool ( string name ) : bool
GetFloat ( string name ) : float
GetInteger ( string name ) : int
GetString ( string name ) : string
Init ( ) : void
IsModified ( string name ) : bool
Register ( idCvar var ) : void
RegisterStatics ( ) : void
SetBool ( string name, bool value, CvarFlags flags ) : void
SetFloat ( string name, float value, CvarFlags flags ) : void
SetInteger ( string name, int value, CvarFlags flags ) : void
SetModified ( string name ) : void
SetString ( string name, string value, CvarFlags flags ) : void
idCvarSystem ( ) : System

Private Methods

Method Description
Cmd_List ( object sender, CommandEventArgs e ) : void
Cmd_Reset ( object sender, CommandEventArgs e ) : void
Cmd_Restart ( object sender, CommandEventArgs e ) : void
Cmd_Set ( object sender, CommandEventArgs e ) : void
Cmd_SetA ( object sender, CommandEventArgs e ) : void
Cmd_SetS ( object sender, CommandEventArgs e ) : void
Cmd_SetT ( object sender, CommandEventArgs e ) : void
Cmd_SetU ( object sender, CommandEventArgs e ) : void
Cmd_Toggle ( object sender, CommandEventArgs e ) : void
FindInternal ( string name, bool ignoreMissing = false ) : idInternalCvar
ListByFlags ( idCmdArgs args, CvarFlags flags ) : void
SetInternal ( string name, string value, CvarFlags flags ) : void

Method Details

ArgCompletion() public method

public ArgCompletion ( string name, string argText ) : string[]
name string
argText string
return string[]

ClearModified() public method

public ClearModified ( string name ) : void
name string
return void

Command() public method

Called by the command system when a command is unrecognized.
public Command ( idCmdArgs args ) : bool
args idCmdArgs
return bool

CommandCompletion() public method

public CommandCompletion ( Predicate filter ) : string[]
filter Predicate
return string[]

CopyCvarsToDictionary() public method

public CopyCvarsToDictionary ( idDict dict, CvarFlags flags ) : void
dict idDict
flags CvarFlags
return void

Find() public method

public Find ( string name ) : idCvar
name string
return idCvar

GetBool() public method

public GetBool ( string name ) : bool
name string
return bool

GetFloat() public method

public GetFloat ( string name ) : float
name string
return float

GetInteger() public method

public GetInteger ( string name ) : int
name string
return int

GetString() public method

public GetString ( string name ) : string
name string
return string

Init() public method

public Init ( ) : void
return void

IsModified() public method

public IsModified ( string name ) : bool
name string
return bool

Register() public method

public Register ( idCvar var ) : void
var idCvar
return void

RegisterStatics() public method

public RegisterStatics ( ) : void
return void

SetBool() public method

public SetBool ( string name, bool value, CvarFlags flags ) : void
name string
value bool
flags CvarFlags
return void

SetFloat() public method

public SetFloat ( string name, float value, CvarFlags flags ) : void
name string
value float
flags CvarFlags
return void

SetInteger() public method

public SetInteger ( string name, int value, CvarFlags flags ) : void
name string
value int
flags CvarFlags
return void

SetModified() public method

public SetModified ( string name ) : void
name string
return void

SetString() public method

public SetString ( string name, string value, CvarFlags flags ) : void
name string
value string
flags CvarFlags
return void

idCvarSystem() public method

public idCvarSystem ( ) : System
return System