public class RWGui
extends net.risingworld.api.Plugin
implements net.risingworld.api.events.Listener
Important: due to the way Rising World plug-ins are loaded, none of the classes of this package (GuiDialogueBox, GuiLayout and its sub-classes, GuiMenu and GuiUsersMenu, GuiModelessWindow, GuiTitleBar) can be used from within the onEnable() method of a plug-in, as it is impossible to be sure that, at that moment, this plug-in has already been loaded.
The first moment one can be sure that all plug-ins have been loaded is when the first player connects to the server (either dedicated or local).
Modifier and Type | Class and Description |
---|---|
static class |
RWGui.Pair<L,R>
A utility class to hold two related objects.
|
static interface |
RWGui.RWGuiCallback
An interface for the callback objects reporting click and text entry
events to menus, dialogue boxes and similar.
|
Modifier and Type | Field and Description |
---|---|
static int |
ABORT_ID
The id reported by a click event on a close button.
|
static int |
ACTIVE_COLOUR |
static float |
AVG_CHAR_WIDTH1 |
static int |
BORDER_COLOUR |
static int |
BORDER_THICKNESS |
static int |
BUTTON_SIZE |
static int |
DEFAULT_PADDING |
static int |
ERR_INVALID_PARAMETER
A parameter was out of range or invalid.
|
static int |
ERR_ITEM_NOT_FOUND
An item looked for did not exist.
|
static int |
ERR_MISSING_RESOURCE
A resource (icon) looked for did not exist.
|
static int |
ERR_SUCCESS
The operation has been successful.
|
static int |
ICN_ARROW_DOWN |
static int |
ICN_ARROW_LEFT |
static int |
ICN_ARROW_RIGHT |
static int |
ICN_ARROW_UP |
static int |
ICN_CHECK |
static int |
ICN_CROSS |
static int |
ICN_MAX |
static int |
ICN_MIN |
static int |
ICN_MINUS |
static int |
ICN_PLUS |
static int |
ICN_RADIO_CHECK |
static int |
ICN_RADIO_UNCHECK |
static int |
ICN_UNCHECK |
static int |
INACTIVE_COLOUR |
static int |
ITEM_SIZE |
static int |
LAYOUT_H_CENTRE |
static int |
LAYOUT_H_LEFT |
static int |
LAYOUT_H_RIGHT |
static int |
LAYOUT_H_SPREAD |
static int |
LAYOUT_HORIZ |
static int |
LAYOUT_TABLE |
static int |
LAYOUT_V_BOTTOM |
static int |
LAYOUT_V_MIDDLE |
static int |
LAYOUT_V_SPREAD |
static int |
LAYOUT_V_TOP |
static int |
LAYOUT_VERT |
static int |
OK_ID
The id reported by a click event on the default button of dialogue box.
|
static int |
PANEL_COLOUR |
static int |
TEXT_COLOUR |
static int |
TEXT_DIM_COLOUR |
static int |
TEXT_SEL_COLOUR |
static int |
TEXTENTRY_HEIGHT |
static int |
TITLE_COLOUR |
static int |
TITLE_SIZE |
static int |
TITLEBAR_COLOUR |
Constructor and Description |
---|
RWGui() |
Modifier and Type | Method and Description |
---|---|
static net.risingworld.api.utils.Vector2i |
getElementSizes(net.risingworld.api.gui.GuiElement element)
Returns the x, y sizes of a GuiElement as a Vector2i.
|
static int |
getPlayerDbIdFromName(net.risingworld.api.Plugin plugin,
java.lang.String name)
Returns the DB ID of a player given his name.
|
static java.lang.String |
getPlayerNameFromId(net.risingworld.api.Plugin plugin,
int dbId)
Returns the name of a player given his DB ID.
|
static java.util.List<RWGui.Pair<java.lang.Integer,java.lang.String>> |
getPlayers(net.risingworld.api.Plugin plugin)
Returns the list of players known to the World (i.e.
|
static float |
getTextWidth(java.lang.String text,
float fontSize)
Returns (an estimate of) the width of a GuiLabel text.
|
void |
onConnect(net.risingworld.api.events.player.PlayerConnectEvent event) |
void |
onDisable() |
void |
onEnable() |
void |
onLoad() |
static int |
setImage(net.risingworld.api.gui.GuiImage image,
int iconId)
Sets one of the stock icon image into a GuiImage element.
|
enqueue, getAllPlugins, getDescription, getGameVersion, getID, getMySQLConnection, getPath, getPluginByID, getPluginByName, getServer, getSQLiteConnection, getWorld, getWorldDatabase, registerEventListener, triggerEvent, unregisterEventListener
public static final int BUTTON_SIZE
public static final int ITEM_SIZE
public static final int TEXTENTRY_HEIGHT
public static final int TITLE_SIZE
public static final int BORDER_THICKNESS
public static final int DEFAULT_PADDING
public static final float AVG_CHAR_WIDTH1
public static final int PANEL_COLOUR
public static final int TITLEBAR_COLOUR
public static final int BORDER_COLOUR
public static final int ACTIVE_COLOUR
public static final int INACTIVE_COLOUR
public static final int TEXT_COLOUR
public static final int TITLE_COLOUR
public static final int TEXT_SEL_COLOUR
public static final int TEXT_DIM_COLOUR
public static final int ICN_ARROW_DOWN
public static final int ICN_ARROW_LEFT
public static final int ICN_ARROW_RIGHT
public static final int ICN_ARROW_UP
public static final int ICN_CHECK
public static final int ICN_CROSS
public static final int ICN_UNCHECK
public static final int ICN_PLUS
public static final int ICN_MINUS
public static final int ICN_RADIO_CHECK
public static final int ICN_RADIO_UNCHECK
public static final int ICN_MIN
public static final int ICN_MAX
public static final int LAYOUT_HORIZ
public static final int LAYOUT_VERT
public static final int LAYOUT_TABLE
public static final int LAYOUT_H_LEFT
public static final int LAYOUT_H_CENTRE
public static final int LAYOUT_H_RIGHT
public static final int LAYOUT_H_SPREAD
public static final int LAYOUT_V_TOP
public static final int LAYOUT_V_MIDDLE
public static final int LAYOUT_V_BOTTOM
public static final int LAYOUT_V_SPREAD
public static final int OK_ID
public static final int ABORT_ID
public static final int ERR_SUCCESS
public static final int ERR_INVALID_PARAMETER
public static final int ERR_MISSING_RESOURCE
public static final int ERR_ITEM_NOT_FOUND
public void onLoad()
onLoad
in class net.risingworld.api.Plugin
public void onEnable()
onEnable
in class net.risingworld.api.Plugin
public void onDisable()
onDisable
in class net.risingworld.api.Plugin
public void onConnect(net.risingworld.api.events.player.PlayerConnectEvent event)
public static int setImage(net.risingworld.api.gui.GuiImage image, int iconId)
image
- the GuiImage to set the icon image intoiconId
- the id of the iconpublic static float getTextWidth(java.lang.String text, float fontSize)
text
- the text to measurefontSize
- the size of the font usedpublic static net.risingworld.api.utils.Vector2i getElementSizes(net.risingworld.api.gui.GuiElement element)
element
- the element to measurepublic static java.lang.String getPlayerNameFromId(net.risingworld.api.Plugin plugin, int dbId)
plugin
- The plug-in making the request. This is only needed to
access the relevant World database and has no side
effects on the plug-in itself.dbId
- the DB ID of the playerpublic static int getPlayerDbIdFromName(net.risingworld.api.Plugin plugin, java.lang.String name)
plugin
- The plug-in making the request. This is only needed to
access the relevant World database and has no side
effects on the plug-in itself.name
- the name of the playerpublic static java.util.List<RWGui.Pair<java.lang.Integer,java.lang.String>> getPlayers(net.risingworld.api.Plugin plugin)
The list is a List of Pair's each made of an int and a String, the integer being the DB ID of player and the String his name of the player.
The list is sorted by names, in native alphabetical order.
plugin
- The plug-in making the request. This is only needed to
access the relevant World database and has no side
effects on the plug-in itself.