Class CableStore


  • public class CableStore
    extends java.lang.Object
    A vertical list of all cables that can be picked up

    There are buttons for increasing or decreasing the amount of a certain cable type that will be picked up. Also, there is a button for confirming the purchase. It triggers the onPurchase event.

    Author:
    Luna Otte
    • Constructor Summary

      Constructors 
      Constructor Description
      CableStore​(sag.SAGPanel panel, java.util.Map<java.lang.String,​CableConfig> cableTypes, int maxPrice)
      Creates a new CableStore
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void hide()
      Hides the store by pushing it offscreen
      CableStore onPurchase​(java.util.function.Consumer<java.util.HashMap<java.lang.String,​java.lang.Integer>> action)
      This action is performed when a purchase is made
      void show()
      Shows the 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

      • CableStore

        public CableStore​(sag.SAGPanel panel,
                          java.util.Map<java.lang.String,​CableConfig> cableTypes,
                          int maxPrice)
        Creates a new CableStore
        Parameters:
        panel - The panel the CableStore will be attached to
        cableTypes - All available cable types
        maxPrice - The maximum amount that can be spent each round
    • Method Detail

      • show

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

        public void hide()
        Hides the store by pushing it offscreen
      • onPurchase

        public CableStore onPurchase​(java.util.function.Consumer<java.util.HashMap<java.lang.String,​java.lang.Integer>> action)
        This action is performed when a purchase is made
        Parameters:
        action - The action that will be taken on purchase
        Returns:
        The CableStore (for chaining methods)