Example #1
0
    private void PrintTimeInfo()
    {
        HisPosInfo hisPosInfo = posInfo as HisPosInfo; //假如是历史数据

        if (hisPosInfo != null)
        {
            var current = hisPosInfo.CurrentPosInfo;
            var next    = current.Next;

            if (next != null)
            {
                TimeSpan time     = next.Time - current.Time;                //下一个点的时间
                float    distance = Vector3.Distance(next.Vec, current.Vec); //下一个点的距离

                Log.Info("NavAgentControllerBase.UpdatePosition", string.Format("{0}=>{1},time:{2},distance:{3}", current.Vec, next.Vec, time, distance));

                MultHistoryTimeStamp timeStamp = LocationHistoryUITool.GetTimeStamp();
                double   timesum       = timeStamp.timeSum;
                DateTime showPointTime = timeStamp.showPointTime;
                float    currentSpeedT = timeStamp.currentSpeed;

                Log.Info("NavAgentControllerBase.UpdatePosition", string.Format("t1:{0},t2:{1},t3{2}", current.Time.ToString("HH:mm:ss.f"), next.Time.ToString("HH:mm:ss.f"), showPointTime.ToString("HH:mm:ss.f")));
            }
        }
    }
    protected override void Update()
    {
        //if (MultHistoryPlayUINew.Instance.istest)
        //{
        //    int i= 0;
        //}
        base.Update();
        if (MultHistoryPlayUINew.Instance.isPlay)
        {
            if (!isCreatePathComplete)
            {
                return;
            }
            if (!LocationHistoryUITool.GetIsPlaying())
            {
                return;
            }
            if (isNeedHide)
            {
                isNeedHide = false;
                Hide();
                return;
            }
            float valuet = 1;
            valuet = LocationHistoryUITool.GetProcessSliderValue();
            if (valuet < 1)
            {
                //double timesum = MultHistoryPlayUI.Instance.timeSum;
                //DateTime showPointTime = MultHistoryPlayUI.Instance.GetStartTime().AddSeconds(timesum);
                MultHistoryTimeStamp timeStamp = LocationHistoryUITool.GetTimeStamp();
                double   timesum       = timeStamp.timeSum;
                DateTime showPointTime = timeStamp.showPointTime;
                float    currentSpeedT = timeStamp.currentSpeed;
                if (currentPointIndex < PosCount && currentPointIndex > -1)
                {
                    //Debug.LogErrorFormat("timelist[currentPointIndex]:{0},showPointTime:{1}", timelist[currentPointIndex], showPointTime);
                    if (PosInfoList[currentPointIndex].Time < showPointTime)
                    {
                        //double timesum2 = (timelist[currentPointIndex] - HistoryPlayUI.Instance.GetStartTime()).TotalSeconds;
                        //Debug.Log("timesum2:" + timesum2);
                        //progressTargetValue = (double)timesum2 / HistoryPlayUI.Instance.timeLength;
                        //if (MultHistoryPlayUI.Instance.isNewWalkPath)
                        //{
                        if (currentPointIndex - 1 >= 0)
                        {
                            double temp = PosInfoList.GetTimeSpane(currentPointIndex);
                            if (temp > 2f)
                            {
                                //ExcuteHistoryPath(currentPointIndex,1f, false);
                                ExcuteHistoryPath(currentPointIndex, currentSpeedT);
                                currentPointIndex++;
                                return;
                            }
                            else
                            {
                                ExcuteHistoryPath(currentPointIndex, currentSpeedT);
                            }
                        }
                        else
                        {
                            ExcuteHistoryPath(currentPointIndex, currentSpeedT);
                        }
                        //}
                        //else
                        //{
                        //    ExcuteHistoryPath(currentPointIndex, MultHistoryPlayUI.Instance.CurrentSpeed);
                        //}
                        //Debug.LogError("currentPointIndex111:" + currentPointIndex);
                        currentPointIndex++;
                        Show();
                    }
                    else//如果当前点的时间超过了当前进度时间
                    {
                        //if (currentPointIndex - 1 >= 0)
                        //{
                        //    ExcuteHistoryPath(currentPointIndex - 1, MultHistoryPlayUI.Instance.CurrentSpeed);
                        //}

                        ExcuteHistoryPath(currentPointIndex, currentSpeedT);

                        //Debug.LogError("currentPointIndex222:" + currentPointIndex);
                        //if (MultHistoryPlayUI.Instance.isNewWalkPath)
                        //{
                        if (currentPointIndex - 1 >= 0)
                        {
                            double temp = (PosInfoList[currentPointIndex].Time - PosInfoList[currentPointIndex - 1].Time).TotalSeconds;
                            if (temp > 2f)//如果当前要执行历史点的值,超过播放时间值5秒,就认为这超过5秒时间里,没历史轨迹数据,则让人员消失
                            {
                                //Hide();
                            }
                        }
                        else
                        {
                            //Hide();
                        }
                        //}
                        //else
                        //{
                        //    double temp = (timelist[currentPointIndex] - showPointTime).TotalSeconds;
                        //    if (temp > 5f)//如果当前要执行历史点的值,超过播放时间值5秒,就认为这超过5秒时间里,没历史轨迹数据,则让人员消失
                        //    {
                        //        Hide();
                        //    }
                        //}
                    }
                    //progressValue = Mathf.Lerp((float)progressValue, (float)progressTargetValue, 2 * Time.deltaTime);
                    //transform.position = line.GetPoint3D01((float)progressValue);
                    //ExcuteHistoryPath(currentPointIndex);
                }
                else
                {
                    Hide();
                }
            }
            else
            {
                progressValue       = 0;
                progressTargetValue = 0;
                currentPointIndex   = 0;
            }
        }
        //else
        //{
        ShowArea();
        //}

        if (depnode != null)
        {
            if (LocationHistoryManager.Instance && LocationHistoryManager.Instance.IsFocus)//对焦状态时才可以加载设备
            {
                BuildingController buillding = depnode.GetParentNode <BuildingController>();
                if (buillding && !buillding.IsDevCreate)//加载设备
                {
                    buillding.IsDevCreate = true;
                    buillding.LoadDevices(() =>
                    {
                        RoomFactory.Instance.CreateDepDev(buillding, true);//todo:是否可以不加载动态设备
                    });
                }
            }
        }
    }