/// <summary> /// 显示界面 /// </summary> public void ShowUI() { if (CurrentMonitor != null && CurrentMonitor != this) { CurrentMonitor.CloseUI(); } CurrentMonitor = this; BgToggle.isOn = true; gameObject.SetActive(true); }
/// <summary> /// 隐藏界面 /// </summary> public void CloseUI() { BgToggle.isOn = false; gameObject.SetActive(false); CurrentMonitor = null; if (devNode != null) { devNode.HighLightOff(); } }
/// <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); }
/// <summary> /// 创建漂浮UI /// </summary> public void CreateFollowUI() { if (Info == null) { if (isInfoFinded == false) { Info = CommunicationObject.Instance.GetDevByGameObjecName(this.name); Log.Info("FacilityDevController.CreateFollowUI", string.Format("FindInfo:{0},{1}", this.name, Info)); isInfoFinded = true; } } if (ParentDepNode == null) { Log.Error("FacilityDevController.CreateFollowUI", "ParentDepNode == null"); } FollowTargetManage.Instance.CreateDevFollowUI(gameObject, ParentDepNode, this, obj => { followUI = obj; }); }