Class PlayerProfileDisplay

All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable, Renderable, Comparable<Renderable>

public class PlayerProfileDisplay extends UIComponent
This class creates the player profile window. Description of the feature: This feature displays the player's profile for the current player of the game. The profile includes useful and perhaps interesting statistics about the player's performance in the game, including the average time they have taken to win the game, the average number of attempts taken to guess the traitor until they win, how many times they have lost the game, and how many times they have won the game.
  • Constructor Details

    • PlayerProfileDisplay

      public PlayerProfileDisplay()
  • Method Details

    • create

      public void create()
      Description copied from class: Component
      Called when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished.
      Overrides:
      create in class UIComponent
    • getPlayerProfile

      public List<PlayerProfileProperties> getPlayerProfile()
      Gets the list of performance stats of the player (player profile) in the json file.
      Returns:
      list of performance stats
    • calculateAvg

      public float calculateAvg(int sum, int numElements)
      Calculates the average value.
      Parameters:
      sum - the sum of all elements.
      numElements - the number of elements.
      Returns:
      the average of the elements.
    • calculateAveTi

      public float calculateAveTi(int timeLeft, int timeWins)
    • calculateAvgAtm

      public float calculateAvgAtm(int numberOfAttempt, int timeItWin)
    • draw

      public void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch)
      Description copied from class: RenderComponent
      Draw the renderable. Should be called only by the renderer, not manually.
      Specified by:
      draw in class RenderComponent
      Parameters:
      batch - Batch to render to.