コード例 #1
0
 private void Invalidate(ArtObjectMaterializer.InvalidationContext context)
 {
     using (IEnumerator <TrixelEmplacement> enumerator = context.Trixels.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             TrixelEmplacement trixel = enumerator.Current;
             for (int index = 0; index < 6; ++index)
             {
                 FaceOrientation   face      = (FaceOrientation)index;
                 TrixelEmplacement traversed = trixel.GetTraversal(face);
                 if (this.IsBorderTrixelFace(traversed))
                 {
                     if (Enumerable.Any <TrixelSurface>((IEnumerable <TrixelSurface>) this.surfaces, (Func <TrixelSurface, bool>)(x =>
                     {
                         if (x.Orientation == face)
                         {
                             return(x.AnyRectangleContains(trixel));
                         }
                         else
                         {
                             return(false);
                         }
                     })))
                     {
                         context.Removed.Add(new TrixelFace(trixel, face));
                     }
                     if (context.TrixelsExist)
                     {
                         context.Added.Add(new TrixelFace(trixel, face));
                     }
                 }
                 else
                 {
                     FaceOrientation oppositeFace = FezMath.GetOpposite(face);
                     if (Enumerable.Any <TrixelSurface>((IEnumerable <TrixelSurface>) this.surfaces, (Func <TrixelSurface, bool>)(x =>
                     {
                         if (x.Orientation == oppositeFace)
                         {
                             return(x.AnyRectangleContains(traversed));
                         }
                         else
                         {
                             return(false);
                         }
                     })))
                     {
                         context.Removed.Add(new TrixelFace(traversed, oppositeFace));
                     }
                     if (!context.TrixelsExist)
                     {
                         context.Added.Add(new TrixelFace(traversed, oppositeFace));
                     }
                 }
             }
         }
     }
 }