예제 #1
0
        /// <summary>
        /// 获取联赛情况
        /// </summary>
        /// <param name="managerId"></param>
        /// <param name="leagueId"></param>
        /// <returns></returns>
        public GetLeagueInfoResponse GetLeagueInfoResponse(Guid managerId, int leagueId)
        {
            var response = new GetLeagueInfoResponse();

            response.Data = new LeagueInfoEntity();
            List <LeagueManagerrecordEntity> recordList = null;
            var lockList = new List <bool>();

            if (leagueId == 0)
            {
                recordList = LeagueManagerrecordMgr.GetManagerAllMark(managerId);
                foreach (var record in recordList)
                {
                    if (record.IsStart)
                    {
                        leagueId = record.LaegueId;
                        response.Data.IsHaveStartLeague = true;
                        break;
                    }
                    lockList.Add(record.IsLock);
                }
                if (!response.Data.IsHaveStartLeague)
                {
                    response.Data.IsHaveStartLeague = false;
                    response.Data.LockList          = lockList;
                    return(response);
                }
            }
            return(GetLeagueInfo(managerId, leagueId, null));
        }
예제 #2
0
 /// <summary>
 /// 获取所有联赛关卡锁住情况
 /// </summary>
 /// <param name="managerId"></param>
 /// <returns></returns>
 public GetLeagueLockResponse GetLeagueLock(Guid managerId)
 {
     try
     {
         var list = LeagueManagerrecordMgr.GetManagerAllMark(managerId);
         if (list == null)
         {
             SystemlogMgr.Error("获取联赛信息", "经理联赛记录未找到ManagerId:" + managerId);
             return(ResponseHelper.InvalidParameter <GetLeagueLockResponse>());
         }
         var response = new GetLeagueLockResponse();
         response.Data = new LeagueLockEntity
         {
             List = new List <bool>()
         };
         foreach (var item in list)
         {
             response.Data.List.Add(item.IsLock);
         }
         return(response);
     }
     catch (Exception ex)
     {
         SystemlogMgr.Error("联赛获取所有联赛关卡锁住情况", ex);
         return(ResponseHelper.InvalidParameter <GetLeagueLockResponse>());
     }
 }
예제 #3
0
        public LeagueAllPrizeInfoResponse GetAllPrizeInfo(Guid managerId)
        {
            var leagueInfo    = LeagueManagerrecordMgr.GetManagerAllMark(managerId);
            var prizeInfoList = new List <LeagueAllPrizeInfoEntity>();

            foreach (var entity in leagueInfo)
            {
                var prizeInfo = new LeagueAllPrizeInfoEntity();
                prizeInfo.LeagueRecordId = entity.LastPrizeLeagueRecordId;
                prizeInfo.LeagueId       = entity.LaegueId;
                prizeInfo.FirstPass      = !entity.SendFirstPassPrize;
                //已领取过首次通关奖励
                if (entity.SendFirstPassPrize)
                {
                    prizeInfo.Status = 2;
                }
                else
                {
                    //不能领取的
                    if (entity.LastPrizeLeagueRecordId == new Guid())
                    {
                        prizeInfo.Status = 0;
                    }
                    else
                    {
                        prizeInfo.Status = 1;
                    }
                }
                prizeInfoList.Add(prizeInfo);
            }
            var response = ResponseHelper.CreateSuccess <LeagueAllPrizeInfoResponse>();

            response.Data = new LeagueAllPrizeInfoList
            {
                PrizeInfoList = prizeInfoList
            };
            return(response);
        }
예제 #4
0
        /// <summary>
        /// 开启一个新的联赛
        /// </summary>
        /// <param name="managerId"></param>
        /// <param name="leagueId"></param>
        /// <param name="leagueManagerRecord"></param>
        /// <returns></returns>
        public MessageCode StartLeague(Guid managerId, int leagueId, ref LeagueManagerrecordEntity leagueManagerRecord)
        {
            var recordList = LeagueManagerrecordMgr.GetManagerAllMark(managerId);

            foreach (var record in recordList)
            {
                if (record.LaegueId == leagueId)
                {
                    leagueManagerRecord = record;
                }
                if (record.IsStart)
                {
                    return(MessageCode.LeagueHasStart);
                }
            }
            if (leagueManagerRecord == null)
            {
                return(MessageCode.NbParameterError);
            }
            if (leagueManagerRecord.IsLock)
            {
                return(MessageCode.LeagueIdMarkNotLock);
            }
            #region 去掉等级限制
            //var openLevel= LeagueCache.Instance.GetLeagueOpenLevel(leagueId);
            //if (openLevel == -1)
            //    return MessageCode.NbParameterError;
            //var manager = ManagerCore.Instance.GetManager(managerId);
            //if(manager==null)
            //    return MessageCode.NbParameterError;
            //if(manager.Level<openLevel)
            //    return MessageCode.LeagueIdMarkNotLock;
            #endregion
            DateTime date           = DateTime.Now;
            var      leagueRecordId = ShareUtil.GenerateComb();
            leagueManagerRecord.LeagueRecordId = leagueRecordId;
            //info.LastPrizeLeagueRecordId = new Guid();
            leagueManagerRecord.IsPass       = false;
            leagueManagerRecord.IsStart      = true;
            leagueManagerRecord.MatchNumber  = 0;
            leagueManagerRecord.Score        = 0;
            leagueManagerRecord.WinNumber    = 0;
            leagueManagerRecord.FlatNumber   = 0;
            leagueManagerRecord.LoseNumber   = 0;
            leagueManagerRecord.GoalsNumber  = 0;
            leagueManagerRecord.FumbleNumber = 0;
            leagueManagerRecord.UpdateTime   = date;

            var npcCount   = CacheFactory.LeagueCache.GetTeamCount(leagueId);
            var templateId = CacheFactory.LeagueCache.GetTemplateId(npcCount + 1);
            leagueManagerRecord.MaxWheelNumber = npcCount * 2;//总轮数
            leagueManagerRecord.FightDicId     = templateId;

            LeagueRecordEntity entity = new LeagueRecordEntity(leagueRecordId, managerId, leagueId, 1, 0, 0, false, date, date, ShareUtil.BaseTime);
            entity.Idx        = leagueRecordId;
            entity.ManagerId  = managerId;
            entity.LaegueId   = leagueId;
            entity.IsSend     = false;
            entity.Rank       = -1;
            entity.RowTime    = date;
            entity.Schedule   = 1;
            entity.UpdateTime = date;
            entity.Score      = 0;
            var leagueWinCount = LeagueWincountrecordMgr.GetRecord(managerId, leagueId);
            if (leagueWinCount != null)
            {
                if (leagueWinCount.PrizeDate.Date != DateTime.Now.Date)
                {
                    leagueWinCount.WinCount1Status = 0;
                    leagueWinCount.WinCount2Status = 0;
                    leagueWinCount.WinCount3Status = 0;
                    leagueWinCount.UpdateTime      = DateTime.Now;
                    leagueWinCount.PrizeDate       = DateTime.Now;
                    leagueWinCount.PrizeStep       = "0,0,0,0,0";
                }
                leagueWinCount.MaxWinCount = 0;
            }
            //更新当前联赛记录
            if (!LeagueManagerrecordMgr.Update(leagueManagerRecord))
            {
                return(MessageCode.FailUpdate);
            }
            if (!LeagueRecordMgr.Insert(entity))
            {
                return(MessageCode.FailUpdate);
            }
            var figMap = new LeagueFightMapFrame(managerId);
            figMap.ClearFightMapStartLeague(npcCount + 1);
            if (leagueWinCount != null)
            {
                if (!LeagueWincountrecordMgr.Update(leagueWinCount))
                {
                    return(MessageCode.FailUpdate);
                }
            }
            return(MessageCode.Success);
        }