Пример #1
0
    /// <summary>
    /// 创建历史轨迹(轨迹线)
    /// </summary>
    private void CreateHistoryPath()
    {
        Log.Info("CreateHistoryPath Start");
        bool isNormalMode = LocationHistoryUITool.GetIsNormalMode();

        if (PosInfoGroup != null)
        {
            foreach (PositionInfoList positionInfoList in PosInfoGroup)
            {
                try
                {
                    Log.Info("CreateHistoryPath Group Start");
                    var posList = positionInfoList.GetVector3List();
                    //var posList = positionInfoList.GetNavMeshPosList();//改成根据NavMesh上的点获取坐标
                    GameObject o = CreateHistoryPath(posList, posList.Count - 1, isNormalMode);//创建历史轨迹(轨迹线)
                    Log.Info("CreateHistoryPath Group End");
                }
                catch (Exception ex1)
                {
                    Log.Error("LocationHistoryPathBase.CreateHistoryPath", ex1.ToString());
                }
            }
        }
        else
        {
            Log.Error("LocationHistoryPathBase.CreateHistoryPath", "PosInfoGroup=null");
        }

        Log.Info("CreateHistoryPath End");
    }
    private void OnHistoricalToggleTrue()
    {
        Log.Info("OnHistoricalToggleTrue");
        RoomFactory.Instance.FocusNode(FactoryDepManager.Instance, () =>
        {
            if (SceneAssetManager.Instance)
            {
                SceneAssetManager.Instance.SaveEnableLoadBuilding(false);
            }
            AlarmPushManage.Instance.CloseAlarmPushWindow(false);
            //AlarmPushManage.Instance.IsShow.isOn = false;
            ToggleChangedBefore();

            ActionBarManage.Instance.Hide();
            FunctionSwitchBarManage.Instance.SetWindow(false);
            MonitorRangeManager.Instance.HideAllRanges();
            LocationHistoryUITool.Show();
            AlarmPushManage.Instance.CloseAlarmPushWindow(false);
            if (AutoSelectHistoryPath.Instance)
            {
                AutoSelectHistoryPath.Instance.Select();
            }
            if (BaoXinTitle.Instance)
            {
                BaoXinTitle.Instance.Close();
            }
        });
    }
Пример #3
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")));
            }
        }
    }
 /// <summary>
 /// Toggle值改变触发事件,超过人数限制警告触发
 /// </summary>
 public void ToggleAlarm_OnValueChanged(bool b)
 {
     if (b)
     {
         toggle.isOn = false;
         UGUIMessageBox.Show("显示历史轨迹不能超过" + LocationHistoryUITool.GetLimitPersonNum() + "人!");
     }
 }
Пример #5
0
    /// <summary>
    /// 保存按钮触发事件
    /// </summary>
    public void SaveBtn_OnClick()
    {
        Debug.Log("SaveBtn_OnClick!");
        List <Personnel> currentSelectPersonnelsT = new List <Personnel>(currentSelectPersonnels);

        LocationHistoryUITool.ShowPersons(currentSelectPersonnelsT);
        currentSelectPersonnelsBeforeShow = new List <Personnel>(currentSelectPersonnels);
        MultHistoryPlayUINew.Instance.Stop();
        isEdited = false;
    }
 private void OnMultHistoryToggleChange(bool ison)
 {
     if (ison)
     {
         LocationHistoryUITool.Show();
     }
     else
     {
         LocationHistoryUITool.Hide();
     }
 }
Пример #7
0
    /// <summary>
    /// 是否达到人数限制
    /// </summary>
    public bool IsAchisevePersonsLimitNum()
    {
        bool islimitPersonNum = currentSelectPersonnels.Count < LocationHistoryUITool.GetLimitPersonNum();

        if (islimitPersonNum)
        {
            return(false);
        }
        else
        {
            return(true);
        }
    }
Пример #8
0
    /// <summary>
    /// 根据人数限制设置相关操作
    /// </summary>
    public void SetPersonsLimitRelevant()
    {
        bool islimitPersonNum = currentSelectPersonnels.Count < LocationHistoryUITool.GetLimitPersonNum();

        if (islimitPersonNum)
        {
            //SetSearchUIItemInteractable(true);
            SetSearchUIItemLimitAlam(false);
        }
        else
        {
            //SetSearchUIItemInteractable(false);
            SetSearchUIItemLimitAlam(true);
        }
    }
    /// <summary>
    /// 计算历史轨迹人员的所在区域
    /// </summary>
    public Position GetPosition()
    {
        //List<Position> ps = MultHistoryPlayUI.Instance.GetPositionsByPersonnel(locationHistoryPathBase.personnel);
        List <Position> ps = LocationHistoryUITool.GetPositionsByPersonnel(locationHistoryPathBase.personnel);

        if (ps != null)
        {
            if (locationHistoryPathBase.currentPointIndex < ps.Count)
            {
                Position p = ps[locationHistoryPathBase.currentPointIndex];
                return(p);
            }
        }

        return(null);
    }
 /// <summary>
 /// 历史路径
 /// </summary>
 /// <param name="isOn"></param>
 private void OnHistoricalToggleChange(bool isOn)
 {
     if (ConfigButton.instance)
     {
         ConfigButton.instance.ChoseConfigView();                       //关闭打开的配置界面
     }
     //IsHistorical = true;
     ParkInformationManage.Instance.ClosePerAndDevAlarmWindow();
     ParkInformationManage.Instance.ShowParkInfoUI(!isOn);
     ChangeImage(isOn, HistoricalToggle);
     Debug.Log("OnHistoricalToggleChange:" + isOn);
     if (isOn)
     {
         AlarmPushManage.Instance.CloseAlarmPushWindow(false);
         IsHistorical = true;
         if (LocationManager.Instance.IsFocus)
         {
             LocationManager.Instance.RecoverBeforeFocusAlign(() =>
             {
                 OnHistoricalToggleTrue();
             }, false);
         }
         else
         {
             OnHistoricalToggleTrue();
         }
     }
     else
     {
         if (SceneAssetManager.Instance)
         {
             SceneAssetManager.Instance.RecoverEnableLoadBuilding();
         }
         AlarmPushManage.Instance.CloseAlarmPushWindow(true);
         //AlarmPushManage.Instance.IsShow.isOn = true ;
         ActionBarManage.Instance.Show();
         FunctionSwitchBarManage.Instance.SetWindow(true);
         MonitorRangeManager.Instance.ShowRanges(FactoryDepManager.currentDep);
         LocationHistoryUITool.Hide();
         if (BaoXinTitle.Instance)
         {
             BaoXinTitle.Instance.Show();
         }
         IsHistorical = false;
     }
     SetOtherUIStateInHistoricalMode(isOn);
 }
    /// <summary>
    /// 根据进度时间值,获取当前需要执行的点的索引
    /// </summary>
    /// <param name="f"></param>
    /// <param name="accuracy">精确度:时间相差accuracy秒</param>
    public override int GetCompareTime(double f, float accuracy = 0.1f)
    {
        DateTime startTimeT = LocationHistoryUITool.GetStartTime();

        ////相匹配的第一个元素,结果为-1表示没找到
        //return PosInfoList.FindIndex((item) =>
        //{
        //    double timeT = (item.Time - startTimeT).TotalSeconds;
        //    if (Math.Abs(f - timeT) < accuracy)
        //    {
        //        return true;
        //    }
        //    else
        //    {
        //        return false;
        //    }
        //});

        return(PosInfoList.FindIndexByTime(startTimeT, f, accuracy));
    }
    /// <summary>
    /// 获取离它最近的下一个播放点
    /// </summary>
    public override int GetNextPoint(float value)
    {
        double f = timeLength * value;
        //DateTime startTimeT = MultHistoryPlayUI.Instance.GetStartTime();
        DateTime startTimeT = LocationHistoryUITool.GetStartTime();

        //相匹配的第一个元素,结果为-1表示没找到
        return(PosInfoList.FindIndex((item) =>
        {
            double timeT = (item.Time - startTimeT).TotalSeconds;
            if (timeT > f)
            {
                return true;
            }
            else
            {
                return false;
            }
        }));
    }
    /// <summary>
    /// 删除
    /// </summary>
    public void Delete()
    {
        print("删除");
        bool isPlayt = LocationHistoryUITool.GetIsPlaying();

        if (isPlayt)
        {
            UGUIMessageBox.Show("是否终止当前人员历史轨迹演示,并删除该人员?", "是", "否", () =>
            {
                ////如果在播放就让它终止
                //ExecuteEvents.Execute<IPointerClickHandler>(MultHistoryPlayUI.Instance.StopBtn.gameObject, new PointerEventData(EventSystem.current), ExecuteEvents.pointerClickHandler);
                //MultHistoryPlayUI.Instance.RemovePerson(personnel);
                LocationHistoryUITool.StopPlay(personnel);
            }, null, null);
        }
        else
        {
            //MultHistoryPlayUI.Instance.RemovePerson(personnel);
            //ExecuteEvents.Execute<IPointerClickHandler>(MultHistoryPlayUI.Instance.StopBtn.gameObject, new PointerEventData(EventSystem.current), ExecuteEvents.pointerClickHandler);
            LocationHistoryUITool.StopPlay(personnel);
        }
    }
    public override void SetRenderIsEnable(bool isEnable)
    {
        //Log.Info("LocationHistoryPath_M", "SetRenderIsEnable:" + isEnable);
        //base.SetRenderIsEnable(isEnable);
        if (IsShowRenderer != isEnable)
        {
            foreach (Renderer render in renders)
            {
                if (render == null)
                {
                    Log.Error("LocationHistoryPath_M", "render == null");
                    continue;
                }
                render.enabled = isEnable;
            }
            bool isMouseDragSliderT = LocationHistoryUITool.GetIsMouseDragSlider();
            if (!isMouseDragSliderT)
            {
                bool isDrawingMode = LocationHistoryUITool.GetIsDrawingMode();

                //if (MultHistoryPlayUI.Instance.mode == MultHistoryPlayUI.Mode.Drawing)
                if (isDrawingMode)
                {
                    if (isEnable)
                    {
                        historyPathDrawing.Drawing();
                        historyPathDrawing.AddLine();
                    }
                    else
                    {
                        historyPathDrawing.PauseDraw();
                    }
                }
            }
            IsShowRenderer = isEnable;
        }
    }
    /// <summary>
    /// 计算历史轨迹人员的所在区域
    /// </summary>
    public void ShowArea()
    {
        //List<Position> ps = MultHistoryPlayUI.Instance.GetPositionsByPersonnel(personnel);

        List <Position> ps = LocationHistoryUITool.GetPositionsByPersonnel(personnel);

        if (ps != null)
        {
            if (currentPointIndex < ps.Count && currentPointIndex > -1)
            {
                Position p          = ps[currentPointIndex];
                DepNode  depnodeT   = RoomFactory.Instance.GetDepNodeById((int)p.TopoNodeId);
                DepNode  depnodePri = MonitorRangeManager.GetDepNodeBuild(depnode);
                DepNode  depnodeNow = MonitorRangeManager.GetDepNodeBuild(depnodeT);

                if (depnodeNow != null && depnodePri != depnodeNow && LocationHistoryManager.Instance.CurrentFocusController == historyManController)
                {
                    BuildingBox box = depnodeNow.GetComponent <BuildingBox>();
                    if (box)
                    {
                        box.LoadBuilding((nNode) =>
                        {
                            FactoryDepManager.Instance.SetAllColliderIgnoreRaycastOP(true);
                        }, false);
                        //LocationManager.Instance.TransparentPark();
                        //return;
                    }
                }

                depnode = depnodeT;
                if (depnode)
                {
                    LocationHistoryUITool.SetItemArea(personnel, depnode.NodeName);
                }
            }
        }
    }
    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:是否可以不加载动态设备
                    });
                }
            }
        }
    }