fdf
This commit is contained in:
parent
1a802163c0
commit
3ac7c43f30
|
@ -144,7 +144,6 @@ public class Taskpanel : MonoBehaviour
|
||||||
|
|
||||||
public void OnLeaveRoom()
|
public void OnLeaveRoom()
|
||||||
{
|
{
|
||||||
//_ = AdamSync.SyncCreateRoom.SendMessageAsync($"send2room offline,{GlobalFlag.currentUser.user_id}");
|
|
||||||
string _msg = "leaveroom ";
|
string _msg = "leaveroom ";
|
||||||
_ = AdamSync.SyncCreateRoom.SendMessageAsync(_msg);
|
_ = AdamSync.SyncCreateRoom.SendMessageAsync(_msg);
|
||||||
//SceneManager.LoadScene("SampleScene");
|
//SceneManager.LoadScene("SampleScene");
|
||||||
|
|
|
@ -202,7 +202,7 @@ public class GameManager : MonoSingleton<GameManager>
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "offline":
|
case "offline":
|
||||||
|
RemovePlayer(ulong.Parse(data[1]));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -24,13 +24,11 @@ public class UIBootstrap : MonoSingleton<UIBootstrap>
|
||||||
t = Jsonanalyze.FromJson<Traininginformation>(editinformation.data[i].VirtualPath);
|
t = Jsonanalyze.FromJson<Traininginformation>(editinformation.data[i].VirtualPath);
|
||||||
traininginformations.Add(t);
|
traininginformations.Add(t);
|
||||||
}
|
}
|
||||||
AdamSync.SyncCreateRoom.getRoomsRequset += OnGetRooms;
|
|
||||||
AdamSync.SyncCreateRoom.getroomusersRequset += OnGetRoomsUsers;
|
|
||||||
AdamSync.SyncCreateRoom.send2roomRequset += OnGetRoomsInfo;
|
|
||||||
AdamSync.SyncCreateRoom.leaveRoomRequset += OnOtherPlayerOffline;
|
AdamSync.SyncCreateRoom.leaveRoomRequset += OnOtherPlayerOffline;
|
||||||
|
AdamSync.SyncCreateRoom.send2worldRequset += OnGetWorldInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public async void GetSceneData(string roomId)
|
public async void GetSceneData(string roomId)
|
||||||
{
|
{
|
||||||
|
@ -81,73 +79,30 @@ public class UIBootstrap : MonoSingleton<UIBootstrap>
|
||||||
return "0";
|
return "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void OnGetWorldInfo(string msg)
|
||||||
public void OnGetRooms(string msg)
|
|
||||||
{
|
{
|
||||||
Debug.Log("OnGetRooms====" + msg);
|
Debug.Log("OnGetWorldInfo====" + msg);
|
||||||
}
|
GameManager.Instance.RemovePlayer(ulong.Parse(msg));
|
||||||
public void OnGetRoomsUsers(string msg)
|
|
||||||
{
|
|
||||||
Debug.Log("OnGetRooms====" + msg);
|
|
||||||
}
|
|
||||||
public void OnGetRoomsInfo(string msg)
|
|
||||||
{
|
|
||||||
Debug.Log("OnGetRooms====" + msg);
|
|
||||||
}
|
}
|
||||||
public void OnOtherPlayerOffline(string msg)
|
public void OnOtherPlayerOffline(string msg)
|
||||||
{
|
{
|
||||||
string[] data = msg.Split(',');
|
string[] data = msg.Split(',');
|
||||||
Debug.Log(data[1]);
|
Debug.Log(data[1]);
|
||||||
if (data[0] == "offline")
|
_ = AdamSync.SyncCreateRoom.SendMessageAsync($"send2world {GlobalFlag.currentUser.user_id}");
|
||||||
{
|
|
||||||
GameManager.Instance.RemovePlayer(ulong.Parse(data[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
if (Input.GetKeyDown("o"))
|
|
||||||
{
|
|
||||||
string info = "getrooms ";
|
|
||||||
Debug.Log(info);
|
|
||||||
_ = AdamSync.SyncCreateRoom.SendMessageAsync(info);
|
|
||||||
}
|
|
||||||
if (Input.GetKeyDown("g"))
|
|
||||||
{
|
|
||||||
string info = "getroomusers ";
|
|
||||||
Debug.Log(info);
|
|
||||||
_ = AdamSync.SyncCreateRoom.SendMessageAsync(info);
|
|
||||||
}
|
|
||||||
if (Input.GetKeyDown("i"))
|
|
||||||
{
|
|
||||||
string info = "send2room " + "进入房间";
|
|
||||||
Debug.Log(info);
|
|
||||||
_ = AdamSync.SyncCreateRoom.SendMessageAsync(info);
|
|
||||||
}
|
|
||||||
if (Input.GetKeyDown("l"))
|
|
||||||
{
|
|
||||||
string msg = "leaveroom ";
|
|
||||||
_ = AdamSync.SyncCreateRoom.SendMessageAsync(msg);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void OnDisable()
|
private void OnDisable()
|
||||||
{
|
{
|
||||||
Debug.Log("OnDisable");
|
Debug.Log("OnDisable");
|
||||||
AdamSync.SyncCreateRoom.getRoomsRequset -= OnGetRooms;
|
|
||||||
AdamSync.SyncCreateRoom.getroomusersRequset -= OnGetRoomsUsers;
|
|
||||||
AdamSync.SyncCreateRoom.send2roomRequset -= OnGetRoomsInfo;
|
|
||||||
AdamSync.SyncCreateRoom.leaveRoomRequset -= OnOtherPlayerOffline;
|
AdamSync.SyncCreateRoom.leaveRoomRequset -= OnOtherPlayerOffline;
|
||||||
}
|
}
|
||||||
private void OnDestory()
|
private void OnDestory()
|
||||||
{
|
{
|
||||||
Debug.Log("OnDestory");
|
Debug.Log("OnDestory");
|
||||||
AdamSync.SyncCreateRoom.getRoomsRequset -= OnGetRooms;
|
|
||||||
AdamSync.SyncCreateRoom.getroomusersRequset -= OnGetRoomsUsers;
|
|
||||||
AdamSync.SyncCreateRoom.send2roomRequset -= OnGetRoomsInfo;
|
|
||||||
AdamSync.SyncCreateRoom.leaveRoomRequset -= OnOtherPlayerOffline;
|
AdamSync.SyncCreateRoom.leaveRoomRequset -= OnOtherPlayerOffline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ namespace AdamSync
|
||||||
public static Action<string> getroomusersRequset;
|
public static Action<string> getroomusersRequset;
|
||||||
public static Action<string> send2roomRequset;
|
public static Action<string> send2roomRequset;
|
||||||
public static Action<string> send2userRequset;
|
public static Action<string> send2userRequset;
|
||||||
|
public static Action<string> send2worldRequset;
|
||||||
|
|
||||||
|
|
||||||
public static async Task StartLinkTCPServer(string serverIp, int serverPort)
|
public static async Task StartLinkTCPServer(string serverIp, int serverPort)
|
||||||
|
@ -118,6 +119,9 @@ namespace AdamSync
|
||||||
case "send2user":
|
case "send2user":
|
||||||
send2userRequset?.Invoke(commands[1]);
|
send2userRequset?.Invoke(commands[1]);
|
||||||
break;
|
break;
|
||||||
|
case "send2world":
|
||||||
|
send2worldRequset?.Invoke(commands[1]);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue