Exemplo n.º 1
0
        protected static void StorePaiHangPos(DBManager dbMgr, int paiHangType, int huoDongType, int maxPaiHang = 10)
        {
            List <PaiHangItemData> paiHangItemList = null;

            switch (paiHangType)
            {
            case 1:
                paiHangItemList = PaiHangManager.RoleEquipPaiHangList;
                break;

            case 2:
                paiHangItemList = PaiHangManager.RoleXueWeiNumPaiHangList;
                break;

            case 3:
                paiHangItemList = PaiHangManager.RoleSkillLevelPaiHangList;
                break;

            case 4:
                paiHangItemList = PaiHangManager.RoleHorseJiFenPaiHangList;
                break;

            case 5:
                paiHangItemList = PaiHangManager.RoleLevelPaiHangList;
                break;

            case 6:
                paiHangItemList = PaiHangManager.RoleYinLiangPaiHangList;
                break;

            case 7:
                paiHangItemList = PaiHangManager.RoleLianZhanPaiHangList;
                break;

            case 8:
                paiHangItemList = PaiHangManager.RoleKillBossPaiHangList;
                break;

            case 9:
                paiHangItemList = PaiHangManager.RoleBattleNumPaiHangList;
                break;

            case 10:
                paiHangItemList = PaiHangManager.RoleHeroIndexPaiHangList;
                break;

            case 11:
                paiHangItemList = PaiHangManager.RoleGoldPaiHangList;
                break;

            case 12:
                paiHangItemList = PaiHangManager.CombatForcePaiHangList;
                break;
            }
            if (null != paiHangItemList)
            {
                string paiHangTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                int    i           = 0;
                while (i < paiHangItemList.Count && i < maxPaiHang)
                {
                    DBRoleInfo dbRoleInfo = dbMgr.GetDBRoleInfo(ref paiHangItemList[i].RoleID);
                    if (null != dbRoleInfo)
                    {
                        int phvalue = paiHangItemList[i].Val1;
                        DBWriter.AddHongDongPaiHangRecord(dbMgr, paiHangItemList[i].RoleID, dbRoleInfo.RoleName, dbRoleInfo.ZoneID, huoDongType, i + 1, paiHangTime, phvalue);
                    }
                    i++;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 存储排行位置信息,主要用于活动奖励
        /// </summary>
        /// <param name="paiHangType"></param>
        /// <param name="maxPaiHang">最大排行值,只记录小于等于该值的排行,默认是10,只记录前十名</param>
        protected static void StorePaiHangPos(DBManager dbMgr, int paiHangType, int huoDongType, int maxPaiHang = 10)
        {
            List <PaiHangItemData> paiHangItemList = null;

            switch (paiHangType)
            {
            case (int)PaiHangTypes.EquipJiFen:
            {
                paiHangItemList = RoleEquipPaiHangList;
            }
            break;

            case (int)PaiHangTypes.XueWeiNum:
            {
                paiHangItemList = RoleXueWeiNumPaiHangList;
            }
            break;

            case (int)PaiHangTypes.SkillLevel:
            {
                paiHangItemList = RoleSkillLevelPaiHangList;
            }
            break;

            case (int)PaiHangTypes.HorseJiFen:
            {
                paiHangItemList = RoleHorseJiFenPaiHangList;
            }
            break;

            case (int)PaiHangTypes.RoleLevel:
            {
                paiHangItemList = RoleLevelPaiHangList;
            }
            break;

            case (int)PaiHangTypes.RoleYinLiang:
            {
                paiHangItemList = RoleYinLiangPaiHangList;
            }
            break;

            case (int)PaiHangTypes.LianZhan:
            {
                paiHangItemList = RoleLianZhanPaiHangList;
            }
            break;

            case (int)PaiHangTypes.KillBoss:
            {
                paiHangItemList = RoleKillBossPaiHangList;
            }
            break;

            case (int)PaiHangTypes.BattleNum:
            {
                paiHangItemList = RoleBattleNumPaiHangList;
            }
            break;

            case (int)PaiHangTypes.HeroIndex:
            {
                paiHangItemList = RoleHeroIndexPaiHangList;
            }
            break;

            case (int)PaiHangTypes.RoleGold:
            {
                paiHangItemList = RoleGoldPaiHangList;
            }
            break;

            case (int)PaiHangTypes.CombatForceList:
            {
                paiHangItemList = CombatForcePaiHangList;           // 战斗力排行榜
            }
            break;

            default:
            {
                ;        //
            }
            break;
            }
            ;

            if (null == paiHangItemList)
            {
                return;
            }

            //同类活动采用同一个时间
            string paiHangTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            int phvalue = 0;

            //依次记录排行maxPaiHang 以及之前的排名信息
            for (int i = 0; i < paiHangItemList.Count && i < maxPaiHang; i++)
            {
                DBRoleInfo dbRoleInfo = dbMgr.GetDBRoleInfo(paiHangItemList[i].RoleID);
                if (null != dbRoleInfo)
                {
                    //用于计算排行的值
                    phvalue = paiHangItemList[i].Val1;

                    DBWriter.AddHongDongPaiHangRecord(dbMgr, paiHangItemList[i].RoleID, dbRoleInfo.RoleName, dbRoleInfo.ZoneID, huoDongType, i + 1, paiHangTime, phvalue);
                }
            }
        }