/// <summary>
        /// Sends a(n) <see cref="GameEvent"/> to a session
        /// </summary>
        public void SendEvent(int sessionId, GameEvent gameEvent, MessageParameters messageParameters)
        {
            var parameters = ObjectDataMemberMapper.GetValues <DataMemberAttribute>(gameEvent);

            parameters.Add(0, sessionId);

            var eventData = new EventData(gameEvent.EventCode, parameters);

            this.SendEvent(eventData, new SendParameters
            {
                ChannelId = messageParameters.ChannelId,
                Encrypted = messageParameters.Encrypted,
            });
        }
        /// <summary>
        /// Sends a(n) <see cref="GameOperationResponse"/> to a session
        /// </summary>
        public void SendOperationResponse(int sessionId, GameOperationResponse gameResponse, MessageParameters messageParameters)
        {
            var parameters = ObjectDataMemberMapper.GetValues <DataMemberAttribute>(gameResponse);

            parameters.Add(0, sessionId);

            var operationResponse = new OperationResponse(gameResponse.OperationCode, parameters)
            {
                ReturnCode   = gameResponse.ReturnCode,
                DebugMessage = gameResponse.DebugMessage
            };

            this.SendOperationResponse(operationResponse,
                                       new SendParameters
            {
                ChannelId = messageParameters.ChannelId,
                Encrypted = messageParameters.Encrypted,
            });
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Converts properties of an object to <see cref="P:Photon.SocketServer.OperationRequest.Parameters"/>.
 ///  Included properties require the <see cref="T:Photon.SocketServer.Rpc.DataMemberAttribute"/>.
 /// </summary>
 /// <param name="dataContract">
 /// The properties of this object are mapped to <see
 /// cref="P:Photon.SocketServer.OperationRequest.Parameters"/>.
 /// </param>
 public void SetParameters(object dataContract)
 {
     this.Parameters = (dataContract == null) ? null : ObjectDataMemberMapper.GetValues <DataMemberAttribute>(dataContract);
 }
Ejemplo n.º 4
0
 public Dictionary <byte, object> ToDictionary()
 {
     return(ObjectDataMemberMapper.GetValues <DataMemberAttribute>(this));
 }