コード例 #1
0
        public void TestGraphicArchive()
        {
            Graphic expectedGraphic1 = new Graphic("test1", ZoomFactor.Zoom1);
            Graphic expectedGraphic2 = new Graphic("test2", ZoomFactor.Zoom1);

            //expectedGraphic1.AddTransparentLayer(LayerID.Foreground);
            //expectedGraphic2.AddTransparentLayer(LayerID.Foreground);

            expectedGraphic1[LayerID.Foreground, 10, 10] = 100 << 16 | 50 << 8 | 20;
            expectedGraphic2[LayerID.Foreground, 50, 40] = 150 << 16 | 63 << 8 | 123;

            GraphicArchive expectedArchive = new GraphicArchive(ZoomFactor.Zoom1);

            expectedArchive.AddGraphic(expectedGraphic1);
            expectedArchive.AddGraphic(expectedGraphic2);

            expectedArchive.Save("test2.uz1", true);

            GraphicArchive archive = GraphicArchive.Load("test2.uz1");

            Assert.AreEqual(2, archive.GraphicsCount);

            CompareGraphic(expectedGraphic1, archive[0]);
            CompareGraphic(expectedGraphic2, archive[1]);

            System.IO.File.Delete("test2.uz1");
        }
コード例 #2
0
        public void TestHasAlternatives()
        {
            GraphicArchive archive = new GraphicArchive(ZoomFactor.Zoom1);
            Graphic        g       = new Graphic("TestGraphic");

            uint[,] layer         = g[LayerID.Foreground];
            layer[10, 10]         = 100 << 16 | 50 << 8 | 20;
            g[LayerID.Foreground] = layer;

            archive.AddGraphic(0, 0, 0, g);
            archive.AddGraphic(0, 1, 0, g);
            archive.AddGraphic(1, 0, 1, g);
            archive.AddGraphic(1, 0, 2, g);
            archive.AddGraphic(1, 0, 3, g);
            archive.AddGraphic(1, 1, 3, g);
            archive.AddGraphic(2, 0, 1, g);
            archive.AddGraphic(3, 0, 0, g);
            archive.AddGraphic(4, 0, 1, g);

            Assert.IsFalse(archive.HasAlternatives(0));
            Assert.IsTrue(archive.HasAlternatives(1));
            Assert.IsTrue(archive.HasAlternatives(2));
            Assert.IsFalse(archive.HasAlternatives(3));
            Assert.IsTrue(archive.HasAlternatives(4));
        }
コード例 #3
0
        public void TestAnimation()
        {
            GraphicArchive archive = GraphicArchive.Load("testSteam.uz1");

            Assert.IsNotNull(archive.Animation);
            Assert.AreEqual <int>(archive.Animation[0, 0].XDiff, 0);
            Assert.AreEqual <int>(archive.Animation[0, 0].YDiff, 0);
            Assert.AreEqual <int>(archive.Animation[0, 0].Width, 1);
            Assert.AreEqual <int>(archive.Animation[0, 0].Height, 1);
            Assert.AreEqual <int>(archive.Animation[0, 0][0].AnimationPhase, 0);
            Assert.AreEqual <int>(archive.Animation[0, 0][0].MinimumTime, 5);
            Assert.AreEqual <int>(archive.Animation[0, 0][0].MaximumTime, 5);
            Assert.AreEqual <int>(archive.Animation[0, 0][0].Sound, 0);
            Assert.IsNull(archive.Animation[1, 0]);
            Assert.IsNull(archive.Animation[0, 0][1]);
        }
コード例 #4
0
        public void TestAnimationSave()
        {
            GraphicArchive expectedArchive = new GraphicArchive(ZoomFactor.Zoom1);
            Graphic        graphic1        = new Graphic("test1", ZoomFactor.Zoom1);
            Graphic        graphic2        = new Graphic("test2", ZoomFactor.Zoom1);
            Graphic        graphic3        = new Graphic("test3", ZoomFactor.Zoom1);
            Graphic        graphic4        = new Graphic("test4", ZoomFactor.Zoom1);

            graphic1[LayerID.Foreground, 10, 10] = 100 << 16 | 50 << 8 | 20;
            graphic2[LayerID.Foreground, 50, 40] = 150 << 16 | 63 << 8 | 123;
            graphic3[LayerID.Foreground, 50, 40] = 150 << 16 | 63 << 8 | 123;
            graphic4[LayerID.Foreground, 50, 40] = 150 << 16 | 63 << 8 | 123;

            expectedArchive.AddGraphic(0, 0, Constants.NoAlternative, graphic1);
            expectedArchive.AddGraphic(0, 1, Constants.NoAlternative, graphic2);
            expectedArchive.AddGraphic(0, 2, Constants.NoAlternative, graphic3);
            expectedArchive.AddGraphic(2, graphic4);

            expectedArchive.AddAnimation();
            AnimationProgram expectedProgram = new AnimationProgram(0, 0, 1, 1);

            expectedProgram.AddAnimationStep(new AnimationStep(0, 5, 6, 0));
            expectedProgram.AddAnimationStep(new AnimationStep(1, 5, 6, 0));
            expectedProgram.AddAnimationStep(new AnimationStep(2, 10, 10, 0));
            expectedProgram.AddAnimationStep(new AnimationStep(1, 5, 6, 0));
            expectedArchive.Animation.AddAnimationProgram(expectedProgram, 0, Constants.NoAlternative);

            Assert.IsTrue(expectedArchive.Save("testAnimation.uz1", true));

            GraphicArchive archive = GraphicArchive.Load("testAnimation.uz1");

            CompareGraphic(graphic1, archive[0, 0, Constants.NoAlternative]);
            CompareGraphic(graphic2, archive[0, 1, Constants.NoAlternative]);
            CompareGraphic(graphic3, archive[0, 2, Constants.NoAlternative]);
            CompareGraphic(graphic4, archive[2, 0, Constants.NoAlternative]);

            Assert.IsNotNull(archive.Animation);
            Assert.AreEqual <int>(expectedArchive.Animation.AnimationProgramCount, archive.Animation.AnimationProgramCount);
            CompareAnimationProgram(expectedProgram, archive.Animation[0, Constants.NoAlternative]);

            System.IO.File.Delete("testAnimation.uz1");
            System.IO.File.Delete("testAnimation.bnm");
        }
コード例 #5
0
        public void TestAnimationWithZoom2()
        {
            GraphicArchive archive = new GraphicArchive(ZoomFactor.Zoom2);

            archive.AddAnimation();
        }