Class GuiEvent

All Implemented Interfaces:
CinematicEvent, Savable

public class GuiEvent extends AbstractCinematicEvent
A CinematicEvent associated with a Nifty screen.
  • Field Details

    • screen

      protected String screen
      name of the associated Nifty screen (not null)
    • nifty

      protected de.lessvoid.nifty.Nifty nifty
      associated Nifty instance (not null)
  • Constructor Details

    • GuiEvent

      public GuiEvent()
      No-argument constructor needed by SavableClassUtil. Do not invoke directly!
    • GuiEvent

      public GuiEvent(de.lessvoid.nifty.Nifty nifty, String screen)
      Instantiate an event with the default initial duration (10) and mode (DontLoop).
      Parameters:
      nifty - the Nifty instance (not null, alias created)
      screen - the name of the Nifty screen (not null)
    • GuiEvent

      public GuiEvent(de.lessvoid.nifty.Nifty nifty, String screen, float initialDuration)
      Instantiate an event the default mode (DontLoop).
      Parameters:
      nifty - the Nifty instance (not null, alias created)
      screen - the name of the Nifty screen (not null)
      initialDuration - the initial duration (in seconds, ≥0)
    • GuiEvent

      public GuiEvent(de.lessvoid.nifty.Nifty nifty, String screen, LoopMode loopMode)
      Instantiate an event with the default initial duration (10).
      Parameters:
      nifty - the Nifty instance (not null, alias created)
      screen - the name of the Nifty screen (not null)
      loopMode - the loop mode (not null)
    • GuiEvent

      public GuiEvent(de.lessvoid.nifty.Nifty nifty, String screen, float initialDuration, LoopMode loopMode)
      Instantiate an event with the specified initial duration and loop mode.
      Parameters:
      nifty - the Nifty instance (not null, alias created)
      screen - the name of the Nifty screen (not null)
      initialDuration - the initial duration (in seconds, ≥0)
      loopMode - the loop mode (not null)
  • Method Details

    • onPlay

      public void onPlay()
      Invoked when the event is started.
      Specified by:
      onPlay in class AbstractCinematicEvent
    • onStop

      public void onStop()
      Invoked when the event is stopped.
      Specified by:
      onStop in class AbstractCinematicEvent
    • onPause

      public void onPause()
      Invoked when the event is paused.
      Specified by:
      onPause in class AbstractCinematicEvent
    • setNifty

      public void setNifty(de.lessvoid.nifty.Nifty nifty)
      Alter the Nifty instance for this event.
      Parameters:
      nifty - the new instance (not null)
    • setScreen

      public void setScreen(String screen)
      Alter the screen for this event.
      Parameters:
      screen - the name of the new screen (not null)
    • onUpdate

      public void onUpdate(float tpf)
      Invoked once per frame, provided the event is playing.
      Specified by:
      onUpdate in class AbstractCinematicEvent
      Parameters:
      tpf - the time interval between frames (in seconds, ≥0)
    • write

      public void write(JmeExporter ex) throws IOException
      Serialize this event, for example when saving to a J3O file.
      Specified by:
      write in interface Savable
      Overrides:
      write in class AbstractCinematicEvent
      Parameters:
      ex - exporter (not null)
      Throws:
      IOException - from exporter
    • read

      public void read(JmeImporter im) throws IOException
      De-serialize this event, for example when loading from a J3O file.
      Specified by:
      read in interface Savable
      Overrides:
      read in class AbstractCinematicEvent
      Parameters:
      im - importer (not null)
      Throws:
      IOException - from importer