예제 #1
0
            public void CompareWith(ViewportData Viewport)
            {
                string Diff = "Viewport properties changed: ";

                if (this.X != Viewport.X)
                {
                    Diff += $"(X {this.X}->{Viewport.X}) ";
                }
                if (this.Y != Viewport.Y)
                {
                    Diff += $"(Y {this.Y}->{Viewport.Y}) ";
                }
                if (this.Width != Viewport.Width)
                {
                    Diff += $"(Width {this.Width}->{Viewport.Width}) ";
                }
                if (this.Height != Viewport.Height)
                {
                    Diff += $"(Height {this.Height}->{Viewport.Height}) ";
                }
                if (this.OX != Viewport.OX)
                {
                    Diff += $"(OX {this.OX}->{Viewport.OX}) ";
                }
                if (this.OY != Viewport.OY)
                {
                    Diff += $"(OY {this.OY}->{Viewport.OY}) ";
                }
                if (this.Visible != Viewport.Visible)
                {
                    Diff += $"(Visible {this.Visible}->{Viewport.Visible}) ";
                }
                if (this.Disposed != Viewport.Disposed)
                {
                    Diff += $"(Disposed {this.Disposed}->{Viewport.Disposed}) ";
                }
                if (this.Z != Viewport.Z)
                {
                    Diff += $"(Z {this.Z}->{Viewport.Z}) ";
                }
                Diff += this.Color.CompareWith(Viewport.Color);
                if (Diff != "Viewport properties changed: ")
                {
                    Console.WriteLine(Diff.Substring(0, Diff.Length - 1) + ")");
                }
                for (int i = 0; i < Sprites.Count; i++)
                {
                    SpriteData s1 = Sprites[i];
                    SpriteData s2 = i < Viewport.Sprites.Count ? Viewport.Sprites[i] : null;
                    if (s2 == null)
                    {
                        Console.WriteLine($"One disposed sprite ({s1.X}, {s1.Y}, bmp({s1.Bitmap.Width},{s1.Bitmap.Height}))");
                    }
                    else
                    {
                        s1.CompareWith(s2);
                    }
                }
                for (int i = Sprites.Count; i < Viewport.Sprites.Count; i++)
                {
                    SpriteData s = Viewport.Sprites[i];
                    Console.WriteLine($"One new sprite ({s.X}, {s.Y}, bmp({s.Bitmap.Width}, {s.Bitmap.Height}))");
                }
            }