Class ContractStore


  • public class ContractStore
    extends java.lang.Object
    A scrollable list of contracts

    When a player selects a contract, the onSelect event is triggered. A player can also skip, which triggers the onSkip event.

    Author:
    Luna Otte
    • Constructor Summary

      Constructors 
      Constructor Description
      ContractStore​(sag.SAGPanel panel)
      Creates a new ContractStore
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void hide()
      Shows contract store by pushing it offscreen
      ContractStore onEnter​(java.util.function.Consumer<Contract> action)
      This event is triggered when a user's cursor enters a contract
      ContractStore onExit​(java.util.function.Consumer<Contract> action)
      This event is triggered when a user's cursor leaves a contract
      ContractStore onSelect​(java.util.function.Consumer<Contract> action)
      This event is triggered when a contract is selected
      ContractStore onSkip​(java.lang.Runnable action)
      This event is triggered when a user skips and doesn't select a contract
      void setContracts​(Contract[] contracts)
      Sets the available contracts by replacing the old list with a new one
      void show()
      Shows contract store by pushing it onscreen
      • Methods inherited from class java.lang.Object

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

      • ContractStore

        public ContractStore​(sag.SAGPanel panel)
        Creates a new ContractStore
        Parameters:
        panel - The panel the ContractStore will be attached to
    • Method Detail

      • onSelect

        public ContractStore onSelect​(java.util.function.Consumer<Contract> action)
        This event is triggered when a contract is selected
        Parameters:
        action - The action that will be taken when the user selects a contract
        Returns:
        The ContractStore (for chaining methods)
      • onEnter

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

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

        public ContractStore onSkip​(java.lang.Runnable action)
        This event is triggered when a user skips and doesn't select a contract
        Parameters:
        action - The action that will be taken when the user skips
        Returns:
        The ContractStore (for chaining methods)
      • show

        public void show()
        Shows contract store by pushing it onscreen
      • hide

        public void hide()
        Shows contract store by pushing it offscreen
      • setContracts

        public void setContracts​(Contract[] contracts)
        Sets the available contracts by replacing the old list with a new one

        This should only be called when the list of contracts changes on the board.

        Parameters:
        contracts - New contract selection