ice.campaign
Classes related to campaigns.
- class CampaignsGUI: ice.guiswapper.SwappableGUI;
Campaign selection GUI.
- this(GUISystem gui, CampaignManager campaignManager, VFSDir gameDir);
Construct a CampaignsGUI.
This loads the widget tree.
Parameters:Throws:GUISystem gui Reference to the GUI system to load widgets with. CampaignManager campaignManager CampaignManager this GUI is working with. VFSDir gameDir Game data directory to load the GUI from. GUIInitException on GUI loading failure. VFSException if the GUI file/s could not be found.
- struct CampaignWinData;
Used to pass data about a campaign victoryy.
- class CampaignGUI: ice.guiswapper.SwappableGUI;
GUI for a particular campaign, allowing to select the level to play.
- this(GUISystem gui, VFSDir gameDir, Campaign campaign, PlayerProfile playerProfile, void delegate(ref Node, string delegate(), void delegate(GameOverData)) initGame);
Initialize the campaign GUI.
Parameters:Throws:GUISystem gui GUI system to load widgets. VFSDir gameDir Game data directory. Campaign campaign The first selected campaign. PlayerProfile playerProfile Player currently playing the game. void delegate(ref Node, string delegate(), void delegate(GameOverData)) initGame Function called to initialize game, passing the source of level to play, a delegate returning name of the GUI to swap to after the game ends and a delegate for the game to call when the level ends. VFSException on a filesystem error. GUIInitException if the GUI could not be loaded.
- class CampaignInitException: object.Exception;
Exception thrown at campaign initialization errors.
- class CampaignSaveException: object.Exception;
Exception thrown when campaign related data saving fails.
- class CampaignManager;
Loads and provides access to campaigns.
- this(VFSDir gameDir);
Construct a CampaignManager.
Loads campaigns from the campaigns/ directory.
Parameters:Throws:VFSDir gameDir Game data directory (parent of the campaigns/ directory). CampaignInitException if the campaign directory doesn't exist or if a campaign could not be loaded (e.g. due to a YAML error).- void save();
Save campaigns configuration (e.g. currently selected campaign).
- void nextCampaign();
Select the next campaign..
- void previousCampaign();
Select the previous campaign.
- Campaign currentCampaign();
Get the currently selected campaign.
- class Campaign;
Campaign; a series of levels played in order.
- const string name;
- const string humanName;
Human readable name of the campaign.
- this(const(immutable(char)[]) name, Node yaml, VFSDir gameDir);
Construct a Campaign.
Parameters:Throws:const(immutable(char)[]) name Name of the campaign. Node yaml YAML source of the campaign. VFSDir gameDir Game data directory. CampaignInitException on failure.- void nextLevel();
Select the next level.
- void previousLevel();
Select the previous level.
- const pure nothrow @property size_t length();
Get the number of levels in the campaign.
- Tuple!(uint,string,Node) currentLevel();
Get the index, name and YAML source of the currently selected level.
- ref YAMLNode credits();