Class GameInfo

java.lang.Object
com.deco2800.game.files.meta.GameInfo

public class GameInfo
extends java.lang.Object
The class is responsible for keeping a tab of the game metadata
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  GameInfo.GameMetadata
    Represents the game metadata
  • Constructor Summary

    Constructors 
    Constructor Description
    GameInfo()  
  • Method Summary

    Modifier and Type Method Description
    static int getGameCount()
    Returns the number of games that the user has played from local storage By default, 0 games have been played.
    static GameInfo.GameMetadata getGameMetadata()
    Reads the game metadata from local JSON file
    static void incrementGameCount()
    Increment the total number of games that have been played by the user.
    static void setGameMetadata​(GameInfo.GameMetadata info)
    Persist the game metadata

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • incrementGameCount

      public static void incrementGameCount()
      Increment the total number of games that have been played by the user. Persist this in local storage. Ideally, this should be incremented as soon as the main character dies.
    • getGameCount

      public static int getGameCount()
      Returns the number of games that the user has played from local storage By default, 0 games have been played.
      Returns:
      the number of games
    • getGameMetadata

      public static GameInfo.GameMetadata getGameMetadata()
      Reads the game metadata from local JSON file
      Returns:
      latest metadata stored in local storage
    • setGameMetadata

      public static void setGameMetadata​(GameInfo.GameMetadata info)
      Persist the game metadata
      Parameters:
      info - the game metadata to persist in local storage