GuiEvent: add JavaDoc (comments only)
This commit is contained in:
parent
7361aba280
commit
4541b0bde4
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2012 jMonkeyEngine
|
||||
* Copyright (c) 2009-2019 jMonkeyEngine
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -42,48 +42,97 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* A CinematicEvent associated with a Nifty screen.
|
||||
*
|
||||
* @author Nehon
|
||||
*/
|
||||
public class GuiEvent extends AbstractCinematicEvent {
|
||||
|
||||
/**
|
||||
* message logger for this class
|
||||
*/
|
||||
static final Logger log = Logger.getLogger(GuiEvent.class.getName());
|
||||
|
||||
/**
|
||||
* name of the associated Nifty screen(not null)
|
||||
*/
|
||||
protected String screen;
|
||||
/**
|
||||
* associated Nifty instance (not null)
|
||||
*/
|
||||
protected Nifty nifty;
|
||||
|
||||
/**
|
||||
* No-argument constructor needed by SavableClassUtil. Do not invoke
|
||||
* directly!
|
||||
*/
|
||||
public GuiEvent() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate an event with the default initial duration (10) and mode
|
||||
* (DontLoop).
|
||||
*
|
||||
* @param nifty the Nifty instance (not null, alias created)
|
||||
* @param screen the name of the Nifty screen (not null)
|
||||
*/
|
||||
public GuiEvent(Nifty nifty, String screen) {
|
||||
this.screen = screen;
|
||||
this.nifty = nifty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate an event the default mode (DontLoop).
|
||||
*
|
||||
* @param nifty the Nifty instance (not null, alias created)
|
||||
* @param screen the name of the Nifty screen (not null)
|
||||
* @param initialDuration the initial duration (in seconds, ≥0)
|
||||
*/
|
||||
public GuiEvent(Nifty nifty, String screen, float initialDuration) {
|
||||
super(initialDuration);
|
||||
this.screen = screen;
|
||||
this.nifty = nifty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate an event with the default initial duration (10).
|
||||
*
|
||||
* @param nifty the Nifty instance (not null, alias created)
|
||||
* @param screen the name of the Nifty screen (not null)
|
||||
* @param loopMode the loop mode (not null)
|
||||
*/
|
||||
public GuiEvent(Nifty nifty, String screen, LoopMode loopMode) {
|
||||
super(loopMode);
|
||||
this.screen = screen;
|
||||
this.nifty = nifty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate an event with the specified initial duration and loop mode.
|
||||
*
|
||||
* @param nifty the Nifty instance (not null, alias created)
|
||||
* @param screen the name of the Nifty screen (not null)
|
||||
* @param initialDuration the initial duration (in seconds, ≥0)
|
||||
* @param loopMode the loop mode (not null)
|
||||
*/
|
||||
public GuiEvent(Nifty nifty, String screen, float initialDuration, LoopMode loopMode) {
|
||||
super(initialDuration, loopMode);
|
||||
this.screen = screen;
|
||||
this.nifty = nifty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked when the event is started.
|
||||
*/
|
||||
@Override
|
||||
public void onPlay() {
|
||||
log.log(Level.FINEST, "screen should be {0}", screen);
|
||||
nifty.gotoScreen(screen);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked when the event is stopped.
|
||||
*/
|
||||
@Override
|
||||
public void onStop() {
|
||||
if (nifty.getCurrentScreen() != null) {
|
||||
@ -91,22 +140,46 @@ public class GuiEvent extends AbstractCinematicEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked when the event is paused.
|
||||
*/
|
||||
@Override
|
||||
public void onPause() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Alter the Nifty instance for this event.
|
||||
*
|
||||
* @param nifty the new instance (not null)
|
||||
*/
|
||||
public void setNifty(Nifty nifty) {
|
||||
this.nifty = nifty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alter the screen for this event.
|
||||
*
|
||||
* @param screen the name of the new screen (not null)
|
||||
*/
|
||||
public void setScreen(String screen) {
|
||||
this.screen = screen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked once per frame, provided the event is playing.
|
||||
*
|
||||
* @param tpf the time interval between frames (in seconds, ≥0)
|
||||
*/
|
||||
@Override
|
||||
public void onUpdate(float tpf) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize this event, for example when saving to a J3O file.
|
||||
*
|
||||
* @param ex exporter (not null)
|
||||
* @throws IOException from exporter
|
||||
*/
|
||||
@Override
|
||||
public void write(JmeExporter ex) throws IOException {
|
||||
super.write(ex);
|
||||
@ -114,6 +187,12 @@ public class GuiEvent extends AbstractCinematicEvent {
|
||||
oc.write(screen, "screen", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* De-serialize this event, for example when loading from a J3O file.
|
||||
*
|
||||
* @param im importer (not null)
|
||||
* @throws IOException from importer
|
||||
*/
|
||||
@Override
|
||||
public void read(JmeImporter im) throws IOException {
|
||||
super.read(im);
|
||||
|
Loading…
x
Reference in New Issue
Block a user