Exemplo n.º 1
0
    /// <summary>
    /// Disbatch a message to a game object with instructions on locality of the disbatch
    /// </summary>
    public static void DisbatchMessage <EventType>(EventType message, FFPacketInstructionFlags instructions, GameObject go)
    {
        instructions |= FFPacketInstructionFlags.MessageBoardGameObjectSend;
        var packet = new FFPacket <EventType>(instructions, typeof(EventType).Name, message, BaseMessageBoard.LocalIdEntry(go.GetInstanceID()));

        DisbatchPacket(packet);
    }
Exemplo n.º 2
0
 // MessageBoard
 public FFPacket(FFPacketInstructionFlags type, string eventType, EventType message, string eventEntry)
 {
     this.message            = message;
     this.packetInstructions = type;
     this.messageType        = eventType;
     this.entry = eventEntry;
 }
Exemplo n.º 3
0
 // TODO optimization, change FFPacket's message/eventEntry to type object for gameObject Interface for sending netId as a number versus string
 // GameObject Interface
 public static void SendMessageToNet <EventType>(EventType message, int gameObjectInstanceId, FFPacketInstructionFlags instructions, bool varifiedPacket)
 {
     FFSystem.GameObjectData gameObjectData;
     if (FFSystem.TryGetGameObjectDataByInstanceId(gameObjectInstanceId, out gameObjectData))
     {
         FFPacket <EventType> netpacket = new FFPacket <EventType>(instructions, typeof(EventType).ToString(), message, gameObjectData.gameObjectNetId.ToString());
         SendToNet <EventType>(netpacket, varifiedPacket);
     }
     else
     {
         Debug.Log("Tried to send a Message through Net via non-registered GameObject" +
                   "\nInstance ID: " + gameObjectInstanceId +
                   "\nObjects which send events to other NetObject need to be Registered via FFSystem.RegisterNetGameObject");
     }
 }