交互逻辑
This commit is contained in:
parent
6767c1dd20
commit
a3c7156ac7
|
@ -172,12 +172,13 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
UploadLogMain uploadLogMain = new UploadLogMain();
|
UploadLogMain uploadLogMain = new UploadLogMain();
|
||||||
uploadLogMain.PracticeId = GlobalFlag.practiceSubjectID;
|
uploadLogMain.PracticeId = GlobalFlag.practiceSubjectID;
|
||||||
uploadLogMain.ThinkId = GlobalFlag.currentThinkId;
|
uploadLogMain.ThinkId = GlobalFlag.currentThinkId;
|
||||||
string log = currentTime + " " + equipmentType + "(" + deviceID + ")" + "< color = red > 生成 </ color >";
|
string log = currentTime + " " + equipmentType + "(" + deviceID + ")"+"生成 ";
|
||||||
uploadLogMain.log = log;
|
uploadLogMain.log = log;
|
||||||
uploadLogMains.Add(uploadLogMain);
|
uploadLogMains.Add(uploadLogMain);
|
||||||
string uploadLogMainJson = JsonConvert.SerializeObject(uploadLogMains);
|
string uploadLogMainJson = JsonConvert.SerializeObject(uploadLogMains);
|
||||||
WWWForm wWWForm = new WWWForm();
|
WWWForm wWWForm = new WWWForm();
|
||||||
wWWForm.AddField("data", uploadLogMainJson);
|
wWWForm.AddField("data", uploadLogMainJson);
|
||||||
|
Debug.Log(uploadLogMainJson);
|
||||||
StartCoroutine(PostString(Url_Addpracticelog, wWWForm, data => {
|
StartCoroutine(PostString(Url_Addpracticelog, wWWForm, data => {
|
||||||
Debug.Log(data);
|
Debug.Log(data);
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -4,6 +4,8 @@ using UnityEngine;
|
||||||
using AdamThinkDevicesData;
|
using AdamThinkDevicesData;
|
||||||
using AdamSync;
|
using AdamSync;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using static InterfaceManager;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 地面无线电干扰控制
|
/// 地面无线电干扰控制
|
||||||
|
@ -232,6 +234,11 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour
|
||||||
string nowData = GetSyncDis(unmannedAerialVehicle);
|
string nowData = GetSyncDis(unmannedAerialVehicle);
|
||||||
Debug.Log(nowData);
|
Debug.Log(nowData);
|
||||||
DeviceManager.Instance.send2roomStr.Enqueue(nowData);
|
DeviceManager.Instance.send2roomStr.Enqueue(nowData);
|
||||||
|
string currentTime = System.DateTime.Now.ToString();
|
||||||
|
string _log = currentTime + " " + equipmentCommon.equipmentType + "(" + equipmentCommon.deviceID + ")"+
|
||||||
|
"攻击了销毁了"+ unmannedAerialVehicle.unmannedAerialVehicleManage.equipmentCommon.equipmentType + "(" + unmannedAerialVehicle.unmannedAerialVehicleManage.equipmentCommon.deviceID + ")"
|
||||||
|
+ "编号" + unmannedAerialVehicle.serialNumber + "子无人机";
|
||||||
|
UploadLog(_log);
|
||||||
GameObject Bao = Instantiate(explodePrefab, unmannedAerialVehicle.transform);
|
GameObject Bao = Instantiate(explodePrefab, unmannedAerialVehicle.transform);
|
||||||
Bao.transform.localPosition = Vector3.zero;
|
Bao.transform.localPosition = Vector3.zero;
|
||||||
Bao.transform.SetParent(null);
|
Bao.transform.SetParent(null);
|
||||||
|
@ -240,6 +247,29 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour
|
||||||
isDo = true;
|
isDo = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///上传日志
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="deviceID"></param>
|
||||||
|
public void UploadLog(string _log)
|
||||||
|
{
|
||||||
|
|
||||||
|
List<UploadLogMain> uploadLogMains = new List<UploadLogMain>();
|
||||||
|
UploadLogMain uploadLogMain = new UploadLogMain();
|
||||||
|
uploadLogMain.PracticeId = GlobalFlag.practiceSubjectID;
|
||||||
|
uploadLogMain.ThinkId = GlobalFlag.currentThinkId;
|
||||||
|
string log =
|
||||||
|
uploadLogMain.log = _log;
|
||||||
|
uploadLogMains.Add(uploadLogMain);
|
||||||
|
string uploadLogMainJson = JsonConvert.SerializeObject(uploadLogMains);
|
||||||
|
WWWForm wWWForm = new WWWForm();
|
||||||
|
wWWForm.AddField("data", uploadLogMainJson);
|
||||||
|
Debug.Log(uploadLogMainJson);
|
||||||
|
StartCoroutine(PostString(Url_Addpracticelog, wWWForm, data => {
|
||||||
|
Debug.Log(data);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 单个无人机被销毁
|
/// 单个无人机被销毁
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -5,6 +5,8 @@ using DG.Tweening;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AdamSync;
|
using AdamSync;
|
||||||
using static InterfaceManager;
|
using static InterfaceManager;
|
||||||
|
using AdamThinkDevicesData;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 无人机
|
/// 无人机
|
||||||
|
@ -91,19 +93,19 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case "激光打击":
|
//case "激光打击":
|
||||||
AddBao(true);
|
// AddBao(true);
|
||||||
//Debug.Log(transform.name+"被激光打击销毁了");
|
// //Debug.Log(transform.name+"被激光打击销毁了");
|
||||||
break;
|
// break;
|
||||||
case "无线电干扰":
|
//case "无线电干扰":
|
||||||
Vector3 _pos = transform.position - new Vector3(0, 30, 0);
|
// Vector3 _pos = transform.position - new Vector3(0, 30, 0);
|
||||||
transform.LookAt(_pos);
|
// transform.LookAt(_pos);
|
||||||
transform.DOMove(_pos, 1).OnComplete(() =>
|
// transform.DOMove(_pos, 1).OnComplete(() =>
|
||||||
{
|
// {
|
||||||
AddBao(true);
|
// AddBao(true);
|
||||||
});
|
// });
|
||||||
//Debug.Log(transform.name + "无人机被无线电干扰销毁了");
|
// //Debug.Log(transform.name + "无人机被无线电干扰销毁了");
|
||||||
break;
|
// break;
|
||||||
case "攻击到目标":
|
case "攻击到目标":
|
||||||
AddBao(true);
|
AddBao(true);
|
||||||
//Debug.Log(transform.name + "无人机自杀式攻击销毁了");
|
//Debug.Log(transform.name + "无人机自杀式攻击销毁了");
|
||||||
|
@ -129,6 +131,10 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
Debug.Log(nowData);
|
Debug.Log(nowData);
|
||||||
//_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
|
//_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
|
||||||
DeviceManager.Instance.send2roomStr.Enqueue(nowData);
|
DeviceManager.Instance.send2roomStr.Enqueue(nowData);
|
||||||
|
string currentTime = System.DateTime.Now.ToString();
|
||||||
|
string _log= currentTime + " " + unmannedAerialVehicleManage.equipmentCommon.equipmentType + "(" + unmannedAerialVehicleManage.equipmentCommon.deviceID + ")"
|
||||||
|
+ "编号" + serialNumber + "子无人机" + "自杀式攻击自爆了";
|
||||||
|
UploadLog(_log);
|
||||||
}
|
}
|
||||||
GameObject Bao = Instantiate(explodePrefab, transform);
|
GameObject Bao = Instantiate(explodePrefab, transform);
|
||||||
Bao.transform.localPosition = Vector3.zero;
|
Bao.transform.localPosition = Vector3.zero;
|
||||||
|
@ -138,6 +144,29 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///上传日志
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="deviceID"></param>
|
||||||
|
public void UploadLog(string _log)
|
||||||
|
{
|
||||||
|
|
||||||
|
List<UploadLogMain> uploadLogMains = new List<UploadLogMain>();
|
||||||
|
UploadLogMain uploadLogMain = new UploadLogMain();
|
||||||
|
uploadLogMain.PracticeId = GlobalFlag.practiceSubjectID;
|
||||||
|
uploadLogMain.ThinkId = GlobalFlag.currentThinkId;
|
||||||
|
string log =
|
||||||
|
uploadLogMain.log = _log;
|
||||||
|
uploadLogMains.Add(uploadLogMain);
|
||||||
|
string uploadLogMainJson = JsonConvert.SerializeObject(uploadLogMains);
|
||||||
|
WWWForm wWWForm = new WWWForm();
|
||||||
|
wWWForm.AddField("data", uploadLogMainJson);
|
||||||
|
Debug.Log(uploadLogMainJson);
|
||||||
|
StartCoroutine(PostString(Url_Addpracticelog, wWWForm, data => {
|
||||||
|
Debug.Log(data);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 销毁蓝方设备
|
/// 销毁蓝方设备
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -148,6 +177,11 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
string nowData = string.Format("{0},{1}", "SetToBeDestroyed", _equipmentCommon.deviceID);
|
string nowData = string.Format("{0},{1}", "SetToBeDestroyed", _equipmentCommon.deviceID);
|
||||||
Debug.Log(nowData);
|
Debug.Log(nowData);
|
||||||
_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
|
_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
|
||||||
|
string currentTime = System.DateTime.Now.ToString();
|
||||||
|
string _log = currentTime + " " + unmannedAerialVehicleManage.equipmentCommon.equipmentType + "(" + unmannedAerialVehicleManage.equipmentCommon.deviceID + ")"
|
||||||
|
+ "编号" + serialNumber + "子无人机" + "攻击摧毁了"+ _equipmentCommon.equipmentType + "(" + _equipmentCommon.deviceID + ")";
|
||||||
|
UploadLog(_log);
|
||||||
|
|
||||||
WWWForm headers = new WWWForm();
|
WWWForm headers = new WWWForm();
|
||||||
headers.AddField("id", _equipmentCommon.deviceID);
|
headers.AddField("id", _equipmentCommon.deviceID);
|
||||||
StartCoroutine(PostString(Url_Deletepracticedevicedetail, headers, data => {
|
StartCoroutine(PostString(Url_Deletepracticedevicedetail, headers, data => {
|
||||||
|
|
Loading…
Reference in New Issue