Queued
How do I use Queued
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: PhotonAnimatorView.cs
Copy
275 void DeserializeDataContinuously()
276 {
277 if( m_StreamQueue.HasQueuedObjects() == false )
278 {
279 return;
280 }
281
282 for( int i = 0; i < m_SynchronizeLayers.Count; ++i )
283 {
284 if( m_SynchronizeLayers[ i ].SynchronizeType == SynchronizeType.Continuous )
285 {
286 m_Animator.SetLayerWeight( m_SynchronizeLayers[ i ].LayerIndex, (float)m_StreamQueue.ReceiveNext() );
287 }
288 }
289
290 for( int i = 0; i < m_SynchronizeParameters.Count; ++i )
291 {
292 SynchronizedParameter parameter = m_SynchronizeParameters[ i ];
293
294 if( parameter.SynchronizeType == SynchronizeType.Continuous )
295 {
296 switch( parameter.Type )
297 {
298 case ParameterType.Bool:
299 m_Animator.SetBool( parameter.Name, (bool)m_StreamQueue.ReceiveNext() );
300 break;
301 case ParameterType.Float:
302 m_Animator.SetFloat( parameter.Name, (float)m_StreamQueue.ReceiveNext() );
303 break;
304 case ParameterType.Int:
305 m_Animator.SetInteger( parameter.Name, (int)m_StreamQueue.ReceiveNext() );
306 break;
307 case ParameterType.Trigger:
308
309 break;
310 }
311 }
312 }
313 }
File name: PhotonStreamQueue.cs
Copy
109 public bool HasQueuedObjects()
110 {
111 return m_NextObjectIndex != -1;
112 }
File name: SocketUdp.cs
Copy
60 public override bool Disconnect()
61 {
62 if (this.ReportDebugOfLevel(DebugLevel.INFO))
63 {
64 this.EnqueueDebugReturn(DebugLevel.INFO, "CSharpSocket.Disconnect()");
65 }
66
67 this.State = PhotonSocketState.Disconnecting;
68
69 lock (this.syncer)
70 {
71 if (this.sock != null)
72 {
73 try
74 {
75 this.sock.Close();
76 }
77 catch (Exception ex)
78 {
79 this.EnqueueDebugReturn(DebugLevel.INFO, "Exception in Disconnect(): " + ex);
80 }
81
82 this.sock = null;
83 }
84 }
85
86 this.State = PhotonSocketState.Disconnected;
87 return true;
88 }
File name: SocketUdp.cs
Copy
161 public void ReceiveLoop()
162 {
163 byte[] inBuffer = new byte[this.MTU];
164 while (this.State == PhotonSocketState.Connected)
165 {
166 try
167 {
168 int read = this.sock.Receive(inBuffer);
169 this.HandleReceivedDatagram(inBuffer, read, true);
170 }
171 catch (Exception e)
172 {
173 if (this.State != PhotonSocketState.Disconnecting && this.State != PhotonSocketState.Disconnected)
174 {
175 if (this.ReportDebugOfLevel(DebugLevel.ERROR))
176 {
177 this.EnqueueDebugReturn(DebugLevel.ERROR, "Receive issue. State: " + this.State + " Exception: " + e);
178 }
179
180 this.HandleException(StatusCode.ExceptionOnReceive);
181 }
182 }
183 } //while Connected receive
184
185 // on exit of the receive-loop: disconnect socket
186 this.Disconnect();
187 }
Queued 195 lượt xem
Gõ tìm kiếm nhanh...