Exemple #1
0
        /// <summary>
        /// The counter subscribe.
        /// </summary>
        /// <param name="peer">
        /// The photon peer.
        /// </param>
        /// <param name="receiveInterval">
        /// The receive interval.
        /// </param>
        public static void CounterSubscribe(PhotonPeer peer, int receiveInterval)
        {
            var data = new Dictionary <byte, object> {
                { (byte)ParameterCode.CounterReceiveInterval, receiveInterval }
            };

            peer.OpCustom((byte)OperationCode.SubscribeCounter, data, true, Settings.DiagnosticsChannel);
        }
Exemple #2
0
        /// <summary>
        /// The radar subscribe.
        /// </summary>
        /// <param name="peer">
        /// The photon peer.
        /// </param>
        /// <param name="worldName">
        /// The world Name.
        /// </param>
        public static void RadarSubscribe(PhotonPeer peer, string worldName)
        {
            var data = new Dictionary <byte, object> {
                { (byte)ParameterCode.WorldName, worldName }
            };

            peer.OpCustom((byte)OperationCode.RadarSubscribe, data, true, Settings.RadarChannel);
        }
Exemple #3
0
        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 operati0n {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(builder.ToString());
            }

            peer.OpCustom((byte)operationCode, parameter, sendReliable, channelId);

            // avoid operation congestion (QueueOutgoingUnreliableWarning)
            this.outgoingOperationCount++;
            if (this.outgoingOperationCount > 10)
            {
                this.peer.SendOutgoingCommands();
                this.outgoingOperationCount = 0;
            }
        }
 /// <summary>
 /// The counter subscribe.
 /// </summary>
 /// <param name="peer">
 /// The photon peer.
 /// </param>
 /// <param name="receiveInterval">
 /// The receive interval.
 /// </param>
 public static void CounterSubscribe(PhotonPeer peer, int receiveInterval)
 {
     var data = new Dictionary<byte, object> { { (byte)ParameterCode.CounterReceiveInterval, receiveInterval } };
     peer.OpCustom((byte)OperationCode.SubscribeCounter, data, true, Settings.DiagnosticsChannel);
 }
 /// <summary>
 /// The radar subscribe.
 /// </summary>
 /// <param name="peer">
 /// The photon peer.
 /// </param>
 /// <param name="worldName">
 /// The world Name.
 /// </param>
 public static void RadarSubscribe(PhotonPeer peer, string worldName)
 {
     var data = new Dictionary<byte, object> { { (byte)ParameterCode.WorldName, worldName } };
     peer.OpCustom((byte)OperationCode.RadarSubscribe, data, true, Settings.RadarChannel);
 }