/// <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);
    }
Exemple #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;
        }
    }
    /// <summary>
    /// 显示展示信息UI
    /// </summary>
    private void ShowDisplayUI()
    {
        if (uguifollow == null)
        {
            uguifollow = GetComponent <UGUIFollowTarget>();
        }
        uguifollow.SetIsUp(true);

        ContentGrid_PlayForward();
        //LocationManager.Instance.FocusPerson((int)personnel.TagId);
        SetTagName(false);

        StartOutManage.Instance.SetUpperStoryButtonActive(false);
        StartOutManage.Instance.ShowBackButton(()
                                               =>
        {
            LocationManager.Instance.currentLocationFocusObj.SetRendererEnable(true, false);
            LocationManager.Instance.HideCurrentPersonInfoUI();
            //StartOutManage.Instance.HideBackButton();
            if (LocationManager.Instance.IsFocus)
            {
                LocationManager.Instance.RecoverBeforeFocusAlign();
            }
        });
    }
    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);
    }
    /// <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;
                }
            });
        }
    }
Exemple #6
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();
        }
    }
 /// <summary>
 /// 通过UI标志,移除目标物体
 /// </summary>
 /// <param name="groupName"></param>
 /// <param name="target"></param>
 public void RemoveUIbyTarget(string groupName, GameObject target)
 {
     if (name_uilist.ContainsKey(groupName))
     {
         List <GameObject> uis          = name_uilist[groupName];
         GameObject        targetFollow = null;
         foreach (GameObject ui in uis)
         {
             if (ui == null)
             {
                 continue;
             }
             UGUIFollowTarget follow = ui.GetComponent <UGUIFollowTarget>();
             if (follow.Target == target)
             {
                 targetFollow = ui;
                 break;
             }
         }
         if (targetFollow != null)
         {
             uis.Remove(targetFollow);
             DestroyImmediate(targetFollow);
         }
     }
 }
    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();
    }
    private void SetFollowTarget(List <DevNode> devList)
    {
        //int devCout = devList.Count;
        int followUiCout = FollowObject.Count;

        for (int i = 0; i < devList.Count; i++)
        {
            if (!CurrentDevList.Contains(devList[i]))
            {
                CurrentDevList.Add(devList[i]);
            }
            if (i < followUiCout)
            {
                UGUIFollowTarget followTarget = FollowObject[i].GetComponent <UGUIFollowTarget>();
                followTarget.Target = GetTitleObj(devList[i].gameObject);
                DevInfoFollowUI followItem = followTarget.GetComponent <DevInfoFollowUI>();
                followItem.Show(devList[i]);
                followTarget.gameObject.SetActive(true);
            }
            else
            {
                GameObject dev          = devList[i].gameObject;
                GameObject followTarget = InitFollowTarget(dev);
                FollowObject.Add(followTarget);
                DevInfoFollowUI followItem = followTarget.GetComponent <DevInfoFollowUI>();
                followItem.Show(devList[i]);
                followTarget.gameObject.SetActive(true);
            }
        }
    }
    /// <summary>
    /// 创建一项
    /// </summary>
    /// isCreateParent:是否创建父物体
    public GameObject CreateItem(GameObject prefabUI, GameObject target, string groupName, Camera camT = null, bool changeChildActive = false, bool isCreateParent = false, bool IsRayCheckCollision = false, bool isUseCanvasScalerT = true, int layerint = -1)
    {
        if (camT == null)
        {
            camT = GetCamera();
        }
        else
        {
        }
        UGUIFollowTarget followT = GetUIbyTarget(groupName, target);

        if (followT)
        {
            followT.gameObject.SetActive(true);
            return(followT.gameObject);
        }
        GameObject ui = Instantiate(prefabUI);

        ui.SetActive(true);

        UGUIFollowTarget followTarget = UGUIFollowTarget.AddUGUIFollowTarget(ui, target, camT, isUseCanvasScalerT, layerint);

        followTarget.SetTargetChildActive = changeChildActive;
        //followTarget.IsRayCheckCollision = IsRayCheckCollision;
        followTarget.SetIsRayCheckCollision(IsRayCheckCollision);

        if (isCreateParent)
        {
            if (name_uiparent.ContainsKey(groupName))
            {
                ui.transform.SetParent(name_uiparent[groupName].transform);
            }
            else
            {
                CreateParent(groupName);
                ui.transform.SetParent(name_uiparent[groupName].transform);
            }
        }
        else
        {
            ui.transform.SetParent(CommonFollowUIs);
        }

        ui.transform.localScale       = Vector3.one;
        ui.transform.localEulerAngles = Vector3.zero;

        if (name_uilist.ContainsKey(groupName))
        {
            name_uilist[groupName].Add(ui);
        }
        else
        {
            name_uilist.Add(groupName, new List <GameObject>());
            name_uilist[groupName].Add(ui);
        }


        return(ui);
    }
Exemple #11
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.
    }
    public void MobileInspectionPathFollowUI(string txtFlagNumT, PatrolPoint date)
    {
        patrolPointItem = date;

        SetFlagNum(txtFlagNumT);
        uguiFollowTarget = GetComponent <UGUIFollowTarget>();
        RouteBut.onClick.AddListener(ShowRouteInfo);
    }
    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);
    }
    /// <summary>
    /// 设置界面是否显示在最上层
    /// </summary>
    /// <param name="isUp"></param>
    private void SetLayerUp(bool isUp)
    {
        UGUIFollowTarget followTarget = transform.GetComponent <UGUIFollowTarget>();

        if (followTarget)
        {
            followTarget.SetIsUp(isUp);
        }
    }
 /// <summary>
 /// 初始化
 /// </summary>
 public void Init(bool isFinishedT, string txtFlagNumT, string txtContentT)
 {
     isFinished = isFinishedT;
     InitButtonSprite();
     InitColor();
     SetFlagNum(txtFlagNumT);
     SetTxtContent(txtContentT);
     uguiFollowTarget = GetComponent <UGUIFollowTarget>();
 }
    /// <summary>
    /// 设置提示框的位置
    /// </summary>
    public void SetPosition()
    {
        Vector3 screenPos = Input.mousePosition;
        //Vector3 panelPos = new Vector3(screenPos.x - (Screen.width / 2) + offset.x, screenPos.y - (Screen.height / 2) + offset.y);
        Vector3 panelPos = UGUIFollowTarget.ScreenToUI(Camera.main, canvasScaler, screenPos);
        Vector3 pos      = AdjustOutBorder(panelPos);

        panel.transform.localPosition = pos;
    }
    /// <summary>
    /// 设置UI的名称通过组名称和目标物体
    /// </summary>
    public void SetUIbyTarget(string groupname, GameObject target, bool isActive)
    {
        UGUIFollowTarget ui = GetUIbyTarget(groupname, target);

        if (ui != null)
        {
            ui.gameObject.SetActive(isActive);
        }
    }
    public void EntranceFollowUI()
    {
        // Vector3 p= UGUIFollowTarget.WorldToUIWithIgnoreCanvasScaler(Cam ,canvasT ,tagUi .transform .position );
        // this.transform.GetComponent<RectTransform>().localPosition = p;
        UGUIFollowTarget followTarget = UGUIFollowTarget.AddUGUIFollowTarget(this.gameObject, tagUi, Cam, isUseCanvasScalerT, layerint);

        followTarget.SetTargetChildActive = changeChildActive;
        //followTarget.IsRayCheckCollision = IsRayCheckCollision;
        followTarget.SetIsRayCheckCollision(IsRayCheckCollision);
    }
    // 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);
    }
    private void OnEnable()
    {
        UGUIFollowTarget follow = transform.GetComponent <UGUIFollowTarget>();

        if (follow && follow.Target)
        {
            bool isEnable = follow.Target.activeInHierarchy;
            if (!isEnable)
            {
                gameObject.SetActive(false);                    //加载精细模型时,不显示
            }
        }
    }
Exemple #21
0
    private void SetNormalFollowUIState(DevNode dev, bool isShow)
    {
        if (dev == null || dev.FollowUI == null)
        {
            return;
        }
        UGUIFollowTarget follow = dev.FollowUI.GetComponent <UGUIFollowTarget>();

        if (follow)
        {
            follow.enabled = isShow;
            dev.FollowUI.SetActive(isShow);
        }
    }
Exemple #22
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);
    }
Exemple #23
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);
        }
    }
Exemple #24
0
    /// <summary>
    /// 关闭漂浮U
    /// </summary>
    /// <param name="groupName"></param>
    /// <param name="dep"></param>
    private void HideObjectFollowUI(string groupName, DepNode dep)
    {
        if (dep.monitorRangeObject == null)
        {
            return;
        }
        string    groupNameTemp = string.Format("{0}{1}", groupName, dep.NodeID);
        Transform targetTagObj  = dep.monitorRangeObject.gameObject.transform.Find("TitleTag");

        if (targetTagObj)
        {
            UGUIFollowTarget obj = UGUIFollowManage.Instance.GetUIbyTarget(groupNameTemp, targetTagObj.gameObject);
            if (obj)
            {
                obj.gameObject.SetActive(false);
            }
        }
    }
    /// <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);
    }
 /// <summary>
 /// 获取UI标志通过目标物体
 /// </summary>
 public UGUIFollowTarget GetUIbyTarget(string gruopname, GameObject target)
 {
     if (name_uilist.ContainsKey(gruopname))
     {
         List <GameObject> uis = name_uilist[gruopname];
         foreach (GameObject ui in uis)
         {
             if (ui == null)
             {
                 continue;
             }
             UGUIFollowTarget follow = ui.GetComponent <UGUIFollowTarget>();
             if (follow.Target == target)
             {
                 return(follow);
             }
         }
     }
     return(null);
 }
 /// <summary>
 /// 设置跟随UI
 /// </summary>
 /// <param name="dev"></param>
 private void SetFollowTarget(GameObject dev)
 {
     if (_followObject == null)
     {
         _followObject = InitFollowTarget(dev);
     }
     else
     {
         UGUIFollowTarget followTarget = _followObject.GetComponent <UGUIFollowTarget>();
         GameObject       targetTagObj = GetTitleObj(dev);
         if (followTarget != null)
         {
             followTarget.Target = targetTagObj;
         }
     }
     if (DevInfo == null)
     {
         DevInfo = _followObject.GetComponent <DevInfoFollowUI>();
     }
 }
Exemple #29
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);
    }
Exemple #30
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");
    }