/// <summary> /// 检查对象。 /// </summary> /// <param name="name">对象名称。</param> /// <returns>要检查的对象是否存在。</returns> public bool CanSpawn(string name) { GameFrameworkLinkedListRange <Object <T> > objectRange = default(GameFrameworkLinkedListRange <Object <T> >); if (m_Objects.TryGetValue(name, out objectRange)) { foreach (Object <T> internalObject in objectRange) { if (m_AllowMultiSpawn || !internalObject.IsInUse) { return(true); } } } return(false); }
/// <summary> /// 检查对象。 /// </summary> /// <param name="name">对象名称。</param> /// <returns>要检查的对象是否存在。</returns> public bool CanSpawn(string name) { if (name == null) { throw new GameFrameworkException("Name is invalid."); } GameFrameworkLinkedListRange <Object <T> > objectRange = default(GameFrameworkLinkedListRange <Object <T> >); if (m_Objects.TryGetValue(name, out objectRange)) { foreach (Object <T> internalObject in objectRange) { if (m_AllowMultiSpawn || !internalObject.IsInUse) { return(true); } } } return(false); }
/// <summary> /// 获取文件系统。 /// </summary> /// <param name="name">要获取的文件系统的名称。</param> /// <param name="access">要获取的文件系统的访问方式。</param> /// <returns>获取的文件系统。</returns> public IFileSystem GetFileSystem(string name, FileSystemAccess access) { if (string.IsNullOrEmpty(name)) { throw new GameFrameworkException("Name is invalid."); } GameFrameworkLinkedListRange <FileSystem> range = default(GameFrameworkLinkedListRange <FileSystem>); if (m_RegisteredFileSystems.TryGetValue(name, out range)) { foreach (FileSystem fileSystem in range) { if (access != FileSystemAccess.Unspecified && (fileSystem.Access & access) != access) { continue; } return(fileSystem); } } return(null); }
private int GetEmptyBlockIndex() { GameFrameworkLinkedListRange <int> lengthRange = default(GameFrameworkLinkedListRange <int>); if (m_FreeBlockIndexes.TryGetValue(0, out lengthRange)) { int blockIndex = lengthRange.First.Value; m_FreeBlockIndexes.Remove(0, blockIndex); return(blockIndex); } if (m_BlockDatas.Count < m_HeaderData.MaxBlockCount) { int blockIndex = m_BlockDatas.Count; m_BlockDatas.Add(BlockData.Empty); WriteHeaderData(); return(blockIndex); } return(-1); }