示例#1
0
        public override bool TakeAction()
        {
            DialHelper.CheckDialNum(ContextUser.UserID);
            //freeNum = GameConfigSet.FreeSweepstakes;
            UserDial userDial = new GameDataCacheSet <UserDial>().FindKey(ContextUser.UserID);

            if (userDial == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return(false);
            }
            //string content = LanguageManager.GetLang().St_SummerThreeGameCoinNotice.Substring(0, 5);
            //itemHead = userDial.HeadID;
            //if (userDial.PrizeInfo != null && !string.IsNullOrEmpty(userDial.PrizeInfo.UserID))
            //{
            //    if (userDial.PrizeInfo.Type == RewardType.Again || userDial.PrizeInfo.Type == RewardType.Recharge || userDial.PrizeInfo.Type == RewardType.Mood)
            //    {
            //        itemContent = DialHelper.PrizeItemName(userDial.PrizeInfo);
            //    }
            //    else
            //    {
            //        itemContent = content + DialHelper.PrizeItemName(userDial.PrizeInfo);
            //    }
            //}
            //if (userDial.RefreshDate.Date == DateTime.Now.Date)
            //{
            //    freeNum = MathUtils.Subtraction(freeNum, userDial.DialNum);
            //    if (userDial.DialNum >= freeNum)
            //    {
            //        isFree = 1;
            //    }
            //}
            //}

            int itemID   = UserItemHelper.GetUserItemInfoID(ContextUser.UserID, userItemID);
            var itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(itemID);

            if (itemInfo == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return(false);
            }
            int groupID = DialHelper.ChestDialGroupID(ContextUser.UserID, itemID);

            freeNum  = UserItemHelper.UserItemNum(ContextUser.UserID, itemID);
            dialList = new ConfigCacheSet <DialInfo>().FindAll(m => m.GroupID == groupID);
            dialList.QuickSort((x, y) =>
            {
                if (x == null && y == null)
                {
                    return(0);
                }
                if (x != null && y == null)
                {
                    return(1);
                }
                if (x == null)
                {
                    return(-1);
                }
                return(x.ID.CompareTo(y.ID));
            });
            userDial.UserItemID = userItemID;
            return(true);
        }