Esempio n. 1
0
        // video 9

        public void Register(PhotonServerPeer peer)
        {
            var registerSubServerOperation = new RegisterSubServerData()
            {
                GameServerAddress = ServerConfiguration.PublicIpAddress,
                TcpPort           = ServerConfiguration.TcpPort,
                UdpPort           = ServerConfiguration.UdpPort,
                ServerId          = ServerConfiguration.ServerId,
                ServerType        = ServerConfiguration.ServerType,
                ServerName        = ServerConfiguration.ServerName
            };

            XmlSerializer mySerializer = new XmlSerializer(typeof(RegisterSubServerData));
            StringWriter  outString    = new StringWriter();

            mySerializer.Serialize(outString, registerSubServerOperation);

            peer.SendOperationRequest(
                new OperationRequest(0, new RegisterSubServer()
            {
                RegisterSubServerOperation = outString.ToString()
            }),
                new SendParameters());
        }
 protected override void OnConnectionEstablished(object responseObject)
 {
     ServerPeer = ((PhotonPeerFactory)_application.PeerFactory).ServerPeerFactory(this, _peerInfo.IsSiblingConnection);
     ServerPeer.Register();
 }