public AnimatedCellBitmapSet(FramerateDelay delay, params CellBitmap[] bitmaps) { Id = Interlocked.Increment(ref _idCounter); Delay = delay.Delay; Bitmaps = bitmaps; _rotatedCloneLazy = new Lazy <AnimatedCellBitmapSet>(() => new AnimatedCellBitmapSet( delay, Bitmaps .Select(x => BitmapExtensions.Get90DegreesRotatedClone(x.Bitmap)) .Select(x => new CellBitmap(x)).ToArray() )); _bitmapEnumerator = Bitmaps.GetInifiniteEnumerator(); _bitmapEnumerator.MoveNext(); }
private static CellBitmapNetwork GenerateNetwork(string networkName, FramerateDelay delay) { return(new EmbeddedBitmapExtractor() .GetBitmapsFromNamespace("Mirage.Urbanization.Tilesets.NetworkZones." + networkName) .ToList() .Pipe(embeddedResources => { return new CellBitmapNetwork( center: new DirectionalCellBitmap( new AnimatedCellBitmapSetLayers( new AnimatedCellBitmapSet(delay, embeddedResources.Where(x => string.Equals(x.FileName, networkName, StringComparison.InvariantCultureIgnoreCase)) .Select(x => new CellBitmap(x.Bitmap)) .ToArray()), null ) ), east: new DirectionalCellBitmap( new AnimatedCellBitmapSetLayers( new AnimatedCellBitmapSet(delay, embeddedResources.Where(x => string.Equals(x.FileName, networkName + "e", StringComparison.InvariantCultureIgnoreCase)) .Select(x => new CellBitmap(x.Bitmap)) .ToArray()), null ) ), eastWest: new DirectionalCellBitmap( new AnimatedCellBitmapSetLayers( new AnimatedCellBitmapSet(delay, embeddedResources.Where(x => string.Equals(x.FileName, networkName + "ew", StringComparison.InvariantCultureIgnoreCase)) .Select(x => new CellBitmap(x.Bitmap)) .ToArray()), null ) ), northWest: new DirectionalCellBitmap( new AnimatedCellBitmapSetLayers( new AnimatedCellBitmapSet(delay, embeddedResources.Where(x => string.Equals(x.FileName, networkName + "nw", StringComparison.InvariantCultureIgnoreCase)) .Select(x => new CellBitmap(x.Bitmap)) .ToArray()), null ) ), northWestEast: new DirectionalCellBitmap( new AnimatedCellBitmapSetLayers( new AnimatedCellBitmapSet(delay, embeddedResources.Where(x => string.Equals(x.FileName, networkName + "nwe", StringComparison.InvariantCultureIgnoreCase)) .Select(x => new CellBitmap(x.Bitmap)) .ToArray()), null ) ), northWestEastSouth: new DirectionalCellBitmap( new AnimatedCellBitmapSetLayers( new AnimatedCellBitmapSet(delay, embeddedResources.Where(x => string.Equals(x.FileName, networkName + "nwes", StringComparison.InvariantCultureIgnoreCase)) .Select(x => new CellBitmap(x.Bitmap)) .ToArray()), null ) ) ); })); }