online game working
This commit is contained in:
@@ -223,6 +223,10 @@ namespace MegaKoop.Game.Networking
|
||||
if (thirdPersonCamera != null)
|
||||
{
|
||||
thirdPersonCamera.enabled = info.IsLocal;
|
||||
if (info.IsLocal)
|
||||
{
|
||||
thirdPersonCamera.SetTarget(clone.transform);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -93,6 +93,15 @@ namespace MegaKoop.Game.Networking
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (networkManager == null)
|
||||
{
|
||||
networkManager = SteamCoopNetworkManager.Instance;
|
||||
if (networkManager != null)
|
||||
{
|
||||
RegisterHandlers();
|
||||
}
|
||||
}
|
||||
|
||||
if (networkManager == null)
|
||||
{
|
||||
return;
|
||||
@@ -178,7 +187,8 @@ namespace MegaKoop.Game.Networking
|
||||
}
|
||||
else
|
||||
{
|
||||
characterController.enabled = false;
|
||||
characterController.enabled = isLocalPlayer;
|
||||
characterController.SetInputSource(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -132,11 +132,23 @@ namespace MegaKoop.Game.Networking
|
||||
isHost = steamService.IsHost;
|
||||
|
||||
#if STEAMWORKSNET
|
||||
if (steamService.IsInLobby && p2pTransport != null)
|
||||
if (p2pTransport != null)
|
||||
{
|
||||
if (ulong.TryParse(steamService.LobbyIdString, out ulong lobbyValue) && lobbyValue != 0)
|
||||
if (steamService.IsInLobby)
|
||||
{
|
||||
p2pTransport.SetActiveLobby(new CSteamID(lobbyValue));
|
||||
CSteamID lobbyId = steamService.LobbyId;
|
||||
if (lobbyId != CSteamID.Nil)
|
||||
{
|
||||
p2pTransport.SetActiveLobby(lobbyId);
|
||||
}
|
||||
else if (ulong.TryParse(steamService.LobbyIdString, out ulong lobbyValue) && lobbyValue != 0)
|
||||
{
|
||||
p2pTransport.SetActiveLobby(new CSteamID(lobbyValue));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
p2pTransport.SetActiveLobby(CSteamID.Nil);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user