示例#1
0
 //��Ѩȡ����õ�λ��
 public static int ChestLairTreasuerPosition(LairTreasureType lairTreasureType)
 {
     int postion = 0;
     var lairTreasuer = new ConfigCacheSet<LairTreasureInfo>().FindKey(MathUtils.ToInt(lairTreasureType));
     double[] LairDoubleList = new double[lairTreasuer.LairTreasureList.Count];
     for (int i = 0; i < lairTreasuer.LairTreasureList.Count; i++)
     {
         LairDoubleList[i] = (double)lairTreasuer.LairTreasureList[i].Probability;
     }
     postion = (int)RandomUtils.GetHitIndex(LairDoubleList);
     return postion;
 }
示例#2
0
        public static int ChestLairTreasuerPosition(LairTreasureType lairTreasureType)       //��Ѩȡ����õ�λ��
        {
            int postion      = 0;
            var lairTreasuer = new ConfigCacheSet <LairTreasureInfo>().FindKey(MathUtils.ToInt(lairTreasureType));

            double[] LairDoubleList = new double[lairTreasuer.LairTreasureList.Count];
            for (int i = 0; i < lairTreasuer.LairTreasureList.Count; i++)
            {
                LairDoubleList[i] = (double)lairTreasuer.LairTreasureList[i].Probability;
            }
            postion = (int)RandomUtils.GetHitIndex(LairDoubleList);
            return(postion);
        }
示例#3
0
        public static ItemBaseInfo ShowLairReward(LairTreasure lairTreasure, GameUser gameUser, LairTreasureType lairTreasureType)    //��ʾ��õ���Ʒ
        {
            var cacheSetItem = new ConfigCacheSet<ItemBaseInfo>();
            ItemBaseInfo itemBaseInfo = null;
            var lairRewardList = new ConfigCacheSet<LairRewardInfo>().FindAll(s => s.LairPosition == lairTreasure.LairPosition && s.LairTreasureType == lairTreasureType.ToInt());
            if (lairRewardList.Count >0)
            {
                var lairRewardInfo = lairRewardList[RandomUtils.GetRandom(0, lairRewardList.Count)];
                itemBaseInfo = cacheSetItem.FindKey(lairRewardInfo.ItemID);
                if (itemBaseInfo != null)
                {
                    UserItemHelper.AddUserItem(gameUser.UserID, lairRewardInfo.ItemID, lairTreasure.Num);
                }
            }

            return itemBaseInfo;
        }
示例#4
0
        //��ȡ��Ʒ
        public static void GetLaiReward(LairTreasureType lairTreasureType, GameUser gameUser, int id, int postion)
        {
            var lairTreasuerList = new ConfigCacheSet<LairTreasureInfo>().FindKey(MathUtils.ToInt(lairTreasureType));
            LairTreasure lairTreasure = lairTreasuerList.LairTreasureList[postion];
            var lairRewardInfo = new ConfigCacheSet<LairRewardInfo>().FindKey(id);
            var rewardTye = lairRewardInfo.LairRewardType.ToEnum<LairRewardType>();
            switch (rewardTye)
            {
                case LairRewardType.GameGoin:
                    gameUser.GameCoin = MathUtils.Addition(gameUser.GameCoin, lairTreasure.Num);
                    break;
                case LairRewardType.Gold:
                    gameUser.PayGold = MathUtils.Addition(gameUser.PayGold, lairTreasure.Num);
                    break;
                case LairRewardType.FunJi:
                case LairRewardType.WuPing:
                    UserItemHelper.AddUserItem(gameUser.UserID, lairRewardInfo.ItemID, 1);
                    break;

            }
        }
示例#5
0
        public static void GetLaiReward(LairTreasureType lairTreasureType, GameUser gameUser, int id, int postion)       //��ȡ��Ʒ
        {
            var          lairTreasuerList = new ConfigCacheSet <LairTreasureInfo>().FindKey(MathUtils.ToInt(lairTreasureType));
            LairTreasure lairTreasure     = lairTreasuerList.LairTreasureList[postion];
            var          lairRewardInfo   = new ConfigCacheSet <LairRewardInfo>().FindKey(id);
            var          rewardTye        = lairRewardInfo.LairRewardType.ToEnum <LairRewardType>();

            switch (rewardTye)
            {
            case LairRewardType.GameGoin:
                gameUser.GameCoin = MathUtils.Addition(gameUser.GameCoin, lairTreasure.Num);
                break;

            case LairRewardType.Gold:
                gameUser.PayGold = MathUtils.Addition(gameUser.PayGold, lairTreasure.Num);
                break;

            case LairRewardType.FunJi:
            case LairRewardType.WuPing:
                UserItemHelper.AddUserItem(gameUser.UserID, lairRewardInfo.ItemID, 1);
                break;
            }
        }
示例#6
0
        public static ItemBaseInfo ShowLairReward(LairTreasure lairTreasure, GameUser gameUser, LairTreasureType lairTreasureType)    //��ʾ��õ���Ʒ
        {
            var          cacheSetItem   = new ConfigCacheSet <ItemBaseInfo>();
            ItemBaseInfo itemBaseInfo   = null;
            var          lairRewardList = new ConfigCacheSet <LairRewardInfo>().FindAll(s => s.LairPosition == lairTreasure.LairPosition && s.LairTreasureType == lairTreasureType.ToInt());

            if (lairRewardList.Count > 0)
            {
                var lairRewardInfo = lairRewardList[RandomUtils.GetRandom(0, lairRewardList.Count)];
                itemBaseInfo = cacheSetItem.FindKey(lairRewardInfo.ItemID);
                if (itemBaseInfo != null)
                {
                    UserItemHelper.AddUserItem(gameUser.UserID, lairRewardInfo.ItemID, lairTreasure.Num);
                }
            }

            return(itemBaseInfo);
        }