Class PlayerInfo


  • public class PlayerInfo
    extends java.lang.Object
    Displays info about the player;
    • Their contracts
    • Their inventory state
    Author:
    Luna Otte
    • Constructor Summary

      Constructors 
      Constructor Description
      PlayerInfo​(sag.SAGPanel panel, java.util.Collection<CableConfig> cableConfig)
      Builds a new info layer into the panel
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addContract​(Contract contract)
      Adds a contract to the contract list
      PlayerInfo onEnterContract​(java.util.function.Consumer<Contract> action)
      This event is triggered when a user's cursor enters a contract from the contract list
      PlayerInfo onExitContract​(java.util.function.Consumer<Contract> action)
      This event is triggered when a user's cursor leaves a contract from the contract list
      void setCableAmounts​(java.util.HashMap<java.lang.String,​java.lang.Integer> amounts)
      Sets the amount of cables that are shown in the inventory
      void setContracts​(java.util.Collection<Contract> contracts)
      Sets the contracts of the contract list
      • Methods inherited from class java.lang.Object

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

      • PlayerInfo

        public PlayerInfo​(sag.SAGPanel panel,
                          java.util.Collection<CableConfig> cableConfig)
        Builds a new info layer into the panel
        Parameters:
        panel - The panel that the info layer is added to
        cableConfig - The cable configuration
    • Method Detail

      • setContracts

        public void setContracts​(java.util.Collection<Contract> contracts)
        Sets the contracts of the contract list
        Parameters:
        contracts - The contracts
      • addContract

        public void addContract​(Contract contract)
        Adds a contract to the contract list
        Parameters:
        contract - The new contract
      • setCableAmounts

        public void setCableAmounts​(java.util.HashMap<java.lang.String,​java.lang.Integer> amounts)
        Sets the amount of cables that are shown in the inventory
        Parameters:
        amounts - The new amounts of cables
      • onEnterContract

        public PlayerInfo onEnterContract​(java.util.function.Consumer<Contract> action)
        This event is triggered when a user's cursor enters a contract from the contract list
        Parameters:
        action - The action that will be taken when the mouse enters
        Returns:
        The PlayerInfo (for chaining methods)
      • onExitContract

        public PlayerInfo onExitContract​(java.util.function.Consumer<Contract> action)
        This event is triggered when a user's cursor leaves a contract from the contract list
        Parameters:
        action - The action that will be taken when the mouse leaves
        Returns:
        The PlayerInfo (for chaining methods)