Package 

Class GuiBase

  • All Implemented Interfaces:

    
    public class GuiBase
    
                        

    The base class you need to extend/inherit from to create a GUI

    call the constructor of this class in your constructor (via super) and pass it a guiLayout object you can use the defaultGuiLayout by passing nothing if you want to get started quickly

    Override getTitleString to set a display title

    call GuiBase.addButton and/or addButtonGroup in your constructor to define what the GUI does

    Call this classes advance and render in a BaseEveryFrame(Combat)Script advance/render methods

    It makes sense to create a new GUI object when a hotkey is pressed

    To get started quickly, you can use the SampleGuiLauncher

    • Constructor Detail

    • Method Detail

      • getTitleString

         String getTitleString()

        override this returning a string representing your GUI title may change between frames

      • getMessageString

         String getMessageString()

        override this to display a message, feel free to return null may change between frames

      • addButtonGroup

         final Unit addButtonGroup(ButtonGroupAction action, CreateButtonsAction create, RefreshButtonsAction refresh, String descriptionText)

        This is the intended way of adding button groups adds a new button group to the GUI. This library will take care of positioning based on grid layout. all actions will be automatically executed when appropriate

        Think of a button group as a row of buttons that can be clicked. Whenever a button gets clicked by the user, it gets activated (i.e. visually highlighted). The user can click the button again to de-activate it. Each button has data (e.g. a string, maybe its name?) associated to it. Whenever a button in this group is clicked by the user, the action of the button group gets executed on the data of all active buttons.

        Parameters:
        action - will be performed when one of the buttons gets clicked, can't pass null Implement a class that implements ButtonGroupAction, overriding the execute method A list of data corresponding to the data of all currently active buttons will be passed to this action
        create - will be performed when the button group gets added, create individual buttons in this action, can't pass null Use the pre-existing class CreateSimpleButtons if you don't want to do anything fancy
        refresh - will be called whenever something changes (e.g.
      • addCustomButtonGroup

         final Unit addCustomButtonGroup(DataButtonGroup buttonGroup)

        It is recommended to use addButtonGroup instead. add a custom button group where you have to take care of positioning etc. You will need to create a new class that inherits from DataButton group and pass an instance to this method actions will be automatically executed when appropriate

      • addButton

         final Unit addButton(ButtonAction action, String txt, String tooltipTxt, Boolean isDisabled)

        add a new button to the GUI and let this library handle positioning a button in this context is the simplest GUI element. If a user clicks it, the passed action gets executed

        Parameters:
        action - will be executed when the button is click, feel free to pass null
        txt - display text AKA name of the button
        tooltipTxt - will be displayed when user hovers over button, feel free to pass an empty string
      • addCustomButton

         final Unit addCustomButton(ActionButton button)

        It is recommended to use addButton instead of this add a custom button where you have to take care of positioning etc.

      • refreshButtons

         Unit refreshButtons()

        calls the refresh method of every button group gets automatically called in advance, feel free to call once at the end of your constructor call

      • advance

         Unit advance()

        call this every frame in your e.g. BaseEveryFrameCombatPlugin executes button logic, such as checking which button was clicked and executing actions when appropriate

      • reRenderButtonGroups

         Unit reRenderButtonGroups()

        delete all buttons from button groups and re-create them with the given CreateButtonsAction

      • render

         Unit render()

        call this every frame in your e.g. BaseEveryFrameCombatPlugin renders buttons, texts and tooltips