Example #1
0
 public void SetUpTransmissionIds()
 {
     foreach (TCPClientInfo connectionInfo in server.getConnectedClients)
     {
         DataIDs dataIDs = server.GetConnection(connectionInfo.clientID).dataIDs;
         dataIDs.DefineCustomDataTypeForID <Structs.InitialData>(Structs.InitialPacketId, null);
         dataIDs.DefineCustomDataTypeForID <Structs.PlayCardAction>(Structs.PlayCardPacketId, OnPlayCardPacketReceived);
         dataIDs.DefineCustomDataTypeForID <Structs.DrawCardAction>(Structs.DrawPacketId, OnDrawCardPacketReceived);
         dataIDs.DefineCustomDataTypeForID <Structs.ExtraCardArgs>(Structs.ExtraCardArgsPacketId, OnExtraCardArgsPacketReceived);
         dataIDs.DefineCustomDataTypeForID <Structs.LossPacket>(Structs.LossId, OnLossPacketReceived);
     }
 }
Example #2
0
    public void SetUpTransmissionIds()
    {
        DataIDs ids = client.getConnection.dataIDs;

        try {
            ids.DefineCustomDataTypeForID <Structs.InitialData>(Structs.InitialPacketId, OnInitialData);
            ids.DefineCustomDataTypeForID <Structs.PlayCardAction>(Structs.PlayCardPacketId, OnCardPlayed);
            ids.DefineCustomDataTypeForID <Structs.DrawCardAction>(Structs.DrawPacketId, OnDrawCard);
            ids.DefineCustomDataTypeForID <Structs.ExtraCardArgs>(Structs.ExtraCardArgsPacketId, OnExtraInfo);
            ids.DefineCustomDataTypeForID <Structs.ServerState>(Structs.ServerStateId, OnServerStateReceived);
            ids.DefineCustomDataTypeForID <Structs.NewClient>(Structs.NewClientId, OnNewClientConnected);
            client.getConnection.OnStringReceived += OnStringReceived;
        }
        catch (Exception e) {
            Debug.LogWarning(e.Message + "\n" + e.InnerException?.Message);
            lm.Print(e.Message + "\n" + e.InnerException?.Message);
        }
    }