Class NpcEvictionMenuDisplayNew

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

public class NpcEvictionMenuDisplayNew extends UIComponent
A Window actor for displaying the npc eviction menu.
In order to match the game, this class is rebuilt passing Window() rather than UIComponent
How to use:
NpcEvictionMenuDisplayNew var = new NpcEvictionMenuDisplayNew(...);
window.addActor(var.creatEvictionMenu());
See Also:
  • Constructor Details

    • NpcEvictionMenuDisplayNew

      public NpcEvictionMenuDisplayNew(org.slf4j.Logger logger, ResourceService resourceService, float width, float height, ForestGameArea gameArea, GdxGame game)
      Implement NpcEvictionMenu in to a Window(), use creatEvictionMenu() to get this Window()
      Parameters:
      logger - logger from Screen
      resourceService - resourceService where load/unload the textures
      width - width of window of the Screen
      height - height of window of the Screen
  • Method Details

    • getErrorNum

      public Integer getErrorNum()
      return the errorNum
      Returns:
      errorNum
    • setFindKey

      public void setFindKey(Boolean findKey)
      Setting from other class, true if the player has found the key
      Parameters:
      findKey - whether player has found the key in this game round
    • handleLogic

      Handle the game logic of select the traitor
      player has 3 choices to find traitor
      if wrong, it will decrease the blood and time at the same time
      Parameters:
      name - name of npc selected
      Returns:
      NpcResultDialogType.RIGHT_BOX: if player correctly select the traitor
      NpcResultDialogType.WRONG_BOX1: if player fails for the first time
      NpcResultDialogType.WRONG_BOX2: if player fails for the second time
      NpcResultDialogType.LOSE: if player select 3 times and all fail
      NpcResultDialogType.WIN: if player have correctly select in the past
      null: This is not a return result that should occur. If it does, it indicates that there is a problem with in the code
    • creatEvictionMenu

      public com.badlogic.gdx.scenes.scene2d.ui.Window creatEvictionMenu()
      return the window of Eviction Menu, use window.addActor() to add onto window
      Returns:
      the window of Eviction Menu
    • draw

      protected 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.
    • createConfirmDialog

      public void createConfirmDialog(String button_name)
      Display a confirm dialog on the window, the style is based on Team7 prototype
      All scales are calculated according to the prototype from team 7 only
      player has 3 choices to find traitor, if all fail, the game will directly over
      if correct, A key will be spawned on the map, player can pick it up and use it in the warehouse. The game will win
      For using the key, we have written the code in the warehouse component of team 8
      Parameters:
      button_name - The name of the button that calls this function
      See Also: