From bdc8c8bbe8d4a181f57c5d6f92a8b456a1da7c43 Mon Sep 17 00:00:00 2001 From: yulong <1838206582@qq.com> Date: Sun, 4 Feb 2024 13:54:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=83=B3=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Temp/Scripts/Scenariopage.cs | 78 ++++++++++++------------- Assets/Zion/Scripts/Adam/DragManager.cs | 39 ++----------- 2 files changed, 43 insertions(+), 74 deletions(-) diff --git a/Assets/Temp/Scripts/Scenariopage.cs b/Assets/Temp/Scripts/Scenariopage.cs index 8ed2a1e9..7d6b0c4f 100644 --- a/Assets/Temp/Scripts/Scenariopage.cs +++ b/Assets/Temp/Scripts/Scenariopage.cs @@ -415,12 +415,12 @@ public class Scenariopage : MonoBehaviour if (ison) { pingpu3 += index + ","; - Debug.Log(pingpu3); + //Debug.Log(pingpu3); } else { pingpu3 = pingpu3.Replace(index + ",", ""); - Debug.Log(pingpu3); + //Debug.Log(pingpu3); } })); } @@ -439,12 +439,12 @@ public class Scenariopage : MonoBehaviour if (ison) { frequ += index + ","; - Debug.Log(frequ); + //Debug.Log(frequ); } else { frequ = frequ.Replace(index + ",", ""); - Debug.Log(frequ); + //Debug.Log(frequ); } })); } @@ -508,8 +508,8 @@ public class Scenariopage : MonoBehaviour private void WB(bool arg1, string arg2) { - Debug.LogError(arg1); - Debug.LogError(arg2); + //Debug.LogError(arg1); + //Debug.LogError(arg2); } private void Bobomethod() @@ -611,8 +611,8 @@ public class Scenariopage : MonoBehaviour private void PPTCWQ(bool arg1, string arg2) { - Debug.LogError(arg1); - Debug.LogError(arg2); + //Debug.LogError(arg1); + //Debug.LogError(arg2); } private void Spectrumweapon1() @@ -626,7 +626,7 @@ public class Scenariopage : MonoBehaviour { if (bol) { - Debug.LogError(str); + //Debug.LogError(str); weaponitemone1 = Newtonsoft.Json.JsonConvert.DeserializeObject(str); } for (int i = 0; i < toggleprobes.Count; i++) @@ -746,7 +746,7 @@ public class Scenariopage : MonoBehaviour if (ison) { quantity7 += index + ","; - Debug.Log(quantity7); + //Debug.Log(quantity7); } else { @@ -868,15 +868,15 @@ public class Scenariopage : MonoBehaviour } string str = Newtonsoft.Json.JsonConvert.SerializeObject(aircrafts); - Debug.Log(str); + //Debug.Log(str); Dictionary dic = new Dictionary(); dic.Add("data", str); StartCoroutine(PostData2(Url_Updatedevicepara, dic, Two20)); } public void Two20(bool bol, string str) { - Debug.Log(bol); - Debug.Log(str); + //Debug.Log(bol); + //Debug.Log(str); } private void Droneretrieval() { @@ -892,7 +892,7 @@ public class Scenariopage : MonoBehaviour { if (bol) { - Debug.Log(str); + //Debug.Log(str); weaponitemone1 = Newtonsoft.Json.JsonConvert.DeserializeObject(str); } if (weaponitemone1.state) @@ -901,7 +901,7 @@ public class Scenariopage : MonoBehaviour { uavnamelist2.Clear(); } - Debug.Log(weaponitemone1.data.Count); + //Debug.Log(weaponitemone1.data.Count); Toggle1.isOn = false; Toggle2.isOn = false; Toggle3.isOn = false; @@ -1134,15 +1134,15 @@ public class Scenariopage : MonoBehaviour } string str = Newtonsoft.Json.JsonConvert.SerializeObject(aircrafts); - Debug.Log(str); + //Debug.Log(str); Dictionary dic = new Dictionary(); dic.Add("data", str); StartCoroutine(PostData2(Url_Updatedevicepara, dic, One4)); } public void One4(bool bol, string str) { - Debug.Log(bol); - Debug.Log(str); + //Debug.Log(bol); + //Debug.Log(str); } private void Wirelesssearch() @@ -1160,7 +1160,7 @@ public class Scenariopage : MonoBehaviour { if (bol) { - Debug.Log(str); + //Debug.Log(str); weaponitemone1 = Newtonsoft.Json.JsonConvert.DeserializeObject(str); } if (weaponitemone1.state) @@ -1169,7 +1169,7 @@ public class Scenariopage : MonoBehaviour { wirelesslist2.Clear(); } - Debug.Log(weaponitemone1.data.Count); + //Debug.Log(weaponitemone1.data.Count); for (int i = 0; i < weaponitemone1.data.Count; i++) { wirelesslist[i].text = weaponitemone1.data[i].para_name; @@ -1291,15 +1291,15 @@ public class Scenariopage : MonoBehaviour } string str = Newtonsoft.Json.JsonConvert.SerializeObject(aircrafts); - Debug.Log(str); + //Debug.Log(str); Dictionary dic = new Dictionary(); dic.Add("data", str); StartCoroutine(PostData2(Url_Updatedevicepara, dic, getInfo5)); } public void getInfo5(bool bol, string str) { - Debug.Log(bol); - Debug.Log(str); + //Debug.Log(bol); + //Debug.Log(str); } private void Aircraftparameters() { @@ -1316,12 +1316,12 @@ public class Scenariopage : MonoBehaviour Weaponitemone weaponitemone1 = new Weaponitemone(); if (bol) { - Debug.Log(str); + //Debug.Log(str); weaponitemone1 = Newtonsoft.Json.JsonConvert.DeserializeObject(str); } if (weaponitemone1.state) { - Debug.Log(weaponitemone1.data.Count); + //Debug.Log(weaponitemone1.data.Count); for (int i = 0; i < weaponitemone1.data.Count; i++) { Rettalist[i].text = weaponitemone1.data[i].para_name; @@ -1379,19 +1379,19 @@ public class Scenariopage : MonoBehaviour aircraft.para_unit = laserunitlists[i]; aircraft.r1 = Laserunitlist[i].text; //aircraft.r2 = ""; - //aircraft.r3 = ""; k, + //aircraft.r3 = ""; aircrafts.Add(aircraft); } string str = Newtonsoft.Json.JsonConvert.SerializeObject(aircrafts); - Debug.Log(str); + //Debug.Log(str); Dictionary dic = new Dictionary(); dic.Add("data", str); StartCoroutine(PostData2(Url_Updatedevicepara, dic, Two1)); } public void Two1(bool bol, string str) { - Debug.Log(bol); - Debug.Log(str); + //Debug.Log(bol); + //Debug.Log(str); } private void Laserviewing() { @@ -2142,9 +2142,9 @@ public class Scenariopage : MonoBehaviour } datalist.Add(data); } - Debug.Log(datalist); + //Debug.Log(datalist); string datas = Newtonsoft.Json.JsonConvert.SerializeObject(datalist); - Debug.Log(datas); + //Debug.Log(datas); Dictionary dic = new Dictionary(); //dic.Add("action", "adddevice"); dic.Add("think_id", "" + Id + ""); @@ -2153,8 +2153,8 @@ public class Scenariopage : MonoBehaviour } public void getInfo2(bool bol, string str) { - Debug.Log(bol); - Debug.Log(str); + //Debug.Log(bol); + //Debug.Log(str); Chaxun();//查询接口 } @@ -2642,7 +2642,7 @@ public class Scenariopage : MonoBehaviour { - Inquire();//查询接口 + Inquire();//查询设备想定接口 environment_configuration1.gameObject.SetActive(false); object_list_panl.gameObject.SetActive(false); @@ -2762,7 +2762,7 @@ public class Scenariopage : MonoBehaviour Environment.WindDir = "" + winddir + ""; Environment.Light = Slider.value.ToString("f0"); Environment.EnvWu = Foggy_slider.value.ToString("0"); - //Debug.LogError((1 - Slider.value / 10).ToString("f1")); + string res = JsonMapper.ToJson(Environment);//利用插件LitJson将类对象转为json Debug.Log(res); Dictionary formDic = new Dictionary();//用字典保存到对应的想定id里面 @@ -2902,7 +2902,7 @@ public class Scenariopage : MonoBehaviour windamt = "1"; break; } - Debug.LogError(windamt); + //Debug.LogError(windamt); } private void WindDir(float wind) { @@ -3051,10 +3051,10 @@ public class Scenariopage : MonoBehaviour tempEintAmt = 1.0f; break; } - Debug.LogError(tempEintAmt); - Debug.LogError(windDrop.value); + //Debug.LogError(tempEintAmt); + //Debug.LogError(windDrop.value); tenkokuModule.weather_WindAmt = Mathf.Lerp(0.0f, 1.0f, tempEintAmt); - Debug.LogError(tenkokuModule.weather_WindAmt); + //Debug.LogError(tenkokuModule.weather_WindAmt); } diff --git a/Assets/Zion/Scripts/Adam/DragManager.cs b/Assets/Zion/Scripts/Adam/DragManager.cs index 30606b2b..89251df0 100644 --- a/Assets/Zion/Scripts/Adam/DragManager.cs +++ b/Assets/Zion/Scripts/Adam/DragManager.cs @@ -11,7 +11,7 @@ public class DragManager : MonoSingleton { public List deviceimages1 = new List();//把最终场景中存在的模型放入链表当中 public List devices = new List();//把最开始生成在场景中的模型存入链表 - public List modellist = new List();//存入最开始场景生成模型的名字 + public Dictionary model = new Dictionary(); @@ -26,14 +26,7 @@ public class DragManager : MonoSingleton } - //public void AddModeData(string str, GameObject gameObject) - //{ - // GameObject obj = null; - // if (model.TryGetValue(str, out obj)) - // return; - - // model.Add(str, gameObject); - //} + public void AddObj(GameObject obj) { devices.Add(obj);//把生成的预设体放入链表当中 @@ -42,10 +35,7 @@ public class DragManager : MonoSingleton { deviceimages1.Add(obj.GetComponent().modelequipment);//把场景中存在的的模型放入链表当众 } - public void Addtext(string name) - { - modellist.Add(name);//把UI上模型对应的名字存入链表 - } + public void RemoveObj(GameObject obj) { @@ -72,25 +62,4 @@ public class DragManager : MonoSingleton } } -//public class DragManager : MonoSingleton -//{ -// public Deviceimage prefab; - -// start() -// { -// for deviceimages -// Deviceimage d = instance (prefab) -// d.setvalue(Set, De, deviceimages[i].name ,) -// } - -// public void Set() -// { - -// } - -// public void De() -// { - - -// } -//} + From f79657930560d5cca9c86b33ee5d1cf438d3f316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BF=97=E5=8B=8B?= <3077614386@qq.com> Date: Sun, 4 Feb 2024 14:03:09 +0800 Subject: [PATCH 2/2] 1 --- Assets/StreamingAssets/mqttConfig.json | 2 +- Assets/Temp/Scripts/Judgmentstate.cs | 14 +++--- Assets/Temp/Scripts/Login_panl.cs | 25 ++++++++++- Assets/Temp/Scripts/Main_interface_Panel.cs | 29 ++++++++++-- Assets/Temp/Scripts/Taskpanel.cs | 13 +++--- Assets/Temp/Scripts/View_Panel2.cs | 8 ++-- .../AdamTraining_pilot_terminal_panl 1.unity | 45 +++++++++++++++---- Assets/Zion/Scenes/SampleScene.unity | 4 +- Assets/Zion/Scripts/InterfaceManager.cs | 5 +++ Assets/Zion/Scripts/MQTT/MQTTManager.cs | 2 +- ProjectSettings/ProjectSettings.asset | 4 +- 11 files changed, 119 insertions(+), 32 deletions(-) diff --git a/Assets/StreamingAssets/mqttConfig.json b/Assets/StreamingAssets/mqttConfig.json index a632f329..9ca72740 100644 --- a/Assets/StreamingAssets/mqttConfig.json +++ b/Assets/StreamingAssets/mqttConfig.json @@ -1 +1 @@ -{"ip":"172.16.1.117","port":54232,"userName":"server1234","passwd":"123456"} \ No newline at end of file +{"ip":"172.16.1.120","port":54232,"userName":"server1234","passwd":"123456"} \ No newline at end of file diff --git a/Assets/Temp/Scripts/Judgmentstate.cs b/Assets/Temp/Scripts/Judgmentstate.cs index 5e6fcca9..8eb9a309 100644 --- a/Assets/Temp/Scripts/Judgmentstate.cs +++ b/Assets/Temp/Scripts/Judgmentstate.cs @@ -1,10 +1,7 @@ using AdamSync; -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.SceneManagement; using UnityEngine.UI; - +using static InterfaceManager; public class Judgmentstate : MonoBehaviour { @@ -83,7 +80,14 @@ public class Judgmentstate : MonoBehaviour _ = SyncCreateRoom.SendMessageAsync(msg); }); off_btn.onClick.AddListener(() => { - Application.Quit(); + string url = Url_Exit + GlobalFlag.currentUser.login_name; + StartCoroutine(GetString(url, data => + { + Debug.Log(data); + Application.Quit(); + + })); + }); } diff --git a/Assets/Temp/Scripts/Login_panl.cs b/Assets/Temp/Scripts/Login_panl.cs index 44e59e39..39b76ab2 100644 --- a/Assets/Temp/Scripts/Login_panl.cs +++ b/Assets/Temp/Scripts/Login_panl.cs @@ -1,7 +1,8 @@ -using LitJson; +using LitJson; using System.Collections; using UnityEngine; using UnityEngine.Networking; +using UnityEngine.SceneManagement; using UnityEngine.UI; using static InterfaceManager; public class Login_panl : MonoBehaviour @@ -102,6 +103,28 @@ public class Login_panl : MonoBehaviour } } + /// + /// 账号用户退出 + /// + /// 返回 退出 + public void AddGetString(bool exirOrQuit) + { + string url = Url_Exit + GlobalFlag.currentUser.login_name; + StartCoroutine(GetString(url, data => + { + Debug.Log(data); + if (exirOrQuit) + { + SceneManager.LoadScene("SampleScene"); + } + else + { + Application.Quit(); + } + + })); + } + public void OnRegist(string msg) { //Debug.Log("OnRegist====" + msg); diff --git a/Assets/Temp/Scripts/Main_interface_Panel.cs b/Assets/Temp/Scripts/Main_interface_Panel.cs index 3f1c8827..d6b94c47 100644 --- a/Assets/Temp/Scripts/Main_interface_Panel.cs +++ b/Assets/Temp/Scripts/Main_interface_Panel.cs @@ -1,10 +1,11 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; using XFrame.Core.UI; +using static InterfaceManager; public class Main_interface_Panel : XUIPanel { @@ -29,11 +30,33 @@ public class Main_interface_Panel : XUIPanel ShowPanel(); this.transform.Find("UPBG/Back_bton").GetComponent