public void OnClientConnected(LidgrenClient client) { OnZoneClientConnect(); ZcRegisterWorld msg = new ZcRegisterWorld(worldZoneId, UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex, GetMachineStaticIP(), client.GetConnection().Peer.Port); client.Send(msg, Lidgren.Network.NetDeliveryMethod.ReliableOrdered); }
public void OnClientDisconnected(LidgrenClient client) { OnDisconnected(); isConnected = false; isAuthorized = false; }
private void Awake() { handler = new NetworkMessageHandler(); client = new LidgrenClient(); client.clientDelegate = this; RegisterMessage <ZmRegisterWorldReply>(HandleZmRegisterWorldReply); }
private void Awake() { isConnected = false; isAuthorized = false; client = new LidgrenClient(); client.clientDelegate = this; handler = new NetworkMessageHandler(); RegisterMessage <LsLoginReply>(HandleLsLoginReply); RegisterMessage <LsCreateAccountReply>(HandleLsCreateAccountReply); }
private void Awake() { if (singleton != null) { throw new InvalidOperationException("Multiple instances of network manager is not allowed"); } singleton = this; if (playerPrefab == null) { throw new InvalidOperationException("playerPrefab field is not set"); } isServer = false; isClient = false; clientOwners = new Dictionary <ushort, ulong>(); players = new Dictionary <ulong, ushort>(); networkObjects = new Dictionary <ulong, UNetworkIdentity>(); serverPlayerObjects = new Dictionary <ushort, GameObject>(); readyPlayers = new List <ushort>(); registeredPrefabs = new Dictionary <ulong, GameObject>(); serverObject = new LidgrenServer(); serverObject.serverDelegate = this; clientObject = new LidgrenClient(); clientObject.clientDelegate = this; serverMessageHandler = new NetworkMessageHandler(); clientMessageHandler = new NetworkMessageHandler(); RegisterClientMessageHandler <UMsgLoadTargetScene>(ClientHandleUMsgLoadTargetScene); RegisterClientMessageHandler <UMsgSpawnObject>(ClientHandleUMsgSpawnObject); RegisterClientMessageHandler <UMsgUnspawnObject>(ClientHandleUMsgUnspawnObject); RegisterClientMessageHandler <UMsgAddPlayer>(ClientHandleUMsgAddPlayer); RegisterClientMessageHandler <UMsgRemovePlayer>(ClientHandleUMsgRemovePlayer); RegisterServerMessageHandler <UMsgSyncState>(ServerHandleUMsgSyncState); RegisterClientMessageHandler <UMsgSyncState>(ClientHandleUMsgSyncState); RegisterServerMessageHandler <UMsgScriptMessage>(ServerHandleUMsgScriptMessage); RegisterClientMessageHandler <UMsgScriptMessage>(ClientHandleUMsgScriptMessage); RegisterClientMessageHandler <UMsgSetOwner>(ClientHandleUMsgSetOwner); RegisterSpawnablePrefabs(); }
public void OnClientMessageReceived(LidgrenClient client, Message msg) { handler.HandleMessage(msg); }
public void OnClientDisconnected(LidgrenClient client) { }
public void OnClientConnected(LidgrenClient client) { isConnected = true; OnConnected(); }
public void OnClientDisconnected(LidgrenClient client) { StopManager(); }
// // // public void OnClientConnected(LidgrenClient client) { Debug.Log("client connected"); }