Class: GameOverseer::MessageManager
- Inherits:
-
Object
- Object
- GameOverseer::MessageManager
- Defined in:
- lib/gameoverseer/messages/message_manager.rb
Overview
Handles sending messages to clients on behalf of services
Constant Summary collapse
- MESSAGES =
[]
- BROADCASTS =
[]
Class Method Summary collapse
Instance Method Summary collapse
-
#broadcast(string, reliable = false, channel = ChannelManager::CHAT) ⇒ Object
Send a message to all connected clients.
-
#initialize ⇒ MessageManager
constructor
A new instance of MessageManager.
-
#message(client_id, string, reliable = false, channel = ChannelManager::CHAT) ⇒ Object
Send a message to a specific client.
Constructor Details
#initialize ⇒ MessageManager
Returns a new instance of MessageManager.
8 9 10 |
# File 'lib/gameoverseer/messages/message_manager.rb', line 8 def initialize MessageManager.instance = self end |
Class Method Details
.instance ⇒ MessageManager
31 32 33 |
# File 'lib/gameoverseer/messages/message_manager.rb', line 31 def self.instance @instance end |
.instance=(_instance) ⇒ Object
36 37 38 |
# File 'lib/gameoverseer/messages/message_manager.rb', line 36 def self.instance=_instance @instance = _instance end |
Instance Method Details
#broadcast(string, reliable = false, channel = ChannelManager::CHAT) ⇒ Object
Send a message to all connected clients
26 27 28 |
# File 'lib/gameoverseer/messages/message_manager.rb', line 26 def broadcast(string, reliable = false, channel = ChannelManager::CHAT) GameOverseer::ENetServer.instance.broadcast(string, reliable, channel) end |
#message(client_id, string, reliable = false, channel = ChannelManager::CHAT) ⇒ Object
Send a message to a specific client
17 18 19 |
# File 'lib/gameoverseer/messages/message_manager.rb', line 17 def (client_id, string, reliable = false, channel = ChannelManager::CHAT) GameOverseer::ENetServer.instance.transmit(client_id, string, reliable, channel) end |