Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ModelBoneCollection.cs
Go to the documentation of this file.
1using System;
5
7
8public sealed class ModelBoneCollection : ReadOnlyCollection<ModelBone>
9{
10 public struct Enumerator : IEnumerator<ModelBone>, 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 ModelBone this[string boneName]
50 {
51 get
52 {
54 {
55 throw new KeyNotFoundException();
56 }
57 return value;
58 }
59 }
60
62 : base((IList<ModelBone>)bones)
63 {
64 wrappedArray = bones;
65 }
66
67 public bool TryGetValue(string boneName, out ModelBone value)
68 {
69 if (string.IsNullOrEmpty(boneName))
70 {
71 throw new ArgumentNullException("boneName");
72 }
73 int count = base.Items.Count;
74 for (int i = 0; i < count; i++)
75 {
76 ModelBone modelBone = base.Items[i];
77 if (string.Compare(modelBone.Name, boneName, 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 boneName, out ModelBone value)