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

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

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

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

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

            handler = new NetworkMessageHandler();

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

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