Ejemplo n.º 1
0
        /// <summary>
        /// 趋势1:上升,2:下降,3:不变化
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public static short SportTrend(string userID)
        {
            short    trend    = 3;
            GameUser gameUser = UserCacheGlobal.CheckLoadUser(userID);

            if (gameUser == null)
            {
                return(trend);
            }

            IList <SportsCombat> userSportsCombats = gameUser.GetSportsCombat();

            if (userSportsCombats.Count == 0)
            {
                return(trend);
            }

            SportsCombat nextCombat = userSportsCombats[userSportsCombats.Count - 1];

            if (DateTime.Now < nextCombat.CombatDate.AddSeconds(3600))
            {
                trend = nextCombat.RankStatus == 0 ? (short)3 : (nextCombat.RankStatus == 2 ? (short)2 : (short)1);
            }
            return(trend);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 连胜金币奖励
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public static int GetRewardGameCoin(GameUser user, short userLv)
        {
            int rewardGameCoin = 0;
            IList <SportsCombat> toUserCombat = user.GetSportsCombat();

            if (toUserCombat.Count > 0)
            {
                var temp = toUserCombat[toUserCombat.Count - 1];
                if (temp.WinNum > 10)
                {
                    rewardGameCoin = (int)(userLv * 40 * 1.2);
                }
                else if (temp.WinNum > 20)
                {
                    rewardGameCoin = (int)(userLv * 40 * 1.5);
                }
                else if (temp.WinNum > 50)
                {
                    rewardGameCoin = (int)(userLv * 40 * 2);
                }
                else if (temp.WinNum > 100)
                {
                    rewardGameCoin = (int)(userLv * 40 * 3);
                }
                else
                {
                    rewardGameCoin = (int)(userLv * 40);
                }
            }
            else
            {
                rewardGameCoin = (int)(userLv * 40);
            }
            if (rewardGameCoin.IsValid())
            {
                return(rewardGameCoin);
            }
            throw new ArgumentOutOfRangeException(string.Format("User:{0}连胜金币奖励溢出:{1}", user.UserID, rewardGameCoin));
        }