Ejemplo n.º 1
0
 public static UniTask SendAsync <TMessageType>(string id, IUnityMessage <TMessageType> message, CancellationToken cancellationToken = default) where TMessageType : Enum
 => UnityMessageManager.SendPlainInternalAsync(id, (int)(object)message.Type(), message, cancellationToken);
Ejemplo n.º 2
0
 /// <summary>
 /// Sends message with data.
 /// </summary>
 /// <param name="id">The message id (identifying target).</param>
 /// <param name="message">The message data.</param>
 /// <remarks>
 /// Message format:
 ///  {
 ///    "id": MESSAGE_TARGET_ID, // <paramref name="id" />
 ///    "type": SERIALIZED_TYPE, // <paramref name="message.Type" />
 ///    "data": SERIALIZED_DATA, // <paramref name="message" />
 ///  }
 ///
 /// Raw message is automatically prefixed with <see cref="UnityMessageManager.MessagePrefix" />
 /// constant to distinguish it from unformatted messages.
 /// </remarks>
 public static void Send <TMessageType>(string id, IUnityMessage <TMessageType> message) where TMessageType : Enum
 {
     CheckMainThreadAccess();
     UnityMessageManager.SendPlainInternal(id, (int)(object)message.Type(), message);
 }