示例#1
0
 // This only gets called over the network if this is a network instrument
 void NetworkEventReceive(byte eventCode, object content, int senderID)
 {
     // See if the message is intended for this instrument
     if (senderID != ownerID) // Not us
     {
         if (specID == null || specID != senderID)
         {
             return;                                       // Not spectating this person either
         }
         // Is spectating
         T noteID = (T)content;
         controller.NoteEvent(eventCode == 1, noteID, true);
     }
     else if (!isLocal)      // Don't want to send ourselves messages
     {
         if (eventCode == 2) // If is a change of instrument params
         {
             controller.SetParameters((P)content);
         }
         else // Otherwise, playing a note
         {
             // Get the note ID and tell the controller to play that note
             T noteID = (T)content;
             controller.NoteEvent(eventCode == 1, noteID, false);
         }
     }
 }
    // This only gets called over the network if this is a network instrument
    void NetworkEventReceive(byte eventCode, object content, int senderID)
    {
        // See if the message is intended for this instrument
        if (senderID != ownerID)
        {
            return;
        }
        // If so, get the note ID and tell the controller to play that note
        T noteID = (T)content;

        controller.NoteEvent(eventCode == 1, noteID);
    }