Exemplo n.º 1
0
        private void LoadMail()
        {
            Player player = UnitManager.Instance.GetUnitByIdx(m_char_idx) as Player;

            if (player == null)
            {
                return;
            }

            SQLMailHandle.LoadCharRecvs(m_char_idx, player.db_id, (info) =>
            {
                m_had_recv_mails = info;
                SQLMailHandle.LoadMailList(m_char_idx, player.spid, player.db_id, OnLoadMailEnd);
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// 修改已经领取过的邮件
        /// </summary>
        /// <param name="info"></param>
        /// <param name="callback"></param>
        public static void UpdateCharRecvs(long char_idx, MailCharRecvs info)
        {
            string sql = "replace into `mail_char_recv`" +
                         "(`char_idx`,`bin_mails`) " +
                         "values (" +
                         char_idx + "," +
                         "@bin_mails)";

            ByteArray by = DBUtils.AllocDBArray();

            info.Write(by);
            List <MySqlParameter> param = new List <MySqlParameter>();
            MySqlParameter        p     = Database.MakeMysqlParam("@bin_mails", MySqlDbType.Blob, by.GetBuffer(), by.Available);

            param.Add(p);
            DBManager.Instance.GetDB(eDBType.Game).Execute(sql, param);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 加载玩家已经领取过的邮件列表
        /// </summary>
        /// <param name="char_idx">收件人</param>
        /// <param name="callback"></param>
        public static void LoadCharRecvs(long char_idx, Action <MailCharRecvs> callback)
        {
            string sql = "call SP_MAIL_GET_CHAR_RECV(" + char_idx + ")";

            DBManager.Instance.GetDB(eDBType.Game).Query(sql, (reader) =>
            {
                MailCharRecvs info = new MailCharRecvs();
                if (reader.HasRows && reader.Read())
                {
                    long len = reader.GetBytes(0, 0, null, 0, int.MaxValue);
                    if (len > 0)
                    {
                        ByteArray by = DBUtils.AllocDBArray();
                        reader.GetBytes(0, 0, by.Buffer, 0, (int)len);
                        by.WriteEmpty((int)len);//直接修改m_tail
                        info.Read(by);
                    }
                }
                callback(info);
            });
        }
Exemplo n.º 4
0
 /// <summary>
 /// 玩家领取过的全局邮件
 /// </summary>
 private void OnLoadRecvMailEnd(MailCharRecvs info)
 {
     m_had_recv_mails = info;
 }