Пример #1
0
        public static QuerySelector Open(Rect r, IBlockSource source, string title = null)
        {
            var w = new QuerySelector(r, source, title);

            w.Show(r);
            w.Bind();
            return(w);
        }
 /// <summary>
 /// Construct
 /// </summary>
 /// <param name="chunkBounds"></param>
 /// <param name="blockSource"></param>
 public HashedChunkLevel(
     Coordinate chunkBounds,
     IBlockSource blockSource
     ) : base(chunkBounds, blockSource)
 {
     loadedChunks = new Dictionary <long, ChunkType>(
         chunkBounds.x * chunkBounds.y * chunkBounds.z
         );
 }
Пример #3
0
        public RefillBuffer(ICircularBuffer <T> circBuffer, IBlockSource <T> blockSource)
        {
            this.circBuffer  = circBuffer;
            this.blockSource = blockSource;

            for (int i = 0; i < circBuffer.Buffer.Length; i++)
            {
                blockSource.InitializeBlock(out circBuffer.Buffer[i]);
            }
        }
Пример #4
0
        public QuerySelector(Rect rect, IBlockSource dataSource, string title = null)
            : base(new AdvancedDropdownState())
        {
            m_BlockSource  = dataSource;
            m_Title        = title ?? m_BlockSource.editorTitle ?? m_BlockSource.name ?? string.Empty;
            m_Propositions = m_BlockSource.FetchPropositions().Where(p => p.valid);

            minimumSize = new Vector2(Mathf.Max(rect.width, 250f), 350f);
            maximumSize = new Vector2(Mathf.Max(rect.width, 400f), 450f);

            m_DataSource = new CallbackDataSource(BuildRoot);
            m_Gui        = new QuerySelectorItemGUI(m_DataSource, this);
        }
Пример #5
0
 public static IEnumerable <Block> TakeAll(this IBlockSource Reader)
 {
     while (true)
     {
         var block = Reader.Take();
         if (block != null)
         {
             yield return(block);
         }
         else
         {
             yield break;
         }
     }
 }
Пример #6
0
 public FileProcessWorkerRepetitiveRoutine(IBlockSource Source, IBlockSink Sink, IProcessor Processor)
 {
     _processor = Processor;
     _sink      = Sink;
     _source    = Source;
 }
 /// <summary>
 /// construct
 /// </summary>
 /// <param name="chunkBounds"></param>
 /// <param name="blockSource"></param>
 public ColumnLoadedLevel(Coordinate chunkBounds, IBlockSource blockSource) : base(chunkBounds, blockSource)
 {
     chunkLoadQueueManagerJob   = new JLoadChunks(this);
     chunkUnloadQueueManagerJob = new JUnloadChunks(this);
 }
Пример #8
0
 /// <summary>Делает указанный <see cref="IBlockSource" /> потокобезопасным</summary>
 /// <remarks>
 ///     Использует <see cref="SemaphoreSlim" /> для обеспечения потокобезопасности, блокирует запрашиваемый поток до
 ///     тех пор, пока другой поток не закончит выполнение операции.
 /// </remarks>
 public static IBlockSource Locked(this IBlockSource Core)
 {
     return(new LockedBlockSourceDecorator(Core));
 }
Пример #9
0
        //public int BufferUnderrunCount { get; private set; }

        public RefillBuffer(ICircularBuffer <T> circBuffer, IBlockSource <T> blockSource, int consumerCount) : this(circBuffer, blockSource)
        {
            Initialize(consumerCount);
        }
Пример #10
0
 public LockedBlockSourceDecorator(IBlockSource Core)
 {
     _core      = Core;
     _semaphore = new SemaphoreSlim(1, 1);
 }