com.wallstop-studios.dxmessaging 2.0.0-rc26.8 → 2.0.0-rc26.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -51,6 +51,7 @@ namespace DxMessaging.Core.DataStructure
|
|
|
51
51
|
public int Count { get; private set; }
|
|
52
52
|
|
|
53
53
|
private readonly List<T> _buffer;
|
|
54
|
+
private readonly List<T> _cache = new();
|
|
54
55
|
private int _position;
|
|
55
56
|
|
|
56
57
|
public T this[int index]
|
|
@@ -132,21 +133,24 @@ namespace DxMessaging.Core.DataStructure
|
|
|
132
133
|
return false;
|
|
133
134
|
}
|
|
134
135
|
|
|
135
|
-
int write = 0;
|
|
136
|
-
bool removed = false;
|
|
137
136
|
comparer ??= EqualityComparer<T>.Default;
|
|
137
|
+
|
|
138
|
+
_cache.Clear();
|
|
138
139
|
for (int i = 0; i < Count; ++i)
|
|
139
140
|
{
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
_cache.Add(_buffer[AdjustedIndexFor(i)]);
|
|
142
|
+
}
|
|
142
143
|
|
|
143
|
-
|
|
144
|
+
// Find and remove the element
|
|
145
|
+
bool removed = false;
|
|
146
|
+
for (int i = 0; i < _cache.Count; ++i)
|
|
147
|
+
{
|
|
148
|
+
if (comparer.Equals(_cache[i], element))
|
|
144
149
|
{
|
|
150
|
+
_cache.RemoveAt(i);
|
|
145
151
|
removed = true;
|
|
146
|
-
|
|
152
|
+
break;
|
|
147
153
|
}
|
|
148
|
-
|
|
149
|
-
_buffer[write++] = item;
|
|
150
154
|
}
|
|
151
155
|
|
|
152
156
|
if (!removed)
|
|
@@ -154,9 +158,10 @@ namespace DxMessaging.Core.DataStructure
|
|
|
154
158
|
return false;
|
|
155
159
|
}
|
|
156
160
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
161
|
+
// Rebuild the buffer with linearized data
|
|
162
|
+
_buffer.Clear();
|
|
163
|
+
_buffer.AddRange(_cache);
|
|
164
|
+
Count = _cache.Count;
|
|
160
165
|
_position = Count < Capacity ? Count : 0;
|
|
161
166
|
return true;
|
|
162
167
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "com.wallstop-studios.dxmessaging",
|
|
3
|
-
"version": "2.0.0-rc26.
|
|
3
|
+
"version": "2.0.0-rc26.9",
|
|
4
4
|
"displayName": "DxMessaging",
|
|
5
5
|
"description": "Synchronous Event Bus for Unity",
|
|
6
6
|
"unity": "2021.3",
|
|
@@ -32,11 +32,3 @@
|
|
|
32
32
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|