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.

Afficher le fichier Open project: iainmckay/idtech4.net

Méthodes publiques

Méthode 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

Méthode 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 méthode

public ArgCompletion ( string name, string argText ) : string[]
name string
argText string
Résultat string[]

ClearModified() public méthode

public ClearModified ( string name ) : void
name string
Résultat void

Command() public méthode

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

CommandCompletion() public méthode

public CommandCompletion ( Predicate filter ) : string[]
filter Predicate
Résultat string[]

CopyCvarsToDictionary() public méthode

public CopyCvarsToDictionary ( idDict dict, CvarFlags flags ) : void
dict idDict
flags CvarFlags
Résultat void

Find() public méthode

public Find ( string name ) : idCvar
name string
Résultat idCvar

GetBool() public méthode

public GetBool ( string name ) : bool
name string
Résultat bool

GetFloat() public méthode

public GetFloat ( string name ) : float
name string
Résultat float

GetInteger() public méthode

public GetInteger ( string name ) : int
name string
Résultat int

GetString() public méthode

public GetString ( string name ) : string
name string
Résultat string

Init() public méthode

public Init ( ) : void
Résultat void

IsModified() public méthode

public IsModified ( string name ) : bool
name string
Résultat bool

Register() public méthode

public Register ( idCvar var ) : void
var idCvar
Résultat void

RegisterStatics() public méthode

public RegisterStatics ( ) : void
Résultat void

SetBool() public méthode

public SetBool ( string name, bool value, CvarFlags flags ) : void
name string
value bool
flags CvarFlags
Résultat void

SetFloat() public méthode

public SetFloat ( string name, float value, CvarFlags flags ) : void
name string
value float
flags CvarFlags
Résultat void

SetInteger() public méthode

public SetInteger ( string name, int value, CvarFlags flags ) : void
name string
value int
flags CvarFlags
Résultat void

SetModified() public méthode

public SetModified ( string name ) : void
name string
Résultat void

SetString() public méthode

public SetString ( string name, string value, CvarFlags flags ) : void
name string
value string
flags CvarFlags
Résultat void

idCvarSystem() public méthode

public idCvarSystem ( ) : System
Résultat System