FindIndex









How do I use Find Index
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: PhotonAnimatorView.cs Copy
117     public bool DoesLayerSynchronizeTypeExist( int layerIndex )
118     {
119         return m_SynchronizeLayers.FindIndex( item => item.LayerIndex == layerIndex ) != -1;
120     }
File name: PhotonAnimatorView.cs Copy
127     public bool DoesParameterSynchronizeTypeExist( string name )
128     {
129         return m_SynchronizeParameters.FindIndex( item => item.Name == name ) != -1;
130     }
File name: PhotonAnimatorView.cs Copy
155     public SynchronizeType GetLayerSynchronizeType( int layerIndex )
156     {
157         int index = m_SynchronizeLayers.FindIndex( item => item.LayerIndex == layerIndex );
158
159         if( index == -1 )
160         {
161             return SynchronizeType.Disabled;
162         }
163
164         return m_SynchronizeLayers[ index ].SynchronizeType;
165     }
File name: PhotonAnimatorView.cs Copy
172     public SynchronizeType GetParameterSynchronizeType( string name )
173     {
174         int index = m_SynchronizeParameters.FindIndex( item => item.Name == name );
175
176         if( index == -1 )
177         {
178             return SynchronizeType.Disabled;
179         }
180
181         return m_SynchronizeParameters[ index ].SynchronizeType;
182     }
File name: PhotonAnimatorView.cs Copy
189     public void SetLayerSynchronized( int layerIndex, SynchronizeType synchronizeType )
190     {
191         if( Application.isPlaying == true )
192         {
193             m_WasSynchronizeTypeChanged = true;
194         }
195
196         int index = m_SynchronizeLayers.FindIndex( item => item.LayerIndex == layerIndex );
197
198         if( index == -1 )
199         {
200             m_SynchronizeLayers.Add( new SynchronizedLayer { LayerIndex = layerIndex, SynchronizeType = synchronizeType } );
201         }
202         else
203         {
204             m_SynchronizeLayers[ index ].SynchronizeType = synchronizeType;
205         }
206     }
File name: PhotonAnimatorView.cs Copy
213     public void SetParameterSynchronized( string name, ParameterType type, SynchronizeType synchronizeType )
214     {
215         if( Application.isPlaying == true )
216         {
217             m_WasSynchronizeTypeChanged = true;
218         }
219
220         int index = m_SynchronizeParameters.FindIndex( item => item.Name == name );
221
222         if( index == -1 )
223         {
224             m_SynchronizeParameters.Add( new SynchronizedParameter { Name = name, Type = type, SynchronizeType = synchronizeType } );
225         }
226         else
227         {
228             m_SynchronizeParameters[ index ].SynchronizeType = synchronizeType;
229         }
230     }

FindIndex 115 lượt xem

Gõ tìm kiếm nhanh...