Beispiel #1
0
        //载入数据
        public void DB_Load()
        {
            String sql = string.Format("select id,name,guanjue from cq_user ORDER BY guanjue DESC");
            MySqlCommand command = new MySqlCommand(sql, MysqlConn.GetConn());

            MysqlConn.Conn_Open();
            MySqlDataReader reader = command.ExecuteReader();
            //最多五十个排名
            const int MAX_JUEWEI = 50;
            int index = 0;
            while(reader.Read())
            {
                if (!reader.HasRows)break;
                ulong guanjue = reader.GetUInt64("guanjue");
                if (guanjue == 0) break;

                GuanJueInfo info = new GuanJueInfo();
                info.guanjue = guanjue;
                info.id = reader.GetUInt32("id");
                info.name = reader.GetString("name");
                info.name = Coding.Latin1ToGB2312(info.name);
                mListInfo.Add(info);

                index++;
                if (index > MAX_JUEWEI) break;
            }

            MysqlConn.Conn_Close();
            command.Dispose();
        }
 public void Create(byte[] msg)
 {
     PackIn inpack = new PackIn(msg);
     inpack.ReadUInt16();
     int count = inpack.ReadInt32();
     for (int i = 0; i < count; i++)
     {
         GuanJueInfo info = new GuanJueInfo();
         info.Create(inpack);
         list_item.Add(info);
     }
 }
 public UPDATEGUANJUEDATA()
 {
     mparam = Define.UPDATEGUANJUEDATA;
     info = new GuanJueInfo();
 }
Beispiel #4
0
        //更新爵位信息
        public void UpdateGuanJueInfo(GuanJueInfo info)
        {
            //先删-- 然后再排序
            for (int i = 0; i < mListInfo.Count; i++)
            {
                if (mListInfo[i].id == info.id)
                {
                    mListInfo.RemoveAt(i);
                    break;
                }
            }

            bool bInsert = false;
            for (int i = 0; i < mListInfo.Count; i++)
            {
                if (info.guanjue > mListInfo[i].guanjue)
                {
                    mListInfo.Insert(i, info);
                    bInsert = true;
                    break;
                }
            }
            if (!bInsert && mListInfo.Count < GameBase.Config.Define.MAX_JUEWEICOUNT)
            {
                mListInfo.Add(info);
            }
        }
Beispiel #5
0
        public void SetValue(int play_id,String name, ulong guanjue)
        {
            // bool bFind = false;
            for (int i = 0; i < mList.Count; i++)
            {
                if (mList[i].id == play_id)
                {
                    //mList[i].guanjue = guanjue;
                    mList.RemoveAt(i);
                    //bFind = true;
                    break;
                }
            }

            GuanJueInfo info = new GuanJueInfo();
            info.id = (uint)play_id;
            info.name = name;
            info.guanjue = guanjue;
            //插入--
            bool bInsert = false;
            for (int i = 0; i < mList.Count; i++)
            {
                if (guanjue > mList[i].guanjue)
                {
                    mList.Insert(i, info);
                    bInsert = true;
                    break;
               }
            }
            if (!bInsert && mList.Count < GameBase.Config.Define.MAX_JUEWEICOUNT)
            {
                mList.Add(info);
             }
        }