예제 #1
0
        private void decode_Response(PhotonCmdHeader cmd_hdr, BinaryReader packet)
        {
            // see func ReliableMessage() decode in...
            // https://github.com/broderickhyman/photon_spectator/blob/master/photon_command.go

            var opResponse = new ReliableMessage_Response();

            opResponse.ChannelID = cmd_hdr.ChannelID;

            opResponse.OperationCode         = packet.ReadByte();   // Operation Code
            opResponse.OperationResponseCode = packet.ReadUInt16(); // Operation Response Code
            opResponse.OperationDebugByte    = packet.ReadByte();   // Operation Debug Byte

            opResponse.ParameterCount = packet.ReadInt16();         // Parameter Count   (?? is this valid for all msg types?)

            Event_Photon_Cmd_Info?.Invoke("Photon Reliable Response - " + opResponse.OperationResponseCode);

            var parameters = new ReliableMessage_Response.Paramaters();

            // decode the paramaters
            for (int i = 0; i < opResponse.ParameterCount; i++)
            {
                var             paramID   = packet.ReadByte();                  // paramID
                PhotonParamType paramType = (PhotonParamType)packet.ReadByte(); // paramType

                var param_value = Decode_PhotonValueType.Decode(packet, paramType);

                parameters[paramID] = param_value;
                Event_Photon_Info?.Invoke("ParamID: " + paramID + "  value: " + param_value.ToString());
            }
            opResponse.ParamaterData = parameters;

            Event_Photon_ReliableResponse?.Invoke(opResponse);
        }
예제 #2
0
 public void Decode_ReliableResponse(ReliableMessage_Response info)
 {
     Event_Albion_Info?.Invoke(
         String.Format("RESPONSE [{0} - chn {1}] \n... {2}",
                       info.OperationCode,
                       info.ChannelID,
                       RenderParameters(info.ParamaterData)
                       ));
 }
 private void PhotonDecoder_Event_Photon_ReliableResponse(ReliableMessage_Response info)
 {
     packetStats.photon_reliable_response++;
     albionDecoder.Decode_ReliableResponse(info);
 }