Compare commits

...

3 Commits

Author SHA1 Message Date
账号名 ea2b35a030 删除设备接口调试 2023-11-24 14:57:05 +08:00
账号名 2d0f6cd10d Merge branch 'master' of http://git.umayle.com:2023/yulong/NewN_UAVPlane 2023-11-24 13:48:54 +08:00
账号名 acb5d28826 bug 2023-11-24 13:44:35 +08:00
4 changed files with 58 additions and 10 deletions

View File

@ -54,6 +54,10 @@ public static class InterfaceManager
/// 修改环境
/// </summary>
public static string Url_update_env { get => IpAddress + "/Handler/Thinkingfile.ashx?action=update_env"; }
/// <summary>
/// 删除房间想定设备详情
/// </summary>
public static string Url_Deletepracticedevicedetail { get => IpAddress + "/Handler/Thinkingfile.ashx?action=deletepracticedevicedetail"; }
#endregion
public static string GetLocalTxt(string path)
@ -172,6 +176,31 @@ public static class InterfaceManager
}
}
public static IEnumerator PostString(string url, WWWForm formdata, Action<string> callback = null)
{
using (UnityWebRequest www = UnityWebRequest.Post(url, formdata))
{
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
callback(null);
Debug.Log("网络请求失败了");
}
else
{
if (!string.IsNullOrEmpty(www.downloadHandler.text))
{
callback(www.downloadHandler.text);
}
else
{
callback(null);
}
}
}
}
public static IEnumerator GetString(string url, Dictionary<string, string> headers = null,int time=50,Action<string> callback = null)
{
while (true)

View File

@ -18,7 +18,7 @@ public class DistanceMeasurement : MonoBehaviour
{
if (isPathCanBePlanned)
{
if (Input.GetMouseButtonDown(0)&& IsPointerOverUI())
if (Input.GetMouseButtonDown(0)&& !IsPointerOverUI())
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
@ -27,7 +27,7 @@ public class DistanceMeasurement : MonoBehaviour
AddMarker(hit.point);
}
}
if (Input.GetMouseButtonDown(1) && IsPointerOverUI())
if (Input.GetMouseButtonDown(1) && !IsPointerOverUI())
{
ClearMarkers();
}
@ -59,6 +59,7 @@ public class DistanceMeasurement : MonoBehaviour
newMarkers[markers.Length] = go.transform;
markers = newMarkers;
unmannedAerialVehicleManage.positions.Enqueue(go.transform.position);
go.transform.SetParent(transform);
}
// 根据新的标记点数组重新绘制路径

View File

@ -4,6 +4,7 @@ using UnityEngine;
using DG.Tweening;
using System.Linq;
using AdamSync;
using static InterfaceManager;
/// <summary>
/// 无人机
@ -155,6 +156,11 @@ public class UnmannedAerialVehicle : MonoBehaviour
string nowData = string.Format("{0},{1}", "SetToBeDestroyed", _equipmentCommon.deviceID);
Debug.Log(nowData);
_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
Dictionary<string, string> headers = new Dictionary<string, string>();
headers.Add("id", _equipmentCommon.deviceID);
StartCoroutine(GetString(Url_Deletepracticedevicedetail, headers, data => {
Debug.Log(data);
}));
GameObject Bao = Instantiate(explodePrefab, _transform);
Bao.transform.localPosition = Vector3.zero;
Bao.transform.SetParent(null);

View File

@ -6,6 +6,7 @@ using UnityEngine;
using AdamThinkDevicesData;
using AdamSync;
using System.Linq;
using static InterfaceManager;
/// <summary>
/// 单个无人机蜂群控制
@ -143,14 +144,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
// Update is called once per frame
void Update()
{
if (isStartRehearsing && equipmentCommon.isPlayer && pattern == Pattern.)
{
if (airRoute)
{
StartMoveObjectAlongPath();
}
}
if (equipmentCommon.isPlayer &&isStartRehearsing)
if(isStartRehearsing && equipmentCommon.isPlayer)
{
switch (pattern)
{
@ -161,9 +155,27 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
break;
case Pattern.:
SelectiveAttackDrone();
if (airRoute)
{
StartMoveObjectAlongPath();
}
break;
}
var _unmannedAerialVehicle = unmannedAerialVehicles.FindAll(x => x != null);
if (_unmannedAerialVehicle==null)
{
string nowData = string.Format("{0},{1}", "SetToBeDestroyed", equipmentCommon.deviceID);
Debug.Log(nowData);
_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
Dictionary<string, string> headers = new Dictionary<string, string>();
headers.Add("id", equipmentCommon.deviceID);
StartCoroutine(GetString(Url_Deletepracticedevicedetail, headers, data => {
Debug.Log(data);
}));
}
}
}