Merge branch 'master' of http://git.umayle.com:2023/yulong/NewN_UAVPlane
This commit is contained in:
commit
7bc64d5aa8
|
@ -8,13 +8,13 @@ public class PostureController : MonoBehaviour
|
|||
{
|
||||
public List<EquipmentCommon> redObjs = new List<EquipmentCommon>();
|
||||
public List<EquipmentCommon> blueObjs = new List<EquipmentCommon>();
|
||||
public DeviceManager deviceManager;
|
||||
private DeviceManager deviceManager;
|
||||
public Transform redContanier;
|
||||
public Transform blueContanier;
|
||||
public DeviceBtnItem deviceBtnItem;
|
||||
public RawImage redShowImage;
|
||||
public RawImage blueShowImage;
|
||||
public DroneViewDisplay droneViewDisplay;
|
||||
private DroneViewDisplay droneViewDisplay;
|
||||
// Start is called before the first frame update
|
||||
void Awake()
|
||||
{
|
||||
|
@ -54,10 +54,28 @@ public class PostureController : MonoBehaviour
|
|||
for (int i = 0; i < redObjs.Count; i++)
|
||||
{
|
||||
CreatDeviceItem(redContanier, redObjs[i].name, redObjs[i].deviceID, 0);
|
||||
redObjs[i].onDeviceDelete += RemoveItem;
|
||||
}
|
||||
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);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void OnDeviceBtn(string id, int redOrBlue)
|
||||
|
|
|
@ -5,6 +5,7 @@ using AdamSync;
|
|||
using Newtonsoft.Json;
|
||||
using static InterfaceManager;
|
||||
using System.Collections;
|
||||
using UnityEngine.Events;
|
||||
|
||||
/// <summary>
|
||||
/// 设备
|
||||
|
@ -67,6 +68,8 @@ public class EquipmentCommon : MonoBehaviour
|
|||
/// </summary>
|
||||
public GameObject explodePrefab;
|
||||
|
||||
public UnityAction<string> onDeviceDelete;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
equipmentCommon = GetComponent<EquipmentCommon>();
|
||||
|
@ -78,7 +81,7 @@ public class EquipmentCommon : MonoBehaviour
|
|||
}
|
||||
void Start()
|
||||
{
|
||||
_isStartRehearsing= GlobalFlag.isStartRehearsing;
|
||||
_isStartRehearsing = GlobalFlag.isStartRehearsing;
|
||||
}
|
||||
|
||||
|
||||
|
@ -172,7 +175,7 @@ public class EquipmentCommon : MonoBehaviour
|
|||
TerrestrialRadioInterferenceManger terrestrialRadioInterferenceManger = GetComponent<TerrestrialRadioInterferenceManger>();
|
||||
terrestrialRadioInterferenceManger.FillInTheData(weaponitemone);
|
||||
terrestrialRadioInterferenceManger.isStartRehearsing = isStartRehearsing;
|
||||
|
||||
|
||||
break;
|
||||
case "蜂群无人机":
|
||||
UnmannedAerialVehicleManage unmannedAerialVehicleManage = GetComponent<UnmannedAerialVehicleManage>();
|
||||
|
@ -331,6 +334,7 @@ public class EquipmentCommon : MonoBehaviour
|
|||
}
|
||||
break;
|
||||
case "SetToBeDestroyed"://设备被销毁
|
||||
onDeviceDelete?.Invoke(deviceID);
|
||||
GameObject Bao = Instantiate(explodePrefab, transform);
|
||||
Bao.transform.localPosition = Vector3.zero;
|
||||
Bao.transform.SetParent(null);
|
||||
|
@ -338,6 +342,7 @@ public class EquipmentCommon : MonoBehaviour
|
|||
Destroy(transform.gameObject);
|
||||
break;
|
||||
case "SetToBeDestroyedTwo"://设备被收回
|
||||
onDeviceDelete?.Invoke(deviceID);
|
||||
Destroy(transform.gameObject);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -207,6 +207,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
headers.AddField("id", equipmentCommon.deviceID);
|
||||
StartCoroutine(PostString(Url_Deletepracticedevicedetail, headers, data =>
|
||||
{
|
||||
equipmentCommon.onDeviceDelete?.Invoke(equipmentCommon.deviceID);
|
||||
//Debug.Log(data);
|
||||
Destroy(gameObject);
|
||||
}));
|
||||
|
|
Loading…
Reference in New Issue