public object GetMessage(FunMessage msg, MessageType msg_type) { object _msg = null; bool success = Extensible.TryGetValue(serializer_, MessageTable.GetType(msg_type), msg, (int)msg_type, DataFormat.Default, true, out _msg); if (!success) { DebugUtils.Log("Failed to decode {0} {1}", MessageTable.GetType(msg_type), (int)msg_type); return null; } return _msg; }
private void SendEmptyMessage(TransportProtocol protocol) { FunapiTransport transport = GetTransport(protocol); if (transport == null) { DebugUtils.Log("SendEmptyMessage - transport is null."); return; } session_protocol_ = protocol; DebugUtils.DebugLog("{0} send empty message", transport.str_protocol); if (transport.Encoding == FunEncoding.kJson) { object msg = transport.JsonHelper.Deserialize("{}"); transport.SendMessage(new FunapiMessage(transport.Protocol, "", msg)); } else if (transport.Encoding == FunEncoding.kProtobuf) { FunMessage msg = new FunMessage(); transport.SendMessage(new FunapiMessage(transport.Protocol, "", msg)); } }
public FunMessage CreateFunMessage(object msg, MessageType msg_type) { FunMessage _msg = new FunMessage(); Extensible.AppendValue(serializer_, _msg, (int)msg_type, DataFormat.Default, msg); return _msg; }
public object GetMessage(FunMessage msg, Type msg_type, int msg_index) { object _msg = null; bool success = Extensible.TryGetValue(serializer_, msg_type, msg, msg_index, DataFormat.Default, true, out _msg); if (!success) { Debug.Log(String.Format("Failed to decode {0} {1}", msg_type, msg_index)); return null; } return _msg; }
private void SendAck(FunapiTransport transport, UInt32 ack) { DebugUtils.Assert(session_reliability_); if (transport == null) { DebugUtils.Log("SendAck - transport is null."); return; } if (state_ == State.kStopped) return; DebugUtils.DebugLog("{0} send ack message - ack:{1}", transport.Protocol, ack); if (transport.Encoding == FunEncoding.kJson) { object ack_msg = transport.JsonHelper.Deserialize("{}"); transport.JsonHelper.SetStringField(ack_msg, kSessionIdBodyField, session_id_); transport.JsonHelper.SetIntegerField(ack_msg, kAckNumberField, ack); transport.SendMessage(new FunapiMessage(transport.Protocol, "", ack_msg)); } else if (transport.Encoding == FunEncoding.kProtobuf) { FunMessage ack_msg = new FunMessage(); ack_msg.sid = session_id_; ack_msg.ack = ack; transport.SendMessage(new FunapiMessage(transport.Protocol, "", ack_msg)); } }
public static bool TryGetExtension_pbuf_echo(this FunMessage message, out PbufEchoMessage value) { return(ProtoBuf.Extensible.TryGetValue(message, (int)ExtendedMessageFieldNumber.FunMessage_pbuf_echo, out value)); }
public FunMessage CreateFunMessage(object msg, int msg_index) { FunMessage _msg = new FunMessage(); Extensible.AppendValue(serializer_, _msg, msg_index, DataFormat.Default, msg); return _msg; }
public static void AppendExtension_pbuf_another(this FunMessage message, PbufAnotherMessage value) { ProtoBuf.Extensible.AppendValue(message, (int)ExtendedMessageFieldNumber.FunMessage_pbuf_another, value); }
public static void AppendExtension_lobby_single_result(this FunMessage message, LobbySingleModeResultMessage value) { ProtoBuf.Extensible.AppendValue(message, (int)ExtendedMessageFieldNumber.FunMessage_lobby_single_result, value); }
public static bool TryGetExtension_lobby_single_result(this FunMessage message, out LobbySingleModeResultMessage value) { return(ProtoBuf.Extensible.TryGetValue(message, (int)ExtendedMessageFieldNumber.FunMessage_lobby_single_result, out value)); }
public static void AppendExtension_lobby_rank_list_req(this FunMessage message, LobbyRankListRequest value) { ProtoBuf.Extensible.AppendValue(message, (int)ExtendedMessageFieldNumber.FunMessage_lobby_rank_list_req, value); }
public static bool TryGetExtension_lobby_rank_list_req(this FunMessage message, out LobbyRankListRequest value) { return(ProtoBuf.Extensible.TryGetValue(message, (int)ExtendedMessageFieldNumber.FunMessage_lobby_rank_list_req, out value)); }