示例#1
0
    /// <summary>
    /// 开启摄像头UI
    /// </summary>
    /// <param name="cameraDev"></param>
    /// <param name="devDep"></param>
    /// <param name="info"></param>
    public void CreateCameraUI(GameObject cameraDev, DepNode devDep, DevNode info)
    {
        GameObject targetTagObj = UGUIFollowTarget.CreateTitleTag(cameraDev, Vector3.zero);

        if (UGUIFollowManage.Instance == null)
        {
            Debug.LogError("UGUIFollowManage.Instance==null");
            return;
        }
        if (RoamCamera == null)
        {
            return;
        }
        GameObject ui = Instantiate(CameraUIPrefab);

        ui.transform.parent           = CameraUIContainer.transform;
        ui.transform.localScale       = Vector3.one;
        ui.transform.localEulerAngles = Vector3.zero;
        ui.SetActive(true);
        UGUIFollowTarget followTarget = UGUIFollowTarget.AddUGUIFollowTarget(ui, targetTagObj, RoamCamera, true, -1);

        followTarget.SetIsRayCheckCollision(true);
        followTarget.SetEnableDistace(true, MaxUIDis);
        CameraMonitorFollowUI cameraInfo = ui.GetComponent <CameraMonitorFollowUI>();

        if (cameraInfo != null)
        {
            if (!RoamCameraList.Contains(cameraInfo))
            {
                RoamCameraList.Add(cameraInfo);
            }
            cameraInfo.SetInfo(info);
            //cameraInfo.Show();
        }
    }
示例#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;
        }
    }
    protected override void StartInit()
    {
        lines       = new List <VectorLine>();
        dottedlines = new List <VectorLine>();
        CreatePathParent();
        //LocationHistoryManager.Instance.AddHistoryPath(this as LocationHistoryPath);
        transform.SetParent(pathParent);
        if (PosCount <= 1)
        {
            return;
        }
        render   = gameObject.GetComponent <Renderer>();
        renders  = gameObject.GetComponentsInChildren <Renderer>();
        collider = gameObject.GetComponent <Collider>();

        GameObject targetTagObj = UGUIFollowTarget.CreateTitleTag(gameObject, new Vector3(0, 0.1f, 0));

        followUI = UGUIFollowManage.Instance.CreateItem(LocationHistoryManager.Instance.NameUIPrefab, targetTagObj, "LocationNameUI", null, true);
        Text nametxt = followUI.GetComponentInChildren <Text>();

        nametxt.text = name;
        if (historyManController)
        {
            historyManController.SetFollowUI(followUI);
        }

        GroupingLine();
    }
    /// <summary>
    /// 创建设备漂浮UI
    /// </summary>
    /// <param name="sisDev"></param>
    /// <param name="info"></param>
    /// <param name="isShow">是否显示</param>
    public GameObject CreateArchorFollowUI(GameObject archorDev, DepNode devDep, DevNode info)
    {
        GameObject targetTagObj = UGUIFollowTarget.CreateTitleTag(archorDev, Vector3.zero);

        if (UGUIFollowManage.Instance == null)
        {
            Debug.LogError("UGUIFollowManage.Instance==null");
            return(null);
        }
        Camera mainCamera = GetMainCamera();

        if (mainCamera == null)
        {
            return(null);
        }
        string devDepName = GetDepNodeId(devDep) + ArchorDevUIName;
        DisposeFollowTarget dispostTarget = targetTagObj.AddMissingComponent <DisposeFollowTarget>();

        dispostTarget.SetInfo(devDepName);

        //if (!DevDepNameList.Contains(devDepName)) DevDepNameList.Add(devDepName);
        GameObject          name         = UGUIFollowManage.Instance.CreateItem(ArchorDevUIPrefab, targetTagObj, devDepName, mainCamera, false, true);
        UGUIFollowTarget    followTarget = name.GetComponent <UGUIFollowTarget>();
        BaseStationFollowUI archorFollow = name.GetComponent <BaseStationFollowUI>();

        if (archorFollow != null)
        {
            archorFollow.InitInfo(info);
        }
        if (DevSubsystemManage.IsRoamState || !FunctionSwitchBarManage.Instance.ArchorInfoToggle.ison)
        {
            UGUIFollowManage.Instance.SetGroupUIbyName(devDepName, false);
        }
        return(name);
    }
    /// <summary>
    /// 显示工作票路线
    /// </summary>
    public void ShowMobileInspectionPath(PersonnelMobileInspection personnelMobileInspectionT)
    {
        Hide();
        if (personnelMobileInspectionT.list == null)
        {
            return;
        }
        for (int i = 0; i < personnelMobileInspectionT.list.Length; i++)
        {
            PersonnelMobileInspectionItem item = personnelMobileInspectionT.list[i];

            RoomFactory.Instance.GetDevByid(item.DevId,
                                            (devNodeT) =>
            {
                if (devNodeT == null)
                {
                    return;
                }
                GameObject targetTagObj1         = UGUIFollowTarget.CreateTitleTag(devNodeT.gameObject, Vector3.zero);
                GameObject uiObj1                = UGUIFollowManage.Instance.CreateItem(followUI.gameObject, targetTagObj1, "MobileInspectionUI", null, false, false);
                MobileInspectionFollowUI follow1 = uiObj1.GetComponent <MobileInspectionFollowUI>();

                List <PersonnelMobileInspectionItem> listT   = personnelMobileInspectionT.list.ToList();
                PersonnelMobileInspectionItem operationItemT = listT.Find((itemt) => itemt.DevId == devNodeT.Info.Id);
                try
                {
                    follow1.Init(true, operationItemT.nOrder.ToString(), devNodeT.name);
                }
                catch
                {
                    int j = 0;
                }
            });
        }
    }
    public GameObject CreateCameraUI(GameObject cameraDev, DepNode devDep, DevNode info)
    {
        GameObject targetTagObj = UGUIFollowTarget.CreateTitleTag(cameraDev, Vector3.zero);

        if (UGUIFollowManage.Instance == null)
        {
            Debug.LogError("UGUIFollowManage.Instance==null");
            return(null);
        }
        Camera mainCamera = GetMainCamera();

        if (mainCamera == null)
        {
            return(null);
        }
        string cameraDepName = GetDepNodeId(devDep) + CameraListName;
        DisposeFollowTarget dispostTarget = targetTagObj.AddMissingComponent <DisposeFollowTarget>();

        dispostTarget.SetInfo(cameraDepName);

        //if (!CameraDepNameList.Contains(cameraDepName)) CameraDepNameList.Add(cameraDepName);
        GameObject            name       = UGUIFollowManage.Instance.CreateItem(CameraUIPrefab, targetTagObj, cameraDepName, mainCamera, false, true);
        CameraMonitorFollowUI cameraInfo = name.GetComponent <CameraMonitorFollowUI>();

        if (cameraInfo != null)
        {
            cameraInfo.SetInfo(info);
        }
        if (DevSubsystemManage.IsRoamState || !FunctionSwitchBarManage.Instance.CameraToggle.ison || ObjectAddListManage.IsEditMode)
        {
            UGUIFollowManage.Instance.SetGroupUIbyName(cameraDepName, false);
        }
        return(name);
    }
示例#7
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.
    }
    private void NewMethod(Transform tranT, bool isFinishedT, string numStr, string contentStr)
    {
        GameObject targetTagObj          = UGUIFollowTarget.CreateTitleTag(tranT.gameObject, Vector3.zero);
        GameObject uiObj                 = UGUIFollowManage.Instance.CreateItem(followUI.gameObject, targetTagObj, "MobileInspectionUI", null, false, false);
        MobileInspectionFollowUI follow3 = uiObj.GetComponent <MobileInspectionFollowUI>();

        follow3.Init(isFinishedT, numStr, contentStr);
    }
    // Use this for initialization
    public override void Start()
    {
        base.Start();
        GameObject targetTagObj = UGUIFollowTarget.CreateTitleTag(gameObject, Vector3.zero);

        followNameUI = UGUIFollowManage.Instance.CreateItem(MonitorRangeManager.Instance.NameUI, targetTagObj, "BorderDevUI", null, false, false);
        Text ntxt = followNameUI.GetComponentInChildren <Text>();

        ntxt.text        = Info.Name;
        oriFollowUIColor = followNameUI.GetComponentInChildren <Image>().color;
        SetRendererEnable(false);
    }
示例#10
0
    /// <summary>
    /// 显示工作票路线
    /// </summary>
    public void ShowWorkTicketPath(WorkTicket workTicketT)
    {
        Hide();
        DepNode depNodeT = RoomFactory.Instance.GetDepNodeById(workTicketT.AreaId);

        if (depNodeT == null)
        {
            return;
        }
        GameObject        targetTagObj1 = UGUIFollowTarget.CreateTitleTag(depNodeT.NodeObject.gameObject, Vector3.zero);
        GameObject        uiObj1        = UGUIFollowManage.Instance.CreateItem(followUI.gameObject, targetTagObj1, "TwoTicketFollowUI", null, false, false);
        TwoTicketFollowUI follow1       = uiObj1.GetComponent <TwoTicketFollowUI>();

        follow1.Init(true, "1", depNodeT.NodeName);
        //CreateWorkTicketHistoryPath(workTicketT);
    }
示例#11
0
    private void InstantiateNavAgent(LocationObject o, Vector3 pos)
    {
        if (o == null)
        {
            Log.Error("PathFindingManager.InstantiateNavAgent", "o == null");
            return;
        }
        if (o.personnel == null)
        {
            Log.Error("PathFindingManager.InstantiateNavAgent", "o.personnel == null");
            return;
        }
        var prefab = TargetPrefabs[o.personnel.TargetType];
        var obj    = GameObject.Instantiate <GameObject>(prefab, pos, Quaternion.identity, o.transform.parent);
        //创建一个Agent跟随,这里要直接设置position,因为不设置的话,NavAgent必须在NavMesh上面初始化。
        var agent = obj.AddMissingComponent <NavAgentFollowPerson>();

        agent.MaxDistance = MaxDistance;
        agent.enableJump  = enableJump;

        agent.name             = o.gameObject.name + "(Nav)";
        agent.gameObject.layer = o.gameObject.layer;
        agent.gameObject.tag   = o.gameObject.tag;

        //agent.transform.parent = o.CreatePathParent();

        //agent.transform.position = o.transform.position;
        //agent.transform.parent = o.transform.parent;


        o.navAgentFollow = agent;
        agent.SetFollowTarget(o.transform);
        //agent.gameObject.SetActive(false);

        //o.uiTarget = agent.gameObject;//UI跟谁的目标

        DisableRenderer(o.gameObject);

        UGUIFollowTarget uiFollow = o.personInfoUI.gameObject.GetComponent <UGUIFollowTarget>();

        if (uiFollow != null)
        {
            uiFollow.Target = UGUIFollowTarget.CreateTitleTag(obj.gameObject, Vector3.zero);
        }
    }
    /// <summary>
    /// 创建建筑信息UI
    /// </summary>
    private void CreateFollowUI()
    {
        //if(FactoryDepManager.currentDep!=null||FactoryDepManager.currentDep as DepController)
        //{
        //    Debug.Log("FollowUI is exist:"+Name);
        //    return;
        //}
        GameObject         targetTagObj = UGUIFollowTarget.CreateTitleTag(gameObject, Vector3.zero);
        FollowTargetManage controller   = FollowTargetManage.Instance;

        if (controller != null && controller.BuildingNameUIPrefab != null)
        {
            if (UGUIFollowManage.Instance == null)
            {
                Debug.LogError("UGUIFollowManage.Instance==null");
                return;
            }
            Camera mainCamera = GetMainCamera();
            if (mainCamera == null)
            {
                return;
            }

            GameObject       name     = UGUIFollowManage.Instance.CreateItem(controller.BuildingNameUIPrefab, targetTagObj, controller.BuildingListName, null, false, true);
            BuildingFollowUI followUI = name.GetComponentInChildren <BuildingFollowUI>(false);

            DisposeFollowTarget dispostTarget = targetTagObj.AddMissingComponent <DisposeFollowTarget>();
            dispostTarget.SetInfo(controller.BuildingListName, name);

            if (followUI)
            {
                followUI.SetUIInfo(Name, Area, Height, FloorNum);
            }

            if (FunctionSwitchBarManage.Instance)
            {
                ToggleButton3 toggle = FunctionSwitchBarManage.Instance.BuildingToggle;
                if (!toggle.ison || FactoryDepManager.currentDep != FactoryDepManager.Instance)
                {
                    UGUIFollowManage.Instance.SetGroupUIbyName(controller.BuildingListName, false);
                }
            }
        }
    }
    /// <summary>
    /// 创建漂浮物体
    /// </summary>
    /// <param name="followPrefab"></param>
    /// <param name="dev"></param>
    /// <param name="UIGroupName"></param>
    /// <returns></returns>
    private GameObject CreateFollowTarget(GameObject followPrefab, GameObject dev, string UIGroupName)
    {
        GameObject targetTagObj = UGUIFollowTarget.CreateTitleTag(dev, Vector3.zero);

        if (UGUIFollowManage.Instance == null)
        {
            Debug.LogError("UGUIFollowManage.Instance==null");
            return(null);
        }
        Camera mainCamera = GetMainCamera();

        if (mainCamera == null)
        {
            return(null);
        }
        GameObject obj = UGUIFollowManage.Instance.CreateItem(followPrefab, targetTagObj, UIGroupName, mainCamera);

        return(obj);
    }
示例#14
0
    /// <summary>
    /// 显示工作票路线
    /// </summary>
    public void ShowOperationTicketPath(OperationTicket operationTicketT)
    {
        Hide();
        if (operationTicketT.OperationItems == null)
        {
            return;
        }
        for (int i = 0; i < operationTicketT.OperationItems.Length; i++)
        {
            OperationItem item = operationTicketT.OperationItems[i];
            //DevNode devNodeT = RoomFactory.Instance.GetDevById(item.DevId);
            //if (devNodeT == null) continue;
            //GameObject targetTagObj1 = UGUIFollowTarget.CreateTitleTag(devNodeT.gameObject, Vector3.zero);
            //GameObject uiObj1 = UGUIFollowManage.Instance.CreateItem(followUI.gameObject, targetTagObj1, "TwoTicketFollowUI", null, false, false);
            //MobileInspectionFollowUI follow1 = uiObj1.GetComponent<MobileInspectionFollowUI>();
            //follow1.Init(true, i.ToString(), devNodeT.name);

            RoomFactory.Instance.GetDevById(item.DevId,
                                            (devNodeT) =>
            {
                if (devNodeT == null)
                {
                    return;
                }
                GameObject targetTagObj1 = UGUIFollowTarget.CreateTitleTag(devNodeT.gameObject, Vector3.zero);
                GameObject uiObj1        = UGUIFollowManage.Instance.CreateItem(followUI.gameObject, targetTagObj1, "TwoTicketFollowUI", null, false, false);
                //MobileInspectionFollowUI follow1 = uiObj1.GetComponent<MobileInspectionFollowUI>();
                TwoTicketFollowUI follow1    = uiObj1.GetComponent <TwoTicketFollowUI>();
                List <OperationItem> listT   = operationTicketT.OperationItems.ToList();
                OperationItem operationItemT = listT.Find((itemt) => itemt.DevId == devNodeT.Info.DevID);
                //index = index + 1;
                //if (index > 0)
                //{
                //    follow1.Init(true, index.ToString(), devNodeT.name);
                //}
                follow1.Init(true, operationItemT.OrderNum.ToString(), devNodeT.name);
            });
        }

        //CreateOperationTicketHistoryPath(operationTicketT);
    }
示例#15
0
    public void ShowDemo2()
    {
        Hide();
        GameObject targetTagObj1         = UGUIFollowTarget.CreateTitleTag(item11.gameObject, Vector3.zero);
        GameObject uiObj1                = UGUIFollowManage.Instance.CreateItem(followUI.gameObject, targetTagObj1, "TwoTicketFollowUI", null, false, false);
        MobileInspectionFollowUI follow1 = uiObj1.GetComponent <MobileInspectionFollowUI>();

        follow1.Init(true, "1", "操作点1");

        GameObject targetTagObj2         = UGUIFollowTarget.CreateTitleTag(item22.gameObject, Vector3.zero);
        GameObject uiObj2                = UGUIFollowManage.Instance.CreateItem(followUI.gameObject, targetTagObj2, "TwoTicketFollowUI", null, false, false);
        MobileInspectionFollowUI follow2 = uiObj2.GetComponent <MobileInspectionFollowUI>();

        follow2.Init(true, "2", "操作点2");

        GameObject targetTagObj3         = UGUIFollowTarget.CreateTitleTag(item33.gameObject, Vector3.zero);
        GameObject uiObj3                = UGUIFollowManage.Instance.CreateItem(followUI.gameObject, targetTagObj3, "TwoTicketFollowUI", null, false, false);
        MobileInspectionFollowUI follow3 = uiObj3.GetComponent <MobileInspectionFollowUI>();

        follow3.Init(true, "3", "操作点3");
    }
    /// <summary>
    /// 创建设备漂浮UI
    /// </summary>
    /// <param name="sisDev"></param>
    /// <param name="info"></param>
    /// <param name="isShow">是否显示</param>
    public GameObject CreateDevFollowUI(GameObject sisDev, DepNode devDep, DevNode info, Action <DeviceFollowUI> onCreateFinished = null)
    {
        GameObject targetTagObj = UGUIFollowTarget.CreateTitleTag(sisDev, Vector3.zero);

        if (UGUIFollowManage.Instance == null)
        {
            Debug.LogError("UGUIFollowManage.Instance==null");
            return(null);
        }
        Camera mainCamera = GetMainCamera();

        if (mainCamera == null)
        {
            return(null);
        }
        string devDepName = GetDepNodeId(devDep) + DevListName;
        DisposeFollowTarget dispostTarget = targetTagObj.AddMissingComponent <DisposeFollowTarget>();

        dispostTarget.SetInfo(devDepName);

        //if (!DevDepNameList.Contains(devDepName)) DevDepNameList.Add(devDepName);
        GameObject       name         = UGUIFollowManage.Instance.CreateItem(DevUIPrefab, targetTagObj, devDepName, mainCamera, false, true);
        UGUIFollowTarget followTarget = name.GetComponent <UGUIFollowTarget>();
        //followTarget.SetEnableDistace(true,60);
        DeviceFollowUI cameraInfo = name.GetComponent <DeviceFollowUI>();

        if (cameraInfo != null)
        {
            cameraInfo.SetInfo(info);
            if (onCreateFinished != null)
            {
                onCreateFinished(cameraInfo);
            }
        }
        //if (DevSubsystemManage.IsRoamState||!FunctionSwitchBarManage.Instance.DevInfoToggle.ison)
        //{
        //    UGUIFollowManage.Instance.SetGroupUIbyName(devDepName, false);
        //}
        return(name);
    }
示例#17
0
    // Use this for initialization
    void Start()
    {
        alarmPersons    = new List <LocationObject>();
        locationPersons = new List <LocationObject>();
        InitDepNode();

        SetEditEvent(true);



        GameObject targetTagObj = UGUIFollowTarget.CreateTitleTag(gameObject, Vector3.zero);

        followNameUI         = UGUIFollowManage.Instance.CreateItem(MonitorRangeManager.Instance.NameUI, targetTagObj, "MapAreasUI", null, false, false);
        areaNameUIController = followNameUI.GetComponent <AreaNameUIController>();
        if (areaNameUIController)
        {
            areaNameUIController.SetMonitorRangeObject(this);
        }
        Text ntxt = followNameUI.GetComponentInChildren <Text>();

        ntxt.text        = info.Name;
        oriFollowUIColor = followNameUI.GetComponentInChildren <Image>().color;
        if (MonitorRangeManager.Instance.isShowRangeRender == false)
        {
            if (!MonitorRangeManager.Instance.IsEditState)
            {
                SetFollowNameUIEnable(false);
            }
        }

        if (isNewAdd)
        {
            areaNameUIController.SetImageRaycast(false);
        }

        if (MonitorRangeManager.Instance.IsEditState)
        {
            SetSelectedUI(true);
        }
    }
 public void ShowMobileInspectionPath(PatrolPoint date, int num)
 {
     RoomFactory.Instance.GetDevByid((int)date.DevId,
                                     (devNodeT) =>
     {
         if (devNodeT == null)
         {
             return;
         }
         GameObject targetTagObj1         = UGUIFollowTarget.CreateTitleTag(devNodeT.gameObject, Vector3.zero);
         GameObject uiObj1                = UGUIFollowManage.Instance.CreateItem(PatrolPointFollowPrafeb.gameObject, targetTagObj1, "MobileInspectionUI", null, false, false);
         MobileInspectionFollowUI follow1 = uiObj1.GetComponent <MobileInspectionFollowUI>();
         try
         {
             follow1.MobileInspectionPathFollowUI(num.ToString(), date);
         }
         catch
         {
             int j = 0;
         }
     });
 }