/// <summary>
 /// </summary>
 /// <param name="localID"></param>
 /// <param name="ent"></param>
 /// <param name="createIt"></param>
 /// <returns>true if we created a new entry</returns>
 public bool TryGetCreateEntityLocalID(uint localID, out IEntity ent, RegionCreateEntityCallback createIt)
 {
     try {
         IEntity newEntity = null;
         lock (m_entityCollection) {
             if (!TryGetEntityLocalID(localID, out ent))
             {
                 newEntity = createIt();
                 m_entityCollection.AddEntity(newEntity);
                 ent = newEntity;
             }
         }
         return(true);
     }
     catch (Exception e) {
         m_log.Log(LogLevel.DBADERROR, "TryGetCreateEntityLocalID: Failed to create entity: {0}", e.ToString());
     }
     ent = null;
     return(false);
 }
示例#2
0
 /// <summary>
 /// </summary>
 /// <param name="localID"></param>
 /// <param name="ent"></param>
 /// <param name="createIt"></param>
 /// <returns>true if we created a new entry</returns>
 public bool TryGetCreateEntity(EntityName entName, out IEntity ent, RegionCreateEntityCallback createIt)
 {
     // m_log.Log(LogLevel.DWORLDDETAIL, "TryGetCreateEntity: n={0}", entName);
     try {
         lock (this) {
             if (!TryGetEntity(entName, out ent))
             {
                 IEntity newEntity = createIt();
                 AddEntity(newEntity);
                 ent = newEntity;
             }
         }
         return(true);
     }
     catch (Exception e) {
         m_log.Log(LogLevel.DBADERROR, "TryGetCreateEntityLocalID: Failed to create entity: {0}", e.ToString());
     }
     ent = null;
     return(false);
 }
 /// <summary>
 /// </summary>
 /// <param name="localID"></param>
 /// <param name="ent"></param>
 /// <param name="createIt"></param>
 /// <returns>true if we created a new entry</returns>
 public bool TryGetCreateEntityLocalID(uint localID, out IEntity ent, RegionCreateEntityCallback createIt)
 {
     try {
     IEntity newEntity = null;
     lock (m_entityCollection) {
         if (!TryGetEntityLocalID(localID, out ent)) {
             newEntity = createIt();
             m_entityCollection.AddEntity(newEntity);
             ent = newEntity;
         }
     }
     return true;
     }
     catch (Exception e) {
     m_log.Log(LogLevel.DBADERROR, "TryGetCreateEntityLocalID: Failed to create entity: {0}", e.ToString());
     }
     ent = null;
     return false;
 }
 /// <summary>
 /// </summary>
 /// <param name="localID"></param>
 /// <param name="ent"></param>
 /// <param name="createIt"></param>
 /// <returns>true if we created a new entry</returns>
 public bool TryGetCreateEntity(EntityName entName, out IEntity ent, RegionCreateEntityCallback createIt)
 {
     // m_log.Log(LogLevel.DWORLDDETAIL, "TryGetCreateEntity: n={0}", entName);
     try {
     lock (this) {
         if (!TryGetEntity(entName, out ent)) {
             IEntity newEntity = createIt();
             AddEntity(newEntity);
             ent = newEntity;
         }
     }
     return true;
     }
     catch (Exception e) {
     m_log.Log(LogLevel.DBADERROR, "TryGetCreateEntityLocalID: Failed to create entity: {0}", e.ToString());
     }
     ent = null;
     return false;
 }