/// <summary>
    /// 拉近对焦某一个人员
    /// </summary>
    /// <param name="controller"></param>
    /// <param name="afterFocus"></param>
    public void Focus(HistoryManController controller, Action afterFocus = null)
    {
        if (IsFocus)
        {
            ClearFollowUIState(currentFocusController);
            if (controller == currentFocusController)
            {
                RecoverBeforeFocusAlign();
                return;
            }
            else
            {
                currentFocusController.historyNameUI.SetCameraFollowToggleButtonActive(false);
                //ClearFollowUIState(currentFocusController);
                CameraSceneManager.Instance.SetTheThirdPersonCameraFalse();
            }
        }
        else
        {
            SetLinesActive(false);
        }
        SetFocusController(controller);
        AlignTarget alignTargetT = controller.GetAlignTarget();

        FocusPerson(alignTargetT, afterFocus);

        if (SceneAssetManager.Instance)
        {
            SceneAssetManager.Instance.subject = controller.transform;
        }

        LoadBuildingOfPerson(controller);//加载人物所在的建筑物

        OnFocusPersonChanged(controller.gameObject, true);
    }
Example #2
0
    public void StopNavAgent(HistoryManController man)
    {
        LocationHistoryPath_M path_m = man.GetComponent <LocationHistoryPath_M>();

        if (path_m == null)
        {
            Log.Error("PathFindingManager.StopNavAgent path_m == null");
            return;
        }
        if (path_m.navAgentFollow)//有跟谁人员
        {
            man.EnableRenderer();

            var target = man.gameObject;
            path_m.navAgentFollow.gameObject.SetActive(false);

            var uiFollowTarget      = UGUIFollowTarget.CreateTitleTag(target, new Vector3(0, 0.1f, 0));
            UGUIFollowTarget follow = man.followUI.GetComponent <UGUIFollowTarget>();
            follow.Target = uiFollowTarget;

            CameraSceneManager.Instance.FocusTarget(target.transform);

            target.HighlightOn();

            path_m.enableMoveByController = true;

            path_m.heightOffset = 0.85f;

            LocationHistoryManager.Instance.isSetPersonHeightByRay = false;//还是false

            man.followTarget = this.transform;
            man.ResetTitleTag();
            man.followTitle = man.titleTag;
        }
    }
Example #3
0
    public void StartNavAgent(HistoryManController man)
    {
        Log.Info("PathFindingManager.StartNavAgent");
        if (man == null)
        {
            Log.Error("PathFindingManager.StartNavAgent man == null");
            return;
        }
        LocationHistoryPath_M path_m = man.GetComponent <LocationHistoryPath_M>();

        if (path_m == null)
        {
            Log.Error("PathFindingManager.StartNavAgent path_m == null");
            return;
        }
        if (path_m.navAgentFollow)//有跟谁人员
        {
            path_m.navAgentFollow.MaxDistance = MaxDistance;
            path_m.navAgentFollow.enableJump  = enableJump;

            if (ShowOriginalPersonWhenEditor)
            {
#if UNITY_EDITOR
                man.gameObject.SetTransparent(0.5f);
#else
                //man.DisableRenderer();
                man.DestroyRenderer();
#endif
            }
            else
            {
                //man.DisableRenderer();
                man.DestroyRenderer();//直接删除不需要再出现了
            }


            var target = path_m.navAgentFollow.gameObject;
            target.SetActive(true);

            var uiFollowTarget      = UGUIFollowTarget.CreateTitleTag(target, new Vector3(0, 0.1f, 0));
            UGUIFollowTarget follow = man.followUI.GetComponent <UGUIFollowTarget>();
            follow.Target = uiFollowTarget;

            CameraSceneManager.Instance.FocusTarget(target.transform);

            target.HighlightOn();

            path_m.enableMoveByController = false;

            path_m.heightOffset = 0.55f;

            LocationHistoryManager.Instance.isSetPersonHeightByRay = false;

            man.followTarget = target.transform;
            man.followTitle  = uiFollowTarget.transform;
            man.ChangeTitleTag(uiFollowTarget);
        }
        //AroundAlignCamera.
    }
 /// <summary>
 /// 清除跟随UI状态
 /// </summary>
 public void ClearFollowUIState(HistoryManController controller)
 {
     if (controller == null)
     {
         return;
     }
     controller.SetCameraFollowButtonEnable(false);
     controller.historyNameUI.CameraFollowToggleButton.RReset();
     controller.followUIbtn.RReset();
 }
    private void LoadBuildingOfPerson(HistoryManController controller)
    {
        LocationHistoryPath_M path_m = controller.GetComponent <LocationHistoryPath_M>();
        DepNode depnodeNow           = MonitorRangeManager.GetDepNodeBuild(path_m.depnode);

        if (depnodeNow != null)
        {
            BuildingBox box = depnodeNow.GetComponent <BuildingBox>();
            if (box)
            {
                box.LoadBuilding((nNode) => {
                    FactoryDepManager.Instance.SetAllColliderIgnoreRaycastOP(true);
                }, false);
            }
        }
    }
    Position firstPoint = null;//第一个点的位置 自动移动进度条到该点

    /// <summary>
    /// 显示某个标签的历史数据
    /// </summary>
    /// <param name="code"></param>
    public void ShowHistoryData()
    {
        if (isLoadDataSuccessed)
        {
            return;
        }
        //LocationManager.Instance.ClearHistoryPaths();
        //string code = "0002";

        List <HistoryPersonUIItem> historyPersonUIItems = personsGrid.GetComponentsInChildren <HistoryPersonUIItem>().ToList();

        DateTime end   = GetEndTime();
        DateTime start = GetStartTime();
        List <List <Position> > psList = new List <List <Position> >();

        personnel_Points = new Dictionary <Personnel, List <Position> >();
        //List<Position> ps = new List<Position>();
        List <LocationHistoryPath_M> paths = new List <LocationHistoryPath_M>();

        progressbarLoadValue = 0;

        List <int> topoNodeIds = RoomFactory.Instance.GetCurrentDepNodeChildNodeIds(SceneEvents.DepNode);

        Loom.StartSingleThread(() =>
        {
            firstPoint = null;
            foreach (Personnel p in currentPersonnels)
            {
                List <Position> ps = GetHistoryData(p.Id, topoNodeIds, start, end, 1440f);
                psList.Add(ps);
                if (personnel_Points.ContainsKey(p))
                {
                    personnel_Points[p] = ps;
                }
                else
                {
                    personnel_Points.Add(p, ps);
                }
                if (ps != null && ps.Count > 0)
                {
                    Position fps = ps[0];
                    if (firstPoint == null)
                    {
                        firstPoint = fps;
                    }
                    else
                    {
                        if (fps.Time < firstPoint.Time)
                        {
                            firstPoint = fps;
                        }
                    }
                }
            }
            Debug.Log("StartSingleThread1");
            Loom.DispatchToMainThread(() =>
            {
                ProgressbarLoad.Instance.Show(1);
                ProgressbarLoad.Instance.Hide();
                int k = 0;
                foreach (Personnel p in personnel_Points.Keys)
                {
                    List <Position> ps = personnel_Points[p];
                    Debug.LogError("点数:" + ps.Count);
                    if (ps.Count < 2)
                    {
                        continue;
                    }
                    var posInfoList = new PositionInfoList();
                    for (int i = 0; i < ps.Count; i++)
                    {
                        var posInfo = new PositionInfo(ps[i], start);
                        posInfoList.Add(posInfo);
                    }

                    Color colorT             = colors[k % colors.Count];
                    HistoryPersonUIItem item = historyPersonUIItems.Find((i) => i.personnel.Id == p.Id);
                    if (item != null)
                    {
                        colorT = item.color;
                    }

                    PathInfo pathInfo   = new PathInfo();
                    pathInfo.personnelT = p;
                    pathInfo.color      = colorT;
                    pathInfo.posList    = posInfoList;
                    pathInfo.timeLength = timeLength;

                    LocationHistoryPath_M histoyObj = LocationHistoryManager.Instance.ShowLocationHistoryPath_M(pathInfo);
                    //histoyObj.InitData(timeLength, timelist);
                    HistoryManController historyManController = histoyObj.gameObject.AddComponent <HistoryManController>();
                    histoyObj.historyManController            = historyManController;
                    historyManController.Init(colorT, histoyObj);
                    PersonAnimationController personAnimationController = histoyObj.gameObject.GetComponent <PersonAnimationController>();
                    personAnimationController.DoMove();
                    Debug.Log("StartSingleThread2");
                    k++;
                }
            });

            //Debug.Log("StartSingleThread3");
            Loom.DispatchToMainThread(() =>
            {
                isLoadDataSuccessed = true;
                //timeStart = Time.time;
                timeSum = 0;
                Debug.Log("StartSingleThread3");
                if (firstPoint != null)
                {
                    DateTime t = LocationManager.GetTimestampToDateTime(firstPoint.Time);
                    Debug.Log(firstPoint.Time);
                    timeSum = t.Hour * 3600 + t.Minute * 60 + t.Second - slider.ValueMin * 3600;
                    Debug.Log(timeSum);
                }
            });
        });
    }
 /// <summary>
 /// 设置当前聚焦定位人员
 /// </summary>
 public void SetFocusController(HistoryManController controllerT)
 {
     currentFocusController = controllerT;
 }
Example #8
0
    /// <summary>
    /// 显示某个标签的历史数据
    /// </summary>
    /// <param name="code"></param>
    public void ShowHistoryData()
    {
        if (isLoadDataSuccessed)
        {
            return;
        }
        //LocationManager.Instance.ClearHistoryPaths();
        //string code = "0002";
        List <Vector3>  list        = new List <Vector3>();
        List <DateTime> timelist    = new List <DateTime>();
        var             posInfoList = new PositionInfoList();
        DateTime        end         = GetEndTime();
        DateTime        start       = GetStartTime();

        //List<Position> positions = new List<Position>();
        positions = new List <Position>();

        List <int> topoNodeIds = RoomFactory.Instance.GetCurrentDepNodeChildNodeIds(SceneEvents.DepNode);


        Loom.StartSingleThread(() =>
        {
            //ps = CommunicationObject.Instance.GetHistoryPositonsByTime(code, start, end);
            positions = GetHistoryData(personnel.Id, topoNodeIds, start, end);

            Loom.DispatchToMainThread(() =>
            {
                Debug.LogError("点数:" + positions.Count);
                if (positions.Count < 2)
                {
                    return;
                }

                for (int i = 0; i < positions.Count; i++)
                {
                    var p = new PositionInfo(positions[i], start);
                    posInfoList.Add(p);
                }

                PathInfo pathInfo   = new PathInfo();
                pathInfo.personnelT = personnel;
                pathInfo.color      = Color.green;
                pathInfo.posList    = posInfoList;
                pathInfo.timeLength = timeLength;

                LocationHistoryPath histoyObj             = LocationHistoryManager.Instance.ShowLocationHistoryPath(pathInfo, "HistoryPath0002");
                HistoryManController historyManController = histoyObj.gameObject.AddComponent <HistoryManController>();
                histoyObj.historyManController            = historyManController;
                historyManController.Init(Color.green, histoyObj);
                PersonAnimationController personAnimationController = histoyObj.gameObject.GetComponent <PersonAnimationController>();
                personAnimationController.DoMove();

                PathFindingManager.Instance.StartNavAgent(historyManController);

                isLoadDataSuccessed = true;
                timeStart           = Time.time;
                timeSum             = 0;
                //histoyObj.InitData(timeLength, timelist);
            });
        });
    }