Ejemplo n.º 1
0
 private Tile Parse(string s)
 {
     if (s.Contains("!"))
     {
         // TODO: Cleanup and validate
         // TODO: Support hexagonal directions
         var a    = s.Split('!');
         var b    = a[1];
         var refl = false;
         if (b.StartsWith("x"))
         {
             refl = true;
             b    = b.Substring(1);
         }
         var rotation = ((int.Parse(b) / 90) + 4) % 4;
         return(new Tile(new RotatedTile
         {
             Tile = Parse(a[0]),
             ReflectX = refl,
             RotateCw = rotation,
         }));
     }
     // TODO: Apply tiles by name
     if (loader != null)
     {
         return(loader.Parse(s));
     }
     else
     {
         return(new Tile(s));
     }
 }
Ejemplo n.º 2
0
 private Tile Parse(string s)
 {
     if (s.Contains("!"))
     {
         // TODO: Cleanup and validate
         var a    = s.Split('!');
         var b    = a[1];
         var refl = false;
         if (b.StartsWith("x"))
         {
             refl = true;
             b    = b.Substring(1);
         }
         var rotateCw = (int.Parse(b) + 360) % 360;
         return(new Tile(new RotatedTile
         {
             Tile = Parse(a[0]),
             Rotation = new Rotation(rotateCw, refl),
         }));
     }
     // TODO: Apply tiles by name
     if (loader != null)
     {
         return(loader.Parse(s));
     }
     else
     {
         return(new Tile(s));
     }
 }