Beispiel #1
0
        //pvp采取记录冲线前的数据点
        private void StartLoadInfo()
        {
            //记录开启后的位置点
            MatchModule matchModule = UtilsModuleManager.GetModule(ModuleType.MatchModule) as MatchModule;

            if (matchModule != null)
            {
                int _horseCount = matchModule.ModelHorseViewSet.Count;
                if (_horseCount > 0)
                {
                    for (int index = 0; index < _horseCount; index++)
                    {
                        Match.ModelHorseView _singleHorseView = matchModule.ModelHorseViewSet[index];
                        if (_singleHorseView != null)
                        {
                            List <HorseCrossLineStatus> _list  = new List <HorseCrossLineStatus>();
                            Vector3              _tempPosition = _singleHorseView.obj.position;
                            Quaternion           _tempRotation = _singleHorseView.obj.rotation;
                            HorseCrossLineStatus _curStatus    = new HorseCrossLineStatus(_tempPosition, _tempRotation);
                            _list.Add(_curStatus);
                            m_raceHorseDic[_singleHorseView] = _list;
                        }
                    }
                }
            }

            //打开update开始每隔几帧记录所有马匹的信息
            _bIsSaveHorsesData = true;
        }
Beispiel #2
0
 //开始回放所有的马的移动信息存档
 private void MoveFromCurPositionToTargetPos()
 {
     if (m_raceHorseDic != null && m_raceHorseDic.Count > 0)
     {
         foreach (var item in m_raceHorseDic)
         {
             Match.ModelHorseView        _singleHorseView            = item.Key;
             List <HorseCrossLineStatus> _singleHorseCrossLineStatus = item.Value;
             if (_singleHorseView != null && _singleHorseCrossLineStatus != null && _singleHorseCrossLineStatus.Count > 0)
             {
                 _singleHorseView.SetHorseReplayCrossLine(_singleHorseCrossLineStatus);
             }
         }
     }
 }
Beispiel #3
0
        //真正的开始回放
        private void ReviewCrossLine()
        {
            if (UtilsModuleManager.GetModule(ModuleType.MatchModule) is MatchModule matchModule &&
                matchModule.matchInit != null &&
                matchModule.matchInit.funcs != null &&
                matchModule.matchInit.funcs.NotifyOpenEndCamera != null &&
                m_raceHorseDic != null &&
                m_raceHorseDic.Count > 0)
            {
                //先切回看向终点线的相机
                matchModule.matchInit.funcs.NotifyOpenEndCamera.Invoke();

                //将需要回放的所有马匹放置于第一次记录的位置
                foreach (var item in m_raceHorseDic)
                {
                    Match.ModelHorseView        _singleHorseView          = item.Key;
                    List <HorseCrossLineStatus> _horseCrossLineStatusList = item.Value;

                    if (_singleHorseView != null && _horseCrossLineStatusList != null && _horseCrossLineStatusList.Count > 0)
                    {
                        HorseCrossLineStatus _firstPoint = _horseCrossLineStatusList[0];
                        if (_firstPoint != null)
                        {
                            Vector3    _targetVec3     = _firstPoint.HorseCrossLineTempTarget;
                            Quaternion _targetRotation = _firstPoint.HorseCrossLineTempRotation;

                            //屏蔽掉正常的马的坐标运算
                            _singleHorseView.PrepareReplayCrossLine();

                            _singleHorseView.obj.position = _targetVec3;
                            _singleHorseView.obj.rotation = _targetRotation;
                            item.Value.RemoveAt(0);
                        }
                    }
                }

                //正式开始回放
                this.MoveFromCurPositionToTargetPos();
            }
        }
Beispiel #4
0
        public void Update()
        {
            //PVE比赛结束,等待收到PVE结算奖励
            if (m_bIsPVEWaitBattleSettleReward)
            {
                MatchModule matchModule = UtilsModuleManager.GetModule(ModuleType.MatchModule) as MatchModule;
                if (matchModule != null)
                {
                    if (matchModule.IsReceiveRoomSettle)
                    {
                        matchModule.IsReceiveRoomSettle = false;
                        m_bIsPVEWaitBattleSettleReward  = false;

                        this.ReadyShowGameReward();
                    }
                }
            }

            //PVP比赛结束,并且收到PVP比赛的奖励通知
            if (m_bIsPVPReviewFinished)
            {
                MatchModule matchModule = UtilsModuleManager.GetModule(ModuleType.MatchModule) as MatchModule;
                if (matchModule != null)
                {
                    if (matchModule.IsReceiveRoomSettle)
                    {
                        matchModule.IsReceiveRoomSettle = false;
                        m_bIsPVPReviewFinished          = false;

                        this.ReadyShowGameReward();
                    }
                }
            }

            //pvp时存储所有马匹的位置和朝向信息
            if (_bIsSaveHorsesData)
            {
                if (_curPerTime >= SAVE_PER_TIME)
                {
                    _curPerTime = 0;

                    MatchModule matchModule = UtilsModuleManager.GetModule(ModuleType.MatchModule) as MatchModule;
                    if (matchModule != null && matchModule.matchInit != null)
                    {
                        if (matchModule != null && matchModule.ModelHorseViewSet != null)
                        {
                            int _horseCount = matchModule.ModelHorseViewSet.Count;
                            if (_horseCount > 0)
                            {
                                for (int index = 0; index < _horseCount; index++)
                                {
                                    Match.ModelHorseView _singleHorseView = matchModule.ModelHorseViewSet[index];
                                    if (_singleHorseView != null && _singleHorseView.data != null)
                                    {
                                        //速度大于0就一直记录
                                        if (_singleHorseView.data.speedForward > 0)
                                        {
                                            List <HorseCrossLineStatus> _list = m_raceHorseDic[_singleHorseView];
                                            if (_list != null && _list.Count > 0)
                                            {
                                                Vector3              _tempPosition = _singleHorseView.obj.position;
                                                Quaternion           _tempRotation = _singleHorseView.obj.rotation;
                                                HorseCrossLineStatus _curStatus    = new HorseCrossLineStatus(_tempPosition, _tempRotation);
                                                _list.Add(_curStatus);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    ++_curPerTime;
                }
            }

            //PVP时候给一段时间缓冲,延长记录的信息
            if (m_bIsPrepareReview)
            {
                if (m_reviewCalTime >= PREPARE_REVIEW_CAL_TIME)
                {
                    m_reviewCalTime    = 0;
                    _bIsSaveHorsesData = false;

                    //开始真正的回放
                    this.ReviewCrossLine();
                }
                else
                {
                    ++m_reviewCalTime;
                }
            }

            //pve的慢镜头时间统计
            if (m_bIsPrepareStopGame)
            {
                if (m_startCalCrossLineTime >= CROSS_LINE_CAL_TIME)
                {
                    m_bIsPrepareStopGame    = false;
                    m_startCalCrossLineTime = 0;
                    Time.timeScale          = 1.0f;
                    //在子弹时间过后将摄像机视角切到结算流程
                    Game.EventSystem.Run(EventIdType.ChangeCameraAfterBulletTimeFinish);
                }
                else
                {
                    m_startCalCrossLineTime++;
                }
            }

            //pvp的回放时间统计
            if (m_bIsPrepareStopPVPGame)
            {
                if (m_startCalPVPCrossLineTime >= PVP_CROSS_LINE_CAL_TIME)
                {
                    m_bIsPrepareStopPVPGame    = false;
                    m_startCalPVPCrossLineTime = 0;
                    //在子弹时间过后将摄像机视角切到结算流程
                    Game.EventSystem.Run(EventIdType.ChangeCameraAfterBulletTimeFinish);
                }
                else
                {
                    m_startCalPVPCrossLineTime++;
                }
            }

            //等待所有人冲线
            if (m_bWaitBattleFinished)
            {
                //等待比赛结束
                MatchModule matchModule = UtilsModuleManager.GetModule(ModuleType.MatchModule) as MatchModule;
                if (matchModule != null && matchModule.matchInit != null && matchModule.matchInit.funcs != null)
                {
                    bool _bIsUsingFrameSync = matchModule.matchInit.funcs.UsingFrameSync;
                    if (!_bIsUsingFrameSync)
                    {
                        if (matchModule.myRunData.IsPassEnd)
                        {
                            m_bWaitBattleFinished = false;
                            this.ConnectServerToFinishBattle();
                        }
                    }
                    else
                    {
                        if (matchModule.matchInit.isGameEnd)
                        {
                            m_bWaitBattleFinished = false;
                            this.PrepareReplayCrossLineView();
                        }
                    }
                }
            }
        }