生成脚本传递
This commit is contained in:
parent
cddd9c869a
commit
8fe23716ee
|
@ -2,12 +2,14 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using AdamThinkDevicesData;
|
||||
using AdamSync;
|
||||
|
||||
/// <summary>
|
||||
/// 设备
|
||||
/// </summary>
|
||||
public class EquipmentCommon : MonoBehaviour
|
||||
{
|
||||
public EquipmentCommon equipmentCommon;
|
||||
/// <summary>
|
||||
/// 场景所在方
|
||||
/// </summary>
|
||||
|
@ -38,6 +40,7 @@ public class EquipmentCommon : MonoBehaviour
|
|||
|
||||
void Start()
|
||||
{
|
||||
equipmentCommon = GetComponent<EquipmentCommon>();
|
||||
equipmentCommons.Add(this);
|
||||
// 订阅布尔值变化事件
|
||||
OnActivationChanged += OnActivationChangedHandler;
|
||||
|
@ -49,6 +52,12 @@ public class EquipmentCommon : MonoBehaviour
|
|||
/// <param name="newValue"></param>
|
||||
void OnActivationChangedHandler(bool newValue)
|
||||
{
|
||||
if (equipmentCommon)
|
||||
{
|
||||
string msg = $"send2room {equipmentCommon.equipmentType}+{transform.position.ToString().Replace(" ", "").Replace("(", "").Replace(")", "")}+{transform.eulerAngles.ToString().Replace(" ", "").Replace("(", "").Replace(")", "")}";
|
||||
Debug.Log(msg);
|
||||
_ = SyncCreateRoom.SendMessageAsync(msg);
|
||||
}
|
||||
switch (equipmentType)
|
||||
{
|
||||
case "激光火控平台":
|
||||
|
@ -78,6 +87,12 @@ public class EquipmentCommon : MonoBehaviour
|
|||
/// <param name="weaponitemone"></param>
|
||||
public void FillInTheData(List<List_paraItem> weaponitemone)
|
||||
{
|
||||
if (equipmentCommon)
|
||||
{
|
||||
string msg = $"send2room {equipmentCommon.equipmentType}+{transform.position.ToString().Replace(" ", "").Replace("(", "").Replace(")", "")}+{transform.eulerAngles.ToString().Replace(" ", "").Replace("(", "").Replace(")", "")}";
|
||||
Debug.Log(msg);
|
||||
_ = SyncCreateRoom.SendMessageAsync(msg);
|
||||
}
|
||||
switch (equipmentType)
|
||||
{
|
||||
case "激光火控平台":
|
||||
|
|
|
@ -3,12 +3,14 @@ using System.Collections.Generic;
|
|||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
using AdamThinkDevicesData;
|
||||
using AdamSync;
|
||||
|
||||
/// <summary>
|
||||
/// 激光火控平台
|
||||
/// </summary>
|
||||
public class LaserFireControlPlatformManger : MonoBehaviour
|
||||
{
|
||||
public EquipmentCommon equipmentCommon;
|
||||
/// <summary>
|
||||
/// 所有激光火控平台
|
||||
/// </summary>
|
||||
|
@ -48,14 +50,6 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
public float interval = 5.0f;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 测试用
|
||||
/// </summary>
|
||||
public string msg;
|
||||
/// <summary>
|
||||
/// 测试接受数据
|
||||
/// </summary>
|
||||
private Weaponitemone weaponitemones;
|
||||
|
||||
#region 激光火控平台数据
|
||||
/// <summary>
|
||||
|
@ -93,6 +87,7 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
equipmentCommon = GetComponent<EquipmentCommon>();
|
||||
laserFireControlPlatformMangers.Add(this);
|
||||
//weaponitemones = Newtonsoft.Json.JsonConvert.DeserializeObject<Weaponitemone>(msg);
|
||||
//FillInTheData(weaponitemones);//测试写入
|
||||
|
@ -152,6 +147,12 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
/// <param name="weaponitemone"></param>
|
||||
public void FillInTheData(List<List_paraItem> weaponitemone)
|
||||
{
|
||||
if (equipmentCommon)
|
||||
{
|
||||
string msg = $"send2room {equipmentCommon.equipmentType}+{transform.position.ToString().Replace(" ", "").Replace("(", "").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)
|
||||
|
|
|
@ -2,12 +2,15 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using AdamThinkDevicesData;
|
||||
using AdamSync;
|
||||
|
||||
/// <summary>
|
||||
/// 雷达控制
|
||||
/// </summary>
|
||||
public class RadarManger : MonoBehaviour
|
||||
{
|
||||
|
||||
public EquipmentCommon equipmentCommon;
|
||||
#region 启动暂停
|
||||
private bool _isStartRehearsing = false;
|
||||
/// <summary>
|
||||
|
@ -43,14 +46,6 @@ public class RadarManger : MonoBehaviour
|
|||
public float interval = 5.0f;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 测试用
|
||||
/// </summary>
|
||||
public string msg;
|
||||
/// <summary>
|
||||
/// 测试接受数据
|
||||
/// </summary>
|
||||
private Weaponitemone weaponitemones;
|
||||
|
||||
/// <summary>
|
||||
/// 雷达UI预制体
|
||||
|
@ -123,8 +118,7 @@ public class RadarManger : MonoBehaviour
|
|||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
//weaponitemones = Newtonsoft.Json.JsonConvert.DeserializeObject<Weaponitemone>(msg);
|
||||
//FillInTheData(weaponitemones);
|
||||
equipmentCommon = GetComponent<EquipmentCommon>();
|
||||
aniRandar = GetComponent<Animator>();
|
||||
if (RadarUi == null)
|
||||
{
|
||||
|
@ -137,12 +131,9 @@ public class RadarManger : MonoBehaviour
|
|||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (isStartRehearsing)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
#region 启动暂停
|
||||
/// <summary>
|
||||
/// 导条变化调用
|
||||
|
@ -219,6 +210,12 @@ public class RadarManger : MonoBehaviour
|
|||
/// <param name="weaponitemone"></param>
|
||||
public void FillInTheData(List<List_paraItem> weaponitemone)
|
||||
{
|
||||
if (equipmentCommon)
|
||||
{
|
||||
string msg = $"send2room {equipmentCommon.equipmentType}+{transform.position.ToString().Replace(" ", "").Replace("(", "").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)
|
||||
|
|
|
@ -2,6 +2,7 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using AdamThinkDevicesData;
|
||||
using AdamSync;
|
||||
|
||||
/// <summary>
|
||||
/// 地面无线电干扰控制
|
||||
|
@ -9,15 +10,7 @@ using AdamThinkDevicesData;
|
|||
public class TerrestrialRadioInterferenceManger : MonoBehaviour
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 测试用
|
||||
/// </summary>
|
||||
public string msg;
|
||||
/// <summary>
|
||||
/// 测试接受数据
|
||||
/// </summary>
|
||||
private Weaponitemone weaponitemones;
|
||||
public EquipmentCommon equipmentCommon;
|
||||
|
||||
#region 地面无线电干扰数据
|
||||
/// <summary>
|
||||
|
@ -82,9 +75,7 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour
|
|||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
//weaponitemones = Newtonsoft.Json.JsonConvert.DeserializeObject<Weaponitemone>(msg);
|
||||
//FillInTheData(weaponitemones);//测试写入
|
||||
|
||||
equipmentCommon = GetComponent<EquipmentCommon>();
|
||||
// 订阅布尔值变化事件
|
||||
OnActivationChanged += OnActivationChangedHandler;
|
||||
}
|
||||
|
@ -153,6 +144,12 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour
|
|||
/// <param name="weaponitemone"></param>
|
||||
public void FillInTheData(List<List_paraItem> weaponitemone)
|
||||
{
|
||||
if (equipmentCommon)
|
||||
{
|
||||
string msg = $"send2room {equipmentCommon.equipmentType}+{transform.position.ToString().Replace(" ", "").Replace("(", "").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)
|
||||
|
|
|
@ -217,7 +217,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
{
|
||||
if (equipmentCommon)
|
||||
{
|
||||
string msg = $"send2room {equipmentCommon.equipmentType}+{transform.position.ToString().Replace(" ", "")}+{transform.eulerAngles.ToString().Replace(" ", "").Replace("(", "").Replace(")", "")}";
|
||||
string msg = $"send2room {equipmentCommon.equipmentType}+{transform.position.ToString().Replace(" ", "").Replace("(", "").Replace(")", "")}+{transform.eulerAngles.ToString().Replace(" ", "").Replace("(", "").Replace(")", "")}";
|
||||
Debug.Log(msg);
|
||||
_ = SyncCreateRoom.SendMessageAsync(msg);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue