Exemple #1
0
        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);
        }
Exemple #2
0
        public void OnClientDisconnected(LidgrenClient client)
        {
            OnDisconnected();

            isConnected  = false;
            isAuthorized = false;
        }
Exemple #3
0
        private void Awake()
        {
            handler = new NetworkMessageHandler();

            client = new LidgrenClient();
            client.clientDelegate = this;

            RegisterMessage <ZmRegisterWorldReply>(HandleZmRegisterWorldReply);
        }
Exemple #4
0
        private void Awake()
        {
            isConnected  = false;
            isAuthorized = false;

            client = new LidgrenClient();
            client.clientDelegate = this;

            handler = new NetworkMessageHandler();

            RegisterMessage <LsLoginReply>(HandleLsLoginReply);
            RegisterMessage <LsCreateAccountReply>(HandleLsCreateAccountReply);
        }
Exemple #5
0
        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();
        }
Exemple #6
0
 public void OnClientMessageReceived(LidgrenClient client, Message msg)
 {
     handler.HandleMessage(msg);
 }
Exemple #7
0
 public void OnClientDisconnected(LidgrenClient client)
 {
 }
Exemple #8
0
 public void OnClientConnected(LidgrenClient client)
 {
     isConnected = true;
     OnConnected();
 }
Exemple #9
0
 public void OnClientDisconnected(LidgrenClient client)
 {
     StopManager();
 }
Exemple #10
0
        //
        //
        //

        public void OnClientConnected(LidgrenClient client)
        {
            Debug.Log("client connected");
        }