Ejemplo n.º 1
0
        /// <summary>
        /// 添加一个场景
        /// </summary>
        public bool AddHuanYingSiYuanCopyScenes(GameClient client, CopyMap copyMap)
        {
            if (copyMap.MapCode == RuntimeData.MapCode)
            {
                int fuBenSeqId = copyMap.FuBenSeqID;
                int mapCode    = copyMap.MapCode;
                lock (Mutex)
                {
                    HuanYingSiYuanScene huanYingSiYuanScene = null;
                    if (!HuanYingSiYuanSceneDict.TryGetValue(fuBenSeqId, out huanYingSiYuanScene))
                    {
                        huanYingSiYuanScene         = new HuanYingSiYuanScene();
                        huanYingSiYuanScene.CopyMap = copyMap;
                        huanYingSiYuanScene.CleanAllInfo();
                        huanYingSiYuanScene.GameId         = (int)Global.GetClientKuaFuServerLoginData(client).GameId;
                        huanYingSiYuanScene.m_nMapCode     = mapCode;
                        huanYingSiYuanScene.CopyMapId      = copyMap.CopyMapID;
                        huanYingSiYuanScene.FuBenSeqId     = fuBenSeqId;
                        huanYingSiYuanScene.m_nPlarerCount = 1;

                        HuanYingSiYuanSceneDict[fuBenSeqId] = huanYingSiYuanScene;
                    }
                    else
                    {
                        huanYingSiYuanScene.m_nPlarerCount++;
                    }

                    if (client.ClientData.BattleWhichSide == 1)
                    {
                        huanYingSiYuanScene.ScoreInfoData.Count1++;
                    }
                    else
                    {
                        huanYingSiYuanScene.ScoreInfoData.Count2++;
                    }

                    copyMap.IsKuaFuCopy = true;
                    copyMap.SetRemoveTicks(TimeUtil.NOW() + RuntimeData.TotalSecs * TimeUtil.SECOND);
                    GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_HYSY_SCORE_INFO, huanYingSiYuanScene.ScoreInfoData, huanYingSiYuanScene.CopyMap);
                }

                client.SceneContextData2 = new HuanYingSiYuanLianShaContextData();

                //更新状态
                HuanYingSiYuanClient.getInstance().GameFuBenRoleChangeState(client.ClientData.RoleID, (int)KuaFuRoleStates.StartGame);
                GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 1, 0, 0, (int)GameTypes.HuanYingSiYuan);

                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加一个场景
        /// </summary>
        public bool AddTianTiCopyScenes(GameClient client, CopyMap copyMap, SceneUIClasses sceneType)
        {
            if (sceneType == SceneUIClasses.TianTi)
            {
                int fuBenSeqId = copyMap.FuBenSeqID;
                int mapCode    = copyMap.MapCode;
                lock (RuntimeData.Mutex)
                {
                    TianTiScene tianTiScene = null;
                    if (!TianTiSceneDict.TryGetValue(fuBenSeqId, out tianTiScene))
                    {
                        tianTiScene         = new TianTiScene();
                        tianTiScene.CopyMap = copyMap;
                        tianTiScene.CleanAllInfo();
                        tianTiScene.GameId         = (int)Global.GetClientKuaFuServerLoginData(client).GameId;
                        tianTiScene.m_nMapCode     = mapCode;
                        tianTiScene.CopyMapId      = copyMap.CopyMapID;
                        tianTiScene.FuBenSeqId     = fuBenSeqId;
                        tianTiScene.m_nPlarerCount = 1;

                        TianTiSceneDict[fuBenSeqId] = tianTiScene;
                    }
                    else
                    {
                        tianTiScene.m_nPlarerCount++;
                    }

                    copyMap.IsKuaFuCopy = true;
                    SaveClientBattleSide(tianTiScene, client);
                    copyMap.SetRemoveTicks(TimeUtil.NOW() + RuntimeData.TotalSecs * TimeUtil.SECOND);

                    if (tianTiScene.SuccessSide == -1)
                    {
                        client.sendCmd((int)TCPGameServerCmds.CMD_SPR_TIANTI_AWARD, new TianTiAwardsData()
                        {
                            Success = -1
                        });
                    }
                }

                //更新状态
                TianTiClient.getInstance().GameFuBenRoleChangeState(client.ClientData.RoleID, (int)KuaFuRoleStates.StartGame);
                GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 1, 0, 0, (int)GameTypes.TianTi);

                return(true);
            }

            return(false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 添加一个场景
        /// </summary>
        public bool AddCopyScene(GameClient client, CopyMap copyMap)
        {
            if (copyMap.MapCode == _runtimeData.MapID)
            {
                int fuBenSeqId = copyMap.FuBenSeqID;
                int mapCode    = copyMap.MapCode;
                lock (_mutex)
                {
                    CopyWolfSceneInfo newScene = null;
                    if (!_runtimeData.SceneDict.TryGetValue(fuBenSeqId, out newScene))
                    {
                        newScene             = new CopyWolfSceneInfo();
                        newScene.CopyMapInfo = copyMap;
                        newScene.CleanAllInfo();
                        newScene.GameId      = Global.GetClientKuaFuServerLoginData(client).GameId;
                        newScene.MapID       = mapCode;
                        newScene.CopyID      = copyMap.CopyMapID;
                        newScene.FuBenSeqId  = fuBenSeqId;
                        newScene.PlayerCount = 1;

                        _runtimeData.SceneDict[fuBenSeqId] = newScene;
                    }
                    else
                    {
                        newScene.PlayerCount++;
                    }

                    client.ClientData.BattleWhichSide = _runtimeData.CampID;
                    copyMap.IsKuaFuCopy = true;
                    copyMap.SetRemoveTicks(TimeUtil.NOW() + _runtimeData.TotalSecs * TimeUtil.SECOND);
                    GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_COPY_WOLF_SCORE_INFO, newScene.ScoreData, newScene.CopyMapInfo);
                }

                //更新状态
                // ElementWarClient.getInstance().GameFuBenRoleChangeState(client.ClientData.RoleID, (int)KuaFuRoleStates.StartGame);
                // 开始游戏统计
                GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 1, 0, 0, (int)_gameType);

                return(true);
            }

            return(false);
        }
Ejemplo n.º 4
0
        public bool AddCopyScenes(GameClient client, CopyMap copyMap, SceneUIClasses sceneType)
        {
            bool result;

            if (copyMap.MapCode == this.RuntimeData.MapID)
            {
                int fuBenSeqId = copyMap.FuBenSeqID;
                int mapCode    = copyMap.MapCode;
                lock (this.RuntimeData.Mutex)
                {
                    WanMoXiaGuScene scene = null;
                    if (!this.SceneDict.TryGetValue(fuBenSeqId, out scene))
                    {
                        scene             = new WanMoXiaGuScene();
                        scene.CopyMapInfo = copyMap;
                        scene.CleanAllInfo();
                        scene.GameId               = Global.GetClientKuaFuServerLoginData(client).GameId;
                        scene.MapID                = mapCode;
                        scene.CopyMapID            = copyMap.CopyMapID;
                        scene.FuBenSeqId           = fuBenSeqId;
                        scene.PlayerCount          = 1;
                        scene.BossLifePercent      = 1.0;
                        this.SceneDict[fuBenSeqId] = scene;
                    }
                    else
                    {
                        scene.PlayerCount++;
                    }
                    client.ClientData.BattleWhichSide = 1;
                    client.SceneObject       = scene;
                    copyMap.IsKuaFuCopy      = true;
                    copyMap.CustomPassAwards = true;
                    copyMap.SetRemoveTicks(TimeUtil.NOW() + (long)(this.RuntimeData.TotalSecs * 1000));
                    GameManager.ClientMgr.BroadSpecialCopyMapMessage <WanMoXiaGuScoreData>(1266, scene.ScoreData, scene.CopyMapInfo);
                }
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Ejemplo n.º 5
0
        public bool AddCopyScene(GameClient client, CopyMap copyMap)
        {
            bool result;

            if (copyMap.MapCode == this._runtimeData.MapID)
            {
                int fuBenSeqId = copyMap.FuBenSeqID;
                int mapCode    = copyMap.MapCode;
                lock (CopyWolfManager._mutex)
                {
                    CopyWolfSceneInfo newScene = null;
                    if (!this._runtimeData.SceneDict.TryGetValue(fuBenSeqId, out newScene))
                    {
                        newScene             = new CopyWolfSceneInfo();
                        newScene.CopyMapInfo = copyMap;
                        newScene.CleanAllInfo();
                        newScene.GameId      = Global.GetClientKuaFuServerLoginData(client).GameId;
                        newScene.MapID       = mapCode;
                        newScene.CopyID      = copyMap.CopyMapID;
                        newScene.FuBenSeqId  = fuBenSeqId;
                        newScene.PlayerCount = 1;
                        this._runtimeData.SceneDict[fuBenSeqId] = newScene;
                    }
                    else
                    {
                        newScene.PlayerCount++;
                    }
                    client.ClientData.BattleWhichSide = this._runtimeData.CampID;
                    copyMap.IsKuaFuCopy = true;
                    copyMap.SetRemoveTicks(TimeUtil.NOW() + (long)(this._runtimeData.TotalSecs * 1000));
                    GameManager.ClientMgr.BroadSpecialCopyMapMessage <CopyWolfScoreData>(1025, newScene.ScoreData, newScene.CopyMapInfo);
                }
                GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 1, 0, 0, 11);
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 心跳处理
        /// </summary>
        public void TimerProc()
        {
            long nowTicks = TimeUtil.NOW();

            if (nowTicks < _nextHeartBeatTicks)
            {
                return;
            }

            _nextHeartBeatTicks = nowTicks + 1020; //1020毫秒执行一次

            long nowSecond = nowTicks / 1000;

            foreach (ElementWarScene scene in _sceneDict.Values)
            {
                lock (_mutex)
                {
                    int nID     = scene.FuBenSeqId;
                    int nCopyID = scene.CopyID;
                    int nMapID  = scene.MapID;

                    if (nID < 0 || nCopyID < 0 || nMapID < 0)
                    {
                        continue;
                    }

                    CopyMap copyMap = scene.CopyMapInfo;

                    if (scene.SceneStatus == GameSceneStatuses.STATUS_NULL)             // 如果处于空状态 -- 是否要切换到准备状态
                    {
                        scene.PrepareTime = nowSecond;
                        scene.BeginTime   = nowSecond + _runtimeData.PrepareSecs;
                        scene.SceneStatus = GameSceneStatuses.STATUS_PREPARE;

                        scene.StateTimeData.GameType = (int)_gameType;
                        scene.StateTimeData.State    = (int)scene.SceneStatus;
                        scene.StateTimeData.EndTicks = nowTicks + _runtimeData.PrepareSecs * 1000;//scene.BeginTime;
                        GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_NOTIFY_TIME_STATE, scene.StateTimeData, scene.CopyMapInfo);
                    }
                    else if (scene.SceneStatus == GameSceneStatuses.STATUS_PREPARE)     // 场景战斗状态切换
                    {
                        if (nowSecond >= (scene.BeginTime))
                        {
                            scene.SceneStatus = GameSceneStatuses.STATUS_BEGIN;
                            scene.EndTime     = nowSecond + _runtimeData.FightingSecs;

                            scene.StateTimeData.GameType = (int)_gameType;
                            scene.StateTimeData.State    = (int)scene.SceneStatus;
                            scene.StateTimeData.EndTicks = nowTicks + _runtimeData.FightingSecs * 1000;//scene.EndTime;
                            GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_NOTIFY_TIME_STATE, scene.StateTimeData, scene.CopyMapInfo);

                            //放开光幕
                            //copyMap.AddGuangMuEvent(1, 0);
                            //GameManager.ClientMgr.BroadSpecialMapAIEvent(copyMap.MapCode, copyMap.CopyMapID, 1, 0);
                        }
                    }
                    else if (scene.SceneStatus == GameSceneStatuses.STATUS_BEGIN)       // 战斗开始
                    {
                        if (nowSecond >= scene.EndTime)
                        {
                            scene.SceneStatus = GameSceneStatuses.STATUS_END;
                            continue;
                        }

                        //检查怪物
                        bool bNeedCreateMonster = false;
                        int  upWave             = 0;
                        lock (scene)
                        {
                            ElementWarMonsterConfigInfo configInfo = _runtimeData.GetOrderConfig(scene.MonsterWave);
                            if (configInfo == null)
                            {
                                scene.MonsterWaveOld = 1;
                                scene.MonsterWave    = 0;
                                scene.SceneStatus    = GameSceneStatuses.STATUS_END;
                                continue;
                            }
                            //检查超时
                            if (scene.CreateMonsterTime > 0 && nowSecond - scene.CreateMonsterTime >= configInfo.Up1)
                            {
                                scene.MonsterWave = 0;
                                scene.SceneStatus = GameSceneStatuses.STATUS_END;
                                continue;
                            }

                            if (scene.CreateMonsterTime > 0 && scene.IsMonsterFlag == 0 && scene.ScoreData.MonsterCount <= 0)
                            {
                                if (scene.MonsterWave < scene.MonsterWaveTotal)
                                {
                                    bNeedCreateMonster = true;
                                    if (nowSecond - scene.CreateMonsterTime <= configInfo.Up4)
                                    {
                                        upWave = 4;
                                    }
                                    else if (nowSecond - scene.CreateMonsterTime <= configInfo.Up3)
                                    {
                                        upWave = 3;
                                    }
                                    else if (nowSecond - scene.CreateMonsterTime <= configInfo.Up2)
                                    {
                                        upWave = 2;
                                    }
                                    else if (nowSecond - scene.CreateMonsterTime < configInfo.Up1)
                                    {
                                        upWave = 1;
                                    }
                                }
                                else
                                {
                                    scene.MonsterWaveOld = scene.MonsterWave;
                                    scene.MonsterWave    = 0;
                                    scene.SceneStatus    = GameSceneStatuses.STATUS_END;
                                    continue;
                                }
                            }

                            if (scene.CreateMonsterTime <= 0)
                            {
                                bNeedCreateMonster = true;
                            }

                            if (bNeedCreateMonster)
                            {
                                CreateMonster(scene, upWave);
                            }
                        }
                    }
                    else if (scene.SceneStatus == GameSceneStatuses.STATUS_END)
                    {
                        GiveAwards(scene);

                        //结算奖励
                        scene.SceneStatus = GameSceneStatuses.STATUS_AWARD;
                        scene.EndTime     = nowSecond;
                        scene.LeaveTime   = scene.EndTime + _runtimeData.ClearRolesSecs;

                        //  ElementWarClient.getInstance().GameFuBenChangeState(scene.GameId, GameFuBenState.End, DateTime.Now);

                        scene.StateTimeData.GameType = (int)_gameType;
                        scene.StateTimeData.State    = (int)GameSceneStatuses.STATUS_END;
                        scene.StateTimeData.EndTicks = nowTicks + _runtimeData.ClearRolesSecs * 1000;//scene.LeaveTime;
                        GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_NOTIFY_TIME_STATE, scene.StateTimeData, scene.CopyMapInfo);
                    }
                    else if (scene.SceneStatus == GameSceneStatuses.STATUS_AWARD)         // 战斗结束
                    {
                        if (nowSecond >= scene.LeaveTime)
                        {
                            copyMap.SetRemoveTicks(scene.LeaveTime);
                            scene.SceneStatus = GameSceneStatuses.STATUS_CLEAR;

                            try
                            {
                                List <GameClient> objsList = copyMap.GetClientsList();
                                if (objsList != null && objsList.Count > 0)
                                {
                                    for (int n = 0; n < objsList.Count; ++n)
                                    {
                                        GameClient c = objsList[n];
                                        if (c != null)
                                        {
                                            KuaFuManager.getInstance().GotoLastMap(c);
                                        }
                                    }
                                }
                            }
                            catch (System.Exception ex)
                            {
                                DataHelper.WriteExceptionLogEx(ex, "【元素试炼】清场调度异常");
                            }
                        }
                    }
                }
            }

            return;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 添加一个场景
        /// </summary>
        public bool AddCopyScenes(GameClient client, CopyMap copyMap, SceneUIClasses sceneType)
        {
            if (sceneType == SceneUIClasses.YongZheZhanChang)
            {
                GameMap gameMap = null;
                if (!GameManager.MapMgr.DictMaps.TryGetValue(client.ClientData.MapCode, out gameMap))
                {
                    return(false);
                }

                int      fuBenSeqId = copyMap.FuBenSeqID;
                int      mapCode    = copyMap.MapCode;
                int      roleId     = client.ClientData.RoleID;
                int      gameId     = (int)Global.GetClientKuaFuServerLoginData(client).GameId;
                DateTime now        = TimeUtil.NowDateTime();
                lock (RuntimeData.Mutex)
                {
                    YongZheZhanChangScene scene = null;
                    if (!SceneDict.TryGetValue(fuBenSeqId, out scene))
                    {
                        YongZheZhanChangSceneInfo sceneInfo = null;
                        YongZheZhanChangFuBenData fuBenData;
                        if (!RuntimeData.FuBenItemData.TryGetValue(gameId, out fuBenData))
                        {
                            LogManager.WriteLog(LogTypes.Error, "勇者战场没有为副本找到对应的跨服副本数据,GameID:" + gameId);
                        }

                        if (!RuntimeData.SceneDataDict.TryGetValue(fuBenData.GroupIndex, out sceneInfo))
                        {
                            LogManager.WriteLog(LogTypes.Error, "勇者战场没有为副本找到对应的档位数据,ID:" + fuBenData.GroupIndex);
                        }

                        scene         = new YongZheZhanChangScene();
                        scene.CopyMap = copyMap;
                        scene.CleanAllInfo();
                        scene.GameId         = gameId;
                        scene.m_nMapCode     = mapCode;
                        scene.CopyMapId      = copyMap.CopyMapID;
                        scene.FuBenSeqId     = fuBenSeqId;
                        scene.m_nPlarerCount = 1;
                        scene.SceneInfo      = sceneInfo;
                        scene.MapGridWidth   = gameMap.MapGridWidth;
                        scene.MapGridHeight  = gameMap.MapGridHeight;
                        DateTime startTime = now.Date.Add(GetStartTime(sceneInfo.Id));
                        scene.StartTimeTicks = startTime.Ticks / 10000;

                        scene.GameStatisticalData.GameId = gameId;

                        SceneDict[fuBenSeqId] = scene;
                    }
                    else
                    {
                        scene.m_nPlarerCount++;
                    }

                    YongZheZhanChangClientContextData clientContextData;
                    if (!scene.ClientContextDataDict.TryGetValue(roleId, out clientContextData))
                    {
                        clientContextData = new YongZheZhanChangClientContextData()
                        {
                            RoleId = roleId, ServerId = client.ServerId, BattleWhichSide = client.ClientData.BattleWhichSide
                        };
                        scene.ClientContextDataDict[roleId] = clientContextData;
                    }
                    else
                    {
                        clientContextData.KillNum = 0;
                    }

                    client.SceneContextData2 = clientContextData;

                    copyMap.IsKuaFuCopy = true;
                    copyMap.SetRemoveTicks(TimeUtil.NOW() + scene.SceneInfo.TotalSecs * TimeUtil.SECOND);

                    // 非首次进来的人会有旧的积分信息需要通知
                    // 改为进入的时候,让客户端来主动查询
                    //NotifyTimeStateInfoAndScoreInfo(client, false, true, true);
                }

                //更新状态
                YongZheZhanChangClient.getInstance().GameFuBenRoleChangeState(roleId, (int)KuaFuRoleStates.StartGame);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 心跳处理
        /// </summary>
        public void TimerProc()
        {
            long nowTicks = TimeUtil.NOW();

            if (nowTicks < NextHeartBeatTicks)
            {
                return;
            }

            NextHeartBeatTicks = nowTicks + 1020; //1020毫秒执行一次

            foreach (var scene in SceneDict.Values)
            {
                lock (RuntimeData.Mutex)
                {
                    int nID = -1;
                    nID = scene.FuBenSeqId;

                    int nCopyID = -1;
                    nCopyID = scene.CopyMapId;

                    int nMapCodeID = -1;
                    nMapCodeID = scene.m_nMapCode;

                    if (nID < 0 || nCopyID < 0 || nMapCodeID < 0)
                    {
                        continue;
                    }

                    CopyMap copyMap = scene.CopyMap;

                    // 当前tick
                    DateTime now   = TimeUtil.NowDateTime();
                    long     ticks = TimeUtil.NOW();

                    if (scene.m_eStatus == GameSceneStatuses.STATUS_NULL)             // 如果处于空状态 -- 是否要切换到准备状态
                    {
                        if (ticks >= scene.StartTimeTicks)
                        {
                            scene.m_lPrepareTime = scene.StartTimeTicks;
                            scene.m_lBeginTime   = scene.m_lPrepareTime + scene.SceneInfo.PrepareSecs * TimeUtil.SECOND;
                            scene.m_eStatus      = GameSceneStatuses.STATUS_PREPARE;

                            scene.StateTimeData.GameType = (int)GameTypes.YongZheZhanChang;
                            scene.StateTimeData.State    = (int)scene.m_eStatus;
                            scene.StateTimeData.EndTicks = scene.m_lBeginTime;
                            GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_NOTIFY_TIME_STATE, scene.StateTimeData, scene.CopyMap);
                        }
                    }
                    else if (scene.m_eStatus == GameSceneStatuses.STATUS_PREPARE)     // 场景战斗状态切换
                    {
                        if (ticks >= scene.m_lBeginTime)
                        {
                            scene.m_eStatus  = GameSceneStatuses.STATUS_BEGIN;
                            scene.m_lEndTime = scene.m_lBeginTime + scene.SceneInfo.FightingSecs * TimeUtil.SECOND;

                            scene.StateTimeData.GameType = (int)GameTypes.YongZheZhanChang;
                            scene.StateTimeData.State    = (int)scene.m_eStatus;
                            scene.StateTimeData.EndTicks = scene.m_lEndTime;
                            GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_NOTIFY_TIME_STATE, scene.StateTimeData, scene.CopyMap);

                            InitCreateDynamicMonster(scene);

                            copyMap.AddGuangMuEvent(1, 0);
                            GameManager.ClientMgr.BroadSpecialMapAIEvent(copyMap.MapCode, copyMap.CopyMapID, 1, 0);
                            copyMap.AddGuangMuEvent(2, 0);
                            GameManager.ClientMgr.BroadSpecialMapAIEvent(copyMap.MapCode, copyMap.CopyMapID, 2, 0);
                            copyMap.AddGuangMuEvent(3, 0);
                            GameManager.ClientMgr.BroadSpecialMapAIEvent(copyMap.MapCode, copyMap.CopyMapID, 3, 0);
                            copyMap.AddGuangMuEvent(4, 0);
                            GameManager.ClientMgr.BroadSpecialMapAIEvent(copyMap.MapCode, copyMap.CopyMapID, 4, 0);
                        }
                    }
                    else if (scene.m_eStatus == GameSceneStatuses.STATUS_BEGIN)       // 战斗开始
                    {
                        if (ticks >= scene.m_lEndTime)
                        {
                            int successSide = 0;
                            if (scene.ScoreData.Score1 > scene.ScoreData.Score2)
                            {
                                successSide = 1;
                            }
                            else if (scene.ScoreData.Score2 > scene.ScoreData.Score1)
                            {
                                successSide = 2;
                            }

                            CompleteScene(scene, successSide);
                            scene.m_eStatus    = GameSceneStatuses.STATUS_END;
                            scene.m_lLeaveTime = scene.m_lEndTime + scene.SceneInfo.ClearRolesSecs * TimeUtil.SECOND;

                            scene.StateTimeData.GameType = (int)GameTypes.YongZheZhanChang;
                            scene.StateTimeData.State    = (int)GameSceneStatuses.STATUS_CLEAR;
                            scene.StateTimeData.EndTicks = scene.m_lLeaveTime;
                            GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_NOTIFY_TIME_STATE, scene.StateTimeData, scene.CopyMap);
                        }
                        else
                        {
                            CheckCreateDynamicMonster(scene, ticks);
                        }
                    }
                    else if (scene.m_eStatus == GameSceneStatuses.STATUS_END)         // 战斗结束
                    {
                        GameManager.CopyMapMgr.KillAllMonster(scene.CopyMap);

                        //结算奖励
                        scene.m_eStatus = GameSceneStatuses.STATUS_AWARD;
                        YongZheZhanChangClient.getInstance().GameFuBenChangeState(scene.GameId, GameFuBenState.End, now);
                        GiveAwards(scene);

                        YongZheZhanChangFuBenData fuBenData;
                        if (RuntimeData.FuBenItemData.TryGetValue(scene.GameId, out fuBenData))
                        {
                            fuBenData.State = GameFuBenState.End;
                            LogManager.WriteLog(LogTypes.Error, string.Format("勇者战场跨服副本GameID={0},战斗结束", fuBenData.GameId));
                        }
                    }
                    else if (scene.m_eStatus == GameSceneStatuses.STATUS_AWARD)
                    {
                        if (ticks >= scene.m_lLeaveTime)
                        {
                            copyMap.SetRemoveTicks(scene.m_lLeaveTime);
                            scene.m_eStatus = GameSceneStatuses.STATUS_CLEAR;

                            try
                            {
                                List <GameClient> objsList = copyMap.GetClientsList();
                                if (objsList != null && objsList.Count > 0)
                                {
                                    for (int n = 0; n < objsList.Count; ++n)
                                    {
                                        GameClient c = objsList[n];
                                        if (c != null)
                                        {
                                            KuaFuManager.getInstance().GotoLastMap(c);
                                        }
                                    }
                                }
                            }
                            catch (System.Exception ex)
                            {
                                DataHelper.WriteExceptionLogEx(ex, "勇者战场系统清场调度异常");
                            }
                        }
                    }
                }
            }

            return;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 心跳处理
        /// </summary>
        public void TimerProc()
        {
            long nowTicks = TimeUtil.NOW();

            if (nowTicks < NextHeartBeatTicks)
            {
                return;
            }

            NextHeartBeatTicks = nowTicks + 1020; //1020毫秒执行一次

            foreach (var huanYingSiYuanScene in HuanYingSiYuanSceneDict.Values)
            {
                lock (Mutex)
                {
                    int nID = -1;
                    nID = huanYingSiYuanScene.FuBenSeqId;

                    int nCopyID = -1;
                    nCopyID = huanYingSiYuanScene.CopyMapId;

                    int nMapCodeID = -1;
                    nMapCodeID = huanYingSiYuanScene.m_nMapCode;

                    if (nID < 0 || nCopyID < 0 || nMapCodeID < 0)
                    {
                        continue;
                    }

                    CopyMap copyMap = huanYingSiYuanScene.CopyMap;

                    // 当前tick
                    DateTime now   = TimeUtil.NowDateTime();
                    long     ticks = TimeUtil.NOW();

                    if (huanYingSiYuanScene.m_eStatus == GameSceneStatuses.STATUS_NULL)             // 如果处于空状态 -- 是否要切换到准备状态
                    {
                        huanYingSiYuanScene.m_lPrepareTime = ticks;
                        huanYingSiYuanScene.m_lBeginTime   = ticks + RuntimeData.PrepareSecs * TimeUtil.SECOND;
                        huanYingSiYuanScene.m_eStatus      = GameSceneStatuses.STATUS_PREPARE;

                        huanYingSiYuanScene.StateTimeData.GameType = (int)GameTypes.HuanYingSiYuan;
                        huanYingSiYuanScene.StateTimeData.State    = (int)huanYingSiYuanScene.m_eStatus;
                        huanYingSiYuanScene.StateTimeData.EndTicks = huanYingSiYuanScene.m_lBeginTime;
                        GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_NOTIFY_TIME_STATE, huanYingSiYuanScene.StateTimeData, huanYingSiYuanScene.CopyMap);
                    }
                    else if (huanYingSiYuanScene.m_eStatus == GameSceneStatuses.STATUS_PREPARE)     // 场景战斗状态切换
                    {
                        if (ticks >= (huanYingSiYuanScene.m_lBeginTime))
                        {
                            huanYingSiYuanScene.m_eStatus  = GameSceneStatuses.STATUS_BEGIN;
                            huanYingSiYuanScene.m_lEndTime = ticks + RuntimeData.FightingSecs * TimeUtil.SECOND;

                            huanYingSiYuanScene.StateTimeData.GameType = (int)GameTypes.HuanYingSiYuan;
                            huanYingSiYuanScene.StateTimeData.State    = (int)huanYingSiYuanScene.m_eStatus;
                            huanYingSiYuanScene.StateTimeData.EndTicks = huanYingSiYuanScene.m_lEndTime;
                            GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_NOTIFY_TIME_STATE, huanYingSiYuanScene.StateTimeData, huanYingSiYuanScene.CopyMap);

                            //刷圣杯
                            foreach (var shengBeiData in RuntimeData.ShengBeiDataDict.Values)
                            {
                                HuanYingSiYuanShengBeiContextData contextData = new HuanYingSiYuanShengBeiContextData()
                                {
                                    UniqueId      = GetInternalId(),
                                    FuBenSeqId    = huanYingSiYuanScene.FuBenSeqId,
                                    ShengBeiId    = shengBeiData.ID,
                                    BufferGoodsId = shengBeiData.GoodsID,
                                    MonsterId     = shengBeiData.MonsterID,
                                    PosX          = shengBeiData.PosX,
                                    PosY          = shengBeiData.PosY,
                                    CopyMapID     = huanYingSiYuanScene.CopyMapId,
                                    Score         = shengBeiData.Score,
                                    Time          = shengBeiData.Time,
                                    BufferProps   = shengBeiData.BufferProps,
                                };

                                CreateMonster(huanYingSiYuanScene, contextData);
                            }

                            //放开光幕
                            copyMap.AddGuangMuEvent(1, 0);
                            GameManager.ClientMgr.BroadSpecialMapAIEvent(copyMap.MapCode, copyMap.CopyMapID, 1, 0);
                        }
                    }
                    else if (huanYingSiYuanScene.m_eStatus == GameSceneStatuses.STATUS_BEGIN)       // 战斗开始
                    {
                        if (ticks >= huanYingSiYuanScene.m_lEndTime)
                        {
                            int successSide = 0;
                            if (huanYingSiYuanScene.ScoreInfoData.Score1 > huanYingSiYuanScene.ScoreInfoData.Score2)
                            {
                                successSide = 1;
                            }
                            else if (huanYingSiYuanScene.ScoreInfoData.Score2 > huanYingSiYuanScene.ScoreInfoData.Score1)
                            {
                                successSide = 2;
                            }

                            CompleteHuanYingSiYuanScene(huanYingSiYuanScene, successSide);
                        }
                        else
                        {
                            CheckShengBeiBufferTime(huanYingSiYuanScene, nowTicks);
                        }
                    }
                    else if (huanYingSiYuanScene.m_eStatus == GameSceneStatuses.STATUS_END)
                    {
                        //结算奖励
                        huanYingSiYuanScene.m_eStatus    = GameSceneStatuses.STATUS_AWARD;
                        huanYingSiYuanScene.m_lEndTime   = nowTicks;
                        huanYingSiYuanScene.m_lLeaveTime = huanYingSiYuanScene.m_lEndTime + RuntimeData.ClearRolesSecs * TimeUtil.SECOND;

                        HuanYingSiYuanClient.getInstance().GameFuBenChangeState(huanYingSiYuanScene.GameId, GameFuBenState.End, now);

                        huanYingSiYuanScene.StateTimeData.GameType = (int)GameTypes.HuanYingSiYuan;
                        huanYingSiYuanScene.StateTimeData.State    = (int)GameSceneStatuses.STATUS_END;
                        huanYingSiYuanScene.StateTimeData.EndTicks = huanYingSiYuanScene.m_lLeaveTime;
                        GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_NOTIFY_TIME_STATE, huanYingSiYuanScene.StateTimeData, huanYingSiYuanScene.CopyMap);

                        GiveAwards(huanYingSiYuanScene);
                    }
                    else if (huanYingSiYuanScene.m_eStatus == GameSceneStatuses.STATUS_AWARD)         // 战斗结束
                    {
                        if (ticks >= huanYingSiYuanScene.m_lLeaveTime)
                        {
                            copyMap.SetRemoveTicks(huanYingSiYuanScene.m_lLeaveTime);
                            huanYingSiYuanScene.m_eStatus = GameSceneStatuses.STATUS_CLEAR;

                            try
                            {
                                List <GameClient> objsList = copyMap.GetClientsList();
                                if (objsList != null && objsList.Count > 0)
                                {
                                    for (int n = 0; n < objsList.Count; ++n)
                                    {
                                        GameClient c = objsList[n];
                                        if (c != null)
                                        {
                                            KuaFuManager.getInstance().GotoLastMap(c);
                                        }
                                    }
                                }
                            }
                            catch (System.Exception ex)
                            {
                                DataHelper.WriteExceptionLogEx(ex, "幻影寺院清场调度异常");
                            }
                        }
                    }
                }
            }

            return;
        }
Ejemplo n.º 10
0
        public void TimerProc()
        {
            long nowTicks = TimeUtil.NOW();

            if (nowTicks >= WanMoXiaGuManager._nextHeartBeatTicks)
            {
                WanMoXiaGuManager._nextHeartBeatTicks = nowTicks + 1020L;
                long nowSecond = nowTicks / 1000L;
                List <WanMoXiaGuScene> removeList = new List <WanMoXiaGuScene>();
                lock (this.RuntimeData.Mutex)
                {
                    foreach (WanMoXiaGuScene scene in this.SceneDict.Values)
                    {
                        int nID     = scene.FuBenSeqId;
                        int nCopyID = scene.CopyMapID;
                        int nMapID  = scene.MapID;
                        if (nID >= 0 && nCopyID >= 0 && nMapID >= 0)
                        {
                            CopyMap copyMap = scene.CopyMapInfo;
                            if (scene.SceneStatus == GameSceneStatuses.STATUS_NULL)
                            {
                                scene.PrepareTime            = nowSecond;
                                scene.BeginTime              = nowSecond + (long)this.RuntimeData.PrepareSecs;
                                scene.SceneStatus            = GameSceneStatuses.STATUS_PREPARE;
                                scene.StateTimeData.GameType = 8;
                                scene.StateTimeData.State    = (int)scene.SceneStatus;
                                scene.StateTimeData.EndTicks = nowTicks + (long)(this.RuntimeData.PrepareSecs * 1000);
                                GameManager.ClientMgr.BroadSpecialCopyMapMessage <GameSceneStateTimeData>(827, scene.StateTimeData, scene.CopyMapInfo);
                            }
                            else if (scene.SceneStatus == GameSceneStatuses.STATUS_PREPARE)
                            {
                                if (nowSecond >= scene.BeginTime)
                                {
                                    scene.SceneStatus            = GameSceneStatuses.STATUS_BEGIN;
                                    scene.EndTime                = nowSecond + (long)this.RuntimeData.FightingSecs;
                                    scene.StateTimeData.GameType = 8;
                                    scene.StateTimeData.State    = (int)scene.SceneStatus;
                                    scene.StateTimeData.EndTicks = nowTicks + (long)(this.RuntimeData.FightingSecs * 1000);
                                    GameManager.ClientMgr.BroadSpecialCopyMapMessage <GameSceneStateTimeData>(827, scene.StateTimeData, scene.CopyMapInfo);
                                }
                            }
                            else if (scene.SceneStatus == GameSceneStatuses.STATUS_BEGIN)
                            {
                                if (nowSecond >= scene.EndTime)
                                {
                                    scene.SceneStatus = GameSceneStatuses.STATUS_END;
                                }
                                else if (null == scene.Boss)
                                {
                                    scene.Boss = (GameManager.MonsterMgr.FindMonsterByExtensionID(copyMap.CopyMapID, this.RuntimeData.BossMonsterID).FirstOrDefault <object>() as Monster);
                                    if (null != scene.Boss)
                                    {
                                        scene.ScoreData.MonsterID       = scene.Boss.RoleID;
                                        scene.ScoreData.BossLifePercent = 1.0;
                                    }
                                }
                                else if (scene.Boss != null && scene.Boss.Alive)
                                {
                                    if (!scene.MonsterCreated && scene.BossLifePercent < this.RuntimeData.WanMoXiaGuCall)
                                    {
                                        int rnd = Global.GetRandomNumber(this.RuntimeData.BeginNum, this.RuntimeData.EndNum);
                                        foreach (WanMoXiaGuMonsterConfigInfo item in this.RuntimeData.MonsterOrderConfigList.Values)
                                        {
                                            if (rnd >= item.BeginNum && rnd <= item.EndNum)
                                            {
                                                scene.ScoreData.Intro       = item.Intro;
                                                scene.ScoreData.Decorations = item.Decorations;
                                                scene.ZuoQiInfo             = item;
                                                this.CreateMonster(scene, scene.ZuoQiInfo);
                                                scene.MonsterCreated  = true;
                                                scene.NextRelifeTicks = nowTicks + (long)(scene.ZuoQiInfo.RecoverTime * 1000);
                                            }
                                        }
                                    }
                                    if (scene.ZuoQiInfo != null)
                                    {
                                        if (scene.MonsterCount != scene.ScoreData.MonsterCount)
                                        {
                                            scene.MonsterCount = scene.ScoreData.MonsterCount;
                                            foreach (string pstr in scene.ZuoQiInfo.Props.Split(new char[]
                                            {
                                                '|'
                                            }))
                                            {
                                                string[] strs = pstr.Split(new char[]
                                                {
                                                    ','
                                                });
                                                ExtPropIndexes propIdx;
                                                double         propValue;
                                                if (strs.Length == 2 && Enum.TryParse <ExtPropIndexes>(strs[0], out propIdx) && double.TryParse(strs[1], out propValue))
                                                {
                                                    scene.Boss.TempPropsBuffer.AddTempExtProp((int)propIdx, propValue * (double)scene.MonsterCount, long.MaxValue);
                                                }
                                            }
                                        }
                                        if (nowTicks >= scene.NextRelifeTicks)
                                        {
                                            scene.NextRelifeTicks = nowTicks + (long)(scene.ZuoQiInfo.RecoverTime * 1000);
                                            if (scene.MonsterCount > 0)
                                            {
                                                Monster monster = scene.Boss;
                                                monster.AddLife((long)(scene.ZuoQiInfo.RecoverNum * scene.MonsterCount));
                                                List <object> listObjs = Global.GetAll9Clients(monster);
                                                GameManager.ClientMgr.NotifyOthersRelife(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, monster, monster.MonsterZoneNode.MapCode, monster.CopyMapID, monster.RoleID, (int)monster.SafeCoordinate.X, (int)monster.SafeCoordinate.Y, (int)monster.SafeDirection, monster.VLife, monster.VMana, 120, listObjs, 0);
                                            }
                                            scene.BossLifePercent = (scene.ScoreData.BossLifePercent = scene.Boss.VLife / scene.Boss.MonsterInfo.VLifeMax);
                                            GameManager.ClientMgr.BroadSpecialCopyMapMessage <WanMoXiaGuScoreData>(1266, scene.ScoreData, scene.CopyMapInfo);
                                        }
                                    }
                                }
                                else
                                {
                                    scene.Success     = 1;
                                    scene.SceneStatus = GameSceneStatuses.STATUS_END;
                                }
                            }
                            else if (scene.SceneStatus == GameSceneStatuses.STATUS_END)
                            {
                                scene.SceneStatus = GameSceneStatuses.STATUS_AWARD;
                                scene.EndTime     = nowSecond;
                                scene.LeaveTime   = scene.EndTime + (long)this.RuntimeData.ClearRolesSecs;
                                if (scene.Success > 0)
                                {
                                    this.GiveAwards(scene);
                                }
                                scene.StateTimeData.GameType = 8;
                                scene.StateTimeData.State    = 3;
                                scene.StateTimeData.EndTicks = nowTicks + (long)(this.RuntimeData.ClearRolesSecs * 1000);
                                GameManager.ClientMgr.BroadSpecialCopyMapMessage <GameSceneStateTimeData>(827, scene.StateTimeData, scene.CopyMapInfo);
                            }
                            else if (scene.SceneStatus == GameSceneStatuses.STATUS_AWARD)
                            {
                                if (nowSecond >= scene.LeaveTime)
                                {
                                    removeList.Add(scene);
                                    copyMap.SetRemoveTicks(scene.LeaveTime);
                                    scene.SceneStatus = GameSceneStatuses.STATUS_CLEAR;
                                    try
                                    {
                                        List <GameClient> objsList = copyMap.GetClientsList();
                                        if (objsList != null && objsList.Count > 0)
                                        {
                                            for (int i = 0; i < objsList.Count; i++)
                                            {
                                                GameClient c = objsList[i];
                                                if (c != null)
                                                {
                                                    KuaFuManager.getInstance().GotoLastMap(c);
                                                }
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        DataHelper.WriteExceptionLogEx(ex, "【万魔峡谷】清场调度异常");
                                    }
                                }
                            }
                        }
                    }
                }
                if (removeList.Count > 0)
                {
                    lock (this.RuntimeData.Mutex)
                    {
                        foreach (WanMoXiaGuScene scene in removeList)
                        {
                            WanMoXiaGuScene item2;
                            this.SceneDict.TryRemove(scene.FuBenSeqId, out item2);
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 添加一个场景
        /// </summary>
        public bool AddCopyScenes(GameClient client, CopyMap copyMap, SceneUIClasses sceneType)
        {
            if (sceneType == SceneUIClasses.LangHunLingYu)
            {
                GameMap gameMap = null;
                if (!GameManager.MapMgr.DictMaps.TryGetValue(client.ClientData.MapCode, out gameMap))
                {
                    return(false);
                }

                int      fuBenSeqId = copyMap.FuBenSeqID;
                int      mapCode    = copyMap.MapCode;
                int      roleId     = client.ClientData.RoleID;
                int      gameId     = (int)Global.GetClientKuaFuServerLoginData(client).GameId;
                DateTime now        = TimeUtil.NowDateTime();
                lock (RuntimeData.Mutex)
                {
                    LangHunLingYuScene scene = null;
                    if (!RuntimeData.SceneDict.TryGetValue(fuBenSeqId, out scene))
                    {
                        LangHunLingYuFuBenData fuBenData;
                        if (!RuntimeData.FuBenDataDict.TryGetValue(gameId, out fuBenData))
                        {
                            LogManager.WriteLog(LogTypes.Error, "圣域争霸没有为副本找到对应的跨服副本数据,GameID:" + gameId);
                        }

                        scene = new LangHunLingYuScene();
                        scene.CleanAllInfo();
                        scene.GameId              = gameId;
                        RuntimeData.MapGridWidth  = gameMap.MapGridWidth;
                        RuntimeData.MapGridHeight = gameMap.MapGridHeight;
                        int cityLevel = GetCityLevelById(fuBenData.CityId);
                        if (!RuntimeData.CityLevelInfoDict.TryGetValue(cityLevel, out scene.LevelInfo))
                        {
                            LogManager.WriteLog(LogTypes.Error, "圣域争霸没有为副本找到对应的城池等级配置:CityId=" + fuBenData.CityId);
                        }

                        scene.SceneInfo = client.SceneInfoObject as LangHunLingYuSceneInfo;

                        DateTime startTime = now.Date.Add(GetStartTime(scene.LevelInfo.ID));
                        scene.StartTimeTicks = startTime.Ticks / 10000;
                        scene.m_lEndTime     = scene.StartTimeTicks + (scene.SceneInfo.PrepareSecs + scene.SceneInfo.FightingSecs) * TimeUtil.SECOND;
                        InitScene(scene, client);

                        RuntimeData.SceneDict[fuBenSeqId] = scene;
                        scene.CityData.CityId             = fuBenData.CityDataEx.CityId;
                        scene.CityData.CityLevel          = fuBenData.CityDataEx.CityLevel;
                        LangHunLingYuBangHuiDataEx bangHuiDataEx;
                        if (RuntimeData.BangHuiDataExDict.TryGetValue(fuBenData.CityDataEx.Site[0], out bangHuiDataEx))
                        {
                            scene.LongTaOwnerData.OwnerBHid     = bangHuiDataEx.Bhid;
                            scene.LongTaOwnerData.OwnerBHName   = bangHuiDataEx.BhName;
                            scene.LongTaOwnerData.OwnerBHZoneId = bangHuiDataEx.ZoneId;
                        }
                    }

                    scene.CopyMapDict[mapCode] = copyMap;

                    int bhid = client.ClientData.Faction;
                    if (!RuntimeData.BangHuiMiniDataCacheDict.ContainsKey(bhid))
                    {
                        RuntimeData.BangHuiMiniDataCacheDict[bhid] = Global.GetBangHuiMiniData(bhid, client.ServerId);
                    }

                    LangHunLingYuClientContextData clientContextData;
                    if (!scene.ClientContextDataDict.TryGetValue(roleId, out clientContextData))
                    {
                        clientContextData = new LangHunLingYuClientContextData()
                        {
                            RoleId = roleId, ServerId = client.ServerId, BattleWhichSide = client.ClientData.BattleWhichSide
                        };
                        scene.ClientContextDataDict[roleId] = clientContextData;
                    }

                    client.SceneObject       = scene;
                    client.SceneGameId       = scene.GameId;
                    client.SceneContextData2 = clientContextData;

                    copyMap.SetRemoveTicks(scene.StartTimeTicks + scene.SceneInfo.TotalSecs * TimeUtil.SECOND);
                    copyMap.IsKuaFuCopy = true;
                }

                //更新状态
                YongZheZhanChangClient.getInstance().GameFuBenRoleChangeState(roleId, (int)KuaFuRoleStates.StartGame);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 12
0
        public void TimerProc()
        {
            long nowTicks = TimeUtil.NOW();

            if (nowTicks >= ElementWarManager._nextHeartBeatTicks)
            {
                ElementWarManager._nextHeartBeatTicks = nowTicks + 1020L;
                long nowSecond = nowTicks / 1000L;
                foreach (ElementWarScene scene in this._sceneDict.Values)
                {
                    lock (ElementWarManager._mutex)
                    {
                        int nID     = scene.FuBenSeqId;
                        int nCopyID = scene.CopyID;
                        int nMapID  = scene.MapID;
                        if (nID >= 0 && nCopyID >= 0 && nMapID >= 0)
                        {
                            CopyMap copyMap = scene.CopyMapInfo;
                            if (scene.SceneStatus == GameSceneStatuses.STATUS_NULL)
                            {
                                scene.PrepareTime            = nowSecond;
                                scene.BeginTime              = nowSecond + (long)this._runtimeData.PrepareSecs;
                                scene.SceneStatus            = GameSceneStatuses.STATUS_PREPARE;
                                scene.StateTimeData.GameType = 4;
                                scene.StateTimeData.State    = (int)scene.SceneStatus;
                                scene.StateTimeData.EndTicks = nowTicks + (long)(this._runtimeData.PrepareSecs * 1000);
                                GameManager.ClientMgr.BroadSpecialCopyMapMessage <GameSceneStateTimeData>(827, scene.StateTimeData, scene.CopyMapInfo);
                            }
                            else if (scene.SceneStatus == GameSceneStatuses.STATUS_PREPARE)
                            {
                                if (nowSecond >= scene.BeginTime)
                                {
                                    scene.SceneStatus            = GameSceneStatuses.STATUS_BEGIN;
                                    scene.EndTime                = nowSecond + (long)this._runtimeData.FightingSecs;
                                    scene.StateTimeData.GameType = 4;
                                    scene.StateTimeData.State    = (int)scene.SceneStatus;
                                    scene.StateTimeData.EndTicks = nowTicks + (long)(this._runtimeData.FightingSecs * 1000);
                                    GameManager.ClientMgr.BroadSpecialCopyMapMessage <GameSceneStateTimeData>(827, scene.StateTimeData, scene.CopyMapInfo);
                                }
                            }
                            else if (scene.SceneStatus == GameSceneStatuses.STATUS_BEGIN)
                            {
                                if (nowSecond >= scene.EndTime)
                                {
                                    scene.SceneStatus = GameSceneStatuses.STATUS_END;
                                }
                                else
                                {
                                    bool bNeedCreateMonster = false;
                                    int  upWave             = 0;
                                    lock (scene)
                                    {
                                        ElementWarMonsterConfigInfo configInfo = this._runtimeData.GetOrderConfig(scene.MonsterWave);
                                        if (configInfo == null)
                                        {
                                            scene.MonsterWaveOld = 1;
                                            scene.MonsterWave    = 0;
                                            scene.SceneStatus    = GameSceneStatuses.STATUS_END;
                                        }
                                        else if (scene.CreateMonsterTime > 0L && nowSecond - scene.CreateMonsterTime >= (long)configInfo.Up1)
                                        {
                                            scene.MonsterWave = 0;
                                            scene.SceneStatus = GameSceneStatuses.STATUS_END;
                                        }
                                        else
                                        {
                                            if (scene.CreateMonsterTime > 0L && scene.IsMonsterFlag == 0 && scene.ScoreData.MonsterCount <= 0L)
                                            {
                                                if (scene.MonsterWave >= scene.MonsterWaveTotal)
                                                {
                                                    scene.MonsterWaveOld = scene.MonsterWave;
                                                    scene.MonsterWave    = 0;
                                                    scene.SceneStatus    = GameSceneStatuses.STATUS_END;
                                                    continue;
                                                }
                                                bNeedCreateMonster = true;
                                                if (nowSecond - scene.CreateMonsterTime <= (long)configInfo.Up4)
                                                {
                                                    upWave = 4;
                                                }
                                                else if (nowSecond - scene.CreateMonsterTime <= (long)configInfo.Up3)
                                                {
                                                    upWave = 3;
                                                }
                                                else if (nowSecond - scene.CreateMonsterTime <= (long)configInfo.Up2)
                                                {
                                                    upWave = 2;
                                                }
                                                else if (nowSecond - scene.CreateMonsterTime < (long)configInfo.Up1)
                                                {
                                                    upWave = 1;
                                                }
                                            }
                                            if (scene.CreateMonsterTime <= 0L)
                                            {
                                                bNeedCreateMonster = true;
                                            }
                                            if (bNeedCreateMonster)
                                            {
                                                this.CreateMonster(scene, upWave);
                                            }
                                        }
                                    }
                                }
                            }
                            else if (scene.SceneStatus == GameSceneStatuses.STATUS_END)
                            {
                                this.GiveAwards(scene);
                                scene.SceneStatus            = GameSceneStatuses.STATUS_AWARD;
                                scene.EndTime                = nowSecond;
                                scene.LeaveTime              = scene.EndTime + (long)this._runtimeData.ClearRolesSecs;
                                scene.StateTimeData.GameType = 4;
                                scene.StateTimeData.State    = 3;
                                scene.StateTimeData.EndTicks = nowTicks + (long)(this._runtimeData.ClearRolesSecs * 1000);
                                GameManager.ClientMgr.BroadSpecialCopyMapMessage <GameSceneStateTimeData>(827, scene.StateTimeData, scene.CopyMapInfo);
                            }
                            else if (scene.SceneStatus == GameSceneStatuses.STATUS_AWARD)
                            {
                                if (nowSecond >= scene.LeaveTime)
                                {
                                    copyMap.SetRemoveTicks(scene.LeaveTime);
                                    scene.SceneStatus = GameSceneStatuses.STATUS_CLEAR;
                                    try
                                    {
                                        List <GameClient> objsList = copyMap.GetClientsList();
                                        if (objsList != null && objsList.Count > 0)
                                        {
                                            for (int i = 0; i < objsList.Count; i++)
                                            {
                                                GameClient c = objsList[i];
                                                if (c != null)
                                                {
                                                    KuaFuManager.getInstance().GotoLastMap(c);
                                                }
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        DataHelper.WriteExceptionLogEx(ex, "【元素试炼】清场调度异常");
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 心跳处理
        /// </summary>
        public void TimerProc()
        {
            long nowTicks = TimeUtil.NOW();

            if (nowTicks < _nextHeartBeatTicks)
            {
                return;
            }

            _nextHeartBeatTicks = nowTicks + 1020; //1020毫秒执行一次

            long nowSecond = nowTicks / 1000;

            foreach (CopyWolfSceneInfo scene in _runtimeData.SceneDict.Values)
            {
                lock (_mutex)
                {
                    int nID     = scene.FuBenSeqId;
                    int nCopyID = scene.CopyID;
                    int nMapID  = scene.MapID;

                    if (nID < 0 || nCopyID < 0 || nMapID < 0)
                    {
                        continue;
                    }

                    CopyMap copyMap = scene.CopyMapInfo;
                    if (scene.SceneStatus == GameSceneStatuses.STATUS_NULL)             // 如果处于空状态 -- 是否要切换到准备状态
                    {
                        scene.PrepareTime = nowSecond;
                        scene.BeginTime   = nowSecond + _runtimeData.PrepareSecs;
                        scene.SceneStatus = GameSceneStatuses.STATUS_PREPARE;

                        scene.StateTimeData.GameType = (int)_gameType;
                        scene.StateTimeData.State    = (int)scene.SceneStatus;
                        scene.StateTimeData.EndTicks = nowTicks + _runtimeData.PrepareSecs * 1000;
                        GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_NOTIFY_TIME_STATE, scene.StateTimeData, scene.CopyMapInfo);
                    }
                    else if (scene.SceneStatus == GameSceneStatuses.STATUS_PREPARE)     // 场景战斗状态切换
                    {
                        if (nowSecond >= (scene.BeginTime))
                        {
                            scene.SceneStatus = GameSceneStatuses.STATUS_BEGIN;
                            scene.EndTime     = nowSecond + _runtimeData.FightingSecs;

                            scene.StateTimeData.GameType = (int)_gameType;
                            scene.StateTimeData.State    = (int)scene.SceneStatus;
                            scene.StateTimeData.EndTicks = nowTicks + _runtimeData.FightingSecs * 1000;
                            GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_NOTIFY_TIME_STATE, scene.StateTimeData, scene.CopyMapInfo);
                        }
                    }
                    else if (scene.SceneStatus == GameSceneStatuses.STATUS_BEGIN)       // 战斗开始
                    {
                        if (nowSecond >= scene.EndTime)
                        {
                            scene.SceneStatus = GameSceneStatuses.STATUS_END;
                            continue;
                        }

                        //要塞
                        if (scene.IsFortFlag <= 0)
                        {
                            CreateFort(scene);
                        }

                        //检查怪物
                        bool bNeedCreateMonster = false;
                        lock (scene)
                        {
                            CopyWolfWaveInfo configInfo = _runtimeData.GetWaveConfig(scene.MonsterWave);
                            if (configInfo == null)
                            {
                                scene.MonsterWaveOld = 0;
                                scene.MonsterWave    = 0;
                                scene.SceneStatus    = GameSceneStatuses.STATUS_END;
                                continue;
                            }

                            //if (scene.MonsterWave >= scene.MonsterWaveTotal)
                            //{
                            //    scene.MonsterWaveOld = scene.MonsterWave;
                            //    scene.MonsterWave = 0;
                            //    scene.SceneStatus = GameSceneStatuses.STATUS_END;
                            //    continue;
                            //}

                            //刷新下一波
                            if (scene.CreateMonsterTime > 0 && nowSecond - scene.CreateMonsterTime >= configInfo.NextTime && configInfo.NextTime > 0)
                            {
                                bNeedCreateMonster = true;
                            }

                            //怪物清除
                            if (scene.CreateMonsterTime > 0 && scene.IsMonsterFlag == 0 && scene.KilledMonsterHashSet.Count == scene.MonsterCountCreate)
                            {
                                bNeedCreateMonster = true;
                            }

                            if (scene.CreateMonsterTime <= 0)
                            {
                                bNeedCreateMonster = true;
                                scene.MonsterWave  = 0;
                            }

                            if (bNeedCreateMonster)
                            {
                                CreateMonster(scene);
                            }
                        }
                    }
                    else if (scene.SceneStatus == GameSceneStatuses.STATUS_END)
                    {
                        int leftSecond = 0;
                        if (scene.MonsterWave >= scene.MonsterWaveTotal)
                        {
                            leftSecond = (int)Math.Max(0, nowSecond - scene.EndTime);
                        }
                        GiveAwards(scene, leftSecond);

                        //结算奖励
                        scene.SceneStatus = GameSceneStatuses.STATUS_AWARD;
                        scene.EndTime     = nowSecond;
                        scene.LeaveTime   = scene.EndTime + _runtimeData.ClearRolesSecs;

                        scene.StateTimeData.GameType = (int)_gameType;
                        scene.StateTimeData.State    = (int)GameSceneStatuses.STATUS_END;
                        scene.StateTimeData.EndTicks = nowTicks + _runtimeData.ClearRolesSecs * 1000;
                        GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_NOTIFY_TIME_STATE, scene.StateTimeData, scene.CopyMapInfo);
                    }
                    else if (scene.SceneStatus == GameSceneStatuses.STATUS_AWARD)         // 战斗结束
                    {
                        if (nowSecond >= scene.LeaveTime)
                        {
                            copyMap.SetRemoveTicks(scene.LeaveTime);
                            scene.SceneStatus = GameSceneStatuses.STATUS_CLEAR;

                            try
                            {
                                List <GameClient> objsList = copyMap.GetClientsList();
                                if (objsList != null && objsList.Count > 0)
                                {
                                    for (int n = 0; n < objsList.Count; ++n)
                                    {
                                        GameClient c = objsList[n];
                                        if (c != null)
                                        {
                                            KuaFuManager.getInstance().GotoLastMap(c);
                                        }
                                    }
                                }
                            }
                            catch (System.Exception ex)
                            {
                                DataHelper.WriteExceptionLogEx(ex, "【狼魂要塞】清场调度异常");
                            }
                        }
                    }
                }
            }

            return;
        }
Ejemplo n.º 14
0
        public bool AddCopyScenes(GameClient client, CopyMap copyMap, SceneUIClasses sceneType)
        {
            bool result;

            if (sceneType == SceneUIClasses.KarenWest)
            {
                GameMap gameMap = null;
                if (!GameManager.MapMgr.DictMaps.TryGetValue(client.ClientData.MapCode, out gameMap))
                {
                    result = false;
                }
                else
                {
                    int      fuBenSeqId = copyMap.FuBenSeqID;
                    int      mapCode    = copyMap.MapCode;
                    int      roleId     = client.ClientData.RoleID;
                    int      gameId     = (int)Global.GetClientKuaFuServerLoginData(client).GameId;
                    DateTime now        = TimeUtil.NowDateTime();
                    lock (this.RuntimeData.Mutex)
                    {
                        KarenBattleScene scene = null;
                        if (!this.SceneDict.TryGetValue(fuBenSeqId, out scene))
                        {
                            KarenFuBenData fuBenData;
                            if (!this.RuntimeData.FuBenItemData.TryGetValue(gameId, out fuBenData))
                            {
                                LogManager.WriteLog(LogTypes.Error, "阿卡伦战场没有为副本找到对应的跨服副本数据,GameID:" + gameId, null, true);
                            }
                            KarenBattleSceneInfo sceneInfo;
                            if (null == (sceneInfo = KarenBattleManager.getInstance().TryGetKarenBattleSceneInfo(mapCode)))
                            {
                                LogManager.WriteLog(LogTypes.Error, "阿卡伦战场没有为副本找到对应的档位数据,ID:" + mapCode, null, true);
                            }
                            scene         = new KarenBattleScene();
                            scene.CopyMap = copyMap;
                            scene.CleanAllInfo();
                            scene.GameId         = gameId;
                            scene.m_nMapCode     = mapCode;
                            scene.CopyMapId      = copyMap.CopyMapID;
                            scene.FuBenSeqId     = fuBenSeqId;
                            scene.m_nPlarerCount = 1;
                            scene.SceneInfo      = sceneInfo;
                            scene.MapGridWidth   = gameMap.MapGridWidth;
                            scene.MapGridHeight  = gameMap.MapGridHeight;
                            DateTime startTime = now.Date.Add(KarenBattleManager.getInstance().GetStartTime(sceneInfo.MapCode));
                            scene.StartTimeTicks = startTime.Ticks / 10000L;
                            this.InitScene(scene, client);
                            this.SceneDict[fuBenSeqId] = scene;
                        }
                        else
                        {
                            scene.m_nPlarerCount++;
                        }
                        KarenBattleClientContextData clientContextData;
                        if (!scene.ClientContextDataDict.TryGetValue(roleId, out clientContextData))
                        {
                            clientContextData = new KarenBattleClientContextData
                            {
                                RoleId          = roleId,
                                ServerId        = client.ServerId,
                                BattleWhichSide = client.ClientData.BattleWhichSide
                            };
                            scene.ClientContextDataDict[roleId] = clientContextData;
                        }
                        client.SceneObject       = scene;
                        client.SceneGameId       = (long)scene.GameId;
                        client.SceneContextData2 = clientContextData;
                        copyMap.IsKuaFuCopy      = true;
                        copyMap.SetRemoveTicks(TimeUtil.NOW() + (long)(scene.SceneInfo.TotalSecs * 1000));
                    }
                    JunTuanClient.getInstance().GameFuBenRoleChangeState(client.ServerId, roleId, gameId, client.ClientData.BattleWhichSide, 5);
                    result = true;
                }
            }
            else
            {
                result = false;
            }
            return(result);
        }
Ejemplo n.º 15
0
        public bool AddCopyScenes(GameClient client, CopyMap copyMap, SceneUIClasses sceneType)
        {
            bool result;

            if (sceneType == SceneUIClasses.KuaFuBoss)
            {
                int            fuBenSeqId = copyMap.FuBenSeqID;
                int            mapCode    = copyMap.MapCode;
                int            roleId     = client.ClientData.RoleID;
                int            gameId     = (int)Global.GetClientKuaFuServerLoginData(client).GameId;
                DateTime       now        = TimeUtil.NowDateTime();
                KuaFuBossScene scene      = null;
                lock (this.RuntimeData.Mutex)
                {
                    if (!this.SceneDict.TryGetValue(fuBenSeqId, out scene))
                    {
                        KuaFuBossSceneInfo        sceneInfo = null;
                        YongZheZhanChangFuBenData fuBenData;
                        if (!this.RuntimeData.FuBenItemData.TryGetValue(gameId, out fuBenData))
                        {
                            LogManager.WriteLog(LogTypes.Error, "跨服Boss没有为副本找到对应的跨服副本数据,GameID:" + gameId, null, true);
                        }
                        if (!this.RuntimeData.SceneDataDict.TryGetValue(fuBenData.GroupIndex, out sceneInfo))
                        {
                            LogManager.WriteLog(LogTypes.Error, "跨服Boss没有为副本找到对应的档位数据,ID:" + fuBenData.GroupIndex, null, true);
                        }
                        scene         = new KuaFuBossScene();
                        scene.CopyMap = copyMap;
                        scene.CleanAllInfo();
                        scene.GameId         = gameId;
                        scene.m_nMapCode     = mapCode;
                        scene.CopyMapId      = copyMap.CopyMapID;
                        scene.FuBenSeqId     = fuBenSeqId;
                        scene.m_nPlarerCount = 1;
                        scene.SceneInfo      = sceneInfo;
                        DateTime startTime = now.Date.Add(this.GetStartTime(sceneInfo.Id));
                        scene.StartTimeTicks             = startTime.Ticks / 10000L;
                        scene.GameStatisticalData.GameId = gameId;
                        this.SceneDict[fuBenSeqId]       = scene;
                        List <BattleDynamicMonsterItem> dynMonsterList;
                        if (this.RuntimeData.SceneDynMonsterDict.TryGetValue(mapCode, out dynMonsterList))
                        {
                            scene.DynMonsterList = dynMonsterList;
                        }
                    }
                    else
                    {
                        scene.m_nPlarerCount++;
                    }
                    copyMap.IsKuaFuCopy = true;
                    copyMap.SetRemoveTicks(TimeUtil.NOW() + (long)(scene.SceneInfo.TotalSecs * 1000));
                }
                GameMap gameMap = null;
                if (GameManager.MapMgr.DictMaps.TryGetValue(copyMap.MapCode, out gameMap))
                {
                    scene.MapGridWidth  = gameMap.MapGridWidth;
                    scene.MapGridHeight = gameMap.MapGridHeight;
                }
                YongZheZhanChangClient.getInstance().GameFuBenRoleChangeState(roleId, 5, 0, 0);
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Ejemplo n.º 16
0
        public void TimerProc()
        {
            long nowTicks = TimeUtil.NOW();

            if (nowTicks >= KuaFuBossManager.NextHeartBeatTicks)
            {
                KuaFuBossManager.NextHeartBeatTicks = nowTicks + 1020L;
                foreach (KuaFuBossScene scene in this.SceneDict.Values)
                {
                    lock (this.RuntimeData.Mutex)
                    {
                        int nID        = scene.FuBenSeqId;
                        int nCopyID    = scene.CopyMapId;
                        int nMapCodeID = scene.m_nMapCode;
                        if (nID >= 0 && nCopyID >= 0 && nMapCodeID >= 0)
                        {
                            CopyMap  copyMap = scene.CopyMap;
                            DateTime now     = TimeUtil.NowDateTime();
                            long     ticks   = TimeUtil.NOW();
                            if (scene.m_eStatus == GameSceneStatuses.STATUS_NULL)
                            {
                                if (ticks >= scene.StartTimeTicks)
                                {
                                    scene.m_lPrepareTime         = scene.StartTimeTicks;
                                    scene.m_lBeginTime           = scene.m_lPrepareTime + (long)(scene.SceneInfo.PrepareSecs * 1000);
                                    scene.m_eStatus              = GameSceneStatuses.STATUS_PREPARE;
                                    scene.StateTimeData.GameType = 6;
                                    scene.StateTimeData.State    = (int)scene.m_eStatus;
                                    scene.StateTimeData.EndTicks = scene.m_lBeginTime;
                                    GameManager.ClientMgr.BroadSpecialCopyMapMessage <GameSceneStateTimeData>(827, scene.StateTimeData, scene.CopyMap);
                                }
                            }
                            else if (scene.m_eStatus == GameSceneStatuses.STATUS_PREPARE)
                            {
                                if (ticks >= scene.m_lBeginTime)
                                {
                                    scene.m_eStatus              = GameSceneStatuses.STATUS_BEGIN;
                                    scene.m_lEndTime             = scene.m_lBeginTime + (long)(scene.SceneInfo.FightingSecs * 1000);
                                    scene.StateTimeData.GameType = 6;
                                    scene.StateTimeData.State    = (int)scene.m_eStatus;
                                    scene.StateTimeData.EndTicks = scene.m_lEndTime;
                                    GameManager.ClientMgr.BroadSpecialCopyMapMessage <GameSceneStateTimeData>(827, scene.StateTimeData, scene.CopyMap);
                                }
                            }
                            else if (scene.m_eStatus == GameSceneStatuses.STATUS_BEGIN)
                            {
                                if (ticks >= scene.m_lEndTime)
                                {
                                    scene.m_eStatus              = GameSceneStatuses.STATUS_END;
                                    scene.m_lLeaveTime           = scene.m_lEndTime + (long)(scene.SceneInfo.ClearRolesSecs * 1000);
                                    scene.StateTimeData.GameType = 6;
                                    scene.StateTimeData.State    = 5;
                                    scene.StateTimeData.EndTicks = scene.m_lLeaveTime;
                                    GameManager.ClientMgr.BroadSpecialCopyMapMessage <GameSceneStateTimeData>(827, scene.StateTimeData, scene.CopyMap);
                                    this.NotifySceneData(scene);
                                }
                                else
                                {
                                    scene.ElapsedSeconds = (int)Math.Min((nowTicks - scene.m_lBeginTime) / 1000L, (long)scene.SceneInfo.TotalSecs);
                                    this.CheckCreateDynamicMonster(scene, ticks);
                                    if (nowTicks > scene.NextNotifySceneStateDataTicks)
                                    {
                                        scene.NextNotifySceneStateDataTicks = nowTicks + 3000L;
                                        this.NotifySceneData(scene);
                                    }
                                }
                            }
                            else if (scene.m_eStatus == GameSceneStatuses.STATUS_END)
                            {
                                GameManager.CopyMapMgr.KillAllMonster(scene.CopyMap);
                                scene.m_eStatus = GameSceneStatuses.STATUS_AWARD;
                                YongZheZhanChangClient.getInstance().PushGameResultData(scene.GameStatisticalData);
                                YongZheZhanChangClient.getInstance().GameFuBenChangeState(scene.GameId, GameFuBenState.End, now);
                                YongZheZhanChangFuBenData fuBenData;
                                if (this.RuntimeData.FuBenItemData.TryGetValue(scene.GameId, out fuBenData))
                                {
                                    fuBenData.State = GameFuBenState.End;
                                    LogManager.WriteLog(LogTypes.Error, string.Format("跨服Boss跨服副本GameID={0},战斗结束", fuBenData.GameId), null, true);
                                }
                            }
                            else if (scene.m_eStatus == GameSceneStatuses.STATUS_AWARD)
                            {
                                if (ticks >= scene.m_lLeaveTime)
                                {
                                    copyMap.SetRemoveTicks(scene.m_lLeaveTime);
                                    scene.m_eStatus = GameSceneStatuses.STATUS_CLEAR;
                                    try
                                    {
                                        List <GameClient> objsList = copyMap.GetClientsList();
                                        if (objsList != null && objsList.Count > 0)
                                        {
                                            for (int i = 0; i < objsList.Count; i++)
                                            {
                                                GameClient c = objsList[i];
                                                if (c != null)
                                                {
                                                    KuaFuManager.getInstance().GotoLastMap(c);
                                                }
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        DataHelper.WriteExceptionLogEx(ex, "跨服Boss系统清场调度异常");
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 心跳处理
        /// </summary>
        public void TimerProc()
        {
            long nowTicks = TimeUtil.NOW();

            if (nowTicks < NextHeartBeatTicks)
            {
                return;
            }

            NextHeartBeatTicks = nowTicks + 1020; //1020毫秒执行一次

            foreach (var tianTiScene in TianTiSceneDict.Values)
            {
                lock (RuntimeData.Mutex)
                {
                    int nID = -1;
                    nID = tianTiScene.FuBenSeqId;

                    int nCopyID = -1;
                    nCopyID = tianTiScene.CopyMapId;

                    int nMapCodeID = -1;
                    nMapCodeID = tianTiScene.m_nMapCode;

                    if (nID < 0 || nCopyID < 0 || nMapCodeID < 0)
                    {
                        continue;
                    }

                    CopyMap copyMap = tianTiScene.CopyMap;

                    // 当前tick
                    DateTime now   = TimeUtil.NowDateTime();
                    long     ticks = TimeUtil.NOW();

                    if (tianTiScene.m_eStatus == GameSceneStatuses.STATUS_NULL)             // 如果处于空状态 -- 是否要切换到准备状态
                    {
                        tianTiScene.m_lPrepareTime = ticks;
                        tianTiScene.m_lBeginTime   = ticks + RuntimeData.WaitingEnterSecs * TimeUtil.SECOND;
                        tianTiScene.m_eStatus      = GameSceneStatuses.STATUS_PREPARE;

                        tianTiScene.StateTimeData.GameType = (int)GameTypes.TianTi;
                        tianTiScene.StateTimeData.State    = (int)tianTiScene.m_eStatus;
                        tianTiScene.StateTimeData.EndTicks = tianTiScene.m_lBeginTime;
                        GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_NOTIFY_TIME_STATE, tianTiScene.StateTimeData, tianTiScene.CopyMap);
                    }
                    else if (tianTiScene.m_eStatus == GameSceneStatuses.STATUS_PREPARE)     // 场景战斗状态切换
                    {
                        //检查双方是否都进入了
                        if (copyMap.GetGameClientCount() >= 2)
                        {
                            tianTiScene.m_eStatus  = GameSceneStatuses.STATUS_BEGIN;
                            tianTiScene.m_lEndTime = ticks + RuntimeData.FightingSecs * TimeUtil.SECOND;

                            tianTiScene.StateTimeData.GameType = (int)GameTypes.TianTi;
                            tianTiScene.StateTimeData.State    = (int)tianTiScene.m_eStatus;
                            tianTiScene.StateTimeData.EndTicks = tianTiScene.m_lEndTime;
                            GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_NOTIFY_TIME_STATE, tianTiScene.StateTimeData, tianTiScene.CopyMap);

                            //放开光幕
                            copyMap.AddGuangMuEvent(1, 0);
                            GameManager.ClientMgr.BroadSpecialMapAIEvent(copyMap.MapCode, copyMap.CopyMapID, 1, 0);
                            copyMap.AddGuangMuEvent(2, 0);
                            GameManager.ClientMgr.BroadSpecialMapAIEvent(copyMap.MapCode, copyMap.CopyMapID, 2, 0);
                        }
                        else if (ticks >= (tianTiScene.m_lBeginTime))
                        {
                            CompleteTianTiScene(tianTiScene, -1);
                        }
                    }
                    else if (tianTiScene.m_eStatus == GameSceneStatuses.STATUS_BEGIN)       // 战斗开始
                    {
                        if (ticks >= tianTiScene.m_lEndTime)
                        {
                            CompleteTianTiScene(tianTiScene, 0);
                        }
                    }
                    else if (tianTiScene.m_eStatus == GameSceneStatuses.STATUS_END)         // 战斗结束
                    {
                        ProcessEnd(tianTiScene, now, nowTicks);
                    }
                    else if (tianTiScene.m_eStatus == GameSceneStatuses.STATUS_AWARD)
                    {
                        if (ticks >= tianTiScene.m_lLeaveTime)
                        {
                            copyMap.SetRemoveTicks(tianTiScene.m_lLeaveTime);
                            tianTiScene.m_eStatus = GameSceneStatuses.STATUS_CLEAR;

                            try
                            {
                                List <GameClient> objsList = copyMap.GetClientsList();
                                if (objsList != null && objsList.Count > 0)
                                {
                                    for (int n = 0; n < objsList.Count; ++n)
                                    {
                                        GameClient c = objsList[n];
                                        if (c != null)
                                        {
                                            KuaFuManager.getInstance().GotoLastMap(c);
                                        }
                                    }
                                }
                            }
                            catch (System.Exception ex)
                            {
                                DataHelper.WriteExceptionLogEx(ex, "跨服天梯系统清场调度异常");
                            }
                        }
                    }
                }
            }

            return;
        }