public abstract class NetworkChat extends Object implements Networkable, InputDeviceKeyListener
Constructor and Description |
---|
NetworkChat(byte type)
Constructor base.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addMessage(String message)
Add a new message.
|
void |
addNetworkMessage(NetworkMessage message)
Add a message to the queue.
|
void |
applyMessage(NetworkMessage message)
Apply message.
|
protected abstract boolean |
canAddChar(char c)
Check if the input char can be added.
|
protected abstract boolean |
canSendMessage(String message)
Check if the message can be sent.
|
void |
clearNetworkMessages()
Clear the network messages list.
|
Byte |
getClientId()
Get the client id.
|
protected abstract String |
getMessage(NetworkMessageChat message)
Get the message string from the network message.
|
Queue<String> |
getMessages()
Get the list of messages.
|
Collection<NetworkMessage> |
getNetworkMessages()
Get the messages list.
|
String |
getWriting()
Get the current writing string.
|
void |
keyPressed(int keyCode,
char keyChar) |
void |
keyReleased(int keyCode,
char keyChar) |
abstract void |
render(Graphic g)
Render the chat.
|
void |
setClientId(Byte id)
Set the client id.
|
void |
setKeyBackSpace(int keyBackSpace)
Set the key that insert a space in a message.
|
void |
setKeyValidate(int keyValidate)
Set the key that allow to validate a message.
|
void |
setMessagesMax(int max)
Set the message queue max length.
|
public NetworkChat(byte type)
type
- The message type enum.public abstract void render(Graphic g)
g
- The graphic output.protected abstract String getMessage(NetworkMessageChat message)
message
- The network message.protected abstract boolean canSendMessage(String message)
message
- The message to check.true
if can be sent, false
else.protected abstract boolean canAddChar(char c)
c
- The input char.true
if can be added, false
else.public void setKeyValidate(int keyValidate)
keyValidate
- The key that allow to validate a message.public void setKeyBackSpace(int keyBackSpace)
keyBackSpace
- The key that insert a backspace in a message.public void setMessagesMax(int max)
max
- The maximum number of messages that can be kept.public Queue<String> getMessages()
public String getWriting()
protected void addMessage(String message)
message
- The message to add.public void addNetworkMessage(NetworkMessage message)
Networkable
addNetworkMessage
in interface Networkable
message
- The message to add.public void applyMessage(NetworkMessage message)
Networkable
applyMessage
in interface Networkable
message
- The message.public Collection<NetworkMessage> getNetworkMessages()
Networkable
getNetworkMessages
in interface Networkable
public void clearNetworkMessages()
Networkable
clearNetworkMessages
in interface Networkable
public void setClientId(Byte id)
Networkable
setClientId
in interface Networkable
id
- The client id.public Byte getClientId()
Networkable
getClientId
in interface Networkable
public void keyPressed(int keyCode, char keyChar)
keyPressed
in interface InputDeviceKeyListener
public void keyReleased(int keyCode, char keyChar)
keyReleased
in interface InputDeviceKeyListener
Copyright © 2017 Byron 3D Games Studio. All rights reserved.