An extension to help you with bootstrapping your application.
Bootstrapping is modifying how your program runs from startup - usually based on a configuration file.
This project is built upon TinYard at commit #61477e8eecdc704454157b97574c40d8e1b501b5.
This is some way between Version 1.2 and Version 1.3. It should be updated to work with Version 1.3 when released.
Short and sweet:
- Inherit the
IBootstrapSettingRequestor
interface when you want to dispatch events asking for settings. - Inherit the
IBootstrapSettingReceiver
interface when you want to receive settings requested.
This extension provides you with bootstrap settings from an XML file that you provide.
The location of this file can be set through the BootstrapSettingsConfig
, as an override parameter - You need to provide an absolute path.
Otherwise, the default location of your bootstrap file is Directory.GetCurrentDirectory()/Assets/bootstrap-settings.xml
-> WorkingDirectory/Assets/bootstrap-settings.xml
.
The Events available to use in this extension are:
RetrieveBootstrapSettingsEvent
This event has two Type's:
- Get
- Got
When requesting a setting, use Get
. You have two event constructors available for this:
RetrieveBootstrapSettingsEvent(string settingName);
RetrieveBootstrapSettingsEvent(string settingName, Type settingType);
If you use the first constructor, it will default to getting a string value from the IBootstrapSettingsModel
- The SettingValue
will be a string.
The second constructor will return an object
, but this should be of type SettingValueType
and you should be able to successfully cast this.
When the value has been retrieved from the IBootstrapSettingsModel
, the Got
Type will be dispatched and you can listen for this.
It is recommended that rather than create your own mediator to handle the events, as this requires adding more configurations, you use the IBootstrapSettingRequestor
and/or IBootstrapSettingReceiver
interfaces. The Requestor interface is for when you want to be able to dispatch the Get
Type and the Receiver interface is for when receiving the Got
Type.