Compare commits
2 Commits
61df6df538
...
97a09ec9f1
| Author | SHA1 | Date |
|---|---|---|
|
|
97a09ec9f1 | |
|
|
e0a33711d6 |
|
|
@ -146,7 +146,6 @@ public class Taskpanel : MonoBehaviour
|
||||||
{
|
{
|
||||||
string _msg = "leaveroom ";
|
string _msg = "leaveroom ";
|
||||||
_ = AdamSync.SyncCreateRoom.SendMessageAsync(_msg);
|
_ = AdamSync.SyncCreateRoom.SendMessageAsync(_msg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -476,6 +476,9 @@ public class View_Panel2 : XUIPanel
|
||||||
//SceneManager.LoadScene("AdamTraining_pilot_terminal_panl 1");
|
//SceneManager.LoadScene("AdamTraining_pilot_terminal_panl 1");
|
||||||
//加入房间
|
//加入房间
|
||||||
Debug.Log("进入训练");
|
Debug.Log("进入训练");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
string RoomName = "joinroom " + currentRoomName;
|
string RoomName = "joinroom " + currentRoomName;
|
||||||
_ = AdamSync.SyncCreateRoom.SendMessageAsync(RoomName);
|
_ = AdamSync.SyncCreateRoom.SendMessageAsync(RoomName);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ public class GameManager : MonoSingleton<GameManager>
|
||||||
{
|
{
|
||||||
if (deviceData.data[i].id == deviceInfo[7])
|
if (deviceData.data[i].id == deviceInfo[7])
|
||||||
{
|
{
|
||||||
SpawnDevice(devicePrefab, deviceData.data[i],deviceInfo);
|
SpawnDevice(devicePrefab, deviceData.data[i], deviceInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -269,10 +269,10 @@ public class GameManager : MonoSingleton<GameManager>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SpawnDevice(GameObject obj, AdamThinkDevicesData.DataItem data,string[] tran = null )
|
public void SpawnDevice(GameObject obj, AdamThinkDevicesData.DataItem data, string[] tran = null)
|
||||||
{
|
{
|
||||||
GameObject device = Instantiate(obj);
|
GameObject device = Instantiate(obj);
|
||||||
if(tran != null)
|
if (tran != null)
|
||||||
{
|
{
|
||||||
device.transform.position = new Vector3(float.Parse(tran[1]), float.Parse(tran[2]), float.Parse(tran[3]));
|
device.transform.position = new Vector3(float.Parse(tran[1]), float.Parse(tran[2]), float.Parse(tran[3]));
|
||||||
device.transform.eulerAngles = new Vector3(float.Parse(tran[4]), float.Parse(tran[5]), float.Parse(tran[6]));
|
device.transform.eulerAngles = new Vector3(float.Parse(tran[4]), float.Parse(tran[5]), float.Parse(tran[6]));
|
||||||
|
|
@ -283,24 +283,26 @@ public class GameManager : MonoSingleton<GameManager>
|
||||||
|
|
||||||
private void OnGetRoomUsers(string obj)
|
private void OnGetRoomUsers(string obj)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(obj)) return;
|
if (!string.IsNullOrWhiteSpace(obj))
|
||||||
string[] data = obj.Split(';');
|
|
||||||
//Debug.Log("datas=" + data[0]);
|
|
||||||
for (int i = 0; i < data.Length; i++)
|
|
||||||
{
|
{
|
||||||
int index = i;
|
string[] data = obj.Split(';');
|
||||||
string[] userInfo = data[index].Split(',');
|
for (int i = 0; i < data.Length; i++)
|
||||||
if (!userIds.Contains(ulong.Parse(userInfo[0])))
|
|
||||||
{
|
{
|
||||||
SyncPlayerTransform spt = Instantiate(playerTransformPrefab);
|
int index = i;
|
||||||
spt.gameObject.SetActive(true);
|
string[] userInfo = data[index].Split(',');
|
||||||
spt.SetPlayerInfo(ulong.Parse(userInfo[0]), userInfo[1], ulong.Parse(userInfo[2]), false);
|
if (!userIds.Contains(ulong.Parse(userInfo[0])))
|
||||||
spt.transform.position = new Vector3(spawnPos.position.x + index * 0.5f, spawnPos.position.y, spawnPos.position.z + index * 0.5f);
|
{
|
||||||
spt.transform.eulerAngles = spawnPos.eulerAngles;
|
SyncPlayerTransform spt = Instantiate(playerTransformPrefab);
|
||||||
AddPlayers(spt);
|
spt.gameObject.SetActive(true);
|
||||||
userIds.Add(ulong.Parse(userInfo[0]));
|
spt.SetPlayerInfo(ulong.Parse(userInfo[0]), userInfo[1], ulong.Parse(userInfo[2]), false);
|
||||||
|
spt.transform.position = new Vector3(spawnPos.position.x + index * 0.5f, spawnPos.position.y, spawnPos.position.z + index * 0.5f);
|
||||||
|
spt.transform.eulerAngles = spawnPos.eulerAngles;
|
||||||
|
AddPlayers(spt);
|
||||||
|
userIds.Add(ulong.Parse(userInfo[0]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Debug.Log($"<color=yellow>OnGetRoomUsers={obj}</color>");
|
||||||
SpawnDevice();
|
SpawnDevice();
|
||||||
string msg = $"send2room online,{ulong.Parse(GlobalFlag.currentUser.user_id)},{GlobalFlag.currentUser.login_name},{ulong.Parse(GlobalFlag.roomID)}";
|
string msg = $"send2room online,{ulong.Parse(GlobalFlag.currentUser.user_id)},{GlobalFlag.currentUser.login_name},{ulong.Parse(GlobalFlag.roomID)}";
|
||||||
_ = SyncCreateRoom.SendMessageAsync(msg);
|
_ = SyncCreateRoom.SendMessageAsync(msg);
|
||||||
|
|
@ -340,8 +342,17 @@ public class GameManager : MonoSingleton<GameManager>
|
||||||
private void OnDisable()
|
private void OnDisable()
|
||||||
{
|
{
|
||||||
Debug.Log("OnDisable");
|
Debug.Log("OnDisable");
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Reset()
|
||||||
|
{
|
||||||
SyncCreateRoom.getroomusersRequset -= OnGetRoomUsers;
|
SyncCreateRoom.getroomusersRequset -= OnGetRoomUsers;
|
||||||
SyncCreateRoom.send2roomRequset -= OnRoomInfo;
|
SyncCreateRoom.send2roomRequset -= OnRoomInfo;
|
||||||
|
string _msg = "leaveroom ";
|
||||||
|
_ = AdamSync.SyncCreateRoom.SendMessageAsync(_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -168,4 +168,10 @@ public class ToolsBootstrap : MonoSingleton<ToolsBootstrap>
|
||||||
{
|
{
|
||||||
wrjManager.wrjMenuSetPanel.gameObject.SetActive(false);
|
wrjManager.wrjMenuSetPanel.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnApplicationQuit()
|
||||||
|
{
|
||||||
|
string _msg = "leaveroom ";
|
||||||
|
_ = AdamSync.SyncCreateRoom.SendMessageAsync(_msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,18 @@ public class UIBootstrap : MonoSingleton<UIBootstrap>
|
||||||
}
|
}
|
||||||
return "0";
|
return "0";
|
||||||
}
|
}
|
||||||
|
///// <summary>
|
||||||
|
///// 是否分配角色
|
||||||
|
///// </summary>
|
||||||
|
//public bool IsAllocate()
|
||||||
|
//{
|
||||||
|
// string currentName =
|
||||||
|
// for(int i = 0;i < subjectInfo.Count; i++)
|
||||||
|
// {
|
||||||
|
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void OnGetWorldInfo(string msg)
|
public void OnGetWorldInfo(string msg)
|
||||||
|
|
@ -87,6 +99,7 @@ public class UIBootstrap : MonoSingleton<UIBootstrap>
|
||||||
Debug.Log("OnGetWorldInfo====" + msg);
|
Debug.Log("OnGetWorldInfo====" + msg);
|
||||||
GameManager.Instance.RemovePlayer(ulong.Parse(msg));
|
GameManager.Instance.RemovePlayer(ulong.Parse(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnLeaveRoomInfo(string msg)
|
public void OnLeaveRoomInfo(string msg)
|
||||||
{
|
{
|
||||||
string[] data = msg.Split(',');
|
string[] data = msg.Split(',');
|
||||||
|
|
@ -102,6 +115,8 @@ public class UIBootstrap : MonoSingleton<UIBootstrap>
|
||||||
{
|
{
|
||||||
Debug.Log("OnDisable");
|
Debug.Log("OnDisable");
|
||||||
AdamSync.SyncCreateRoom.leaveRoomRequset -= OnLeaveRoomInfo;
|
AdamSync.SyncCreateRoom.leaveRoomRequset -= OnLeaveRoomInfo;
|
||||||
|
string _msg = "leaveroom ";
|
||||||
|
_ = AdamSync.SyncCreateRoom.SendMessageAsync(_msg);
|
||||||
}
|
}
|
||||||
private void OnDestory()
|
private void OnDestory()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ namespace AdamSync
|
||||||
|
|
||||||
if (commands.Length > 0)
|
if (commands.Length > 0)
|
||||||
{
|
{
|
||||||
//Debug.Log("commands[0]====" + commands[0]);
|
Debug.Log($"<color=green>commands[0]===={commands[0]}</color>");
|
||||||
switch (commands[0])
|
switch (commands[0])
|
||||||
{
|
{
|
||||||
case "regist":
|
case "regist":
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue