Beispiel #1
0
        public DiagonalTileRegistry(ITileRegistry <TRenderTile> baseRegistry,
                                    ITileTagEntrySelectionFactory <bool> tags = null,
                                    string tagFormat = null)
        {
            this.baseRegistry = baseRegistry ?? throw new ArgumentNullException(nameof(baseRegistry));
            var tagProvider  = tags ?? TileTagEntries.CreateFlagTagEntries();
            var formatString = tagFormat ?? "{{0}}_nw{0}ne{1}se{2}sw{3}";

            this.suffixMapping = DiagonalTileSelectionKey.Values.Select(e => Format(e, tagProvider, formatString)).ToArray();
        }
Beispiel #2
0
 public CornerTileRegistry(ITileRegistry <TRenderTile> baseRegistry,
                           ITileTagEntrySelectionFactory <bool> booleanFormats  = null,
                           ITileTagEntrySelectionFactory <Direction> directions = null,
                           string format = null)
 {
     this.baseRegistry  = baseRegistry;
     this.suffixMapping = GenerateSuffixes(booleanFormats ?? TileTagEntries.CreateFlagTagEntries(),
                                           directions ?? TileTagEntries.CreateDirectionTagEntries(),
                                           format ?? "{{0}}_{0}{1}{2}{3}");
 }
Beispiel #3
0
        static string Format(CardinalTileSelectorKey k,
                             ITileTagEntrySelectionFactory <bool> formatProvider = null,
                             string format = null)
        {
            formatProvider ??= TileTagEntries.CreateFlagTagEntries();
            format ??= "{{0}}_n{0}e{1}s{2}w{3}";
            var n = formatProvider.Lookup(k.North).Tag;
            var e = formatProvider.Lookup(k.East).Tag;
            var s = formatProvider.Lookup(k.South).Tag;
            var w = formatProvider.Lookup(k.West).Tag;

            return(string.Format(format, n, e, s, w));
        }