Exemplo n.º 1
0
        private static bool CreateGameFuBen(DateTime now, params EscapeBattle_K.JoinPkData[] joinArr)
        {
            for (int side = 1; side <= joinArr.Length; side++)
            {
                joinArr[side - 1].Side = side;
                if (joinArr[side - 1].InGame)
                {
                    return(true);
                }
            }
            int toServerId = 0;
            int gameId     = TianTiPersistence.Instance.GetNextGameId();

            if (ClientAgentManager.Instance().AssginKfFuben(EscapeBattle_K.GameType, (long)gameId, 10, out toServerId))
            {
                EscapeBattleFuBenData copyData = new EscapeBattleFuBenData();
                copyData.GameID   = (long)gameId;
                copyData.ServerID = toServerId;
                EscapeBattleNtfEnterData data = new EscapeBattleNtfEnterData();
                data.ToServerId = toServerId;
                data.GameId     = gameId;
                EscapeBattlePkLogData log = new EscapeBattlePkLogData();
                log.Season     = EscapeBattle_K.SyncData.Season;
                log.StartTime  = now;
                log.GameID     = gameId;
                log.ToServerID = toServerId;
                EscapeBattleMatchConfig config = EscapeBattle_K._Config.MatchConfigList[0];
                log.EndTime = now.AddSeconds((double)config.TotalSecs);
                foreach (EscapeBattle_K.JoinPkData joinRole in joinArr)
                {
                    copyData.SideDict[(long)joinRole.ZhanDuiID] = joinRole.Side;
                    copyData.RoleDict.AddRange(TianTi5v5Service.GetZhanDuiMemberIDs(joinRole.ZhanDuiID));
                    joinRole.ToServerID = toServerId;
                    joinRole.CurrGameID = gameId;
                    joinRole.CopyData   = copyData;
                    joinRole.InGame     = true;
                    data.ZhanDuiIDList.Add(joinRole.ZhanDuiID);
                    log.ZhanDuiIDs.Add(joinRole.ZhanDuiID);
                    log.ZoneIDs.Add(joinRole.ZoneId);
                    log.ZhanDuiNames.Add(joinRole.ZhanDuiName);
                    EscapeBattle_K.JoinPkData zhandui;
                    if (EscapeBattle_K.JoinDict.TryGetValue(joinRole.ZhanDuiID, out zhandui))
                    {
                        zhandui.InGame     = true;
                        zhandui.CurrGameID = gameId;
                        zhandui.Side       = joinRole.Side;
                        zhandui.ToServerID = toServerId;
                        zhandui.CopyData   = copyData;
                        zhandui.State      = 3;
                        zhandui.ReadyState = false;
                        zhandui.ReadyNum   = 0;
                    }
                }
                EscapeBattle_K.AsyncEvQ.Enqueue(KFCallMsg.New <EscapeBattleNtfEnterData>(KuaFuEventTypes.EscapeBattle_NotifyEnter, data));
                EscapeBattle_K.ThisLoopPkLogs[gameId] = log;
                if (!EscapeBattle_K.NeedUpdateRank)
                {
                    EscapeBattle_K.NeedUpdateRank = true;
                }
                LogManager.WriteLog(LogTypes.Trace, string.Format("大逃杀第{0}赛季战队成员通知入场,GameID={1},zhanduiIDs={2}", EscapeBattle_K.SyncData.Season, data.GameId, string.Join <int>(",", log.ZhanDuiIDs)), null, true);
                return(true);
            }
            LogManager.WriteLog(LogTypes.Warning, string.Format("大逃杀第{0}赛季分配游戏服务器失败", EscapeBattle_K.SyncData.Season), null, true);
            return(false);
        }
Exemplo n.º 2
0
        private static bool CreateGameFuBen(DateTime now, ZhanDuiZhengBaMatchConfig matchConfig, ZhanDuiZhengBa_K.JoinRolePkData joinRole1, ZhanDuiZhengBa_K.JoinRolePkData joinRole2)
        {
            bool result;

            if (joinRole1.CurrGameID > 0)
            {
                result = true;
            }
            else
            {
                int betterZhanDuiID = (joinRole1.Rank < joinRole2.Rank) ? joinRole1.ZhanDuiID : joinRole2.ZhanDuiID;
                int toServerId      = 0;
                int gameId          = TianTiPersistence.Instance.GetNextGameId();
                if (ClientAgentManager.Instance().AssginKfFuben(ZhanDuiZhengBa_K.GameType, (long)gameId, 10, out toServerId))
                {
                    ZhanDuiZhengBaFuBenData copyData = new ZhanDuiZhengBaFuBenData();
                    copyData.GameID = (long)gameId;
                    copyData.SideDict[(long)joinRole1.ZhanDuiID] = 1;
                    copyData.SideDict[(long)joinRole2.ZhanDuiID] = 2;
                    copyData.BetterZhanDuiID = betterZhanDuiID;
                    copyData.ConfigID        = matchConfig.ID;
                    copyData.JoinGrade       = (int)matchConfig.JoinGrade;
                    copyData.NewGrade        = (int)matchConfig.WillUpGrade;
                    copyData.ServerID        = toServerId;
                    copyData.RoleDict.AddRange(TianTi5v5Service.GetZhanDuiMemberIDs(joinRole1.ZhanDuiID));
                    if (joinRole1.ZhanDuiID != joinRole2.ZhanDuiID)
                    {
                        copyData.RoleDict.AddRange(TianTi5v5Service.GetZhanDuiMemberIDs(joinRole2.ZhanDuiID));
                    }
                    joinRole1.ToServerID   = (joinRole2.ToServerID = toServerId);
                    joinRole1.CurrGameID   = (joinRole2.CurrGameID = gameId);
                    joinRole1.CopyData     = (joinRole2.CopyData = copyData);
                    joinRole1.WaitReqEnter = (joinRole2.WaitReqEnter = true);
                    ZhanDuiZhengBaNtfEnterData data = new ZhanDuiZhengBaNtfEnterData();
                    data.ZhanDuiID1 = joinRole1.ZhanDuiID;
                    data.ZhanDuiID2 = joinRole2.ZhanDuiID;
                    data.ToServerId = toServerId;
                    data.GameId     = gameId;
                    data.Day        = ZhanDuiZhengBa_K.SyncData.RealActID;
                    ZhanDuiZhengBa_K.AsyncEvQ.Enqueue(KFCallMsg.New <ZhanDuiZhengBaNtfEnterData>(KuaFuEventTypes.ZhanDuiZhengBa_NotifyEnter, data));
                    LogManager.WriteLog(LogTypes.Info, string.Format("战队争霸第{0}轮战队成员通知入场,zhanduiID1={1},zhanduiID2={2}", ZhanDuiZhengBa_K.SyncData.RealActID, joinRole1.ZhanDuiID, joinRole2.ZhanDuiID), null, true);
                    ZhanDuiZhengBaPkLogData log = new ZhanDuiZhengBaPkLogData();
                    log.Month           = ZhanDuiZhengBa_K.SyncData.Month;
                    log.ID              = ZhanDuiZhengBa_K.SyncData.RealActID;
                    log.ZhanDuiID1      = joinRole1.ZhanDuiID;
                    log.ZoneID1         = joinRole1.ZoneId;
                    log.ZhanDuiName1    = joinRole1.RoleName;
                    log.ZhanDuiID2      = joinRole2.ZhanDuiID;
                    log.ZoneID2         = joinRole2.ZoneId;
                    log.ZhanDuiName2    = joinRole2.RoleName;
                    log.StartTime       = now;
                    log.BetterZhanDuiID = betterZhanDuiID;
                    log.GameID          = (long)gameId;
                    ZhanDuiZhengBa_K.ThisLoopPkLogs[gameId] = log;
                    result = true;
                }
                else
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("战队争霸第{0}轮分配游戏服务器失败,zhanduiID1={1},zhanduiID2={2}", ZhanDuiZhengBa_K.SyncData.RealActID, joinRole1.ZhanDuiID, joinRole2.ZhanDuiID), null, true);
                    result = false;
                }
            }
            return(result);
        }