Exemple #1
0
        public void Setup(MPPeer peer)
        {
            base.SetupPeer(peer, peer.peerID == 1);
            Singleton <RuntimeIDManager> .Instance.SetupPeerID(base.peerID);

            Singleton <MPManager> .Instance.RegisterIdentity(0x21800001, 0, new LevelIdentity());
        }
Exemple #2
0
 public void SetupPeer(MPPeer peer, bool isMasterClient)
 {
     this._peer          = peer;
     this._isMaster      = isMasterClient;
     this._peerID        = peer.peerID;
     this._peer.onPacket = new MPPeer.ReceiveHandler(this.OnPeerPacketCallback);
     this.InitChannelManagement();
 }
Exemple #3
0
 public BaseMPManager()
 {
     this._recvByteBuffer      = new ByteBuffer(this._recvBuffer);
     this._defaultSendBuilder  = new FlatBufferBuilder(0x400);
     this._instantiateBuilder  = new FlatBufferBuilder(0x20);
     this._identities          = new Dictionary <uint, BaseMPIdentity>();
     this._identitiesList      = new List <BaseMPIdentity>();
     this._pendingInstantiates = new Dictionary <uint, int>();
     this._peer = IdleMPPeer.IDLE_PEER;
     MPMappings.InitMPMappings();
 }
Exemple #4
0
        private void Awake()
        {
            this._style                     = new GUIStyle();
            this._style.margin              = new RectOffset();
            this._style.padding             = new RectOffset();
            this._style.normal.textColor    = Color.magenta;
            this._style.hover.textColor     = Color.magenta;
            this._style.focused.textColor   = Color.magenta;
            this._style.active.textColor    = Color.magenta;
            this._style.onNormal.textColor  = Color.magenta;
            this._style.onHover.textColor   = Color.magenta;
            this._style.onFocused.textColor = Color.magenta;
            this._style.onActive.textColor  = Color.magenta;
            Texture2D textured = new Texture2D(4, 4);

            Color[] colors = new Color[0x10];
            Color   black  = Color.black;

            black.a = 0.5f;
            for (int i = 0; i < colors.Length; i++)
            {
                colors[i] = black;
            }
            textured.SetPixels(colors);
            textured.Apply();
            this._style.normal.background = textured;
            if (this.peerType == MPPeerType.uNet)
            {
                this._discovery = new UNetDiscovery(this.DiscoveryKey, this.DiscoveryVersion, this.DiscoverySubVersion, 0x3e8, false);
                this._peer      = new UNetMPPeer(this.isDelaySimulator);
            }
            else if (this.peerType == MPPeerType.Lidgren)
            {
                this._discovery = new UNetDiscovery(this.DiscoveryKey, this.DiscoveryVersion, this.DiscoverySubVersion, 0x3e8, true);
                this._peer      = new LidgrenMPPeer();
            }
            this._peer.Init();
            this._discovery.Init();
            this._peer.onConnected = new MPPeer.ConnectedHandler(this.OnClientConnected);
            this._discovery.onClientDiscoveredServer = new UNetDiscovery.ClientDiscoveredServerDelegate(this.OnClientFoundServer);
            this._peer.onEstablished = new MPPeer.EstablishedHandler(this.OnEstablished);
            this._connectedPeerCount = 0;
        }