Example #1
0
 private Cycle(Cycle fromCycle)
 {
     Sequence = fromCycle.Sequence;
     _throttle = fromCycle._throttle;
     NextCycle = this;
     CycleKey = fromCycle.CycleKey;
 }
Example #2
0
        public void Apply(FrameSequence frameSequence)
        {
            // CT_ShapeProperties

            // c:spPr
            this._writer.WriteStartElement(Dml.Chart.Prefix, Dml.Chart.ElSpPr, Dml.Chart.Ns);
            {
                // a:xfrm

                // EG_Geometry

                // EG_FillProperties
                insertFillProperties(frameSequence.AreaFormat, frameSequence.GelFrameSequence);

                // a:ln
                insertLineProperties(frameSequence.LineFormat, frameSequence.GelFrameSequence);

                // EG_EffectProperties

                // a:scene3d

                // a:sp3d
            }
            this._writer.WriteEndElement(); // c:spPr
        }
Example #3
0
        public static void LoadSprite()
        {
            FrameSequence seq = new FrameSequence();

            seq.AddFrame(sprtBmp, 0, 0);
            seq.AddFrame(sprtBmp, 1, 0);
            seq.AddFrame(sprtBmp, 2, 0);
            seq.AddFrame(sprtBmp, 3, 0);
            seq.SequenceCycleType = Gondwana.Common.Enums.CycleType.PingPong;

            Cycle cycle = new Cycle(seq, 0.03, "groovin");

            sprite = Sprites.CreateSprite(matrix, seq[0]);
            sprite.TileAnimator.CurrentCycle = cycle;
            sprite.RenderSize = new Size(50, 50);
            sprite.VertAlign  = Gondwana.Common.Enums.VerticalAlignment.Top;
            sprite.HorizAlign = Gondwana.Common.Enums.HorizontalAlignment.Left;
            sprite.MoveSprite(3, 3);
            sprite.Visible = true;
            sprite.TileAnimator.StartAnimation();
            sprite.DetectCollision = CollisionDetection.All;

            //matrix2[1, 1].EnableAnimator = true;
            //matrix2[1, 1].TileAnimator.CurrentCycle = Cycles.GetAnimationCycle("groovin");
            //matrix2[1, 1].TileAnimator.StartAnimation();
        }
Example #4
0
        public CompilerResults Run(String script, Frame EditingFrame, FrameSequence CurrentSequence)
        {
            Int32         numExtraLines = 0;
            StringBuilder srcCode       = new StringBuilder();

            // add each namespace into the source code
            foreach (string ns in mNamespaces)
            {
                srcCode.AppendFormat("using {0};\n", ns);
                numExtraLines++;
            }

            // form a dummy class and function, etc
            srcCode.Append("namespace Matrix\n{\npublic class ScriptDynamic\n{\n\n");
            srcCode.Append("static public void ScriptRun(Frame EditingFrame, FrameSequence CurrentSequence)\n{");
            numExtraLines += 6;

            // append all the actual source code
            srcCode.Append(script);

            // finish the source code
            srcCode.Append("}\n}\n}\n");

            // compile it
            CompilerResults result = mProvider.CompileAssemblyFromSource(
                mCompilerParam,
                srcCode.ToString());

            // nothing wrong with the compile?
            if (result.Errors.Count == 0)
            {
                try
                {
                    // invoke the compiled funtion
                    Type       dynType   = result.CompiledAssembly.GetType("Matrix.ScriptDynamic");
                    MethodInfo runMethod = dynType.GetMethod("ScriptRun", BindingFlags.Public | BindingFlags.Static);
                    runMethod.Invoke(null, new object[] { EditingFrame, CurrentSequence });
                }
                catch (Exception e)
                {
                    // something bad happened here
                    MessageBox.Show("Fatal Compiler Error : \n\n" + e.Message + "\n\n" + e.InnerException.Message, "Script Compiler");
                }
                return(null);
            }
            else
            {
                // adjust all compiler line errors to take namespace/class additions
                // into account, so any error reporting will be accurate to the original script file
                foreach (CompilerError er in result.Errors)
                {
                    er.Line -= numExtraLines;
                }
            }
            return(result);
        }
Example #5
0
        public void TestIndexers()
        {
            FrameSequence seq = new FrameSequence();
            Frame f1 = new Frame(null);
            Frame f2 = new Frame(null);
            seq[0] = f1;
            seq[1] = f2;

            Assert.AreEqual(seq[1], f2);
            Assert.AreEqual(seq[0], f1);
            Assert.AreEqual(seq[5], null);
        }
Example #6
0
        public Cycle(FrameSequence sequence, double throttleTime, string cycleKey)
        {
            Sequence = sequence;
            ThrottleTime = throttleTime;
            NextCycle = this;
            CycleKey = cycleKey;

            if (Cycle._cycles.ContainsKey(cycleKey))
                Cycle._cycles[cycleKey] = this;
            else
                Cycle._cycles.Add(cycleKey, this);
        }
Example #7
0
        public void TestAppend()
        {
            FrameSequence seq = new FrameSequence();
            Frame f1 = new Frame(null);
            Frame f2 = new Frame(null);
            f2.Duration = 5;
            Frame f3 = new Frame(null);

            seq.Append(f1);
            seq.Append(f2);
            seq.Append(f3);

            Assert.AreEqual(seq[0], f1);
            Assert.AreEqual(seq[1], f2);
            Assert.AreEqual(seq[6], f3);
            Assert.AreEqual(seq[4], null);
        }
Example #8
0
        public FrameSequenceView()
        {
            InitializeComponent();

            this.SetStyle(
                ControlStyles.UserPaint |
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.DoubleBuffer, true);

            m_frameFont  = new Font("Tahoma", 8);
            m_frameBrush = new SolidBrush(Color.WhiteSmoke);

            m_strip = new FrameSequence();
            m_strip.FrameDataChanged += RefreshOnEvent;
            m_strip.SelectionChange  += RefreshOnEvent;
            //m_strip.StripContentsChanged += StripContentsChanged;

            UpdateScroll();
        }
Example #9
0
        public static void LoadSprite()
        {
            FrameSequence seq = new FrameSequence();
            seq.AddFrame(sprtBmp, 0, 0);
            seq.AddFrame(sprtBmp, 1, 0);
            seq.AddFrame(sprtBmp, 2, 0);
            seq.AddFrame(sprtBmp, 3, 0);
            seq.SequenceCycleType = Gondwana.Common.Enums.CycleType.PingPong;

            Cycle cycle = new Cycle(seq, 0.03, "groovin");

            sprite = Sprites.CreateSprite(matrix, seq[0]);
            sprite.TileAnimator.CurrentCycle = cycle;
            sprite.RenderSize = new Size(50, 50);
            sprite.VertAlign = Gondwana.Common.Enums.VerticalAlignment.Top;
            sprite.HorizAlign = Gondwana.Common.Enums.HorizontalAlignment.Left;
            sprite.MoveSprite(3, 3);
            sprite.Visible = true;
            sprite.TileAnimator.StartAnimation();
            sprite.DetectCollision = CollisionDetection.All;

            //matrix2[1, 1].EnableAnimator = true;
            //matrix2[1, 1].TileAnimator.CurrentCycle = Cycles.GetAnimationCycle("groovin");
            //matrix2[1, 1].TileAnimator.StartAnimation();
        }
Example #10
0
 private void btn_addSequence_Click(object sender, EventArgs e)
 {
     // default name
     String name = "Default";
     for(int i=0;i<1000; i++)
     {
         bool nameUsed = false;
         foreach(String seqName in lsb_animSequences.Items)
         {
             if (seqName == "Default" + i)
             {
                 nameUsed = true;
                 break;
             }
         }
         if (!nameUsed)
         {
             name = "Default" + i;
             break;
         }
     }
     FrameSequence animSeq = new FrameSequence();
     animSeq.Name = name;
     FAnim.FrameSeqList.Add(animSeq);
     lsb_animSequences.Items.Add(name);
 }