Esempio n. 1
0
        /// <summary>
        /// 客户端请求消息
        /// </summary>
        public void req_heartbeat(long tick)
        {
            if (robot_status_ != 2 || !end_point_.connect_status)
            {
                return;
            }

            Bit_Buffer buffer = new Bit_Buffer();

            buffer.write_int((int)(tick / 1000), 32);
            end_point_.send_to_server(Msg.REQ_HEARTBEAT, buffer);
            player_log("同步心跳至服务器");
        }
Esempio n. 2
0
 private int set_arg_buffer(Field_Info info, Bit_Buffer buffer, JValue value)
 {
     if (info.field_type == "int")
     {
         int val = int.Parse(value.ToString());
         buffer.write_int(val, info.field_bit);
     }
     else if (info.field_type == "uint")
     {
         uint val = uint.Parse(value.ToString());
         buffer.write_uint(val, info.field_bit);
     }
     else if (info.field_type == "int64")
     {
         long val = long.Parse(value.ToString());
         buffer.write_int64(val);
     }
     else if (info.field_type == "uint64")
     {
         ulong val = ulong.Parse(value.ToString());
         buffer.write_uint64(val);
     }
     else if (info.field_type == "float")
     {
         float val = float.Parse(value.ToString());
         buffer.write_decimal(val, 32);
     }
     else if (info.field_type == "bool")
     {
         bool val = bool.Parse(value.ToString());
         buffer.write_bool(val);
     }
     else if (info.field_type == "string")
     {
         string val = value.ToString();
         buffer.write_string(val);
     }
     return(0);
 }