diff --git a/Assets/Temp/Scripts/Spectrumdetection.cs b/Assets/Temp/Scripts/Spectrumdetection.cs index 29f63310..19e5527e 100644 --- a/Assets/Temp/Scripts/Spectrumdetection.cs +++ b/Assets/Temp/Scripts/Spectrumdetection.cs @@ -1,5 +1,6 @@ using AdamThinkDevicesData; using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using System; using System.Collections; using System.Collections.Generic; @@ -90,8 +91,14 @@ public class Spectrumdetection : MonoBehaviour /// 摄像机显示层数 /// public Camera camera; - + /// + /// + /// public RawImage rawImage; + /// + /// + /// + private bool onlyOne = true; void Start() { spectrumdetections.Add(this); @@ -101,9 +108,18 @@ public class Spectrumdetection : MonoBehaviour OnActivationChanged += OnActivationChangedHandler; _isStartRehearsing = GlobalFlag.isStartRehearsing; Microwave(); - DroneViewDisplay.Instance.CreateUI(equipmentCommon.deviceID, camera, rawImage); + //DroneViewDisplay.Instance.CreateUI(equipmentCommon.deviceID, camera, rawImage); + } + + void Update() + { + if (onlyOne && equipmentCommon.deviceID.Length > 10) + { + onlyOne = false; + DroneViewDisplay.Instance.CreateUI(equipmentCommon.deviceID, camera, rawImage); + } + Search();//微波武器朝向无人机 } - private void Microwave() { frenbutton.onClick.AddListener(() => @@ -341,11 +357,6 @@ public class Spectrumdetection : MonoBehaviour } } - void Update() - { - Search();//微波武器朝向无人机 - //Emittedray(); - } /// /// 点击物体生成页面 /// diff --git a/Assets/Zion/Scripts/ModelFunction/LaserFireControlPlatform/LaserFireControlPlatformManger.cs b/Assets/Zion/Scripts/ModelFunction/LaserFireControlPlatform/LaserFireControlPlatformManger.cs index 204284d7..dead951b 100644 --- a/Assets/Zion/Scripts/ModelFunction/LaserFireControlPlatform/LaserFireControlPlatformManger.cs +++ b/Assets/Zion/Scripts/ModelFunction/LaserFireControlPlatform/LaserFireControlPlatformManger.cs @@ -150,7 +150,10 @@ public class LaserFireControlPlatformManger : MonoBehaviour /// 激光火炮打击时间 /// public float storageIntervalTime; - + /// + /// + /// + private bool onlyOne = true; /// /// 判断物体是否在相机里面 /// @@ -159,7 +162,6 @@ public class LaserFireControlPlatformManger : MonoBehaviour { equipmentCommon = GetComponent(); laserFireControlPlatformMangers.Add(this); - DroneViewDisplay.Instance.CreateUI(equipmentCommon.deviceID, camera, raw); //生成激光 GameObject _InnerLaserlineRenderer = Instantiate(InnerLaserlineRendererPrefab); _InnerLaserlineRenderer.transform.position = Vector3.zero; @@ -181,34 +183,18 @@ public class LaserFireControlPlatformManger : MonoBehaviour OuterLaserlineRenderer.SetPosition(0, LaserPoint.transform.position);// 设置线段起点为物体位置 OuterLaserlineRenderer.SetPosition(1, LaserPoint.transform.position);// 设置线段终点为目标点 } + } - + void Update() { lasertime -= Time.deltaTime; - - //if (UIBootstrap.Instance.GetRoleByIDPracticeId(GlobalFlag.practiceSeatId) != "0" && Input.GetMouseButtonDown(0)) - //{ - // Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); - // RaycastHit hit; - // if (Physics.Raycast(ray, out hit)) - // { - // if (EventSystem.current.IsPointerOverGameObject()) - // { - // return; - // } - // if (hit.transform.gameObject.tag == "AttackTarget" && hit.transform.GetComponent()) - // { - // Transform canvas = GameObject.Find("Canvas").transform; - // if (canvas) - // { - // Instantiate(RawImage, canvas); - // } - // } - // } - - //} + if (onlyOne && equipmentCommon.deviceID.Length > 10) + { + onlyOne = false; + DroneViewDisplay.Instance.CreateUI(equipmentCommon.deviceID, camera, raw); + } } @@ -463,7 +449,8 @@ public class LaserFireControlPlatformManger : MonoBehaviour //{ // Instantiate(RawImage, canvas); //} - rawImageUIObj.SetActive(true); + if (GlobalFlag.blueOrRed == 1) + rawImageUIObj.SetActive(true); } /// /// 检查鼠标是否离开物体 diff --git a/Assets/Zion/Scripts/ModelFunction/Radar/RadarManger.cs b/Assets/Zion/Scripts/ModelFunction/Radar/RadarManger.cs index ec61309c..29fcc18c 100644 --- a/Assets/Zion/Scripts/ModelFunction/Radar/RadarManger.cs +++ b/Assets/Zion/Scripts/ModelFunction/Radar/RadarManger.cs @@ -123,8 +123,14 @@ public class RadarManger : MonoBehaviour /// 激活面板预设体 /// public Image imageprs; - + /// + /// + /// public RawImage rawImage; + /// + /// + /// + private bool onlyOne = true; void Awake() { @@ -136,9 +142,17 @@ public class RadarManger : MonoBehaviour // 订阅布尔值变化事件 OnActivationChanged += OnActivationChangedHandler; - DroneViewDisplay.Instance.CreateUI(equipmentCommon.deviceID, minCamera, rawImage); + //DroneViewDisplay.Instance.CreateUI(equipmentCommon.deviceID, minCamera, rawImage); } + void Update() + { + if (onlyOne && equipmentCommon.deviceID.Length > 10) + { + onlyOne = false; + DroneViewDisplay.Instance.CreateUI(equipmentCommon.deviceID, minCamera, rawImage); + } + } #region 启动暂停 /// /// 导条变化调用 diff --git a/Assets/Zion/Scripts/WRJ0125/DroneViewDisplay.cs b/Assets/Zion/Scripts/WRJ0125/DroneViewDisplay.cs index cded4fb9..15a88a31 100644 --- a/Assets/Zion/Scripts/WRJ0125/DroneViewDisplay.cs +++ b/Assets/Zion/Scripts/WRJ0125/DroneViewDisplay.cs @@ -126,6 +126,9 @@ public class DroneViewDisplay : MonoSingleton /// public void CreateUI(string deviceID,Camera camera,RawImage rawImage) { + if (deviceID.Length < 10) return; + var v= renderTextures.Find(x=>x.name== deviceID); + if (v != null) return; RenderTexture renderTexture = new RenderTexture(500, 500, 0); renderTexture.name = deviceID; camera.targetTexture = renderTexture;