x1212
This commit is contained in:
parent
f2b7476009
commit
978b70d201
|
@ -3,12 +3,12 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class DeviceManager : MonoBehaviour
|
public class DeviceManager : MonoSingleton<DeviceManager>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 所有设备
|
/// 所有设备
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static List<EquipmentCommon> devices = new List<EquipmentCommon>();
|
public List<EquipmentCommon> devices = new List<EquipmentCommon>();
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
|
|
@ -93,6 +93,7 @@ public class GameManager : MonoBehaviour
|
||||||
tenkokuModule.mainCamera = spt.transform;
|
tenkokuModule.mainCamera = spt.transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
SetWeatherValue();
|
SetWeatherValue();
|
||||||
|
|
|
@ -16,9 +16,9 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
/// 场景所在方
|
/// 场景所在方
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SelectedSide selectedSide = SelectedSide.Other;
|
public SelectedSide selectedSide = SelectedSide.Other;
|
||||||
|
|
||||||
public string equipmentType = "";
|
public string equipmentType = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备唯一ID
|
/// 设备唯一ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -44,7 +44,7 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
|
|
||||||
// 布尔值变化时触发的事件
|
// 布尔值变化时触发的事件
|
||||||
public event System.Action<bool> OnActivationChanged;
|
public event System.Action<bool> OnActivationChanged;
|
||||||
|
|
||||||
|
|
||||||
private bool _isStartRehearsing = false;
|
private bool _isStartRehearsing = false;
|
||||||
// 属性绑定布尔值,并在值变化时触发事件
|
// 属性绑定布尔值,并在值变化时触发事件
|
||||||
|
@ -64,7 +64,7 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
equipmentCommon = GetComponent<EquipmentCommon>();
|
equipmentCommon = GetComponent<EquipmentCommon>();
|
||||||
DeviceManager.devices.Add(this);
|
DeviceManager.Instance.devices.Add(this);
|
||||||
// 订阅布尔值变化事件
|
// 订阅布尔值变化事件
|
||||||
OnActivationChanged += OnActivationChangedHandler;
|
OnActivationChanged += OnActivationChangedHandler;
|
||||||
//
|
//
|
||||||
|
@ -72,7 +72,7 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
}
|
}
|
||||||
void OnActivationChangedIsPlayer(bool newValue)
|
void OnActivationChangedIsPlayer(bool newValue)
|
||||||
{
|
{
|
||||||
if(newValue&& equipmentType== "无人机List"&& isOnlyOne)
|
if (newValue && equipmentType == "无人机List" && isOnlyOne)
|
||||||
{
|
{
|
||||||
isOnlyOne = false;
|
isOnlyOne = false;
|
||||||
StartCoroutine(SendMsg());
|
StartCoroutine(SendMsg());
|
||||||
|
@ -110,7 +110,7 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
public char replaceInfo;
|
public char replaceInfo;
|
||||||
public Dictionary<string, string> replaceInfoDic = new Dictionary<string, string>();
|
public Dictionary<string, string> replaceInfoDic = new Dictionary<string, string>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 物体生成时接受数据
|
/// 物体生成时接受数据
|
||||||
|
@ -119,7 +119,7 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
public void FillInTheData(List<List_paraItem> weaponitemone)
|
public void FillInTheData(List<List_paraItem> weaponitemone)
|
||||||
{
|
{
|
||||||
//向其他的单位发送创建信息
|
//向其他的单位发送创建信息
|
||||||
if (isPlayer&& equipmentCommon)//但是是由我自主创建的时候发送一次 且只发送一次
|
if (isPlayer && equipmentCommon)//但是是由我自主创建的时候发送一次 且只发送一次
|
||||||
{
|
{
|
||||||
string paraListJson = JsonConvert.SerializeObject(weaponitemone);
|
string paraListJson = JsonConvert.SerializeObject(weaponitemone);
|
||||||
replaceInfoDic.Add("PracticeId", GlobalFlag.roomID);
|
replaceInfoDic.Add("PracticeId", GlobalFlag.roomID);
|
||||||
|
@ -134,7 +134,7 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
_ = SyncCreateRoom.SendMessageAsync(msg);
|
_ = SyncCreateRoom.SendMessageAsync(msg);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
//填入数据
|
//填入数据
|
||||||
switch (equipmentType)
|
switch (equipmentType)
|
||||||
{
|
{
|
||||||
|
@ -185,7 +185,7 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
return string.Format("{0},{1},{2},{3},{4},{5},{6}", equipmentCommon.deviceID, transform.position.x, transform.position.y, transform.position.z, transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
|
return string.Format("{0},{1},{2},{3},{4},{5},{6}", equipmentCommon.deviceID, transform.position.x, transform.position.y, transform.position.z, transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue