public void SendMessage(string message, ServerMessageTypeEnum type)
 {
     MessageRecieved?.Invoke(this, new ServerMessageRecievedEventArgs
     {
         Type    = type,
         Message = message
     });
 }
Exemplo n.º 2
0
        public void SendServerMessage(ServerMessageTypeEnum type, IDictionary <string, object> data)
        {
            if (onServerMessage != null)
            {
                var message = new Dictionary <string, object>
                {
                    { "type", type }
                };

                if (data != null)
                {
                    foreach (var item in data)
                    {
                        message[item.Key] = item.Value;
                    }
                }

                context.Game.Log(message.SerializeJSON());
                context.Game.ExecuteCallback(this, onServerMessage, true, message);
            }
        }