Package com.prineside.tdi2.managers
Class MessageManager
java.lang.Object
com.prineside.tdi2.Manager.ManagerWithListeners<MessageManager.MessageManagerListener>
com.prineside.tdi2.managers.MessageManager
- All Implemented Interfaces:
Disposable
,Manager
public final class MessageManager
extends Manager.ManagerWithListeners<MessageManager.MessageManagerListener>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
static interface
static class
Nested classes/interfaces inherited from interface com.prineside.tdi2.Manager
Manager.ManagerAdapter, Manager.ManagerWithListeners<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMessage
(MessageManager.Message message) Add a message and notify listeners.void
deleteMessage
(MessageManager.Message message) Delete the message and remember its id in the list of deleted messages.getMessage
(String id) Get a message with the id specifiedint
int
boolean
boolean
boolean
isMessageRead
(String id) boolean
void
markMessageRead
(MessageManager.Message message) Mark a message as read.void
void
void
removeMessage
(MessageManager.Message message) Remove message and do not store its id in the list of deleted messages.void
void
setup()
Вызывается, когда объекты всех менеджеров созданы и можно к ним обращатьсяMethods inherited from class com.prineside.tdi2.Manager.ManagerWithListeners
addListener, dispose, postRender, preRender, removeListener, test
-
Constructor Details
-
MessageManager
public MessageManager()
-
-
Method Details
-
setup
public void setup()Description copied from interface:Manager
Вызывается, когда объекты всех менеджеров созданы и можно к ним обращаться- Specified by:
setup
in interfaceManager
- Overrides:
setup
in classManager.ManagerWithListeners<MessageManager.MessageManagerListener>
-
processLocalMessages
public void processLocalMessages() -
getMessages
- Returns:
- sorted (by date) list of messages that has not been deleted yet
-
isMessageRead
- Parameters:
id
- id of the message- Returns:
- true if message has been read by the player
-
markMessageRead
Mark a message as read. Notifies the server and listeners.- Parameters:
message
- message to mark as read
-
isMessageEverDeleted
- Parameters:
id
- id of the message- Returns:
- true if message has been manually deleted by the player. Can return false if message not exists and has not been deleted - to check if message exists, use getMessage() and check for null
-
isMessageItemsReceived
-
deleteMessage
Delete the message and remember its id in the list of deleted messages. Notifies the server. If message is notDeletable, does nothing and prints an error.- Parameters:
message
- message to delete
-
requestMessagesFromServer
public void requestMessagesFromServer() -
removeMessage
Remove message and do not store its id in the list of deleted messages. Notifies listeners. Does not notify the server. -
addMessage
Add a message and notify listeners. If message with the same id already exists, it will be replaced- Parameters:
message
- message to add
-
getMessage
Get a message with the id specified- Parameters:
id
- id of the message- Returns:
- Message or null if message not exists
-
getUnreadMessageCount
public int getUnreadMessageCount() -
getTotalMessageCount
public int getTotalMessageCount() -
receiveMessageItems
-
isRequestingServer
public boolean isRequestingServer()
-