This commit is contained in:
yulong 2024-01-29 11:28:40 +08:00
commit 4327751b70
4 changed files with 51 additions and 36 deletions

View File

@ -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
/// 摄像机显示层数
/// </summary>
public Camera camera;
/// <summary>
///
/// </summary>
public RawImage rawImage;
/// <summary>
///
/// </summary>
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();
}
/// <summary>
/// 点击物体生成页面
/// </summary>

View File

@ -150,7 +150,10 @@ public class LaserFireControlPlatformManger : MonoBehaviour
/// 激光火炮打击时间
/// </summary>
public float storageIntervalTime;
/// <summary>
///
/// </summary>
private bool onlyOne = true;
/// <summary>
/// 判断物体是否在相机里面
/// </summary>
@ -159,7 +162,6 @@ public class LaserFireControlPlatformManger : MonoBehaviour
{
equipmentCommon = GetComponent<EquipmentCommon>();
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<LaserFireControlPlatformManger>())
// {
// 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);
}
/// <summary>
/// 检查鼠标是否离开物体

View File

@ -123,8 +123,14 @@ public class RadarManger : MonoBehaviour
/// 激活面板预设体
/// </summary>
public Image imageprs;
/// <summary>
///
/// </summary>
public RawImage rawImage;
/// <summary>
///
/// </summary>
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
/// <summary>
/// 导条变化调用

View File

@ -126,6 +126,9 @@ public class DroneViewDisplay : MonoSingleton<DroneViewDisplay>
/// <param name="rawImage"></param>
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;