Class for constants. Contains operation codes. Pun uses these constants internally.
 /// <summary>
 /// The send operation.
 /// </summary>
 /// <param name="game">
 /// The mmo game.
 /// </param>
 /// <param name="operationCode">
 /// The operation code.
 /// </param>
 /// <param name="parameter">
 /// The parameter.
 /// </param>
 /// <param name="sendReliable">
 /// The send reliable.
 /// </param>
 /// <param name="channelId">
 /// The channel Id.
 /// </param>
 public void SendOperation(Game game, OperationCode operationCode, Dictionary<byte, object> parameter, bool sendReliable, byte channelId)
 {
     game.Peer.OpCustom((byte)operationCode, parameter, sendReliable, channelId);
 }
 /// <summary>
 /// The send operation.
 /// </summary>
 /// <param name="game">
 /// The mmo game.
 /// </param>
 /// <param name="operationCode">
 /// The operation code.
 /// </param>
 /// <param name="parameter">
 /// The parameter.
 /// </param>
 /// <param name="sendReliable">
 /// The send reliable.
 /// </param>
 /// <param name="channelId">
 /// The channel Id.
 /// </param>
 public void SendOperation(Game game, OperationCode operationCode, Dictionary<byte, object> parameter, bool sendReliable, byte channelId)
 {
 }
Example #3
0
        /// <summary>
        ///   The send operation.
        /// </summary>
        /// <param name = "operationCode">
        ///   The operation code.
        /// </param>
        /// <param name = "parameter">
        ///   The parameter.
        /// </param>
        /// <param name = "sendReliable">
        ///   The send reliable.
        /// </param>
        /// <param name = "channelId">
        ///   The channel Id.
        /// </param>
        public void SendOperation(OperationCode operationCode, Dictionary<byte, object> parameter, bool sendReliable, byte channelId)
        {
            if (this.listener.IsDebugLogEnabled)
            {
                var builder = new StringBuilder();
                builder.AppendFormat("{0}: send operation {1}:", this.avatar.Id, operationCode);
                foreach (var entry in parameter)
                {
                    builder.AppendFormat(" {0}=", (ParameterCode)entry.Key);
                    if (entry.Value is float[])
                    {
                        builder.Append("float[");
                        foreach (float number in (float[])entry.Value)
                        {
                            builder.AppendFormat("{0:0.00},", number);
                        }

                        builder.Append("]");
                    }
                    else
                    {
                        builder.Append(entry.Value);
                    }
                }

                this.listener.LogDebug(this, builder.ToString());
            }

            this.stateStrategy.SendOperation(this, operationCode, parameter, sendReliable, channelId);

            // avoid operation congestion (QueueOutgoingUnreliableWarning)
            this.outgoingOperationCount++;
            if (this.outgoingOperationCount > 10)
            {
                this.peer.SendOutgoingCommands();
                this.outgoingOperationCount = 0;
            }
        }
 public void SendOperation(OperationCode code, Dictionary<byte, object> parameters)
 {
     _peer.OpCustom((byte) code, parameters, true);
 }