本文整理汇总了C#中DOL.GS.GameObject.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# GameObject.ToString方法的具体用法?C# GameObject.ToString怎么用?C# GameObject.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOL.GS.GameObject
的用法示例。
在下文中一共展示了GameObject.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddObject
/// <summary>
/// Adds an object to the region and assigns the object an id
/// </summary>
/// <param name="obj">A GameObject to be added to the region</param>
/// <returns>success</returns>
internal bool AddObject(GameObject obj)
{
//Thread.Sleep(10000);
Zone zone = GetZone(obj.X, obj.Y);
if (zone == null)
{
if (log.IsWarnEnabled)
log.Warn("Zone not found for Object: " + obj.Name + "(ID=" + obj.InternalID + ")");
}
//Assign a new id
lock (ObjectsSyncLock)
{
if (obj.ObjectID != -1)
{
if (obj.ObjectID < m_objects.Length && obj == m_objects[obj.ObjectID - 1])
{
log.WarnFormat("Object is already in the region ({0})", obj.ToString());
return false;
}
log.Warn(obj.Name + " should be added to " + Description + " but had already an OID(" + obj.ObjectID + ") => not added\n" + Environment.StackTrace);
return false;
}
GameObject[] objectsRef = m_objects;
//*** optimized object management for memory saving primary but keeping it very fast - Blue ***
// find first free slot for the object
int objID = m_nextObjectSlot;
if (objID >= m_objects.Length || m_objects[objID] != null)
{
// we are at array end, are there any holes left?
if (m_objects.Length > m_objectsInRegion)
{
// yes there are some places left in current object array, try to find them
// by using the bit array (can check 32 slots at once!)
int i = m_objects.Length / 32;
// INVARIANT: i * 32 is always lower or equal to m_objects.Length (integer division property)
if (i * 32 == m_objects.Length)
{
i -= 1;
}
bool found = false;
objID = -1;
while (!found && (i >= 0))
{
if (m_objectsAllocatedSlots[i] != 0xffffffff)
{
// we found a free slot
// => search for exact place
int currentIndex = i * 32;
int upperBound = (i + 1) * 32;
while (!found && (currentIndex < m_objects.Length) && (currentIndex < upperBound))
{
if (m_objects[currentIndex] == null)
{
found = true;
objID = currentIndex;
}
currentIndex++;
}
// INVARIANT: at this point, found must be true (otherwise the underlying data structure is corrupt)
}
i--;
}
}
else
{ // our array is full, we must resize now to fit new objects
if (objectsRef.Length == 0)
{
// there is no array yet, so set it to a minimum at least
objectsRef = new GameObject[MINIMUMSIZE];
Array.Copy(m_objects, objectsRef, m_objects.Length);
objID = 0;
}
else if (objectsRef.Length >= Properties.REGION_MAX_OBJECTS)
{
// no available slot
if (log.IsErrorEnabled)
log.Error("Can't add new object - region '" + Description + "' is full. (object: " + obj.ToString() + ")");
return false;
//.........这里部分代码省略.........