Exemplo n.º 1
0
        public Instance2D GetChildByName(string name)
        {
            Instance2D result = null;

            for (int i = 0; i < Children.Count; i++)
            {
                if (Children[i].InstanceName == name)
                {
                    result = Children[i];
                    break;
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        private V2DInstance GetV2DInstance(Instance2D inst)
        {
            V2DInstance result = new V2DInstance();
            result.DefinitionName = inst.DefinitionName;
            result.Density = inst.Density;
            result.Depth = inst.Depth;
            result.Friction = inst.Friction;
            result.InstanceName = inst.InstanceName;
            //result.Joints = inst.Joints;
            DDW.Vex.Matrix m = inst.Matrix;
            //result.Matrix = new V2DMatrix(m.ScaleX, m.Rotate0, m.Rotate1, m.ScaleY, m.TranslateX, m.TranslateY);
            result.Restitution = inst.Restitution;
            result.StartFrame = inst.StartFrame;
            result.EndFrame = inst.TotalFrames + inst.StartFrame;
            result.Visible = inst.Visible;

            result.Alpha = inst.Alpha;
            result.X = inst.X;
            result.Y = inst.Y;
            result.Rotation = inst.Rotation;
            result.ScaleX = inst.ScaleX;
            result.ScaleY = inst.ScaleY;
            result.Transforms = TransformsConversion(result, inst.Transforms);

            return result;

            //Dictionary<string, string> dict = null;
            //if (v2d.codeData.ContainsKey(inst.InstanceName))
            //{
            //    dict = v2d.codeData[inst.InstanceName];
            //}
            //return inst.GetV2DInstance(dict);
        }
Exemplo n.º 3
0
 private Instance2D CreateInstance2D(IDefinition def)
 {
     //MatrixComponents mc = Matrix.Identitiy.GetMatrixComponents();
     //Instance2D result = new Instance2D(def.Name, def.Name, mc.TranslateX, mc.TranslateY, (float)(mc.Rotation * Math.PI / 180), mc.ScaleX, mc.ScaleY);
     Instance2D result = new Instance2D(def.Name, def.Name, 0,0,0,1,1);
     result.Depth = 0;
     result.Transforms = new List<Transform>();
     result.Transforms.Add(new Transform(0, 0, Matrix.Identity, 1, ColorTransform.Identity));
     result.Definition = definitions.Find(d => d.Id == def.Id);
     result.StartFrame = 0;
     result.TotalFrames = 0;
     return result;
 }
Exemplo n.º 4
0
 private Instance2D CreateInstance2D(Instance inst, IDefinition def)
 {
     //MatrixComponents mc = inst.Transformations[0].Matrix.GetMatrixComponents();
     //Instance2D result = new Instance2D(inst.Name, def.Name, mc.TranslateX, mc.TranslateY, (float)(mc.Rotation * Math.PI / 180), mc.ScaleX, mc.ScaleY);
     Instance2D result = new Instance2D(inst.Name, def.Name, 0,0,0,1,1);
     result.Depth = inst.Depth;
     result.Transforms = inst.Transformations;
     result.Definition = definitions.Find(d => d.Id == inst.DefinitionId);
     result.StartFrame = curVo.GetFrameFromMilliseconds(inst.StartTime);
     result.TotalFrames = curVo.GetFrameFromMilliseconds(inst.EndTime) - result.StartFrame - 1; // end frame is last ms of frame, so -1
     return result;
 }
Exemplo n.º 5
0
        public void Init(DDW.Swf.SwfCompilationUnit scu)
        {
            root = new Definition2D();
            root.DefinitionName = V2D.ROOT_NAME;
            root.LinkageName = V2D.ROOT_NAME;
            root.Bounds = Rectangle.Empty;
            root.FrameCount = 1;
            definitions.Add(root);

            rootInstance = new Instance2D(V2D.ROOT_NAME, root.DefinitionName, 0, 0, 0, 1, 1);
            rootInstance.Definition = root;
            rootInstance.Transforms.Add(new Transform(
                0,
                (uint)(scu.Header.FrameCount * (1000 / scu.Header.FrameRate)),
                new Matrix(1, 0, 0, 1, 0, 0),
                1,
                ColorTransform.Identity));

            parentStack.Push(rootInstance);
        }