Ejemplo n.º 1
0
        /**
         * Sends a message along a channel in Subspace. Returns true if the message was sent.
         */
        public static Boolean SendSubspaceMessage(SubspaceMessage _message)
        {
            if (ChannelMap.ContainsKey(_message.GetMessageChannel()) == false) return false;

            foreach (ISubspaceInterface sSI in ChannelMap[_message.GetMessageChannel()])
            {
                sSI.ReceiveMessage(_message);
            }

            return true;
        }
 public void ReceiveMessage(SubspaceMessage _message)
 {
     if (_message.GetMessageCode() == 1)
     {
         Logger.Log("Received message. Channel " + _message.GetMessageChannel() + " Message Code: " + _message.GetMessageCode()); //Log the message info to console.
     }
 }
 /**
  * All plug-ins using Subspace must implement this function. It gets called when
  * a message is sent along a channel.
  */
 public void ReceiveMessage(SubspaceMessage _message)
 {
     /**
      * Use some data in the message. Here we are getting the message code. Which is simply
      * any number you would like to use so other plugins know what "type" of message this is
      * and do the proper logic. In this case we are using it to see if the message is from the
      * second example plug-in to prevent showing our own message as well.
      */
     if (_message.GetMessageCode() == 2)
     {
         Logger.Log("Received message. Channel " + _message.GetMessageChannel()
                    + " Message Code: " + _message.GetMessageCode()); //Log the message info to console.
     }
 }