1212122
This commit is contained in:
parent
6caee0cc20
commit
3aafd10937
|
@ -0,0 +1,28 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class DeviceInfoItem : MonoBehaviour
|
||||||
|
{
|
||||||
|
public string deviceId;
|
||||||
|
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Refesh(string[] data)
|
||||||
|
{
|
||||||
|
Vector3 pos = new Vector3(float.Parse(data[2]), float.Parse(data[3]), float.Parse(data[4]));
|
||||||
|
Vector3 rot = new Vector3(float.Parse(data[4]), float.Parse(data[6]), float.Parse(data[7]));
|
||||||
|
transform.position = pos;
|
||||||
|
transform.position = rot;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0607bb6be5a37184f9cc11fffd5c8c15
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,41 @@
|
||||||
|
using AdamSync;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class DeviceManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
public List<DeviceInfoItem> devices = new List<DeviceInfoItem>();
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
SyncCreateRoom.send2roomRequset += GetSend2roomMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void AddDevice(DeviceInfoItem d)
|
||||||
|
{
|
||||||
|
if (!devices.Contains(d))
|
||||||
|
{
|
||||||
|
devices.Add(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GetSend2roomMsg(string data)
|
||||||
|
{
|
||||||
|
string[] info = data.Split(',');
|
||||||
|
for (int i = 0; i < devices.Count; i++)
|
||||||
|
{
|
||||||
|
if (devices[i].deviceId == info[0])
|
||||||
|
{
|
||||||
|
devices[i].Refesh(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDisalbe()
|
||||||
|
{
|
||||||
|
SyncCreateRoom.send2roomRequset -= GetSend2roomMsg;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 27096289766e99845a47ad87729a988f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -189,6 +189,8 @@ public class GameManager : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void SpawnDevice(DragController deviceDragBtn, string[] data)
|
public void SpawnDevice(DragController deviceDragBtn, string[] data)
|
||||||
{
|
{
|
||||||
GameObject obj = Instantiate(deviceDragBtn.prefabItem);
|
GameObject obj = Instantiate(deviceDragBtn.prefabItem);
|
||||||
|
|
|
@ -179,7 +179,7 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
{
|
{
|
||||||
latestData = nowData;
|
latestData = nowData;
|
||||||
Debug.Log(latestData);
|
Debug.Log(latestData);
|
||||||
_ = SyncCreateRoom.SendMessageAsync(string.Format("WRJ {0}", nowData));
|
_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}",nowData));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,6 +188,10 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
return string.Format("{0},{1},{2},{3},{4},{5},{6},{7}", "WRJPosAngle", 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},{7}", "WRJPosAngle", equipmentCommon.deviceID, transform.position.x, transform.position.y, transform.position.z, transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void GetDeviceInfo(string info)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
|
|
Loading…
Reference in New Issue