tttt
This commit is contained in:
commit
02f1a2ae12
|
@ -281,10 +281,10 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
deviceID:
|
deviceID:
|
||||||
textNmme: {fileID: 0}
|
textNmme: {fileID: 5661051786674650806}
|
||||||
btnAmplification: {fileID: 0}
|
btnAmplification: {fileID: 5661051786863276579}
|
||||||
btnClose: {fileID: 0}
|
btnClose: {fileID: 5661051786339230469}
|
||||||
rawShow: {fileID: 0}
|
rawShow: {fileID: 5661051785896792235}
|
||||||
--- !u!1 &5661051786674650808
|
--- !u!1 &5661051786674650808
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -324,8 +324,8 @@ Camera:
|
||||||
m_GameObject: {fileID: 2040130835863971667}
|
m_GameObject: {fileID: 2040130835863971667}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_ClearFlags: 1
|
m_ClearFlags: 2
|
||||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0}
|
||||||
m_projectionMatrixMode: 1
|
m_projectionMatrixMode: 1
|
||||||
m_GateFitMode: 2
|
m_GateFitMode: 2
|
||||||
m_FOVAxisMode: 0
|
m_FOVAxisMode: 0
|
||||||
|
@ -742,7 +742,7 @@ Camera:
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_ClearFlags: 1
|
m_ClearFlags: 1
|
||||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0}
|
||||||
m_projectionMatrixMode: 1
|
m_projectionMatrixMode: 1
|
||||||
m_GateFitMode: 2
|
m_GateFitMode: 2
|
||||||
m_FOVAxisMode: 0
|
m_FOVAxisMode: 0
|
||||||
|
|
|
@ -170,6 +170,7 @@ MonoBehaviour:
|
||||||
selfBtn: {fileID: 8125462804241330245}
|
selfBtn: {fileID: 8125462804241330245}
|
||||||
id:
|
id:
|
||||||
selfName:
|
selfName:
|
||||||
|
selfText: {fileID: 3870983289451212411}
|
||||||
--- !u!114 &8125462804241330245
|
--- !u!114 &8125462804241330245
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -8,11 +8,13 @@ public class DeviceBtnItem : MonoBehaviour
|
||||||
public Button selfBtn;
|
public Button selfBtn;
|
||||||
public string id;
|
public string id;
|
||||||
public string selfName;
|
public string selfName;
|
||||||
|
public Text selfText;
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
selfBtn = GetComponent<Button>();
|
||||||
|
selfText = transform.GetComponentInChildren<Text>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
@ -25,6 +27,7 @@ public class DeviceBtnItem : MonoBehaviour
|
||||||
{
|
{
|
||||||
id = _id;
|
id = _id;
|
||||||
selfName = _selfName;
|
selfName = _selfName;
|
||||||
|
selfText.text = _selfName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,14 +8,18 @@ public class PostureController : MonoBehaviour
|
||||||
{
|
{
|
||||||
public List<EquipmentCommon> redObjs = new List<EquipmentCommon>();
|
public List<EquipmentCommon> redObjs = new List<EquipmentCommon>();
|
||||||
public List<EquipmentCommon> blueObjs = new List<EquipmentCommon>();
|
public List<EquipmentCommon> blueObjs = new List<EquipmentCommon>();
|
||||||
public DeviceManager deviceManager;
|
private DeviceManager deviceManager;
|
||||||
public Transform redContanier;
|
public Transform redContanier;
|
||||||
public Transform blueContanier;
|
public Transform blueContanier;
|
||||||
public DeviceBtnItem deviceBtnItem;
|
public DeviceBtnItem deviceBtnItem;
|
||||||
|
public RawImage redShowImage;
|
||||||
|
public RawImage blueShowImage;
|
||||||
|
private DroneViewDisplay droneViewDisplay;
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
deviceManager = DeviceManager.Instance;
|
deviceManager = DeviceManager.Instance;
|
||||||
|
droneViewDisplay = DroneViewDisplay.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
@ -49,25 +53,56 @@ public class PostureController : MonoBehaviour
|
||||||
}
|
}
|
||||||
for (int i = 0; i < redObjs.Count; i++)
|
for (int i = 0; i < redObjs.Count; i++)
|
||||||
{
|
{
|
||||||
DeviceBtnItem obj = Instantiate(deviceBtnItem, redContanier);
|
CreatDeviceItem(redContanier, redObjs[i].name, redObjs[i].deviceID, 0);
|
||||||
obj.selfBtn.onClick.AddListener(() =>
|
redObjs[i].onDeviceDelete += RemoveItem;
|
||||||
{
|
|
||||||
OnDeviceBtn(obj.id);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
for (int i = 0; i < blueObjs.Count; i++)
|
for (int i = 0; i < blueObjs.Count; i++)
|
||||||
{
|
{
|
||||||
DeviceBtnItem obj = Instantiate(deviceBtnItem, blueContanier);
|
CreatDeviceItem(blueContanier, blueObjs[i].name, blueObjs[i].deviceID, 1);
|
||||||
|
blueObjs[i].onDeviceDelete += RemoveItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 实时更新设备列表
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public void RemoveItem(string id)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < redObjs.Count; i++)
|
||||||
|
{
|
||||||
|
if (redObjs[i].deviceID == id)
|
||||||
|
{
|
||||||
|
redObjs.Remove(redObjs[i]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreatDeviceItem(Transform contanier, string objName, string id, int redOrBlue)
|
||||||
|
{
|
||||||
|
DeviceBtnItem obj = Instantiate(deviceBtnItem, contanier);
|
||||||
|
obj.SetInfo(id, objName);
|
||||||
obj.selfBtn.onClick.AddListener(() =>
|
obj.selfBtn.onClick.AddListener(() =>
|
||||||
{
|
{
|
||||||
OnDeviceBtn(obj.id);
|
OnDeviceBtn(id, redOrBlue);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDeviceBtn(string id)
|
private void OnDeviceBtn(string id, int redOrBlue)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(id)) return;
|
||||||
|
if (redOrBlue == 0)
|
||||||
|
{
|
||||||
|
RenderTexture t = droneViewDisplay.renderTextureTo(id);
|
||||||
|
redShowImage.texture = t;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
blueShowImage.texture = droneViewDisplay.renderTextureTo(id);
|
||||||
|
|
||||||
|
}
|
||||||
Debug.Log(id);
|
Debug.Log(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,8 @@ public class GameManager : MonoSingleton<GameManager>
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
|
GlobalFlag.blueOrRed = 1;
|
||||||
|
Debug.Log(GlobalFlag.blueOrRed);
|
||||||
postureBtn.onClick.AddListener(() =>
|
postureBtn.onClick.AddListener(() =>
|
||||||
{
|
{
|
||||||
ChangeView(0);
|
ChangeView(0);
|
||||||
|
@ -61,6 +63,7 @@ public class GameManager : MonoSingleton<GameManager>
|
||||||
//0 red layer ==11 , 1 blue layer ==12
|
//0 red layer ==11 , 1 blue layer ==12
|
||||||
if (UIBootstrap.Instance.GetRoleByIDPracticeId(GlobalFlag.practiceSeatId) == "0")
|
if (UIBootstrap.Instance.GetRoleByIDPracticeId(GlobalFlag.practiceSeatId) == "0")
|
||||||
{
|
{
|
||||||
|
GlobalFlag.blueOrRed = 0;
|
||||||
spt.transform.position = redSpawnPos.position;
|
spt.transform.position = redSpawnPos.position;
|
||||||
spt.transform.eulerAngles = redSpawnPos.eulerAngles;
|
spt.transform.eulerAngles = redSpawnPos.eulerAngles;
|
||||||
spt.gameObject.SetActive(true);
|
spt.gameObject.SetActive(true);
|
||||||
|
@ -86,6 +89,7 @@ public class GameManager : MonoSingleton<GameManager>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
GlobalFlag.blueOrRed = 1;
|
||||||
for (int i = 0; i < dviceContent.childCount; i++)
|
for (int i = 0; i < dviceContent.childCount; i++)
|
||||||
{
|
{
|
||||||
Destroy(dviceContent.GetChild(i).gameObject);
|
Destroy(dviceContent.GetChild(i).gameObject);
|
||||||
|
@ -421,7 +425,11 @@ public class GameManager : MonoSingleton<GameManager>
|
||||||
device.GetComponent<EquipmentCommon>().isPlayer = true;
|
device.GetComponent<EquipmentCommon>().isPlayer = true;
|
||||||
}
|
}
|
||||||
if (device.GetComponent<UnmannedAerialVehicleManage>())
|
if (device.GetComponent<UnmannedAerialVehicleManage>())
|
||||||
|
{
|
||||||
device.GetComponent<UnmannedAerialVehicleManage>().SetTipsColor();
|
device.GetComponent<UnmannedAerialVehicleManage>().SetTipsColor();
|
||||||
|
DroneViewDisplay.Instance.CreateUI(device.GetComponent<UnmannedAerialVehicleManage>(), false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGetRoomUsers(string obj)
|
private void OnGetRoomUsers(string obj)
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class UIBootstrap : MonoSingleton<UIBootstrap>
|
||||||
return subjectInfo[index].Role;
|
return subjectInfo[index].Role;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "0";
|
return "-1";
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否分配角色
|
/// 是否分配角色
|
||||||
|
|
|
@ -23,4 +23,8 @@ public class GlobalFlag
|
||||||
/// 当前房间科目ID
|
/// 当前房间科目ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string practiceSubjectID;
|
public static string practiceSubjectID;
|
||||||
|
/// <summary>
|
||||||
|
/// 红方蓝方
|
||||||
|
/// </summary>
|
||||||
|
public static int blueOrRed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ using AdamSync;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using static InterfaceManager;
|
using static InterfaceManager;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using UnityEngine.Events;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备
|
/// 设备
|
||||||
|
@ -67,6 +68,8 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GameObject explodePrefab;
|
public GameObject explodePrefab;
|
||||||
|
|
||||||
|
public UnityAction<string> onDeviceDelete;
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
equipmentCommon = GetComponent<EquipmentCommon>();
|
equipmentCommon = GetComponent<EquipmentCommon>();
|
||||||
|
@ -179,6 +182,8 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
unmannedAerialVehicleManage.MatrixFormation(30, 1);
|
unmannedAerialVehicleManage.MatrixFormation(30, 1);
|
||||||
unmannedAerialVehicleManage.FillInTheData(weaponitemone);
|
unmannedAerialVehicleManage.FillInTheData(weaponitemone);
|
||||||
unmannedAerialVehicleManage.isStartRehearsing = isStartRehearsing;
|
unmannedAerialVehicleManage.isStartRehearsing = isStartRehearsing;
|
||||||
|
DroneViewDisplay.Instance.CreateUI(unmannedAerialVehicleManage, false);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "频谱探测":
|
case "频谱探测":
|
||||||
Spectrumdetection spectrumdetection = GetComponent<Spectrumdetection>();
|
Spectrumdetection spectrumdetection = GetComponent<Spectrumdetection>();
|
||||||
|
@ -329,6 +334,7 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "SetToBeDestroyed"://设备被销毁
|
case "SetToBeDestroyed"://设备被销毁
|
||||||
|
onDeviceDelete?.Invoke(deviceID);
|
||||||
GameObject Bao = Instantiate(explodePrefab, transform);
|
GameObject Bao = Instantiate(explodePrefab, transform);
|
||||||
Bao.transform.localPosition = Vector3.zero;
|
Bao.transform.localPosition = Vector3.zero;
|
||||||
Bao.transform.SetParent(null);
|
Bao.transform.SetParent(null);
|
||||||
|
@ -336,6 +342,7 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
Destroy(transform.gameObject);
|
Destroy(transform.gameObject);
|
||||||
break;
|
break;
|
||||||
case "SetToBeDestroyedTwo"://设备被收回
|
case "SetToBeDestroyedTwo"://设备被收回
|
||||||
|
onDeviceDelete?.Invoke(deviceID);
|
||||||
Destroy(transform.gameObject);
|
Destroy(transform.gameObject);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -162,7 +162,6 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
||||||
//Formation(1);//默认阵型
|
//Formation(1);//默认阵型
|
||||||
// 订阅布尔值变化事件
|
// 订阅布尔值变化事件
|
||||||
OnActivationChanged += OnActivationChangedHandler;
|
OnActivationChanged += OnActivationChangedHandler;
|
||||||
DroneViewDisplay.Instance.CreateUI(this, false);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,6 +207,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
||||||
headers.AddField("id", equipmentCommon.deviceID);
|
headers.AddField("id", equipmentCommon.deviceID);
|
||||||
StartCoroutine(PostString(Url_Deletepracticedevicedetail, headers, data =>
|
StartCoroutine(PostString(Url_Deletepracticedevicedetail, headers, data =>
|
||||||
{
|
{
|
||||||
|
equipmentCommon.onDeviceDelete?.Invoke(equipmentCommon.deviceID);
|
||||||
//Debug.Log(data);
|
//Debug.Log(data);
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -47,28 +47,25 @@ public class DroneViewDisplay : MonoSingleton<DroneViewDisplay>
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
Debug.Log(GlobalFlag.blueOrRed);
|
||||||
|
transform.localScale = GlobalFlag.blueOrRed == 0 ? Vector3.one : Vector3.zero;
|
||||||
btnClose.onClick.AddListener(() => { radioAngleViewMax.localScale = Vector3.zero; });
|
btnClose.onClick.AddListener(() => { radioAngleViewMax.localScale = Vector3.zero; });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示UI
|
/// 显示UI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceID">无人机设备id</param>
|
/// <param name="unmannedAerialVehicleManage">无人机脚本</param>
|
||||||
/// <param name="wRJModel">无人机设备类型</param>
|
/// <param name="isShow">是否显示</param>
|
||||||
/// <param name="name">无人机名称</param>
|
|
||||||
/// <param name="camera">渲染摄像机画面</param>
|
|
||||||
public void CreateUI(UnmannedAerialVehicleManage unmannedAerialVehicleManage, bool isShow)
|
public void CreateUI(UnmannedAerialVehicleManage unmannedAerialVehicleManage, bool isShow)
|
||||||
{
|
{
|
||||||
|
Debug.Log("生成:" + unmannedAerialVehicleManage.transform.name);
|
||||||
|
if (unmannedAerialVehicleManage.equipmentCommon.deviceID.Length < 10) return;
|
||||||
RadioAngleView radioAngleView = radioAngleViews.Find(x => x.deviceID == unmannedAerialVehicleManage.equipmentCommon.deviceID);
|
RadioAngleView radioAngleView = radioAngleViews.Find(x => x.deviceID == unmannedAerialVehicleManage.equipmentCommon.deviceID);
|
||||||
if (radioAngleView)
|
if (radioAngleView)
|
||||||
{
|
{
|
||||||
radioAngleViewMax.localScale = Vector3.one;
|
radioAngleView.transform.SetAsFirstSibling(); // 移到父物体的第一个位置
|
||||||
|
radioAngleView.transform.localScale = Vector3.one;
|
||||||
textNmme.text = name;
|
textNmme.text = name;
|
||||||
rawShow.texture = unmannedAerialVehicleManage.wrjModel == WRJModel.电子侦察无人机 ?
|
rawShow.texture = unmannedAerialVehicleManage.wrjModel == WRJModel.电子侦察无人机 ?
|
||||||
unmannedAerialVehicleManage.dzWRJCamera.targetTexture : unmannedAerialVehicleManage.gxWRJCamera.targetTexture;
|
unmannedAerialVehicleManage.dzWRJCamera.targetTexture : unmannedAerialVehicleManage.gxWRJCamera.targetTexture;
|
||||||
|
@ -76,33 +73,46 @@ public class DroneViewDisplay : MonoSingleton<DroneViewDisplay>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (unmannedAerialVehicleManage.wrjModel == WRJModel.电子侦察无人机|| unmannedAerialVehicleManage.wrjModel == WRJModel.光学无人机){
|
if (unmannedAerialVehicleManage.wrjModel == WRJModel.电子侦察无人机 || unmannedAerialVehicleManage.wrjModel == WRJModel.光学无人机)
|
||||||
GameObject wrj = Instantiate(prefabRadioAngleView, uiParent);
|
|
||||||
wrj.transform.localScale = isShow ? Vector3.one : Vector3.zero;
|
|
||||||
wrj.name = name;
|
|
||||||
RadioAngleView _radioAngleView = wrj.GetComponent<RadioAngleView>();
|
|
||||||
if (_radioAngleView)
|
|
||||||
{
|
{
|
||||||
_radioAngleView.deviceID = unmannedAerialVehicleManage.equipmentCommon.deviceID;
|
GameObject wrj = Instantiate(prefabRadioAngleView, uiParent);
|
||||||
_radioAngleView.textNmme.text = name; Mask mask = wrj.transform.GetComponentInChildren<Mask>();
|
wrj.transform.localScale = Vector3.zero;
|
||||||
|
wrj.name = name;
|
||||||
|
wrj.transform.SetAsLastSibling();// 移到父物体的最后一个位置
|
||||||
|
RadioAngleView radioAngleViewMain = wrj.GetComponent<RadioAngleView>();
|
||||||
|
if (radioAngleViewMain)
|
||||||
|
{
|
||||||
|
radioAngleViewMain.deviceID = unmannedAerialVehicleManage.equipmentCommon.deviceID;
|
||||||
|
radioAngleViewMain.textNmme.text = name;
|
||||||
|
radioAngleViewMain.typeWRJ= unmannedAerialVehicleManage.wrjModel;
|
||||||
|
Mask mask = wrj.transform.GetComponentInChildren<Mask>();
|
||||||
if (mask)
|
if (mask)
|
||||||
mask.enabled = unmannedAerialVehicleManage.wrjModel == WRJModel.电子侦察无人机 ? true : false;
|
mask.enabled = unmannedAerialVehicleManage.wrjModel == WRJModel.电子侦察无人机 ? true : false;
|
||||||
radioAngleViews.Add(_radioAngleView);
|
|
||||||
// 创建 RenderTexture
|
// 创建 RenderTexture
|
||||||
RenderTexture renderTexture = new RenderTexture(500, 500, 0);
|
RenderTexture renderTexture = new RenderTexture(500, 500, 0);
|
||||||
renderTexture.name = unmannedAerialVehicleManage.equipmentCommon.deviceID;
|
renderTexture.name = unmannedAerialVehicleManage.equipmentCommon.deviceID;
|
||||||
|
if(unmannedAerialVehicleManage.wrjModel == WRJModel.电子侦察无人机)
|
||||||
|
{
|
||||||
|
unmannedAerialVehicleManage.dzWRJCamera.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unmannedAerialVehicleManage.gxWRJCamera.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
unmannedAerialVehicleManage.dzWRJCamera.targetTexture = renderTexture;
|
unmannedAerialVehicleManage.dzWRJCamera.targetTexture = renderTexture;
|
||||||
unmannedAerialVehicleManage.gxWRJCamera.targetTexture = renderTexture;
|
unmannedAerialVehicleManage.gxWRJCamera.targetTexture = renderTexture;
|
||||||
_radioAngleView.rawShow.texture = unmannedAerialVehicleManage.wrjModel == WRJModel.电子侦察无人机 ?
|
radioAngleViewMain.rawShow.texture = unmannedAerialVehicleManage.wrjModel == WRJModel.电子侦察无人机 ?
|
||||||
unmannedAerialVehicleManage.dzWRJCamera.targetTexture : unmannedAerialVehicleManage.gxWRJCamera.targetTexture;
|
unmannedAerialVehicleManage.dzWRJCamera.targetTexture : unmannedAerialVehicleManage.gxWRJCamera.targetTexture;
|
||||||
|
|
||||||
renderTextures.Add(renderTexture);
|
renderTextures.Add(renderTexture);
|
||||||
|
radioAngleViews.Add(radioAngleViewMain);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 删除无人机UI
|
/// 删除无人机UI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -134,4 +144,41 @@ public class DroneViewDisplay : MonoSingleton<DroneViewDisplay>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据deviceID返回RenderTexture
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="deviceID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public RenderTexture renderTextureTo(string deviceID)
|
||||||
|
{
|
||||||
|
RenderTexture radioAngleView = renderTextures.Find(x => x.name == deviceID);
|
||||||
|
return radioAngleView;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 打开放大UI
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="_textNmme"></param>
|
||||||
|
/// <param name="rawShow"></param
|
||||||
|
public void RadioAngleViewMaxShow(string _textNmme , RawImage _rawShow, WRJModel wRJModel)
|
||||||
|
{
|
||||||
|
rawShow.texture = null;
|
||||||
|
radioAngleViewMax.localScale = Vector3.one;
|
||||||
|
textNmme.text = _textNmme;
|
||||||
|
rawShow.texture = _rawShow.texture;
|
||||||
|
Mask mask = radioAngleViewMax.transform.GetComponentInChildren<Mask>();
|
||||||
|
if (mask)
|
||||||
|
mask.enabled = wRJModel == WRJModel.电子侦察无人机 ? true : false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void OnDestroy()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < renderTextures.Count; i++)
|
||||||
|
{
|
||||||
|
Destroy((RenderTexture)renderTextures[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,10 @@ public class RadioAngleView : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string deviceID;
|
public string deviceID;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 无人机类型
|
||||||
|
/// </summary>
|
||||||
|
public WRJModel typeWRJ;
|
||||||
|
/// <summary>
|
||||||
/// 无人机
|
/// 无人机
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Text textNmme;
|
public Text textNmme;
|
||||||
|
@ -32,17 +36,19 @@ public class RadioAngleView : MonoBehaviour
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
textNmme=transform.Find("名称").GetComponent<Text>();
|
//textNmme=transform.Find("名称").GetComponent<Text>();
|
||||||
btnAmplification = transform.Find("放大查看").GetComponent<Button>();
|
//btnAmplification = transform.Find("放大查看").GetComponent<Button>();
|
||||||
btnClose = transform.Find("关闭").GetComponent<Button>();
|
//btnClose = transform.Find("关闭").GetComponent<Button>();
|
||||||
rawShow=transform.GetComponentInChildren<RawImage>();
|
//rawShow=transform.GetComponentInChildren<RawImage>();
|
||||||
btnAmplification.onClick.AddListener(() =>
|
btnAmplification.onClick.AddListener(() =>
|
||||||
{
|
{
|
||||||
//吧放大UI打开
|
//吧放大UI打开
|
||||||
|
DroneViewDisplay.Instance.RadioAngleViewMaxShow(textNmme.text, rawShow, typeWRJ);
|
||||||
});
|
});
|
||||||
btnClose.onClick.AddListener(() =>
|
btnClose.onClick.AddListener(() =>
|
||||||
{
|
{
|
||||||
transform.localScale = Vector3.zero;
|
transform.localScale = Vector3.zero;
|
||||||
|
transform.SetAsLastSibling();// 移到父物体的最后一个位置
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue