修改数据格式,添加接受逻辑
This commit is contained in:
parent
bbd6889f3e
commit
cddd9c869a
|
@ -17,10 +17,10 @@ public class GameManager : MonoBehaviour
|
|||
public TenkokuModule tenkokuModule;
|
||||
public System.Collections.Generic.List<ModelInfo> modelsInfo = new System.Collections.Generic.List<ModelInfo>();
|
||||
public Transform dviceContent;
|
||||
public GameObject wrjDrag;
|
||||
public GameObject ldDrag;
|
||||
public GameObject hpDrag;
|
||||
public GameObject wxdDrag;
|
||||
public DragController wrjDrag;
|
||||
public DragController ldDrag;
|
||||
public DragController hpDrag;
|
||||
public DragController wxdDrag;
|
||||
public GameObject Teacher;
|
||||
public GameObject student;
|
||||
// Start is called before the first frame update
|
||||
|
@ -55,8 +55,8 @@ public class GameManager : MonoBehaviour
|
|||
{
|
||||
for (int i = 0; i < UIBootstrap.Instance.GetDeviceByName("蜂群无人机").device_count; i++)
|
||||
{
|
||||
GameObject wrj = Instantiate(wrjDrag, dviceContent);
|
||||
wrj.GetComponent<DragController>().deviceID = UIBootstrap.Instance.GetDeviceByName("蜂群无人机").id;
|
||||
DragController wrj = Instantiate(wrjDrag, dviceContent);
|
||||
wrj.deviceID = UIBootstrap.Instance.GetDeviceByName("蜂群无人机").id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,24 +67,24 @@ public class GameManager : MonoBehaviour
|
|||
{
|
||||
for (int i = 0; i < UIBootstrap.Instance.GetDeviceByName("探测雷达").device_count; i++)
|
||||
{
|
||||
GameObject ld = Instantiate(ldDrag, dviceContent);
|
||||
ld.GetComponent<DragController>().deviceID = UIBootstrap.Instance.GetDeviceByName("探测雷达").id;
|
||||
DragController ld = Instantiate(ldDrag, dviceContent);
|
||||
ld.deviceID = UIBootstrap.Instance.GetDeviceByName("探测雷达").id;
|
||||
}
|
||||
}
|
||||
if (UIBootstrap.Instance.GetDeviceByName("激光火控平台").device_count > 0)
|
||||
{
|
||||
for (int i = 0; i < UIBootstrap.Instance.GetDeviceByName("激光火控平台").device_count; i++)
|
||||
{
|
||||
GameObject hp = Instantiate(hpDrag, dviceContent);
|
||||
hp.GetComponent<DragController>().deviceID = UIBootstrap.Instance.GetDeviceByName("激光火控平台").id;
|
||||
DragController hp = Instantiate(hpDrag, dviceContent);
|
||||
hp.deviceID = UIBootstrap.Instance.GetDeviceByName("激光火控平台").id;
|
||||
}
|
||||
}
|
||||
if (UIBootstrap.Instance.GetDeviceByName("地面无线电干扰").device_count > 0)
|
||||
{
|
||||
for (int i = 0; i < UIBootstrap.Instance.GetDeviceByName("地面无线电干扰").device_count; i++)
|
||||
{
|
||||
GameObject wxd = Instantiate(wxdDrag, dviceContent);
|
||||
wxd.GetComponent<DragController>().deviceID = UIBootstrap.Instance.GetDeviceByName("地面无线电干扰").id;
|
||||
DragController wxd = Instantiate(wxdDrag, dviceContent);
|
||||
wxd.deviceID = UIBootstrap.Instance.GetDeviceByName("地面无线电干扰").id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,6 +112,7 @@ public class GameManager : MonoBehaviour
|
|||
yield return new WaitForSeconds(0.5f);
|
||||
Debug.Log(msg);
|
||||
string[] data = msg.Split(',');
|
||||
|
||||
switch (data[0])
|
||||
{
|
||||
case "online":
|
||||
|
@ -131,6 +132,20 @@ public class GameManager : MonoBehaviour
|
|||
{
|
||||
UnmannedAerialVehicleManage.unmannedAerialVehicleManages[i].isStartRehearsing = true;
|
||||
}
|
||||
break;
|
||||
case "无人机List":
|
||||
GameObject wrj = Instantiate(wrjDrag.model);
|
||||
wrj.transform.position = new Vector3(float.Parse(data[1]), float.Parse(data[2]), float.Parse(data[3]));
|
||||
wrj.transform.eulerAngles = new Vector3(float.Parse(data[4]), float.Parse(data[5]), float.Parse(data[6]));
|
||||
break;
|
||||
case "地面无线电干扰":
|
||||
|
||||
break;
|
||||
case "探测雷达":
|
||||
|
||||
break;
|
||||
case "激光火控平台":
|
||||
|
||||
break;
|
||||
case "Stop":
|
||||
GlobalFlag.isStartRehearsing = false;
|
||||
|
|
|
@ -169,7 +169,8 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
/// </summary>
|
||||
public void modeSwitch(int patternCut)
|
||||
{
|
||||
switch (patternCut) {
|
||||
switch (patternCut)
|
||||
{
|
||||
case 0://待机
|
||||
pattern = Pattern.待机;
|
||||
break;
|
||||
|
@ -216,13 +217,14 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
{
|
||||
if (equipmentCommon)
|
||||
{
|
||||
string msg = $"send2room {equipmentCommon.equipmentType}+{transform.position.ToString().Replace(" ","")}+{transform.eulerAngles.ToString().Replace(" ", "")}";
|
||||
string msg = $"send2room {equipmentCommon.equipmentType}+{transform.position.ToString().Replace(" ", "")}+{transform.eulerAngles.ToString().Replace(" ", "").Replace("(", "").Replace(")", "")}";
|
||||
Debug.Log(msg);
|
||||
_ = SyncCreateRoom.SendMessageAsync(msg);
|
||||
}
|
||||
for (int i = 0; i < weaponitemone.Count; i++)
|
||||
{
|
||||
switch (weaponitemone[i].para_name) {
|
||||
switch (weaponitemone[i].para_name)
|
||||
{
|
||||
case "续航时间:":
|
||||
batteryLife = weaponitemone[i].para_value;
|
||||
break;
|
||||
|
@ -287,7 +289,8 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
/// <param name="number"></param>
|
||||
public void Formation(int number)
|
||||
{
|
||||
switch (number) {
|
||||
switch (number)
|
||||
{
|
||||
case 1:
|
||||
GenerateFormation();
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue