Example #1
0
 internal bool ChangeAnimationProgram()
 {
     this.dataGridView.Rows.Clear();
     if (this.editor.Zoom1Archive != null && this.editor.Zoom1Archive.Animation != null && this.editor.Zoom1Archive.Animation[this.editor.ActualGraphicID, this.editor.ActualAlternativeID] != null)
     {
         this.dataGridView.Visible              = true;
         this.addAnimationStepButton.Visible    = true;
         this.deleteAnimationStepButton.Visible = true;
         this.upAnimationStepButton.Visible     = true;
         this.downAnimationStepButton.Visible   = true;
         this.deleteAnimationButton.Visible     = true;
         this.numericCodeChanged                   = true;
         this.xNumericUpDown.Value                 = this.editor.Zoom1Archive.Animation[this.editor.ActualGraphicID, this.editor.ActualAlternativeID].XDiff;
         this.yNumericUpDown.Value                 = this.editor.Zoom1Archive.Animation[this.editor.ActualGraphicID, this.editor.ActualAlternativeID].YDiff;
         this.widthNumericUpDown.Value             = this.editor.Zoom1Archive.Animation[this.editor.ActualGraphicID, this.editor.ActualAlternativeID].Width;
         this.heightNumericUpDown.Value            = this.editor.Zoom1Archive.Animation[this.editor.ActualGraphicID, this.editor.ActualAlternativeID].Height;
         this.numericCodeChanged                   = false;
         this.xLabel.Visible                       = true;
         this.xNumericUpDown.Visible               = true;
         this.yLabel.Visible                       = true;
         this.yNumericUpDown.Visible               = true;
         this.widthLabel.Visible                   = true;
         this.widthNumericUpDown.Visible           = true;
         this.heightLabel.Visible                  = true;
         this.heightNumericUpDown.Visible          = true;
         this.noAnimationLabel.Visible             = false;
         this.createAnimationProgramButton.Visible = false;
         AnimationProgram program = this.editor.Zoom1Archive.Animation[this.editor.ActualGraphicID, this.editor.ActualAlternativeID];
         for (int i = 0; i < program.AnimationStepCount; i++)
         {
             this.dataGridView.Rows.Add(program[i].AnimationPhase.ToString(CultureInfo.InvariantCulture), program[i].MinimumTime.ToString(CultureInfo.InvariantCulture), program[i].MaximumTime.ToString(CultureInfo.InvariantCulture), program[i].Sound.ToString(CultureInfo.InvariantCulture));
         }
         editor.UpdateAnimation(true);
         return(true);
     }
     this.dataGridView.Visible              = false;
     this.addAnimationStepButton.Visible    = false;
     this.deleteAnimationStepButton.Visible = false;
     this.upAnimationStepButton.Visible     = false;
     this.downAnimationStepButton.Visible   = false;
     this.deleteAnimationButton.Visible     = false;
     this.xLabel.Visible                       = false;
     this.xNumericUpDown.Visible               = false;
     this.yLabel.Visible                       = false;
     this.yNumericUpDown.Visible               = false;
     this.widthLabel.Visible                   = false;
     this.widthNumericUpDown.Visible           = false;
     this.heightLabel.Visible                  = false;
     this.heightNumericUpDown.Visible          = false;
     this.noAnimationLabel.Visible             = true;
     this.createAnimationProgramButton.Visible = true;
     editor.UpdateAnimation(false);
     return(false);
 }
Example #2
0
 private void CompareAnimationProgram(AnimationProgram expectedAnimationProgram, AnimationProgram animationProgram)
 {
     Assert.AreEqual <int>(expectedAnimationProgram.XDiff, animationProgram.XDiff);
     Assert.AreEqual <int>(expectedAnimationProgram.YDiff, animationProgram.YDiff);
     Assert.AreEqual <int>(expectedAnimationProgram.Width, animationProgram.Width);
     Assert.AreEqual <int>(expectedAnimationProgram.Height, animationProgram.Height);
     Assert.AreEqual <int>(expectedAnimationProgram.AnimationStepCount, animationProgram.AnimationStepCount);
     for (int i = 0; i < expectedAnimationProgram.AnimationStepCount; i++)
     {
         Assert.AreEqual <int>(expectedAnimationProgram[0].AnimationPhase, animationProgram[0].AnimationPhase);
         Assert.AreEqual <int>(expectedAnimationProgram[0].MinimumTime, animationProgram[0].MinimumTime);
         Assert.AreEqual <int>(expectedAnimationProgram[0].MaximumTime, animationProgram[0].MaximumTime);
         Assert.AreEqual <int>(expectedAnimationProgram[0].Sound, animationProgram[0].Sound);
     }
 }
Example #3
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");
        }