添加设备
This commit is contained in:
parent
a4ff70aa6a
commit
e5b693125a
|
@ -6,6 +6,7 @@ using System.Diagnostics.SymbolStore;
|
|||
using Tenkoku.Core;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.Experimental.GlobalIllumination;
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
@ -277,7 +278,49 @@ public class Scenariopage : MonoBehaviour
|
|||
public List<string> wirelessidlist = new List<string>();
|
||||
public List<string> droneidlist = new List<string>();
|
||||
public List<string> laseridlist = new List<string>();
|
||||
public List<string> pinpulist = new List<string>();//保存频谱设备参数id
|
||||
public List<string> weiboliist = new List<string>();//保存微波设备参数id
|
||||
public Modelequipment modelequipment;
|
||||
//频谱探测武器
|
||||
public Button shezhi_btn55;//激活频谱探测按钮
|
||||
public Button off_button;//频谱探测叉掉按钮
|
||||
public Button queren_btno;//频谱探测确认按钮
|
||||
public Button quxiao_btno;//频谱探测取消按钮
|
||||
public GameObject spectrum_detection_panl;//频谱探测面板
|
||||
public Slider Slider_probe1;//探测距离滑动条
|
||||
public Text Text111;//显示距离文本
|
||||
public Slider Slider_batch;//批量的处理个数
|
||||
public Text Text222;//显示批量处理个数文本
|
||||
public Slider Slider_Successful1;//探测成功率
|
||||
public Text Text333;//显示探测成功率的文本
|
||||
public Slider Slider_respond;//探测的响应时间
|
||||
public Text Text444;//显示探测响应时间文本
|
||||
public Slider Slider_precision;//探测精度
|
||||
public Text Text555;//显示探测精度
|
||||
public Slider Slider_minimum1;//最小探测速度
|
||||
public Text Text666;//显示最小探测速度
|
||||
public List<Text> tiledlinkedlist = new List<Text>();//储存频谱设备名称
|
||||
public List<Slider> frequencysliderlist = new List<Slider>();//储存频谱设备参数
|
||||
public List<string> frequecystringlist = new List<string>();//存储设备单位
|
||||
public List<Text> frequecytestlist = new List<Text>();//实时显示参数和单位
|
||||
//微波武器
|
||||
public Button shezhi_btn66;//激活微波武器页面
|
||||
public Button off1_btn12;//微波武器叉掉页面
|
||||
public Button quedin_btn123;//微波武器的确认按钮
|
||||
public Button quxiao_btnn33;//微波武器取消按钮
|
||||
public GameObject microwave_weapon;//微波武器界面
|
||||
public Slider Slidertime1;//微波武器储能时间
|
||||
public Text stored_text1;//显示微波武器储能时间
|
||||
public Slider Slideraccumulate1;//微波武器处理目标的个数
|
||||
public Text accumulate_text1;//显示微波武器处理个数
|
||||
public Slider Sliderdistance1;//微波武器射程距离
|
||||
public Text dis_text1;//显示微波武器干扰距离
|
||||
public Slider SliderAngle2;//微波武器的角度
|
||||
public Text angle1_text1;//显示微波武器干扰的角度
|
||||
public List<Text> microwavetextlist = new List<Text>();//微波武器的名字
|
||||
public List<Slider> microwavesliderlist = new List<Slider>();//微波武器的参数
|
||||
public List<string> microwavesstringlist = new List<string>();//微波武器的单位
|
||||
public List<Text> microwavestextlists = new List<Text>();//微波武器单位和参数
|
||||
|
||||
|
||||
public Toggle weather1;
|
||||
|
@ -332,8 +375,181 @@ public class Scenariopage : MonoBehaviour
|
|||
Radiointerference();//无线电干扰页面设置
|
||||
Drone();//无人机蜂群页面
|
||||
Electronicreconnaissance();//电子侦察能里选项和是否有光子侦察
|
||||
Spectrumdetection();//频谱探测的页面按钮
|
||||
Microwaveweapon();//微波武器的页面按钮
|
||||
}
|
||||
|
||||
private void Microwaveweapon()
|
||||
{
|
||||
shezhi_btn66.onClick.AddListener(() =>
|
||||
{
|
||||
if (strlist.Count > 0)
|
||||
{
|
||||
Bobomethod();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < microwavesliderlist.Count; i++)
|
||||
{
|
||||
microwavesliderlist[i].value = 0;
|
||||
}
|
||||
}
|
||||
microwave_weapon.gameObject.SetActive(true);
|
||||
});
|
||||
off1_btn12.onClick.AddListener(() =>
|
||||
{
|
||||
microwave_weapon.gameObject.SetActive(false);
|
||||
});
|
||||
quedin_btn123.onClick.AddListener(() =>
|
||||
{
|
||||
if (strlist.Count > 0)
|
||||
{
|
||||
Microwavemodification();//微波武器的修改
|
||||
}
|
||||
microwave_weapon.gameObject.SetActive(false);
|
||||
});
|
||||
quxiao_btnn33.onClick.AddListener(() =>
|
||||
{
|
||||
microwave_weapon.gameObject.SetActive(false);
|
||||
});
|
||||
}
|
||||
|
||||
private void Microwavemodification()
|
||||
{
|
||||
List<Aircraft> aircraftlist = new List<Aircraft>();
|
||||
for (int i = 0; i < microwavetextlist.Count; i++)
|
||||
{
|
||||
Aircraft aircraft = new Aircraft();
|
||||
aircraft.id = weiboliist[i];
|
||||
aircraft.think_device_id = strlist[5];
|
||||
aircraft.para_name = microwavetextlist[i].text;
|
||||
aircraft.para_value = microwavesliderlist[i].value.ToString();
|
||||
aircraft.para_unit = microwavesstringlist[i];
|
||||
aircraft.r1 = microwavestextlists[i].text;
|
||||
aircraftlist.Add(aircraft);
|
||||
}
|
||||
string str = Newtonsoft.Json.JsonConvert.SerializeObject(aircraftlist);
|
||||
Dictionary<string, string> dict = new Dictionary<string, string>();
|
||||
dict.Add("data", str);
|
||||
StartCoroutine(PostData2(Url_Updatedevicepara, dict, WB));
|
||||
}
|
||||
|
||||
private void WB(bool arg1, string arg2)
|
||||
{
|
||||
Debug.LogError(arg1);
|
||||
Debug.LogError(arg2);
|
||||
}
|
||||
|
||||
private void Bobomethod()
|
||||
{
|
||||
string url = Url_Querydevicepara;
|
||||
url += "think_device_id=";
|
||||
url += strlist[5];
|
||||
StartCoroutine(Post1(url, WBWQ));
|
||||
}
|
||||
private void WBWQ(bool bol, string str)
|
||||
{
|
||||
if (bol)
|
||||
{
|
||||
Debug.LogError(str);
|
||||
weaponitemone1 = Newtonsoft.Json.JsonConvert.DeserializeObject<Weaponitemone>(str);
|
||||
}
|
||||
if (weaponitemone1.state)
|
||||
{
|
||||
for (int i = 0; i < weaponitemone1.data.Count; i++)
|
||||
{
|
||||
microwavetextlist[i].text = weaponitemone1.data[i].para_name;
|
||||
microwavesliderlist[i].value = float.Parse(weaponitemone1.data[i].para_value);
|
||||
microwavestextlists[i].text = weaponitemone1.data[i].r1;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void Spectrumdetection()
|
||||
{
|
||||
shezhi_btn55.onClick.AddListener(() =>
|
||||
{
|
||||
if (strlist.Count > 0)
|
||||
{
|
||||
Spectrumweapon1();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < frequencysliderlist.Count; i++)
|
||||
{
|
||||
frequencysliderlist[i].value = 0;
|
||||
}
|
||||
}
|
||||
spectrum_detection_panl.gameObject.SetActive(true);
|
||||
});
|
||||
off_button.onClick.AddListener(() =>
|
||||
{
|
||||
spectrum_detection_panl.gameObject.SetActive(false);
|
||||
});
|
||||
queren_btno.onClick.AddListener(() =>
|
||||
{
|
||||
if (strlist.Count > 0)
|
||||
{
|
||||
Spectrummodification();//频谱探测修改
|
||||
}
|
||||
spectrum_detection_panl.gameObject.SetActive(false);
|
||||
});
|
||||
quxiao_btno.onClick.AddListener(() =>
|
||||
{
|
||||
spectrum_detection_panl.gameObject.SetActive(false);
|
||||
});
|
||||
}
|
||||
|
||||
private void Spectrummodification()
|
||||
{
|
||||
List<Aircraft> aircrafts = new List<Aircraft>();
|
||||
for (int i = 0; i < tiledlinkedlist.Count; i++)
|
||||
{
|
||||
Aircraft aircraft = new Aircraft();
|
||||
aircraft.id = pinpulist[i];
|
||||
aircraft.think_device_id = strlist[4];
|
||||
aircraft.para_name = tiledlinkedlist[i].text;
|
||||
aircraft.para_value = frequencysliderlist[i].value.ToString();
|
||||
aircraft.para_unit = frequecystringlist[i];
|
||||
aircraft.r1 = frequecytestlist[i].text;
|
||||
aircrafts.Add(aircraft);
|
||||
}
|
||||
string str = Newtonsoft.Json.JsonConvert.SerializeObject(aircrafts);
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
dic.Add("data", str);
|
||||
StartCoroutine(PostData2(Url_Updatedevicepara, dic, PPTCWQ));
|
||||
|
||||
}
|
||||
|
||||
private void PPTCWQ(bool arg1, string arg2)
|
||||
{
|
||||
Debug.LogError(arg1);
|
||||
Debug.LogError(arg2);
|
||||
}
|
||||
|
||||
private void Spectrumweapon1()
|
||||
{
|
||||
string url = Url_Querydevicepara;
|
||||
url += "think_device_id=";
|
||||
url += strlist[4];
|
||||
StartCoroutine(Post1(url, PUTC));
|
||||
}
|
||||
private void PUTC(bool bol, string str)
|
||||
{
|
||||
if (bol)
|
||||
{
|
||||
Debug.LogError(str);
|
||||
weaponitemone1 = Newtonsoft.Json.JsonConvert.DeserializeObject<Weaponitemone>(str);
|
||||
}
|
||||
if (weaponitemone1.state)
|
||||
{
|
||||
for (int i = 0; i < weaponitemone1.data.Count; i++)
|
||||
{
|
||||
tiledlinkedlist[i].text = weaponitemone1.data[i].para_name;
|
||||
frequencysliderlist[i].value = float.Parse(weaponitemone1.data[i].para_value);
|
||||
frequecytestlist[i].text = weaponitemone1.data[i].r1;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void Electronicreconnaissance()
|
||||
{
|
||||
if (toggles.Count > 0)
|
||||
|
@ -1064,7 +1280,7 @@ public class Scenariopage : MonoBehaviour
|
|||
weather7.isOn = false;
|
||||
weather8.isOn = false;
|
||||
weather9.isOn = false;
|
||||
weather10.isOn = false;
|
||||
weather10.isOn = false;
|
||||
switch (scen.data[i].EnvRain)
|
||||
{
|
||||
case "0":
|
||||
|
@ -1209,11 +1425,31 @@ public class Scenariopage : MonoBehaviour
|
|||
power = Dropdown_power.value;
|
||||
foggy_text.text = Foggy_slider.value.ToString("0") + "%";
|
||||
Radar();//雷达页面滑动条显示
|
||||
Frequency(Dropdown_frequency.value);//干扰频率的下拉框
|
||||
|
||||
Frequency(Dropdown_frequency.value);//干扰频率的下拉
|
||||
Disturb();//干扰页面的角度和距离
|
||||
Swarmdrone();//蜂群无人机页面滑动条
|
||||
Laer();//激光火炮控制频台面板
|
||||
Spectrumweapon();//频谱探测面板上的参数
|
||||
Microwave();//微波武器面板上的参数
|
||||
}
|
||||
|
||||
private void Microwave()
|
||||
{
|
||||
stored_text1.text = Slidertime1.value.ToString() + "s";
|
||||
accumulate_text1.text = Slideraccumulate1.value.ToString() + "s";
|
||||
dis_text1.text = Sliderdistance1.value.ToString("f1") + "km";
|
||||
angle1_text1.text = SliderAngle2.value.ToString() + "度";
|
||||
}
|
||||
|
||||
private void Spectrumweapon()
|
||||
{
|
||||
Text111.text = Slider_probe1.value.ToString() + "km";
|
||||
Text222.text = Slider_batch.value.ToString() + "个";
|
||||
Text333.text = Slider_Successful1.value.ToString() + "%";
|
||||
Text444.text = Slider_respond.value.ToString() + "s";
|
||||
Text555.text = Slider_precision.value.ToString() + "度";
|
||||
Text666.text = Slider_minimum1.value.ToString() + "m/s";
|
||||
|
||||
}
|
||||
|
||||
private void Laer()
|
||||
|
@ -1250,22 +1486,22 @@ public class Scenariopage : MonoBehaviour
|
|||
switch (value)
|
||||
{
|
||||
case 0:
|
||||
frequency_text.text = "430~470MHz";
|
||||
frequency_text.text = "1227.60 MHz";
|
||||
break;
|
||||
case 1:
|
||||
frequency_text.text = "832~940MHz";
|
||||
frequency_text.text = "1575.42 MHz";
|
||||
break;
|
||||
case 2:
|
||||
frequency_text.text = "1.2~1.3GHz";
|
||||
frequency_text.text = "1381.05 MHz";
|
||||
break;
|
||||
case 3:
|
||||
frequency_text.text = "1.56~1.62GHz";
|
||||
frequency_text.text = "2GHz";
|
||||
break;
|
||||
case 4:
|
||||
frequency_text.text = "2.4~2.5GHz";
|
||||
frequency_text.text = "4GHz";
|
||||
break;
|
||||
case 5:
|
||||
frequency_text.text = "5.725~5.85GHz";
|
||||
frequency_text.text = "5GHz";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1303,12 +1539,70 @@ public class Scenariopage : MonoBehaviour
|
|||
Wirelessid();//无线电id保存
|
||||
Droneid();//无人机id保存
|
||||
Laserid();//保存激光id
|
||||
Frequencyspectrum();//保存频谱设备参数id
|
||||
Microwave1();//微波武器设备参数
|
||||
}
|
||||
//DragManager.Instance.Modelinformation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void Microwave1()
|
||||
{
|
||||
string url = Url_Querydevicepara;
|
||||
url += "think_device_id=";
|
||||
url += strlist[5];
|
||||
StartCoroutine(Post1(url, Weibowuqi));
|
||||
}
|
||||
|
||||
private void Weibowuqi(bool arg1, string arg2)
|
||||
{
|
||||
if (arg1)
|
||||
{
|
||||
Debug.LogError(arg2);
|
||||
weaponitemone1 = Newtonsoft.Json.JsonConvert.DeserializeObject<Weaponitemone>(arg2);
|
||||
}
|
||||
if (weaponitemone1.state)
|
||||
{
|
||||
if (weiboliist.Count > 0)
|
||||
{
|
||||
weiboliist.Clear();
|
||||
}
|
||||
for (int i = 0; i < weaponitemone1.data.Count; i++)
|
||||
{
|
||||
weiboliist.Add(weaponitemone1.data[i].id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Frequencyspectrum()
|
||||
{
|
||||
string url = Url_Querydevicepara;
|
||||
url += "think_device_id=";
|
||||
url += strlist[4];
|
||||
StartCoroutine(Post1(url, Pinbuwuqi));
|
||||
}
|
||||
|
||||
private void Pinbuwuqi(bool arg1, string arg2)
|
||||
{
|
||||
if (arg1)
|
||||
{
|
||||
Debug.LogError(arg2);
|
||||
weaponitemone1 = Newtonsoft.Json.JsonConvert.DeserializeObject<Weaponitemone>(arg2);
|
||||
}
|
||||
if (weaponitemone1.state)
|
||||
{
|
||||
if (pinpulist.Count > 0)
|
||||
{
|
||||
pinpulist.Clear();
|
||||
}
|
||||
for (int i = 0; i < weaponitemone1.data.Count; i++)
|
||||
{
|
||||
pinpulist.Add(weaponitemone1.data[i].id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Laserid()
|
||||
{
|
||||
string url = Url_Querydevicepara;
|
||||
|
@ -1756,8 +2050,56 @@ public class Scenariopage : MonoBehaviour
|
|||
Wirelessoutput();//无线电波参数值
|
||||
Dronereal();//无人机参数值
|
||||
Laserfirecontrol();//保存激光火炮的参数
|
||||
Spectrumequipmentweapon();//频谱探测设备的参数
|
||||
Microwaveequipmentparameter();//微波武器设备参数
|
||||
}
|
||||
|
||||
private void Microwaveequipmentparameter()
|
||||
{
|
||||
List<Aircraft> aircrafts = new List<Aircraft>();
|
||||
for (int i = 0; i < microwavetextlist.Count; i++)
|
||||
{
|
||||
Aircraft aircraft = new Aircraft();
|
||||
aircraft.para_name = microwavetextlist[i].text;
|
||||
aircraft.para_value = microwavesliderlist[i].value.ToString();
|
||||
aircraft.para_unit = microwavesstringlist[i];
|
||||
aircraft.r1 = microwavestextlists[i].text;
|
||||
aircrafts.Add(aircraft);
|
||||
}
|
||||
string str = Newtonsoft.Json.JsonConvert.SerializeObject(aircrafts);
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
dic.Add("think_device_id", stringlist[5]);
|
||||
dic.Add("data", str);
|
||||
StartCoroutine(PostData2(Url_Adddevicepara, dic, Weibo));
|
||||
}
|
||||
private void Weibo(bool bol, string str)
|
||||
{
|
||||
Debug.LogError(bol);
|
||||
Debug.LogError(str);
|
||||
}
|
||||
private void Spectrumequipmentweapon()
|
||||
{
|
||||
List<Aircraft> aircrafts = new List<Aircraft>();
|
||||
for (int i = 0; i < tiledlinkedlist.Count; i++)
|
||||
{
|
||||
Aircraft aircraft = new Aircraft();
|
||||
aircraft.para_name = tiledlinkedlist[i].text;
|
||||
aircraft.para_value = frequencysliderlist[i].value.ToString();
|
||||
aircraft.para_unit = frequecystringlist[i];
|
||||
aircraft.r1 = frequecytestlist[i].text;
|
||||
aircrafts.Add(aircraft);
|
||||
}
|
||||
string str = Newtonsoft.Json.JsonConvert.SerializeObject(aircrafts);
|
||||
Dictionary<string, string> dict = new Dictionary<string, string>();
|
||||
dict.Add("think_device_id", stringlist[4]);
|
||||
dict.Add("data", str);
|
||||
StartCoroutine(PostData2(Url_Adddevicepara, dict, Pinpu));
|
||||
}
|
||||
private void Pinpu(bool bol, string str)
|
||||
{
|
||||
Debug.LogError(bol);
|
||||
Debug.LogError(str);
|
||||
}
|
||||
private void Dronereal()
|
||||
{
|
||||
|
||||
|
@ -1881,7 +2223,7 @@ public class Scenariopage : MonoBehaviour
|
|||
{
|
||||
Debug.Log(arg1);
|
||||
Debug.Log(arg2);
|
||||
Clearlist();
|
||||
Invoke("Clearlist", 2);
|
||||
}
|
||||
|
||||
private void Clearlist()
|
||||
|
@ -2214,6 +2556,9 @@ public class Scenariopage : MonoBehaviour
|
|||
/// 环境界面确认取消按钮
|
||||
/// </summary>
|
||||
public string tmie;//接收环境的界面日期时间
|
||||
|
||||
|
||||
|
||||
private void Huanjin()
|
||||
{
|
||||
huanjin_btn.onClick.AddListener(() =>
|
||||
|
@ -2466,7 +2811,7 @@ public class Scenariopage : MonoBehaviour
|
|||
environment_configuration1.gameObject.SetActive(true);
|
||||
basic_information_iamg.gameObject.SetActive(false);
|
||||
select_device_iamg.gameObject.SetActive(false);
|
||||
|
||||
|
||||
});
|
||||
fork_off_btn.onClick.AddListener(() =>
|
||||
{
|
||||
|
@ -2474,7 +2819,7 @@ public class Scenariopage : MonoBehaviour
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -9,7 +9,7 @@ using Newtonsoft.Json.Linq;
|
|||
public static class InterfaceManager
|
||||
{
|
||||
|
||||
private static string _IP = "192.168.1.4";
|
||||
private static string _IP = "192.168.46.15";
|
||||
public static string IP
|
||||
{
|
||||
get { return _IP; }
|
||||
|
|
Loading…
Reference in New Issue