I love the smell of UnrealEd crashing in the morning. – tarquin
Difference between revisions of "Legacy:WebAdmin (UT3)/Settings Provider"
m (fixed links to UT3 Settings class) |
(→Commands) |
||
Line 27: | Line 27: | ||
===Commands=== | ===Commands=== | ||
− | There is no way for the WebAdmin to directly load and save the values of the configured properties to configuration files. This has to be done manually. To signal the settings class to load or save the current values the WebAdmin will send commands through the | + | There is no way for the WebAdmin to directly load and save the values of the configured properties to configuration files. This has to be done manually. To signal the settings class to load or save the current values the WebAdmin will send commands through the <code>SetSpecialValue(...)</code> function. This is done so that there is no coupling between the WebAdmin package and the package that contains the settings provider class. |
The WebAdmin sends the following commands (as the property argument): | The WebAdmin sends the following commands (as the property argument): | ||
− | ;WebAdmin_init: called after the creation of the setting provider. It should be used to set the values of the defined properties to the currently configured values. | + | ; WebAdmin_init |
− | ;WebAdmin_save: called when the WebAdmin user pressed the save settings button in the WebAdmin. The WebAdmin already updated the values in the defined properties to reflect the user entered data. This command should be used to copy the values to the correct variables and call the | + | : called after the creation of the setting provider. It should be used to set the values of the defined properties to the currently configured values. |
− | ;WebAdmin_cleanup: this will be called when the WebAdmin is destroyed. The settings provider should use this to clean itself up when needed. | + | ; WebAdmin_save |
+ | : called when the WebAdmin user pressed the save settings button in the WebAdmin. The WebAdmin already updated the values in the defined properties to reflect the user entered data. This command should be used to copy the values to the correct variables and call the <code>StaticSaveConfig()</code> function. | ||
+ | ; WebAdmin_cleanup | ||
+ | : this will be called when the WebAdmin is destroyed. The settings provider should use this to clean itself up when needed. | ||
+ | |||
+ | The WebAdmin also uses <code>GetSpecialValue</code> function. | ||
+ | ; WebAdmin_groups | ||
+ | : this call should return string in form <code><nowiki><group1>;<group2>;<group3></nowiki><code>, where group is <code><nowiki><title>=<pMin>,<pMax>,<lMin>,<lMax></nowiki><code>. '''pMin''' and '''pMax''' denote range in <code>PropertyMappings</code> array, and '''lMin''' and '''lMax''' denote range in <code>LocalizedSettingsMappings</code> array. <!-- whatever that means --> | ||
===Settings rendering=== | ===Settings rendering=== |
Latest revision as of 05:55, 11 January 2012
UT3 does not provide the PlayInfo functionality as it was present in UT2004. Because of this a different mechanism is used to provide functionality to change the configuration settings of mutators and game types. The WebAdmin makes special usages of the Settings class. It is best to first read up on how that class functions.
Contents
Configurable classes[edit]
The WebAdmin provides functionality to configure game types and mutators. But the same functionality could easily be used to extend the functionality to different class sets.
For a game type or mutator to be configurable it must be registered to the system (otherwise it WebAdmin does not know of its existence). And the game type/mutator must have a settings provider class.
The settings provider class[edit]
All settings provides must subclass the Settings class. It does not matter if you directly subclass the Settings class, or if you subclass any of its existing subclasses.
Searching for the class[edit]
The WebAdmin will try to find the settings provides class in by searching for the following:
- in the QHDefaults.SettingsClasses array
- by appending Settings to the class to be configured. For example for ExampleGame.Deathmatch it will look for ExampleGame.DeathmatchSettings
- as a final resort just search for the class (without the package). This only works when the package that contains the class was fully loaded. Otherwise the class was not made known to the system. You could use DLO to force the loading of the class from your mutator/gametype so that the WebAdmin can find it.
Defining properties[edit]
Read the documentation about the Settings class on how to define properties.
The properties are used storage and rendering of the configurable settings.
Commands[edit]
There is no way for the WebAdmin to directly load and save the values of the configured properties to configuration files. This has to be done manually. To signal the settings class to load or save the current values the WebAdmin will send commands through the SetSpecialValue(...)
function. This is done so that there is no coupling between the WebAdmin package and the package that contains the settings provider class.
The WebAdmin sends the following commands (as the property argument):
- WebAdmin_init
- called after the creation of the setting provider. It should be used to set the values of the defined properties to the currently configured values.
- WebAdmin_save
- called when the WebAdmin user pressed the save settings button in the WebAdmin. The WebAdmin already updated the values in the defined properties to reflect the user entered data. This command should be used to copy the values to the correct variables and call the
StaticSaveConfig()
function. - WebAdmin_cleanup
- this will be called when the WebAdmin is destroyed. The settings provider should use this to clean itself up when needed.
The WebAdmin also uses GetSpecialValue
function.
- WebAdmin_groups
- this call should return string in form
<group1>;<group2>;<group3>
, where group is<title>=<pMin>,<pMax>,<lMin>,<lMax>
. pMin and pMax denote range inPropertyMappings
array, and lMin and lMax denote range inLocalizedSettingsMappings
array.
Settings rendering[edit]
The properties are rendered through the WebAdmin.SettingsRenderer class.
The properties are first sorted on their ColumnHeader value, properties and localized settings are mixed. The properties are rendered according to the following rules:
Localized settings are rendered in the same way as properties with the type mapping PVMT_IdMapped.
Mapping Type | Rules |
PVMT_PredefinedValues | This will initially show a drop down list box with the predefined values. But it also provides an option to switch to raw editing of the value. |
PVMT_Ranged | Will be rendered as a HTML text field. Through JavaScript the defined ranges will be enforced. The server will double check the defined ranges. |
PVMT_IdMapped | Will be rendered as a drop down list. |
PVMT_RawValue | The rendering also depends on the data type. In case of a float or integer data type it will be rendered as a text field much like the one used by the range type. You can use the MinVal and MaxVal of the property to define a range, this range however is not enforced on the server. When the data type is of type string will be rendered as either a simple text field or a textarea, depending on the MaxVal value of the property (<256 is a text field). The MaxValue will be used to set the maximum length of the text field. |
IAdvWebAdminSettings[edit]
The Settings class is limited in its functionality. You can only declare settings with constant information. But for example in the Arena mutator it should provide a list of all weapons that exist, including 3rd party weapons. To overcome this problem a special interface has been declared that provides more freedom: IAdvWebAdminSettings (UT3). There are however some side effects to using that interface rather than using a simple subclass of the Settings class. Using the interface introduces a dependency on the optional server-side only WebAdmin package. This means that you'll have to provide a separate package with your mode that contains the settings functionality.