예제 #1
0
        /// <summary>
        /// [2nd step] This function is called for second when anchor is placed 
        /// </summary>
        public void InitVideoStreamingController(List<AcquisitionDelays> acquisitionDelays, string streamId)
        {
            Debug.Log("InitVideoStreamingController called");
            try
            {
                // debug information
                this.snackbarText = GameObject.Find("Snackbar").GetComponentInChildren<Text>();

                // Init code
                this.streamId = String.Copy(streamId);
                this.secBetweenFrame = Settings.Settings.Instance.FPS;
                this.phoneIdCompleteSending = new HashSet<string>();
                this.frameCounter = 0;
                this.acquiringInProgress = false;

                foreach (AcquisitionDelays delay in acquisitionDelays)
                {
                    Debug.Log("Key = " + delay.Key + ", Value = " + delay.Value);
                }
                foreach (MLAPI.Connection.NetworkedClient client in NetworkingManager.Singleton.ConnectedClientsList)
                {
                    Debug.Log("Client ID: " + client.ClientId);
                }
                Debug.Log("StreamID: " + this.streamId);

                foreach (AcquisitionDelays delay in acquisitionDelays)
                {
                    Debug.Log("Invoke remote RPC on: " + delay.Key + " delay send: " + delay.Value);

                    using (PooledBitStream stream = PooledBitStream.Get())
                    {
                        using (PooledBitWriter writer = PooledBitWriter.Get(stream))
                        {
                            writer.WriteString(this.streamId);
                            writer.WriteDouble(delay.Value);

                            InvokeClientRpcOnClientPerformance(InitVideoStreamingPerformance, delay.Key, stream);
                        }
                    }

                        
                    // InvokeClientRpcOnClient(InitVideoStreaming, delay.Key, this.streamId, delay.Value);
                    Debug.Log("RPC client invoked");
                }
            }
            catch (Exception e)
            {
                Debug.LogError("Exception InitVideoStreaming: " + e.ToString());
            }
        }
예제 #2
0
 public void SendReplicationMessage(ReplicationMessage msg)
 {
     using (PooledBitStream stream = PooledBitStream.Get())
     {
         using (PooledBitWriter writer = PooledBitWriter.Get(stream))
         {
             writer.WriteInt32(msg.messageID);
             writer.WriteInt32(msg.timeCreated);
             writer.WriteUInt32(msg.entityId);
             writer.WriteInt16((byte)msg.shape);
             writer.WriteVector2(msg.pos);
             writer.WriteVector2(msg.speed);
             writer.WriteDouble(msg.size);
             CustomMessagingManager.SendNamedMessage("Replication", null, stream, "customChannel");
         }
     }
 }