ice.campaign - ICE 0.1 API documentation

ICE 0.1 API documentation

# 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:

    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.

    Throws:
    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.

  YAMLNode campaignCredits;

    Credits information for the campaign.

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:

    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.

    Throws:
    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:

    VFSDir gameDir | Game data directory (parent of the campaigns/ directory).

    Throws:
    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;

    VFS file name of the campaign.

  const string humanName;

    Human readable name of the campaign.

  this(const(immutable(char)[]) name, Node yaml, VFSDir gameDir);

    Construct a Campaign.

    Parameters:

    const(immutable(char)[]) name | Name of the campaign.
    Node yaml | YAML source of the campaign.
    VFSDir gameDir | Game data directory.

    Throws:
    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();

    Get credits information of this campaign.

Copyright © Ferdinand Majerech 2011. | Page generated by AutoDDoc and Ddoc.