Class: TopLevelComponent

TopLevelComponent()

Top-level component which manages the display of the entire game.

Constructor

new TopLevelComponent()

Source:

Extends

  • Component

Members

current_opponent_display :string

The display name of the current opponent.
Type:
  • string
Source:

current_player_display :string

The display name of the current player.
Type:
  • string
Source:

current_state :GameState|undefined

The current game state.
Type:
  • GameState | undefined
Source:

GameState :object

Make the game state accessible w/in the template.
Type:
  • object
Source:

instructions :string

The current instructions to be shown to the user.
Type:
  • string
Source:

opponent_rows :Array.<Array.<object>>

The opponent's grid data.
Type:
  • Array.<Array.<object>>
Source:

player_is_firing_missiles :boolean

True if the player should be able to fire missiles at their opponent.
Type:
  • boolean
Source:

player_is_placing_ships :boolean

True if the player should be able to place their ships.
Type:
  • boolean
Source:

player_rows :Array.<Array.<object>>

The player's grid data.
Type:
  • Array.<Array.<object>>
Source:

ships_to_place :Array.<ShipType>

If in placement mode, the ships that are yet to be placed.
Type:
  • Array.<ShipType>
Source:

Methods

confirm_player_change()

Called when the player has confirmed the player change.
Source:

(async) on_missile_fired(row_index, column_index)

Called when the player attempts to fire a missile.
Parameters:
Name Type Description
row_index number
column_index number
Source:

on_ship_placed()

Called when the current user has placed a ship.
Source:

ship(n)

Set the number of boats.
Parameters:
Name Type Description
n number
Source:

(async) vue_on_create() → {Promise.<void>}

Called when the component is initialized.
Source:
Returns:
Type
Promise.<void>