完善NetDatabase
This commit is contained in:
1 parent
88125fc128
commit
5cf62f91cd
6 files changed
+85
-27
No files matched your search
@@ -32,6 +32,11 @@ namespace GameCore.LowLevel
|
||||
m_UnsafeDataPtr = null;
|
||||
}
|
||||
|
||||
public bool HasValue(int index)
|
||||
{
|
||||
return m_UnsafeDataPtr->HasValue(index);
|
||||
}
|
||||
|
||||
public bool Free(int index)
|
||||
{
|
||||
return m_UnsafeDataPtr->Free(index);
|
||||
|
||||
@@ -43,6 +43,12 @@ namespace GameCore.LowLevel
|
||||
m_Buffer.Dispose();
|
||||
}
|
||||
|
||||
public bool HasValue(int index)
|
||||
{
|
||||
var node = m_Buffer[index * m_NodeNumPerElement];
|
||||
return node.next < 0;
|
||||
}
|
||||
|
||||
public bool Free(int index)
|
||||
{
|
||||
ref var node = ref m_Buffer.ElementAt(index * m_NodeNumPerElement);
|
||||
@@ -83,7 +89,7 @@ namespace GameCore.LowLevel
|
||||
{
|
||||
ref var node = ref m_Buffer.ElementAt(index * m_NodeNumPerElement);
|
||||
if (node.next >= 0)
|
||||
throw new IndexOutOfRangeException();
|
||||
throw new Exception("Index out of range");
|
||||
|
||||
return ref UnsafeUtility.As<FreeNode, T>(ref m_Buffer.ElementAt(index * m_NodeNumPerElement + 1));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user