This commit is contained in:
parent
7cc9db8d7d
commit
5895771d3c
|
@ -8,13 +8,13 @@ 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 redShowImage;
|
||||||
public RawImage blueShowImage;
|
public RawImage blueShowImage;
|
||||||
public DroneViewDisplay droneViewDisplay;
|
private DroneViewDisplay droneViewDisplay;
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
|
@ -54,10 +54,28 @@ public class PostureController : MonoBehaviour
|
||||||
for (int i = 0; i < redObjs.Count; i++)
|
for (int i = 0; i < redObjs.Count; i++)
|
||||||
{
|
{
|
||||||
CreatDeviceItem(redContanier, redObjs[i].name, redObjs[i].deviceID, 0);
|
CreatDeviceItem(redContanier, redObjs[i].name, redObjs[i].deviceID, 0);
|
||||||
|
redObjs[i].onDeviceDelete += RemoveItem;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < blueObjs.Count; i++)
|
for (int i = 0; i < blueObjs.Count; i++)
|
||||||
{
|
{
|
||||||
CreatDeviceItem(blueContanier, blueObjs[i].name, redObjs[i].deviceID, 1);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +87,7 @@ public class PostureController : MonoBehaviour
|
||||||
{
|
{
|
||||||
OnDeviceBtn(id, redOrBlue);
|
OnDeviceBtn(id, redOrBlue);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDeviceBtn(string id, int redOrBlue)
|
private void OnDeviceBtn(string id, int redOrBlue)
|
||||||
|
|
|
@ -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>();
|
||||||
|
@ -78,7 +81,7 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
}
|
}
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
_isStartRehearsing= GlobalFlag.isStartRehearsing;
|
_isStartRehearsing = GlobalFlag.isStartRehearsing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,7 +175,7 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
TerrestrialRadioInterferenceManger terrestrialRadioInterferenceManger = GetComponent<TerrestrialRadioInterferenceManger>();
|
TerrestrialRadioInterferenceManger terrestrialRadioInterferenceManger = GetComponent<TerrestrialRadioInterferenceManger>();
|
||||||
terrestrialRadioInterferenceManger.FillInTheData(weaponitemone);
|
terrestrialRadioInterferenceManger.FillInTheData(weaponitemone);
|
||||||
terrestrialRadioInterferenceManger.isStartRehearsing = isStartRehearsing;
|
terrestrialRadioInterferenceManger.isStartRehearsing = isStartRehearsing;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "蜂群无人机":
|
case "蜂群无人机":
|
||||||
UnmannedAerialVehicleManage unmannedAerialVehicleManage = GetComponent<UnmannedAerialVehicleManage>();
|
UnmannedAerialVehicleManage unmannedAerialVehicleManage = GetComponent<UnmannedAerialVehicleManage>();
|
||||||
|
@ -331,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);
|
||||||
|
@ -338,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:
|
||||||
|
|
|
@ -207,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);
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in New Issue