HtmlGameViewController

@interface HtmlGameViewController
    : UIViewController <GameViewControllerProtocol>

HtmlGameViewController presents a fullscreen SKWebView to enable users to play games that support HtmlGameData.

  • The object responsible for handling delegate callbacks from the HtmlGameViewController.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable) id<GameViewControllerDelegate>
        delegate;

    Swift

    weak var delegate: GameViewControllerDelegate? { get set }
  • Default Initializer for the HtmlGameViewController.

    Declaration

    Objective-C

    + (nonnull instancetype)
    htmlGameViewControllerWithHtmlGameData:(nonnull HtmlGameData *)gameData
                               vouchrTheme:(nonnull VouchrTheme *)vouchrTheme
                           dialogViewTheme:(nonnull VouchrTheme *)dialogViewTheme
                               loadingView:(nullable id<VouchrLoadingViewProtocol>)
                                               loadingView
                                   creator:(nullable User *)creator
                                  gameMode:(GameMode)gameMode;

    Parameters

    gameData

    - The HtmlGameData to be played.

    vouchrTheme

    - The theme for the view controller.

    loadingView

    - A view with loading indication to be displayed when the view controller is processing information. The loading view will be constrained to the top of the view controller’s view.

    creator

    - The creator of the GameData.

    gameMode

    - The current mode for the game. See GameMode for the different options.

  • This method should be called when a user no longer requires the game session.

    Note

    The HTML game will still continue to run when modal screens are presented on top of this view controller. Call this method if the game running in the background is not desired.

    Note

    The current game data will not be saved.

    Declaration

    Objective-C

    - (void)endGameSession;

    Swift

    func endGameSession()
  • This method reinstantiates the game instance.

    Note

    Call this method to reininitalize the game if endGameSession has been called.

    Declaration

    Objective-C

    - (void)setupGameSession;

    Swift

    func setupGameSession()