Ejemplo n.º 1
0
 private static void AppendLog(int teamId, TeamCombatProcess logTeam)
 {
     if (_combatProcessList != null)
     {
         if (!_combatProcessList.ContainsKey(teamId))
         {
             _combatProcessList.Add(teamId, new TeamCombatResult());
         }
         lock (ThisLock)
         {
             TeamCombatResult tempList = _combatProcessList[teamId];
             tempList.ProcessList.Add(logTeam);
         }
         UserCombatLog log = new UserCombatLog
         {
             CombatLogID   = Guid.NewGuid().ToString(),
             CombatType    = CombatType.MultiPlot,
             UserID        = logTeam.UserId,
             PlotID        = logTeam.PlotID,
             NpcID         = logTeam.PlotNpcID,
             HostileUser   = logTeam.TeamID.ToString(),
             IsWin         = logTeam.IsWin,
             CombatProcess = JsonUtils.Serialize(logTeam.ProcessContainer),
             CreateDate    = DateTime.Now
         };
         var sender = DataSyncManager.GetDataSender();
         sender.Send(log);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 创建组队
        /// </summary>
        /// <param name="user"></param>
        /// <param name="plotId"></param>
        /// <returns></returns>
        private int Create(GameUser user, int plotId)
        {
            if (_teamList == null)
            {
                return(-1);
            }

            int      teamId   = NextTeamId;
            MorePlot morePlot = GetItem(plotId);
            var      team     = new MorePlotTeam
            {
                MorePlot = morePlot,
                TeamID   = teamId,
                TeamUser = new TeamUser
                {
                    UserId   = user.UserID,
                    NickName = user.NickName,
                    //UserLv = user.UserLv,
                    //UseMagicID = user.UseMagicID
                },
                CombatResult = false,
                Status       = 1,
            };

            _teamList.Add(teamId, team);
            AddTeam(teamId);
            return(teamId);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 加入组队,若已经在其它组队则自动退出
 /// </summary>
 /// <param name="teamId"></param>
 public bool AddTeam(int teamId)
 {
     if (_teamList == null)
     {
         return(false);
     }
     if (_teamList.ContainsKey(teamId))
     {
         var team = _teamList[teamId];
         if (!team.IsAllow)
         {
             return(false);
         }
         //是否在其它组队
         if (_userList.ContainsKey(_userId))
         {
             int oldTeamId = _userList[_userId];
             if (oldTeamId != teamId)
             {
                 LeaveTeam(oldTeamId);
                 _userList[_userId] = teamId;
             }
         }
         else
         {
             _userList.Add(_userId, teamId);
         }
         GameUser gameUser = new PersonalCacheStruct <GameUser>().FindKey(_userId);
         team.Append(gameUser);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 加载数据
        /// </summary>
        public static void InitBoss(UserGuild userGuild)
        {
            try
            {
                if (_userGuildList.ContainsKey(userGuild.GuildID))
                {
                    _userGuildList[userGuild.GuildID] = userGuild;
                }
                else
                {
                    _userGuildList.Add(userGuild.GuildID, userGuild);
                }

                CombatGeneral general = CreateBossGeneral(userGuild);
                if (!_bossGeneralList.ContainsKey(userGuild.GuildID))
                {
                    _bossGeneralList.Add(userGuild.GuildID, new BossDictionary {
                        BossGeneral = general
                    });
                }
                else
                {
                    _bossGeneralList[userGuild.GuildID].BossGeneral = general;
                }
            }
            catch (Exception ex)
            {
                new BaseLog().SaveLog(ex);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 设置赢的次数
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="plotId"></param>
        public void SetWinNum(string userId, int plotId)
        {
            if (_userTimesList == null)
            {
                return;
            }
            string key = userId + plotId;

            lock (ThisLock)
            {
                if (_userTimesList.ContainsKey(key))
                {
                    _userTimesList[key] = _userTimesList[key] + 1;
                }
                else
                {
                    _userTimesList.Add(key, 1);
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 加载数据
        /// </summary>
        public static void InitBoss(GameActive gameActive)
        {
            if (_gameActiveList.ContainsKey(gameActive.ActiveId))
            {
                _gameActiveList[gameActive.ActiveId] = gameActive;
            }
            else
            {
                _gameActiveList.Add(gameActive.ActiveId, gameActive);
            }

            CombatGeneral general = CreateBossGeneral(gameActive);

            if (!_bossGeneralList.ContainsKey(gameActive.ActiveId))
            {
                _bossGeneralList.Add(gameActive.ActiveId, new BossDictionary {
                    BossGeneral = general
                });
            }
            else
            {
                _bossGeneralList[gameActive.ActiveId].BossGeneral = general;
            }
        }