Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ModelMeshCollection.cs
Go to the documentation of this file.
1using System;
5
7
8public sealed class ModelMeshCollection : ReadOnlyCollection<ModelMesh>
9{
10 public struct Enumerator : IEnumerator<ModelMesh>, IDisposable, IEnumerator
11 {
13
14 private int position;
15
17
18 object IEnumerator.Current => Current;
19
21 {
22 this.wrappedArray = wrappedArray;
23 position = -1;
24 }
25
26 public bool MoveNext()
27 {
28 position++;
29 if (position >= wrappedArray.Length)
30 {
31 position = wrappedArray.Length;
32 return false;
33 }
34 return true;
35 }
36
38 {
39 position = -1;
40 }
41
42 public void Dispose()
43 {
44 }
45 }
46
48
49 public ModelMesh this[string meshName]
50 {
51 get
52 {
54 {
55 throw new KeyNotFoundException();
56 }
57 return value;
58 }
59 }
60
61 internal ModelMeshCollection(ModelMesh[] meshes)
62 : base((IList<ModelMesh>)meshes)
63 {
64 wrappedArray = meshes;
65 }
66
67 public bool TryGetValue(string meshName, out ModelMesh value)
68 {
69 if (string.IsNullOrEmpty(meshName))
70 {
71 throw new ArgumentNullException("meshName");
72 }
73 int count = base.Items.Count;
74 for (int i = 0; i < count; i++)
75 {
76 ModelMesh modelMesh = base.Items[i];
77 if (string.Compare(modelMesh.Name, meshName, StringComparison.Ordinal) == 0)
78 {
80 return true;
81 }
82 }
83 value = null;
84 return false;
85 }
86
88 {
89 return new Enumerator(wrappedArray);
90 }
91}
bool TryGetValue(string meshName, out ModelMesh value)