Class Console
- java.lang.Object
-
- com.bombinggames.wurfelengine.core.console.Console
-
public class Console extends java.lang.ObjectThe message system can manage & show messages (Line).
-
-
Constructor Summary
Constructors Constructor Description Console(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, int xPos, int yPos)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.String message)Adds a message with the sender "System"voidadd(java.lang.String message, java.lang.String sender)Adds a message to the console.voidadd(java.lang.String message, java.lang.String sender, int importance)Adds a message to the console.voidaddCommand(ConsoleCommand command)Add new commandsjava.util.ArrayList<java.lang.String>autoComplete()suggests a cvar or a dir if cd enteredbooleancheckPath(java.lang.String newPath)check if the path is valid relative to the current onevoidclearCommandLine()voidenter()when a message is enteredbooleanexecuteCommand(java.lang.String command)Tries executing a command.java.lang.StringgetCurrentCommand()returns the currently typed commandjava.lang.StringgetLastMessage()Returns the last Messagejava.lang.StringgetLastMessage(java.lang.String sender, int skip)Returns the last Messagejava.lang.StringgetPath()protected java.util.ArrayList<ConsoleCommand>getRegisteredCommands()booleanisActive()Is the window open?java.util.ArrayList<java.lang.String>ls()displays the content of a folder.voidsetGameplayRef(GameplayScreen gameplayRef)Set the reference field for the console so that it can access the game.voidsetPath(java.lang.String path)Set a path as the current path for the console access.voidsetText(java.lang.String text)Set the text in the box and the cursor at the end.voidupdate(float dt)Updates the console.
-
-
-
Method Detail
-
getPath
public java.lang.String getPath()
- Returns:
-
setGameplayRef
public void setGameplayRef(GameplayScreen gameplayRef)
Set the reference field for the console so that it can access the game.- Parameters:
gameplayRef-
-
add
public void add(java.lang.String message)
Adds a message with the sender "System"- Parameters:
message-
-
add
public void add(java.lang.String message, java.lang.String sender)Adds a message to the console.- Parameters:
message-sender-
-
add
public void add(java.lang.String message, java.lang.String sender, int importance)Adds a message to the console.- Parameters:
message-sender-importance-
-
update
public void update(float dt)
Updates the console.- Parameters:
dt- time in ms
-
enter
public void enter()
when a message is entered
-
clearCommandLine
public void clearCommandLine()
-
isActive
public boolean isActive()
Is the window open?- Returns:
-
getLastMessage
public java.lang.String getLastMessage()
Returns the last Message- Returns:
- if there spawn no last message it returns an empty string
-
getLastMessage
public java.lang.String getLastMessage(java.lang.String sender, int skip)Returns the last Message- Parameters:
sender- filter by the sender, e.g. if you want the last message of a specific playerskip- how many items you want to skip- Returns:
- if there spawn no last message it returns an empty string
-
setText
public void setText(java.lang.String text)
Set the text in the box and the cursor at the end.- Parameters:
text-
-
autoComplete
public java.util.ArrayList<java.lang.String> autoComplete()
suggests a cvar or a dir if cd entered- Returns:
- the possible completions
-
addCommand
public void addCommand(ConsoleCommand command)
Add new commands- Parameters:
command-
-
getRegisteredCommands
protected java.util.ArrayList<ConsoleCommand> getRegisteredCommands()
- Returns:
-
checkPath
public boolean checkPath(java.lang.String newPath)
check if the path is valid relative to the current one- Parameters:
newPath-- Returns:
-
getCurrentCommand
public java.lang.String getCurrentCommand()
returns the currently typed command- Returns:
-
ls
public java.util.ArrayList<java.lang.String> ls()
displays the content of a folder.- Returns:
-
executeCommand
public boolean executeCommand(java.lang.String command)
Tries executing a command. If that fails trys to set cvar. if that fails trys to execute external commands.- Parameters:
command-- Returns:
- false if command or cvar not found
-
setPath
public void setPath(java.lang.String path)
Set a path as the current path for the console access.- Parameters:
path-
-
-