From 8530a158b8c0a7217e69404cef4a65b221353df3 Mon Sep 17 00:00:00 2001 From: yulong <1838206582@qq.com> Date: Wed, 22 Nov 2023 20:32:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Temp/Scripts/Scenariopage.cs | 32 ++++++++++++------------- Assets/Zion/Scenes/InitConnect.unity | 2 +- Assets/Zion/Scripts/InterfaceManager.cs | 21 +++++++++++++++- 3 files changed, 37 insertions(+), 18 deletions(-) diff --git a/Assets/Temp/Scripts/Scenariopage.cs b/Assets/Temp/Scripts/Scenariopage.cs index c7207c5f..7e5b7c04 100644 --- a/Assets/Temp/Scripts/Scenariopage.cs +++ b/Assets/Temp/Scripts/Scenariopage.cs @@ -1477,7 +1477,7 @@ public class Scenariopage : MonoBehaviour } private void Addweapons() { - string url = "http://172.16.1.254:48888/Handler/Thinkingfile.ashx?action=adddevice"; + List datalist = new List(); for (int i = 0; i < namelists.Count; i++) { @@ -1501,7 +1501,7 @@ public class Scenariopage : MonoBehaviour //dic.Add("action", "adddevice"); dic.Add("think_id", "" + Id + ""); dic.Add("data", datas); - StartCoroutine(PostData(url, dic, getInfo2)); + StartCoroutine(PostData(Url_Adddevice, dic, getInfo2)); } public void getInfo2(bool bol, string str) { @@ -1550,7 +1550,7 @@ public class Scenariopage : MonoBehaviour private void Dronereal() { - string url = "http://172.16.1.254:48888/Handler/Thinkingfile.ashx?action=adddevicepara"; + List aircrafts = new List(); if (uavnamelist2.Count>0) { @@ -1577,7 +1577,7 @@ public class Scenariopage : MonoBehaviour Dictionary dic = new Dictionary(); dic.Add("think_device_id", stringlist[2]); dic.Add("data", str); - StartCoroutine(PostData2(url, dic, One10)); + StartCoroutine(PostData2(Url_Adddevicepara, dic, One10)); } public void One10(bool bol, string str) { @@ -1588,7 +1588,7 @@ public class Scenariopage : MonoBehaviour private void Wirelessoutput() { - string url = "http://172.16.1.254:48888/Handler/Thinkingfile.ashx?action=adddevicepara"; + List aircrafts = new List(); if (wirelesslist2.Count>0) { @@ -1612,7 +1612,7 @@ public class Scenariopage : MonoBehaviour Dictionary dic = new Dictionary(); dic.Add("think_device_id", stringlist[1]); dic.Add("data", str); - StartCoroutine(PostData2(url, dic, One1)); + StartCoroutine(PostData2(Url_Adddevicepara, dic, One1)); } public void One1(bool bol, string str) { @@ -1623,7 +1623,7 @@ public class Scenariopage : MonoBehaviour private void Laserfirecontrol() { - string url = "http://172.16.1.254:48888/Handler/Thinkingfile.ashx?action=adddevicepara"; + List aircrafts = new List(); for (int i = 0; i < laserlist.Count; i++) { @@ -1638,7 +1638,7 @@ public class Scenariopage : MonoBehaviour Dictionary dic = new Dictionary(); dic.Add("think_device_id", stringlist[3]); dic.Add("data", str); - StartCoroutine(PostData2(url, dic, One)); + StartCoroutine(PostData2(Url_Adddevicepara, dic, One)); } public void One(bool bol, string str) { @@ -1649,7 +1649,7 @@ public class Scenariopage : MonoBehaviour private void Saveaeroplane() { - string url = "http://172.16.1.254:48888/Handler/Thinkingfile.ashx?action=adddevicepara"; + List aircrafts = new List(); for (int i = 0; i < Rettalist.Count; i++) { @@ -1664,7 +1664,7 @@ public class Scenariopage : MonoBehaviour Dictionary dic = new Dictionary(); dic.Add("think_device_id", stringlist[0]); dic.Add("data", str); - StartCoroutine(PostData2(url, dic, getInfo4)); + StartCoroutine(PostData2(Url_Adddevicepara, dic, getInfo4)); } private void getInfo4(bool arg1, string arg2) @@ -1707,7 +1707,7 @@ public class Scenariopage : MonoBehaviour private void Preservation() { - string url = "http://172.16.1.254:48888/Handler/Thinkingfile.ashx?action=updatedevice"; + List dataItem1s = new List(); for (int i = 0; i < weaponitem.data.Count; i++) { @@ -1730,7 +1730,7 @@ public class Scenariopage : MonoBehaviour Debug.LogError(dataitem); Dictionary map = new Dictionary(); map.Add("data", dataitem); - StartCoroutine(PostData(url, map, getInfo1));//协程调用网络通信 + StartCoroutine(PostData(Url_updatedevice, map, getInfo1));//协程调用网络通信 } public void getInfo1(bool bol, string str) { @@ -1739,13 +1739,13 @@ public class Scenariopage : MonoBehaviour } private void Modelitem() { - string url = "http://172.16.1.254:48888/Handler/Thinkingfile.ashx?action=updatecontent"; + string jsonmodel = Newtonsoft.Json.JsonConvert.SerializeObject(DragManager.Instance.deviceimages1);//把模型路径和位置参数转成json对象 //Debug.LogError(jsonmodel); Dictionary model = new Dictionary(); model.Add("Id", "" + Id + "");//对应的想定ID model.Add("DeviceContent", jsonmodel);//把对应的Json传到接口对应的字段里面 - StartCoroutine(PostData1(url, model, Model)); + StartCoroutine(PostData1(Url_updatecontent, model, Model)); } public void Model(bool s, string str) @@ -2061,7 +2061,7 @@ public class Scenariopage : MonoBehaviour } void Passbyvalue() { - string url = "http://172.16.1.254:48888/Handler/Thinkingfile.ashx?action=update_env";//获取需要传值的接口 + Environment Environment = new Environment();//需要传值对应类 //把需要传的值对象参数对应 @@ -2076,7 +2076,7 @@ public class Scenariopage : MonoBehaviour Dictionary formDic = new Dictionary();//用字典保存到对应的想定id里面 formDic.Add("Id", "" + Id + ""); formDic.Add("data", res); - StartCoroutine(PostData(url, formDic, GetInfo));//协程调用网络通信 + StartCoroutine(PostData(Url_update_env, formDic, GetInfo));//协程调用网络通信 } diff --git a/Assets/Zion/Scenes/InitConnect.unity b/Assets/Zion/Scenes/InitConnect.unity index 91675510..0c9ee084 100644 --- a/Assets/Zion/Scenes/InitConnect.unity +++ b/Assets/Zion/Scenes/InitConnect.unity @@ -236,7 +236,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: isLinkAgain: 0 - serverIP: 192.168.6.15 + serverIP: 172.20.10.5 port: 12345 --- !u!4 &2132962759 Transform: diff --git a/Assets/Zion/Scripts/InterfaceManager.cs b/Assets/Zion/Scripts/InterfaceManager.cs index cca9a406..12b34f8e 100644 --- a/Assets/Zion/Scripts/InterfaceManager.cs +++ b/Assets/Zion/Scripts/InterfaceManager.cs @@ -34,7 +34,26 @@ public static class InterfaceManager /// 查询想定设备 /// public static string Url_Querydevice { get => IpAddress + "/Handler/Thinkingfile.ashx?action=querydevice&"; } - + /// + /// 添加设备 + /// + public static string Url_Adddevice { get => IpAddress + "/Handler/Thinkingfile.ashx?action=adddevice"; } + /// + /// 添加设备参数 + /// + public static string Url_Adddevicepara { get => IpAddress + "/Handler/Thinkingfile.ashx?action=adddevicepara"; } + /// + /// 修改想定接口 + /// + public static string Url_updatedevice { get => IpAddress + "/Handler/Thinkingfile.ashx?action=updatedevice"; } + /// + /// 添加模型路径参数接口 + /// + public static string Url_updatecontent { get => IpAddress + "/Handler/Thinkingfile.ashx?action=updatecontent"; } + /// + /// 修改环境 + /// + public static string Url_update_env { get => IpAddress + "/Handler/Thinkingfile.ashx?action=update_env"; } #endregion public static string GetLocalTxt(string path)