Esempio n. 1
0
        /// <summary>
        /// 更新卡牌收集数量
        /// </summary>
        /// <param name="package"></param>
        /// <returns></returns>
        public MessageCode UpdatePlayCardCount(ItemPackageFrame package, string zoneId = "")
        {
            if (package == null)
            {
                return(MessageCode.Success);
            }
            var taskRecord = TaskRecordMgr.GetManagerTaskList(package.ManagerId, zoneId);

            if (taskRecord == null || taskRecord.Count == 0)
            {
                return(MessageCode.Success);
            }
            foreach (var item in taskRecord)
            {
                var task = CacheFactory.TaskConfigCache.GetTask(item.TaskId);
                if (task == null)
                {
                    continue;
                }
                var require = CacheFactory.TaskConfigCache.GetTaskByRequire(item.TaskId);
                if (require == null)
                {
                    continue;
                }
                switch (require.RequireType)
                {
                case (int)EnumTaskRequireFunc.PlayerCardStrengthCollection:
                    if (require.RequireSub >= 0 && require.RequireSub <= 4)
                    {
                        if (require.RequireThird >= 2 && require.RequireThird <= 9)
                        {
                            var number2 = package.GetStrengthCardCount(require.RequireSub, require.RequireThird);
                            if (number2 > 0)
                            {
                                SavePackageTask(item, number2, task, zoneId);
                            }
                        }
                    }
                    break;

                case (int)EnumTaskRequireFunc.PlayCardCollection:
                    var number1 = package.GetPlayCountByCardLevel(require.RequireSub);
                    if (number1 > 0)
                    {
                        SavePackageTask(item, number1, task, zoneId);
                    }
                    break;

                case (int)EnumTaskRequireFunc.PlayerCardLevel:
                    int number = package.GetLevelCardCount(require.RequireSub);
                    if (number > 0)
                    {
                        SavePackageTask(item, number, task, zoneId);
                    }
                    break;
                }
            }
            return(MessageCode.Success);
        }