public class GuiManager
extends java.lang.Object
Constructor and Description |
---|
GuiManager(@NotNull GuiStateManager guiStateManager,
@NotNull TooltipManagerImpl tooltipManager,
@NotNull Settings settings,
@NotNull CrossfireServerConnection server,
@NotNull JXCWindowRenderer windowRenderer,
@NotNull GuiFactory guiFactory,
@NotNull KeybindingsManager keybindingsManager,
@NotNull JXCConnection connection)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
activateCommandInput(@Nullable java.lang.String newText)
Activates the command input text field.
|
void |
addDialog(@NotNull java.lang.String name,
@NotNull Gui dialog)
Adds a dialog for name based lookup.
|
void |
closeDialog(@NotNull java.lang.String name)
Closes the given dialog.
|
void |
closeKeybindDialog()
Closes the keybinding dialog.
|
void |
closeQueryDialog()
Closes the "query" dialog.
|
boolean |
createKeyBinding(boolean perCharacter,
@NotNull CommandList cmdList)
Adds a key binding.
|
EscAction |
escPressed(boolean connected)
The ESC key has been pressed.
|
@NotNull CommandList |
getCommandList(@NotNull java.lang.String args)
Returns a named command list.
|
@NotNull java.util.Collection<java.lang.String> |
getCommandListNames()
Returns all names of command lists.
|
void |
hideAccountWindows()
Hides all account-related windows.
|
void |
manageAccount()
Displays the main account dialog, to let the player login or create a new
account.
|
void |
openDialog(@NotNull java.lang.String name)
Opens a dialog by name.
|
void |
openQueryDialog(@NotNull java.lang.String prompt,
int queryType)
Opens the "query" dialog.
|
boolean |
openQuitDialog()
Opens the "quit" dialog.
|
void |
playerReceived()
A "player" protocol command has been received.
|
boolean |
removeKeyBinding(boolean perCharacter)
Removes a key binding.
|
void |
selectCharacter(@NotNull java.lang.String accountName,
@NotNull java.lang.String characterName)
Updates the selected character name in an account.
|
void |
setAccountName(@NotNull java.lang.String accountName)
Updates the current account name.
|
void |
setOpaqueDialogBackground(boolean opaque)
Sets whether the dialog's background is opaque.
|
void |
setShowSentCommands(boolean showSentCommands)
Sets whether the commands sent to the server should be shown in the
messages dialog.
|
void |
setShowTimestamps(boolean showTimestamps)
Sets whether timestamps shown in the messages dialog.
|
void |
setSkin(@NotNull JXCSkin skin)
Sets a new skin.
|
void |
showCharacters(int count)
Displays the window with the characters for an account.
|
void |
term()
Terminates the GUI.
|
void |
toggleDialog(@NotNull java.lang.String name)
Toggles a dialog.
|
void |
unsetSkin()
Unsets the current skin.
|
void |
updatePlayerName(@NotNull java.lang.String playerName)
Sets the current player name.
|
void |
updateWindowSize(int width,
int height)
Sets a new window size.
|
public GuiManager(@NotNull @NotNull GuiStateManager guiStateManager, @NotNull @NotNull TooltipManagerImpl tooltipManager, @NotNull @NotNull Settings settings, @NotNull @NotNull CrossfireServerConnection server, @NotNull @NotNull JXCWindowRenderer windowRenderer, @NotNull @NotNull GuiFactory guiFactory, @NotNull @NotNull KeybindingsManager keybindingsManager, @NotNull @NotNull JXCConnection connection)
guiStateManager
- the gui state manager to watchtooltipManager
- the tooltip manager to updatesettings
- the settings to useserver
- the crossfire server connection to monitorwindowRenderer
- the window renderer to useguiFactory
- the gui factory for creating gui instanceskeybindingsManager
- the keybindings manager to useconnection
- the connection to usepublic void addDialog(@NotNull @NotNull java.lang.String name, @NotNull @NotNull Gui dialog)
name
- the name of the dialogdialog
- the dialogpublic void playerReceived()
public void manageAccount()
public void showCharacters(int count)
count
- how many characters the account haspublic void hideAccountWindows()
public boolean openQuitDialog()
public EscAction escPressed(boolean connected)
connected
- whether a connection to the server is activepublic void openQueryDialog(@NotNull @NotNull java.lang.String prompt, int queryType)
prompt
- the query promptqueryType
- the query typepublic void openDialog(@NotNull @NotNull java.lang.String name)
name
- the name of the dialogpublic void toggleDialog(@NotNull @NotNull java.lang.String name)
name
- the name of the dialogpublic void closeQueryDialog()
public void closeKeybindDialog()
public void closeDialog(@NotNull @NotNull java.lang.String name)
name
- the name of the dialogpublic void updatePlayerName(@NotNull @NotNull java.lang.String playerName)
playerName
- the player namepublic void activateCommandInput(@Nullable @Nullable java.lang.String newText)
If neither the main gui nor any visible dialog has an input text field, invisible GUIs are checked as well. If one is found, it is made visible.
newText
- the new command text if non-null
public void unsetSkin()
public void setSkin(@NotNull @NotNull JXCSkin skin)
skin
- the new skinpublic void term()
public boolean createKeyBinding(boolean perCharacter, @NotNull @NotNull CommandList cmdList)
perCharacter
- whether a per-character key binding should be addedcmdList
- the command list to execute on key presspublic boolean removeKeyBinding(boolean perCharacter)
perCharacter
- whether a per-character key binding should be
removedpublic void updateWindowSize(int width, int height)
width
- the new window widthheight
- the new window height@NotNull public @NotNull CommandList getCommandList(@NotNull @NotNull java.lang.String args) throws NoSuchCommandException
args
- the name of the command listNoSuchCommandException
- if the command list does not exist@NotNull public @NotNull java.util.Collection<java.lang.String> getCommandListNames()
public void setAccountName(@NotNull @NotNull java.lang.String accountName)
accountName
- the current account namepublic void selectCharacter(@NotNull @NotNull java.lang.String accountName, @NotNull @NotNull java.lang.String characterName)
accountName
- the account namecharacterName
- the character namepublic void setOpaqueDialogBackground(boolean opaque)
opaque
- whether the background is opaquepublic void setShowSentCommands(boolean showSentCommands)
showSentCommands
- whether to show the commandspublic void setShowTimestamps(boolean showTimestamps)
showTimestamps
- whether to show timestamps