chore: update invaders to ngo 1.0.0 [MTT-3853] (#50)
* updating to NGO 1.0.0 * Restructuring connection and scene management * Adding reference to com.unity.multiplayer.samples.coop for the ClientNetworkTransform
This commit is contained in:
Родитель
3aa7068ff3
Коммит
7453fb69fd
|
@ -10,7 +10,7 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 4266113290039088506}
|
||||
- component: {fileID: 4266113290039088507}
|
||||
- component: {fileID: 4266113290039088509}
|
||||
- component: {fileID: 2756959678467573149}
|
||||
m_Layer: 0
|
||||
m_Name: Invaders Game Manager
|
||||
m_TagString: Untagged
|
||||
|
@ -28,6 +28,7 @@ Transform:
|
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
|
@ -60,7 +61,7 @@ MonoBehaviour:
|
|||
m_EnemyMovingDirection:
|
||||
m_InternalValue: 0.3
|
||||
m_RandomThresholdForSaucerCreation: 0.92
|
||||
--- !u!114 &4266113290039088509
|
||||
--- !u!114 &2756959678467573149
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
|
@ -72,8 +73,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
NetworkInstanceId: 0
|
||||
PrefabHash: 16858280994969747278
|
||||
PrefabHashGenerator: Invaders Game Manager
|
||||
GlobalObjectIdHash: 951099334
|
||||
AlwaysReplicateAsRoot: 0
|
||||
DontDestroyWithOwner: 0
|
||||
AutoObjectParentSync: 1
|
||||
|
|
|
@ -10,8 +10,7 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 2577463361084716461}
|
||||
- component: {fileID: 2577463361084716463}
|
||||
- component: {fileID: 2577463361084716458}
|
||||
- component: {fileID: 2053099818}
|
||||
- component: {fileID: 8303540700821626563}
|
||||
m_Layer: 0
|
||||
m_Name: NetworkManager
|
||||
m_TagString: Untagged
|
||||
|
@ -29,6 +28,7 @@ Transform:
|
|||
m_LocalRotation: {x: 0, y: -0.01745245, z: 0, w: 0.99984777}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
|
@ -45,12 +45,11 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 593a2fe42fa9d37498c96f9a383b6521, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
DontDestroy: 1
|
||||
RunInBackground: 1
|
||||
LogLevel: 1
|
||||
NetworkConfig:
|
||||
ProtocolVersion: 0
|
||||
NetworkTransport: {fileID: 2053099818}
|
||||
NetworkTransport: {fileID: 8303540700821626563}
|
||||
PlayerPrefab: {fileID: 0}
|
||||
NetworkPrefabs:
|
||||
- Override: 0
|
||||
|
@ -112,22 +111,9 @@ MonoBehaviour:
|
|||
NetworkIdRecycleDelay: 120
|
||||
RpcHashSize: 0
|
||||
LoadSceneTimeOut: 120
|
||||
MessageBufferTimeout: 20
|
||||
SpawnTimeout: 1
|
||||
EnableNetworkLogs: 1
|
||||
--- !u!114 &2577463361084716458
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2577463361084716459}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5ea5becd79dc277409330648bf627a3e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
DefaultMainMenu: StartMenu
|
||||
--- !u!114 &2053099818
|
||||
--- !u!114 &8303540700821626563
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
|
@ -140,9 +126,18 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ProtocolType: 0
|
||||
m_MessageBufferSize: 6144
|
||||
m_ReciveQueueSize: 128
|
||||
m_SendQueueSize: 128
|
||||
m_SendQueueBatchSize: 4096
|
||||
m_ServerAddress: 127.0.0.1
|
||||
m_ServerPort: 7777
|
||||
m_MaxPacketQueueSize: 128
|
||||
m_MaxPayloadSize: 32000
|
||||
m_MaxSendQueueSize: 98304
|
||||
m_HeartbeatTimeoutMS: 500
|
||||
m_ConnectTimeoutMS: 1000
|
||||
m_MaxConnectAttempts: 60
|
||||
m_DisconnectTimeoutMS: 30000
|
||||
ConnectionData:
|
||||
Address: 127.0.0.1
|
||||
Port: 7777
|
||||
ServerListenAddress:
|
||||
DebugSimulator:
|
||||
PacketDelayMS: 0
|
||||
PacketJitterMS: 0
|
||||
PacketDropRate: 0
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &7334280962834855350
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7334280962834855337}
|
||||
- component: {fileID: 7334280962834855336}
|
||||
- component: {fileID: 7334280962834855351}
|
||||
m_Layer: 0
|
||||
m_Name: SceneTransitionHandler
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7334280962834855337
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7334280962834855350}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &7334280962834855336
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7334280962834855350}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5ea5becd79dc277409330648bf627a3e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
DefaultMainMenu: StartMenu
|
||||
--- !u!114 &7334280962834855351
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7334280962834855350}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
GlobalObjectIdHash: 951099334
|
||||
AlwaysReplicateAsRoot: 0
|
||||
DontDestroyWithOwner: 0
|
||||
AutoObjectParentSync: 1
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 91098c3dcdcf21840a4b3d63b07286d8
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -14,7 +14,7 @@ GameObject:
|
|||
- component: {fileID: 6100000}
|
||||
- component: {fileID: 5000000}
|
||||
- component: {fileID: 5053919295125167455}
|
||||
- component: {fileID: 1149981187404082562}
|
||||
- component: {fileID: 2800302518702725854}
|
||||
m_Layer: 0
|
||||
m_Name: player
|
||||
m_TagString: Untagged
|
||||
|
@ -173,7 +173,7 @@ MonoBehaviour:
|
|||
AlwaysReplicateAsRoot: 0
|
||||
DontDestroyWithOwner: 0
|
||||
AutoObjectParentSync: 1
|
||||
--- !u!114 &1149981187404082562
|
||||
--- !u!114 &2800302518702725854
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
|
@ -182,21 +182,20 @@ MonoBehaviour:
|
|||
m_GameObject: {fileID: 100000}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e96cb6065543e43c4a752faaa1468eb1, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: df2868252ab5c4d1da357e8f11f1b524, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
SyncPositionX: 1
|
||||
SyncPositionY: 1
|
||||
SyncPositionZ: 1
|
||||
SyncRotAngleX: 1
|
||||
SyncRotAngleY: 1
|
||||
SyncRotAngleZ: 1
|
||||
SyncScaleX: 1
|
||||
SyncScaleY: 1
|
||||
SyncScaleZ: 1
|
||||
SyncPositionY: 0
|
||||
SyncPositionZ: 0
|
||||
SyncRotAngleX: 0
|
||||
SyncRotAngleY: 0
|
||||
SyncRotAngleZ: 0
|
||||
SyncScaleX: 0
|
||||
SyncScaleY: 0
|
||||
SyncScaleZ: 0
|
||||
PositionThreshold: 0.001
|
||||
RotAngleThreshold: 0.01
|
||||
ScaleThreshold: 0.01
|
||||
InLocalSpace: 0
|
||||
Interpolate: 1
|
||||
CanCommitToTransform: 0
|
||||
|
|
|
@ -2129,6 +2129,11 @@ PrefabInstance:
|
|||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 2756959678467573149, guid: 67eb58ec33df0475ca152786107f9037,
|
||||
type: 3}
|
||||
propertyPath: GlobalObjectIdHash
|
||||
value: 1720109418
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4266113290039088506, guid: 67eb58ec33df0475ca152786107f9037,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
|
|
|
@ -38,7 +38,7 @@ RenderSettings:
|
|||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.3731193, g: 0.38073996, b: 0.35872698, a: 1}
|
||||
m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
|
@ -213,3 +213,77 @@ PrefabInstance:
|
|||
objectReference: {fileID: 100000, guid: c02eab22aaa0b68408500d6e87878b32, type: 3}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: a33721e9ba3981444b972ae70c494d73, type: 3}
|
||||
--- !u!1001 &7334280963267320184
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 7334280962834855337, guid: 91098c3dcdcf21840a4b3d63b07286d8,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7334280962834855337, guid: 91098c3dcdcf21840a4b3d63b07286d8,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7334280962834855337, guid: 91098c3dcdcf21840a4b3d63b07286d8,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7334280962834855337, guid: 91098c3dcdcf21840a4b3d63b07286d8,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7334280962834855337, guid: 91098c3dcdcf21840a4b3d63b07286d8,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7334280962834855337, guid: 91098c3dcdcf21840a4b3d63b07286d8,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7334280962834855337, guid: 91098c3dcdcf21840a4b3d63b07286d8,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7334280962834855337, guid: 91098c3dcdcf21840a4b3d63b07286d8,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7334280962834855337, guid: 91098c3dcdcf21840a4b3d63b07286d8,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7334280962834855337, guid: 91098c3dcdcf21840a4b3d63b07286d8,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7334280962834855337, guid: 91098c3dcdcf21840a4b3d63b07286d8,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7334280962834855350, guid: 91098c3dcdcf21840a4b3d63b07286d8,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: SceneTransitionHandler
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7334280962834855351, guid: 91098c3dcdcf21840a4b3d63b07286d8,
|
||||
type: 3}
|
||||
propertyPath: GlobalObjectIdHash
|
||||
value: 4152329973
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 91098c3dcdcf21840a4b3d63b07286d8, type: 3}
|
||||
|
|
|
@ -193,13 +193,13 @@ public class InvadersGame : NetworkBehaviour
|
|||
/// <returns>true or false</returns>
|
||||
private bool ShouldStartCountDown()
|
||||
{
|
||||
//If the game has started, then don't both with the rest of the count down checks.
|
||||
//If the game has started, then don't bother with the rest of the count down checks.
|
||||
if (HasGameStarted()) return false;
|
||||
if (IsServer)
|
||||
{
|
||||
m_CountdownStarted.Value = SceneTransitionHandler.sceneTransitionHandler.AllClientsAreLoaded();
|
||||
|
||||
//While we are counting down, continually set the m_ReplicatedTimeRemaining.Value (client should only receive the update once)
|
||||
//While we are counting down, continually set the replicated time remaining value for clients (client should only receive the update once)
|
||||
if (m_CountdownStarted.Value && !m_ReplicatedTimeSent)
|
||||
{
|
||||
SetReplicatedTimeRemainingClientRPC(m_DelayedStartTime);
|
||||
|
|
|
@ -7,9 +7,6 @@ using UnityEngine.UI;
|
|||
|
||||
public class LobbyControl : NetworkBehaviour
|
||||
{
|
||||
[HideInInspector]
|
||||
public static bool isHosting;
|
||||
|
||||
[SerializeField]
|
||||
private string m_InGameSceneName = "InGame";
|
||||
|
||||
|
@ -23,40 +20,27 @@ public class LobbyControl : NetworkBehaviour
|
|||
private Dictionary<ulong, bool> m_ClientsInLobby;
|
||||
private string m_UserLobbyStatusText;
|
||||
|
||||
/// <summary>
|
||||
/// Awake
|
||||
/// This is one way to kick off a multiplayer session
|
||||
/// </summary>
|
||||
private void Awake()
|
||||
public override void OnNetworkSpawn()
|
||||
{
|
||||
m_ClientsInLobby = new Dictionary<ulong, bool>();
|
||||
|
||||
//Always add ourselves to the list at first
|
||||
m_ClientsInLobby.Add(NetworkManager.LocalClientId, false);
|
||||
|
||||
//We added this information to tell us if we are going to host a game or join an the game session
|
||||
if (isHosting)
|
||||
NetworkManager.Singleton.StartHost(); //Spin up the host
|
||||
else
|
||||
NetworkManager.Singleton.StartClient(); //Spin up the client
|
||||
|
||||
if (NetworkManager.Singleton.IsListening)
|
||||
//If we are hosting, then handle the server side for detecting when clients have connected
|
||||
//and when their lobby scenes are finished loading.
|
||||
if (IsServer)
|
||||
{
|
||||
//Always add ourselves to the list at first
|
||||
m_ClientsInLobby.Add(NetworkManager.Singleton.LocalClientId, false);
|
||||
m_AllPlayersInLobby = false;
|
||||
|
||||
//If we are hosting, then handle the server side for detecting when clients have connected
|
||||
//and when their lobby scenes are finished loading.
|
||||
if (IsServer)
|
||||
{
|
||||
m_AllPlayersInLobby = false;
|
||||
|
||||
//Server will be notified when a client connects
|
||||
NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnectedCallback;
|
||||
SceneTransitionHandler.sceneTransitionHandler.OnClientLoadedScene += ClientLoadedScene;
|
||||
}
|
||||
|
||||
//Update our lobby
|
||||
GenerateUserStatsForLobby();
|
||||
//Server will be notified when a client connects
|
||||
NetworkManager.OnClientConnectedCallback += OnClientConnectedCallback;
|
||||
SceneTransitionHandler.sceneTransitionHandler.OnClientLoadedScene += ClientLoadedScene;
|
||||
}
|
||||
|
||||
//Update our lobby
|
||||
GenerateUserStatsForLobby();
|
||||
|
||||
SceneTransitionHandler.sceneTransitionHandler.SetSceneState(SceneTransitionHandler.SceneStates.Lobby);
|
||||
}
|
||||
|
||||
|
@ -124,7 +108,7 @@ public class LobbyControl : NetworkBehaviour
|
|||
|
||||
/// <summary>
|
||||
/// OnClientConnectedCallback
|
||||
/// Since we are entering a lobby and MLAPI NetowrkingManager is spawning the player,
|
||||
/// Since we are entering a lobby and Netcode's NetworkManager is spawning the player,
|
||||
/// the server can be configured to only listen for connected clients at this stage.
|
||||
/// </summary>
|
||||
/// <param name="clientId">client that connected</param>
|
||||
|
@ -195,14 +179,13 @@ public class LobbyControl : NetworkBehaviour
|
|||
/// </summary>
|
||||
public void PlayerIsReady()
|
||||
{
|
||||
m_ClientsInLobby[NetworkManager.Singleton.LocalClientId] = true;
|
||||
if (IsServer)
|
||||
{
|
||||
m_ClientsInLobby[NetworkManager.Singleton.ServerClientId] = true;
|
||||
UpdateAndCheckPlayersInLobby();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ClientsInLobby[NetworkManager.Singleton.LocalClientId] = true;
|
||||
OnClientIsReadyServerRpc(NetworkManager.Singleton.LocalClientId);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Text.RegularExpressions;
|
||||
using System.Text.RegularExpressions;
|
||||
using TMPro;
|
||||
using Unity.Netcode;
|
||||
using Unity.Netcode.Transports.UNET;
|
||||
using Unity.Netcode.Transports.UTP;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
|
@ -18,8 +18,14 @@ public class MenuControl : MonoBehaviour
|
|||
// Update the current HostNameInput with whatever we have set in the NetworkConfig as default
|
||||
var utpTransport = (UnityTransport)NetworkManager.Singleton.NetworkConfig.NetworkTransport;
|
||||
if (utpTransport) m_HostIpInput.text = "127.0.0.1";
|
||||
LobbyControl.isHosting = true; //This is a work around to handle proper instantiation of a scene for the first time.(See LobbyControl.cs)
|
||||
SceneTransitionHandler.sceneTransitionHandler.SwitchScene(m_LobbySceneName);
|
||||
if (NetworkManager.Singleton.StartHost())
|
||||
{
|
||||
SceneTransitionHandler.sceneTransitionHandler.SwitchScene(m_LobbySceneName);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Failed to start host.");
|
||||
}
|
||||
}
|
||||
|
||||
public void JoinLocalGame()
|
||||
|
@ -30,11 +36,11 @@ public class MenuControl : MonoBehaviour
|
|||
if (utpTransport)
|
||||
{
|
||||
utpTransport.SetConnectionData(Sanitize(m_HostIpInput.text), 7777);
|
||||
// utpTransport.ConnectAddress = m_HostIpInput.text;
|
||||
// utpTransport.ConnectPort = 7777;
|
||||
}
|
||||
LobbyControl.isHosting = false; //This is a work around to handle proper instantiation of a scene for the first time. (See LobbyControl.cs)
|
||||
SceneTransitionHandler.sceneTransitionHandler.SwitchScene(m_LobbySceneName);
|
||||
if (!NetworkManager.Singleton.StartClient())
|
||||
{
|
||||
Debug.LogError("Failed to start client.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Unity.Netcode;
|
||||
|
@ -47,6 +48,7 @@ public class SceneTransitionHandler : NetworkBehaviour
|
|||
}
|
||||
sceneTransitionHandler = this;
|
||||
SetSceneState(SceneStates.Init);
|
||||
DontDestroyOnLoad(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -93,7 +95,9 @@ public class SceneTransitionHandler : NetworkBehaviour
|
|||
{
|
||||
if(NetworkManager.Singleton.IsListening)
|
||||
{
|
||||
NetworkManager.Singleton.SceneManager.OnSceneEvent += OnSceneEvent;
|
||||
m_numberOfClientLoaded = 0;
|
||||
NetworkManager.Singleton.SceneManager.OnLoadComplete += OnLoadComplete;
|
||||
NetworkManager.Singleton.SceneManager.OnLoadEventCompleted += OnLoadEventCompleted;
|
||||
NetworkManager.Singleton.SceneManager.LoadScene(scenename, LoadSceneMode.Single);
|
||||
}
|
||||
else
|
||||
|
@ -101,13 +105,17 @@ public class SceneTransitionHandler : NetworkBehaviour
|
|||
SceneManager.LoadSceneAsync(scenename);
|
||||
}
|
||||
}
|
||||
private void OnSceneEvent(SceneEvent sceneEvent)
|
||||
{
|
||||
//We are only interested by Client Loaded Scene events
|
||||
if (sceneEvent.SceneEventType != SceneEventType.LoadComplete) return;
|
||||
|
||||
void OnLoadComplete(ulong clientId, string sceneName, LoadSceneMode loadSceneMode)
|
||||
{
|
||||
m_numberOfClientLoaded += 1;
|
||||
OnClientLoadedScene?.Invoke(sceneEvent.ClientId);
|
||||
OnClientLoadedScene?.Invoke(clientId);
|
||||
}
|
||||
|
||||
void OnLoadEventCompleted(string sceneName, LoadSceneMode loadSceneMode, List<ulong> clientsCompleted, List<ulong> clientsTimedOut)
|
||||
{
|
||||
NetworkManager.Singleton.SceneManager.OnLoadComplete -= OnLoadComplete;
|
||||
NetworkManager.Singleton.SceneManager.OnLoadEventCompleted -= OnLoadEventCompleted;
|
||||
}
|
||||
|
||||
public bool AllClientsAreLoaded()
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
"com.unity.ide.rider": "3.0.13",
|
||||
"com.unity.ide.visualstudio": "2.0.14",
|
||||
"com.unity.ide.vscode": "1.2.5",
|
||||
"com.unity.netcode.adapter.utp": "1.0.0-pre.2",
|
||||
"com.unity.multiplayer.samples.coop": "https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop",
|
||||
"com.unity.multiplayer.tools": "1.0.0-pre.7",
|
||||
"com.unity.netcode.gameobjects": "1.0.0",
|
||||
"com.unity.render-pipelines.universal": "12.1.6",
|
||||
"com.unity.textmeshpro": "3.0.6",
|
||||
"com.unity.timeline": "1.6.4",
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
"dependencies": {}
|
||||
},
|
||||
"com.unity.burst": {
|
||||
"version": "1.6.5",
|
||||
"depth": 1,
|
||||
"version": "1.6.6",
|
||||
"depth": 2,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.mathematics": "1.2.1"
|
||||
|
@ -16,15 +16,22 @@
|
|||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.collections": {
|
||||
"version": "1.2.3",
|
||||
"version": "1.2.4",
|
||||
"depth": 2,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.burst": "1.6.4",
|
||||
"com.unity.burst": "1.6.6",
|
||||
"com.unity.test-framework": "1.1.31"
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.editorcoroutines": {
|
||||
"version": "1.0.0",
|
||||
"depth": 2,
|
||||
"source": "registry",
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.ext.nunit": {
|
||||
"version": "1.0.6",
|
||||
"depth": 1,
|
||||
|
@ -57,6 +64,16 @@
|
|||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.learn.iet-framework": {
|
||||
"version": "2.2.1",
|
||||
"depth": 1,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.editorcoroutines": "1.0.0",
|
||||
"com.unity.settings-manager": "1.0.3"
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.mathematics": {
|
||||
"version": "1.2.6",
|
||||
"depth": 1,
|
||||
|
@ -64,31 +81,60 @@
|
|||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.netcode.adapter.utp": {
|
||||
"version": "1.0.0-pre.2",
|
||||
"com.unity.multiplayer.samples.coop": {
|
||||
"version": "https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop",
|
||||
"depth": 0,
|
||||
"source": "git",
|
||||
"dependencies": {
|
||||
"com.unity.learn.iet-framework": "1.2.1",
|
||||
"com.unity.multiplayer.tools": "1.0.0-pre.7",
|
||||
"com.unity.netcode.gameobjects": "1.0.0-pre.10",
|
||||
"com.unity.services.authentication": "1.0.0-pre.4",
|
||||
"com.unity.services.lobby": "1.0.0-pre.6",
|
||||
"com.unity.services.relay": "1.0.2"
|
||||
},
|
||||
"hash": "55bc606b0ae04e2368bdaeda903440570bd44900"
|
||||
},
|
||||
"com.unity.multiplayer.tools": {
|
||||
"version": "1.0.0-pre.7",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.netcode.gameobjects": "1.0.0-pre.2",
|
||||
"com.unity.transport": "1.0.0-pre.6"
|
||||
"com.unity.profiling.core": "1.0.0-pre.1",
|
||||
"com.unity.nuget.newtonsoft-json": "2.0.0",
|
||||
"com.unity.nuget.mono-cecil": "1.10.1",
|
||||
"com.unity.collections": "1.1.0",
|
||||
"com.unity.modules.uielements": "1.0.0"
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.netcode.gameobjects": {
|
||||
"version": "1.0.0-pre.2",
|
||||
"depth": 1,
|
||||
"version": "1.0.0",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.modules.ai": "1.0.0",
|
||||
"com.unity.modules.animation": "1.0.0",
|
||||
"com.unity.nuget.mono-cecil": "1.10.1",
|
||||
"com.unity.collections": "1.0.0-pre.5"
|
||||
"com.unity.transport": "1.1.0"
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.nuget.mono-cecil": {
|
||||
"version": "1.10.1",
|
||||
"depth": 2,
|
||||
"depth": 1,
|
||||
"source": "registry",
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.nuget.newtonsoft-json": {
|
||||
"version": "3.0.2",
|
||||
"depth": 3,
|
||||
"source": "registry",
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.profiling.core": {
|
||||
"version": "1.0.2",
|
||||
"depth": 1,
|
||||
"source": "registry",
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
|
@ -121,6 +167,82 @@
|
|||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.services.authentication": {
|
||||
"version": "2.0.0",
|
||||
"depth": 2,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.nuget.newtonsoft-json": "3.0.2",
|
||||
"com.unity.services.core": "1.3.1",
|
||||
"com.unity.modules.unitywebrequest": "1.0.0"
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.services.core": {
|
||||
"version": "1.4.0",
|
||||
"depth": 2,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.modules.unitywebrequest": "1.0.0",
|
||||
"com.unity.nuget.newtonsoft-json": "3.0.2",
|
||||
"com.unity.modules.androidjni": "1.0.0"
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.services.lobby": {
|
||||
"version": "1.0.0-pre.6",
|
||||
"depth": 1,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.services.core": "1.1.0-pre.10",
|
||||
"com.unity.modules.unitywebrequest": "1.0.0",
|
||||
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
|
||||
"com.unity.modules.unitywebrequestaudio": "1.0.0",
|
||||
"com.unity.modules.unitywebrequesttexture": "1.0.0",
|
||||
"com.unity.modules.unitywebrequestwww": "1.0.0",
|
||||
"com.unity.nuget.newtonsoft-json": "2.0.0",
|
||||
"com.unity.services.authentication": "1.0.0-pre.6"
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.services.qos": {
|
||||
"version": "1.0.0",
|
||||
"depth": 2,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.services.core": "1.3.2",
|
||||
"com.unity.modules.unitywebrequest": "1.0.0",
|
||||
"com.unity.nuget.newtonsoft-json": "3.0.1",
|
||||
"com.unity.services.authentication": "2.0.0",
|
||||
"com.unity.collections": "1.2.3"
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.services.relay": {
|
||||
"version": "1.0.2",
|
||||
"depth": 1,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.services.core": "1.4.0",
|
||||
"com.unity.services.authentication": "2.0.0",
|
||||
"com.unity.services.qos": "1.0.0",
|
||||
"com.unity.modules.unitywebrequest": "1.0.0",
|
||||
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
|
||||
"com.unity.modules.unitywebrequestaudio": "1.0.0",
|
||||
"com.unity.modules.unitywebrequesttexture": "1.0.0",
|
||||
"com.unity.modules.unitywebrequestwww": "1.0.0",
|
||||
"com.unity.nuget.newtonsoft-json": "3.0.1",
|
||||
"com.unity.transport": "1.0.0"
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.settings-manager": {
|
||||
"version": "1.0.3",
|
||||
"depth": 2,
|
||||
"source": "registry",
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.shadergraph": {
|
||||
"version": "12.1.6",
|
||||
"depth": 1,
|
||||
|
@ -163,13 +285,13 @@
|
|||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.transport": {
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"depth": 1,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.collections": "1.2.3",
|
||||
"com.unity.burst": "1.6.4",
|
||||
"com.unity.mathematics": "1.2.5"
|
||||
"com.unity.collections": "1.2.4",
|
||||
"com.unity.burst": "1.6.6",
|
||||
"com.unity.mathematics": "1.2.6"
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
|
@ -188,12 +310,24 @@
|
|||
"source": "builtin",
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.unity.modules.androidjni": {
|
||||
"version": "1.0.0",
|
||||
"depth": 3,
|
||||
"source": "builtin",
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.unity.modules.animation": {
|
||||
"version": "1.0.0",
|
||||
"depth": 0,
|
||||
"source": "builtin",
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.unity.modules.assetbundle": {
|
||||
"version": "1.0.0",
|
||||
"depth": 3,
|
||||
"source": "builtin",
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.unity.modules.audio": {
|
||||
"version": "1.0.0",
|
||||
"depth": 0,
|
||||
|
@ -308,6 +442,52 @@
|
|||
"depth": 0,
|
||||
"source": "builtin",
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.unity.modules.unitywebrequest": {
|
||||
"version": "1.0.0",
|
||||
"depth": 2,
|
||||
"source": "builtin",
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.unity.modules.unitywebrequestassetbundle": {
|
||||
"version": "1.0.0",
|
||||
"depth": 2,
|
||||
"source": "builtin",
|
||||
"dependencies": {
|
||||
"com.unity.modules.assetbundle": "1.0.0",
|
||||
"com.unity.modules.unitywebrequest": "1.0.0"
|
||||
}
|
||||
},
|
||||
"com.unity.modules.unitywebrequestaudio": {
|
||||
"version": "1.0.0",
|
||||
"depth": 2,
|
||||
"source": "builtin",
|
||||
"dependencies": {
|
||||
"com.unity.modules.unitywebrequest": "1.0.0",
|
||||
"com.unity.modules.audio": "1.0.0"
|
||||
}
|
||||
},
|
||||
"com.unity.modules.unitywebrequesttexture": {
|
||||
"version": "1.0.0",
|
||||
"depth": 2,
|
||||
"source": "builtin",
|
||||
"dependencies": {
|
||||
"com.unity.modules.unitywebrequest": "1.0.0",
|
||||
"com.unity.modules.imageconversion": "1.0.0"
|
||||
}
|
||||
},
|
||||
"com.unity.modules.unitywebrequestwww": {
|
||||
"version": "1.0.0",
|
||||
"depth": 2,
|
||||
"source": "builtin",
|
||||
"dependencies": {
|
||||
"com.unity.modules.unitywebrequest": "1.0.0",
|
||||
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
|
||||
"com.unity.modules.unitywebrequestaudio": "1.0.0",
|
||||
"com.unity.modules.audio": "1.0.0",
|
||||
"com.unity.modules.assetbundle": "1.0.0",
|
||||
"com.unity.modules.imageconversion": "1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче