コード例 #1
0
        private void Awake()
        {
            handler = new NetworkMessageHandler();

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

            RegisterMessage <ZmRegisterWorldReply>(HandleZmRegisterWorldReply);
        }
コード例 #2
0
ファイル: LoginServer.cs プロジェクト: massdriver/Multiverse
 private void Awake()
 {
     accountDatabase       = GetComponent <AccountDatabase>();
     activeSessions        = new Dictionary <ushort, Multiverse.LoginSession>();
     server                = new LidgrenServer();
     server.serverDelegate = this;
     handler               = new NetworkMessageHandler();
     RegisterMessage <LcRequestLogin>(HandleLcRequestLogin);
     RegisterMessage <LcRequestCreateAccount>(HandleLcRequestCreateAccount);
 }
コード例 #3
0
        private void Awake()
        {
            isConnected  = false;
            isAuthorized = false;

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

            handler = new NetworkMessageHandler();

            RegisterMessage <LsLoginReply>(HandleLsLoginReply);
            RegisterMessage <LsCreateAccountReply>(HandleLsCreateAccountReply);
        }
コード例 #4
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();
        }
コード例 #5
0
ファイル: ZoneMaster.cs プロジェクト: massdriver/Multiverse
        private void Awake()
        {
            if (singleton != null)
            {
                throw new InvalidOperationException("ZoneMaster script already present on scene, only one allowed");
            }

            singleton = this;

            handler = new NetworkMessageHandler();
            handler.SetHandler <ZcRegisterWorld>(HandleZcRegisterWorld);

            server = new LidgrenServer();
            server.serverDelegate = this;
            zones = new Dictionary <ulong, ZoneWorldInfo>();

            RegisterMessage <ZcRegisterWorld>(HandleZcRegisterWorld);
        }
コード例 #6
0
 protected virtual void Awake()
 {
     handlers = new NetworkMessageHandler();
 }