修改上线逻辑
This commit is contained in:
parent
618673c1c6
commit
c9ca72068f
|
@ -15,7 +15,7 @@ public class GameManager : MonoBehaviour
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
SyncCreateRoom.getroomusersRequset += OnGetRoomUsers;
|
SyncCreateRoom.getroomusersRequset += OnGetRoomUsers;
|
||||||
SyncCreateRoom.onlineRequset += OnOtherPlayerOnline;
|
SyncCreateRoom.send2roomRequset += OnOtherPlayerOnline;
|
||||||
SyncPlayerTransform spt = Instantiate(playerTransformPrefab);
|
SyncPlayerTransform spt = Instantiate(playerTransformPrefab);
|
||||||
spt.gameObject.SetActive(true);
|
spt.gameObject.SetActive(true);
|
||||||
spt.gameObject.transform.position = spawnPos.position;
|
spt.gameObject.transform.position = spawnPos.position;
|
||||||
|
@ -27,14 +27,7 @@ public class GameManager : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Update()
|
|
||||||
{
|
|
||||||
if (Input.GetKeyDown("t"))
|
|
||||||
{
|
|
||||||
string msg = "getroomusers ";
|
|
||||||
_ = SyncCreateRoom.SendMessageAsync(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnOtherPlayerOnline(string msg)
|
public void OnOtherPlayerOnline(string msg)
|
||||||
{
|
{
|
||||||
|
@ -84,7 +77,7 @@ public class GameManager : MonoBehaviour
|
||||||
userIds.Add(ulong.Parse(userInfo[0]));
|
userIds.Add(ulong.Parse(userInfo[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string msg = string.Format("send2room " + "online");
|
string msg = string.Format("send2room " + "online,"+ ulong.Parse(GlobalFlag.currentUser.user_id));
|
||||||
_ = SyncCreateRoom.SendMessageAsync(msg);
|
_ = SyncCreateRoom.SendMessageAsync(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class UIBootstrap : MonoSingleton<UIBootstrap>
|
||||||
}
|
}
|
||||||
AdamSync.SyncCreateRoom.getRoomsRequset += OnGetRooms;
|
AdamSync.SyncCreateRoom.getRoomsRequset += OnGetRooms;
|
||||||
AdamSync.SyncCreateRoom.getroomusersRequset += OnGetRoomsUsers;
|
AdamSync.SyncCreateRoom.getroomusersRequset += OnGetRoomsUsers;
|
||||||
AdamSync.SyncCreateRoom.onlineRequset += OnGetRoomsInfo;
|
AdamSync.SyncCreateRoom.send2roomRequset += OnGetRoomsInfo;
|
||||||
}
|
}
|
||||||
public void OnGetRooms(string msg)
|
public void OnGetRooms(string msg)
|
||||||
{
|
{
|
||||||
|
@ -62,13 +62,13 @@ public class UIBootstrap : MonoSingleton<UIBootstrap>
|
||||||
Debug.Log("OnDisable");
|
Debug.Log("OnDisable");
|
||||||
AdamSync.SyncCreateRoom.getRoomsRequset -= OnGetRooms;
|
AdamSync.SyncCreateRoom.getRoomsRequset -= OnGetRooms;
|
||||||
AdamSync.SyncCreateRoom.getroomusersRequset -= OnGetRoomsUsers;
|
AdamSync.SyncCreateRoom.getroomusersRequset -= OnGetRoomsUsers;
|
||||||
AdamSync.SyncCreateRoom.onlineRequset -= OnGetRoomsInfo;
|
AdamSync.SyncCreateRoom.send2roomRequset -= OnGetRoomsInfo;
|
||||||
}
|
}
|
||||||
private void OnDestory()
|
private void OnDestory()
|
||||||
{
|
{
|
||||||
Debug.Log("OnDestory");
|
Debug.Log("OnDestory");
|
||||||
AdamSync.SyncCreateRoom.getRoomsRequset -= OnGetRooms;
|
AdamSync.SyncCreateRoom.getRoomsRequset -= OnGetRooms;
|
||||||
AdamSync.SyncCreateRoom.getroomusersRequset -= OnGetRoomsUsers;
|
AdamSync.SyncCreateRoom.getroomusersRequset -= OnGetRoomsUsers;
|
||||||
AdamSync.SyncCreateRoom.onlineRequset -= OnGetRoomsInfo;
|
AdamSync.SyncCreateRoom.send2roomRequset -= OnGetRoomsInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace AdamSync
|
||||||
public static Action<string> closeRoomRequset;
|
public static Action<string> closeRoomRequset;
|
||||||
public static Action<int, string, string> playerInfoRequset;
|
public static Action<int, string, string> playerInfoRequset;
|
||||||
public static Action<string> getroomusersRequset;
|
public static Action<string> getroomusersRequset;
|
||||||
public static Action<string> onlineRequset;
|
public static Action<string> send2roomRequset;
|
||||||
public static Action<string> send2userRequset;
|
public static Action<string> send2userRequset;
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ namespace AdamSync
|
||||||
getroomusersRequset?.Invoke(commands[1]);
|
getroomusersRequset?.Invoke(commands[1]);
|
||||||
break;
|
break;
|
||||||
case "send2room":
|
case "send2room":
|
||||||
onlineRequset?.Invoke(commands[1]);
|
send2roomRequset?.Invoke(commands[1]);
|
||||||
break;
|
break;
|
||||||
case "send2user":
|
case "send2user":
|
||||||
send2userRequset?.Invoke(commands[1]);
|
send2userRequset?.Invoke(commands[1]);
|
||||||
|
|
Loading…
Reference in New Issue