// Introcard.js
(function () {
/* global adventurejs A */
/**
* @class adventurejs.Introcard
* @ajsinternal
* @param {Game} game A reference to the game instance.
* @ajsnavheading FrameworkClasses
* @summary Manages the introcard for a {@link adventurejs.Game|Game} instance.
* @classdesc
* <p>
* <strong>Introcard</strong> can be used to print an introductory screen
* at the start of the game. Introcard is created automatically
* by {@link adventurejs.Game|Game}. This is an internal class
* that authors should not need to construct. However, authors
* can set intro options from their game file as shown below.
* </p>
* <h3 class="examples">Example:</h3>
* <pre class="display"><code class="language-javascript">var MyGame = new adventurejs.Game( "MyGame", "GameDisplay" );
* MyGame.introcard.set({
* });
* </code></pre>
*/
class Introcard {
constructor(game) {
this.game = game;
this.text = ``;
this.prompt_text = ``;
this.prompt_to_continue = false;
this.clear_on_continue = false;
this.hide_statusbar = false;
this.show_statusbar_on_continue = false;
this.hide_titlebar = false;
this.show_titlebar_on_continue = false;
}
/**
* Provides a chainable shortcut method for setting a number of properties on the instance.
* @method adventurejs.Introcard#set
* @param {Object} props A generic object containing properties to copy to the instance.
* @returns {adventurejs.Introcard} Returns the instance the method is called on (useful for chaining calls.)
* @chainable
*/
set(introcard) {
for (let prop in introcard) {
this[prop] = introcard[prop];
}
return this;
}
}
adventurejs.Introcard = Introcard;
})();