public OutgoingMasterServerPeer(IRpcProtocol protocol, IPhotonPeer nativePeer, GameApplication application)
     : base(protocol, nativePeer)
 {
     this.application = application;
     log.InfoFormat("connection to master at {0}:{1} established (id={2}), serverId={3}", this.RemoteIP, this.RemotePort, this.ConnectionId, GameApplication.ServerId);
     this.RequestFiber.Enqueue(this.Register);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SetPropertiesRequest"/> class.
        /// </summary>
        /// <param name="protocol">
        /// The protocol.
        /// </param>
        /// <param name="operationRequest">
        /// Operation request containing the operation parameters.
        /// </param>
        public SetPropertiesRequest(IRpcProtocol protocol, OperationRequest operationRequest)
            : base(protocol, operationRequest)
        {
            if (!this.IsValid)
            {
                return;
            }

            // special handling for game and actor properties send by AS3/Flash (Amf3 protocol) or JSON clients
            if (protocol.ProtocolType == ProtocolType.Amf3V16 || protocol.ProtocolType == ProtocolType.Json)
            {
                if (this.UpdatingGameProperties)
                {
                    Utilities.ConvertAs3WellKnownPropertyKeys(this.Properties, null);
                    Utilities.ConvertAs3WellKnownPropertyKeys(this.ExpectedValues, null);
                }
                else
                {
                    Utilities.ConvertAs3WellKnownPropertyKeys(null, this.Properties);
                    Utilities.ConvertAs3WellKnownPropertyKeys(null, this.ExpectedValues);
                }
            }

            if (this.UpdatingGameProperties)
            {
                this.isValid = GameParameterReader.TryGetProperties(this.Properties, out this.newMaxPlayer,
                    out this.newIsOpen, out this.newIsVisible,
                    out this.newLobbyProperties, out this.MasterClientId,
                    out this.ExpectedUsers, out this.errorMessage);
            }
        }
    public StarCollectorPeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer)
        : base(protocol, unmanagedPeer)
    {
        #region Assigned ID
        lock (allocateIDLock)
        {
            playerID = lastAssignedID;
            lastAssignedID++;
        }

        //notify player of their ID
        EventData evt = new EventData()
        {
            Code = (byte)AckEventType.AssignPlayerID,
            Parameters = new Dictionary<byte, object>()
            {
                { (byte)Parameter.PlayerID, this.playerID }
            }
        };
        evt.Parameters[(byte)Parameter.PlayerID] = playerID;
        this.SendEvent(evt, new SendParameters());
        #endregion

        #region Join to world
        lock (StarCollectorGame.Instance)
        {
            StarCollectorGame.Instance.PeerJoined(this);
        }
        #endregion
    }
Ejemplo n.º 4
0
 public REPeer(IRpcProtocol rpcprotocol, IPhotonPeer nativePeer, REServer serverApplication)
     : base(rpcprotocol,nativePeer)
 {
     guid = Guid.NewGuid();
     server = serverApplication;
     server.wandererDictionary.Add(guid, this);
 }
 public OutgoingMasterServerPeer(IRpcProtocol protocol, IPhotonPeer nativePeer, SubServer subServer)
     : base(protocol, nativePeer)
 {
     _application = subServer;
     Log.InfoFormat("connection to master at {0}:{1} established (id={2})", RemoteIP, RemotePort, ConnectionId);
     RequestFiber.Enqueue(Register);
 }
Ejemplo n.º 6
0
 public ChatPeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer)
     : base(protocol, unmanagedPeer)
 {
     lock (syncRoot)
     {
         BroadcastMessage += this.OnBroadcastMessage;
     }
 }
Ejemplo n.º 7
0
 public LatencyPeer(IRpcProtocol protocol, IPhotonPeer nativePeer)
     : base(protocol, nativePeer)
 {
     if (log.IsDebugEnabled)
     {
         log.DebugFormat("Latency monitoring client connected, serverId={0}", GameApplication.ServerId);
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "GetPropertiesRequest" /> class.
 /// </summary>
 /// <param name = "protocol">
 ///   The protocol.
 /// </param>
 /// <param name = "operationRequest">
 ///   Operation request containing the operation parameters.
 /// </param>
 public GetPropertiesRequest(IRpcProtocol protocol, OperationRequest operationRequest)
     : base(protocol, operationRequest)
 {
     // special treatment for game and actor properties sent by AS3/Flash or JSON clients
     if (protocol.ProtocolType == ProtocolType.Amf3V16 || protocol.ProtocolType == ProtocolType.Json)
     {
         Utilities.ConvertAs3WellKnownPropertyKeys(this.GamePropertyKeys, this.ActorPropertyKeys);
     }
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 类型:方法
        /// 名称:ServerPeer
        /// 作者:taixihuase
        /// 作用:构造 ServerPeer 对象
        /// 编写日期:2015/7/12
        /// </summary>
        /// <param name="protocol"></param>
        /// <param name="unmanagedPeer"></param>
        /// <param name="server"></param>
        public ServerPeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer, ServerApplication server)
            : base(protocol, unmanagedPeer)
        {
            PeerGuid = Guid.NewGuid();
            Server = server;

            // 将当前 peer 加入连线列表
            Server.Users.AddConnectedPeer(PeerGuid, this);
        }
Ejemplo n.º 10
0
        public MmoPeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer)
            : base(rpcProtocol, nativePeer)
        {
            // this is the operation handler before entering a world
            this.SetCurrentOperationHandler(this);

            #region PopBloop

            string configFile = Path.Combine(DbSettings.BinaryPath, "PopBloopServer.config");
            if (File.Exists(configFile))
            {
                using (StreamReader reader = new StreamReader(configFile))
                {
                    string line = reader.ReadLine();

                    if (line.Length > 1)
                    {
                        string[] config = line.Split('@');
                        string address = config[1];
                        string username = config[0];
                        if (address.Trim().Length > 1 && address.Contains(":"))
                        {
                            DbSettings.DBServerAddress = address;
                            log.Info("DBServerAddress: " + address);
                        }

                        if (username.Trim().Length > 1 && username.Contains(":"))
                        {
                            string[] credentials = username.Split(':');
                            if (credentials.Length == 2)
                            {
                                DbSettings.DBServerUsername = credentials[0];
                                DbSettings.DBServerPassword = credentials[1];
                                log.Info("DBUserName: "******", DBPassword: "******"No credentials found on PopBloopServer.config");
                            }
                        }
                        else
                        {
                            log.Info("Credentials Invalid: '" + username +"'");
                        }
                    }
                }
            }

            #endregion
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JoinGameRequest"/> class.
        /// </summary>
        /// <param name="protocol">
        /// The protocol.
        /// </param>
        /// <param name="operationRequest">
        /// Operation request containing the operation parameters.
        /// </param>
        public JoinGameRequest(IRpcProtocol protocol, OperationRequest operationRequest)
            : base(protocol, operationRequest)
        {
            if (!this.IsValid)
            {
                return;
            }

            // special treatment for game and actor properties sent by AS3/Flash or JSON clients
            var protocolId = protocol.ProtocolType;
            if (protocolId == ProtocolType.Amf3V16 || protocolId == ProtocolType.Json)
            {
                Utilities.ConvertAs3WellKnownPropertyKeys(this.GameProperties, this.ActorProperties);
            }

            this.SetupRequest();
        }
Ejemplo n.º 12
0
        public ActorPeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer)
            : base(protocol, unmanagedPeer)
        {
            #region Assigned ID
            lock (allocateIDLock)
            {
                playerID = lastAssignedID;
                lastAssignedID++;
            }
            #endregion

            #region Join to Arena
            lock (ServerArena.Instance)
            {
                ServerArena.Instance.Enter(this);
            }
            #endregion
        }
Ejemplo n.º 13
0
        public LatencyMonitor(
            IRpcProtocol protocol, IPhotonPeer nativePeer, byte operationCode, int maxHistoryLength, int intervalMs, WorkloadController workloadController)
            : base(protocol, nativePeer)
        {
            this.operationCode = operationCode;
            this.intervalMs = intervalMs;
            this.workloadController = workloadController;
            this.latencyHistory = new ValueHistory(maxHistoryLength);
            this.averageLatencyMs = 0;
            this.lastLatencyMs = 0;

            log.InfoFormat("{1} connection for latency monitoring established (id={0}), serverId={2}", this.ConnectionId, this.NetworkProtocol, GameApplication.ServerId);

            if (!Stopwatch.IsHighResolution)
            {
                log.InfoFormat("No hires stopwatch!");
            }
            
            this.pingTimer = this.RequestFiber.ScheduleOnInterval(this.Ping, 0, this.intervalMs);
        }
        public PhotonAckPeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer)
            : base(protocol, unmanagedPeer)
        {
            lock (lockPlayerID)
            {
                this.playerID = lastAssignedPlayerID;
                lastAssignedPlayerID++;
            }
            PhotonAckGame.Instance.PeerConnected(this);

            EventData evn = new EventData((byte)AckEventType.AssignPlayerID)
            {
                Parameters = new Dictionary<byte, object>()
                {
                    { (byte)Parameter.PlayerID, this.playerID }
                }
            };
            Console.WriteLine("PhotonAckPeer PlayerID: " + this.playerID);
            this.SendEvent(evn,new SendParameters());
            Console.WriteLine("PhotonAckPeer SendEvent");
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SetViewDistance"/> class.
 /// </summary>
 /// <param name="protocol">
 /// The protocol.
 /// </param>
 /// <param name="request">
 /// The request.
 /// </param>
 public SetViewDistance(IRpcProtocol protocol, OperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 16
0
 public DeleteCharacter(IRpcProtocol protocol, GameOperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 17
0
 public EnterServer(IRpcProtocol protocol, OperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 18
0
 public DummyPeer(IRpcProtocol protocol, string username)
 {
     this.protocol     = protocol;
     this.username     = username;
     this.connectionId = Interlocked.Increment(ref connectionIds);
 }
Ejemplo n.º 19
0
 public TestHivePeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer, string userId)
     : this(rpcProtocol, nativePeer)
 {
     this.UserId = userId;
 }
 public AuthenticateUpdateEvent(IRpcProtocol protocol, IEventData eventData)
     : base(protocol, eventData.Parameters)
 {
 }
Ejemplo n.º 21
0
 public AuthenticateRequest(IRpcProtocol protocol, OperationRequest operationRequest)
     : base(protocol, operationRequest)
 {
 }
Ejemplo n.º 22
0
 public EnterWorkshop(IRpcProtocol protocol, OperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 23
0
 public UseInventorySlot(IRpcProtocol protocol, GameOperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 24
0
 public LeaveRequest(IRpcProtocol protocol, OperationRequest operationRequest)
     : base(protocol, operationRequest)
 {
 }
Ejemplo n.º 25
0
 public RequestServerID(IRpcProtocol protocol, OperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 26
0
 public FireBullet(IRpcProtocol protocol, OperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 27
0
 public JoinLobbyRequest(IRpcProtocol protocol, OperationRequest operationRequest)
     : base(protocol, operationRequest)
 {
 }
Ejemplo n.º 28
0
 public MmoPeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer)
     : base(rpcProtocol, nativePeer)
 {
     // this is the operation handler before entering a world
     this.SetCurrentOperationHandler(this);
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateWorld"/> class.
 /// </summary>
 /// <param name="protocol">
 /// The protocol.
 /// </param>
 /// <param name="request">
 /// The request. 
 /// </param>
 public CreateWorld(IRpcProtocol protocol, OperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 30
0
 public RegisterSubServer(IRpcProtocol rpcProtocol, OperationRequest operationRequest)
     : base(rpcProtocol, operationRequest)
 {
 }
Ejemplo n.º 31
0
 public AddActionbarSpell(IRpcProtocol protocol, GameOperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Photon.SocketServer.InitResponse"/> class.
 /// </summary>
 /// <param name="applicationId">The application id.</param>
 /// <param name="protocol">The rpc Protocol.</param>
 internal InitResponse(string applicationId, IRpcProtocol protocol)
 {
     this.applicationId = applicationId;
     this.protocol      = protocol;
 }
Ejemplo n.º 33
0
 public ChangeGroups(IRpcProtocol protocol, OperationRequest operationRequest)
     : base(protocol, operationRequest)
 {
 }
Ejemplo n.º 34
0
 public SubscribeItem(IRpcProtocol protocol, OperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 35
0
 public GetMailBoxOperationRequest(IRpcProtocol protocol, OperationRequest operationRequest)
     : base(protocol, operationRequest)
 {
 }
Ejemplo n.º 36
0
 public AddSession(IRpcProtocol protocol, IEventData eventData)
     : base(protocol, eventData.Parameters)
 {
 }
Ejemplo n.º 37
0
 public UpdateGameEvent(IRpcProtocol protocol, IEventData eventData)
     : base(protocol, eventData.Parameters)
 {
 }
Ejemplo n.º 38
0
 public TestHivePeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer, string userId)
     : this(rpcProtocol, nativePeer)
 {
     this.UserId = userId;
 }
Ejemplo n.º 39
0
 public MyEchoRequest(IRpcProtocol protocol, OperationRequest operationRequest)
     : base(protocol, operationRequest)
 {
 }
 public SetPropertiesRequest(IRpcProtocol protocol, OperationRequest operationRequest)
     : base(protocol, operationRequest)
 {
 }
Ejemplo n.º 41
0
 public SendChat(IRpcProtocol protocol, GameOperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 42
0
 public CreateGameRequest(IRpcProtocol protocol, OperationRequest operationRequest)
     : base(protocol, operationRequest)
 {
 }
Ejemplo n.º 43
0
 public RegisterSubServer(IRpcProtocol rpcProtocol, OperationRequest operationRequest)
     : base(rpcProtocol, operationRequest)
 {
     
 }
Ejemplo n.º 44
0
 public SubscribeCounter(IRpcProtocol protocol, OperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 45
0
 public PokerPeer(PokerApplication pokerApplication,IRpcProtocol protocol, IPhotonPeer unmanagedPeer)
     : base(pokerApplication,protocol, unmanagedPeer)
 {
     RegisterHandler<VoiceDataMessage>(ReceiveVoiceData);
 }
Ejemplo n.º 46
0
 public GetLobbyStatsRequest(IRpcProtocol protocol, OperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 47
0
 public MyPeer(IRpcProtocol rpcProtocol, IPhotonPeer peer)
     : base(rpcProtocol, peer)
 {
 }
Ejemplo n.º 48
0
 public TestHivePeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer)
     : this(new InitRequest(rpcProtocol, nativePeer))
 {
 }
Ejemplo n.º 49
0
 public TestHivePeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer)
     : this(new InitRequest(rpcProtocol, nativePeer))
 {
 }
Ejemplo n.º 50
0
 public BowAutoAttackRequest(string actionSource, IRpcProtocol protocol, OperationRequest request)
     : base(actionSource, protocol, request)
 {
 }
Ejemplo n.º 51
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "LitePeer" /> class.
 /// </summary>
 /// <param name = "rpcProtocol">
 ///   The rpc protocol.
 /// </param>
 /// <param name = "nativePeer">
 ///   The native peer.
 /// </param>
 public LitePeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer)
     : base(rpcProtocol, nativePeer)
 {
 }
Ejemplo n.º 52
0
 public ItemDequipOperation(IRpcProtocol protocol, IMessage message)
     : base(protocol, new OperationRequest(message.Code, message.Parameters))
 {
 }
Ejemplo n.º 53
0
 public RemoveGameEvent(IRpcProtocol protocol, IEventData eventData)
     : base(protocol, eventData.Parameters)
 {
 }
Ejemplo n.º 54
0
 public RegisterGameServerResponse(IRpcProtocol protocol, OperationResponse response)
     : base(protocol, response.Parameters)
 {
 }
Ejemplo n.º 55
0
 public ExitRequest(IRpcProtocol protocol, OperationRequest operationRequest)
     : base(protocol, operationRequest)
 {
 }
Ejemplo n.º 56
0
 public CreateGhost(IRpcProtocol protocol, OperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 57
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DestroyItem"/> class.
 /// </summary>
 /// <param name="protocol">
 /// The protocol.
 /// </param>
 /// <param name="request">
 /// The request. 
 /// </param>
 public DestroyItem(IRpcProtocol protocol, OperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 58
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Move"/> class.
 /// </summary>
 /// <param name="protocol">
 /// The protocol.
 /// </param>
 /// <param name="request">
 /// The request. 
 /// </param>
 public Move(IRpcProtocol protocol, OperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 59
0
 public Login(IRpcProtocol protocol, OperationRequest request)
     : base(protocol, request)
 {
 }
Ejemplo n.º 60
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DetachInterestArea"/> class.
 /// </summary>
 /// <param name="protocol">
 /// The protocol.
 /// </param>
 /// <param name="request">
 /// The request.
 /// </param>
 public DetachInterestArea(IRpcProtocol protocol, OperationRequest request)
     : base(protocol, request)
 {
 }