Пример #1
0
 public Vehicle(Texture2D texture, V2DInstance instance)
     : base(texture, instance)
 {
     this.restitution = .30f;
     this.friction = 0f;
     this.angularDamping = 3;
     this.linearDamping = .1f;
 }
Пример #2
0
        public DisplayObject(Texture2D texture, V2DInstance inst)
        {
            id = idCounter++;

            Texture = texture;
            instanceDefinition = inst;

            this.X = (int)inst.X;
            this.Y = (int)inst.Y;

            ResetInstanceProperties();
        }
Пример #3
0
        public override Sprite CreateDefaultObject(Texture2D texture, V2DInstance inst)
        {
            Sprite result;

            if (inst.Definition.V2DShapes.Count > 0 || inst.Definition.Instances.Count > 0)
            {
                result = new V2DSprite(texture, inst);
            }
            else
            {
                result = new Sprite(texture, inst);
            }
            return(result);
        }
Пример #4
0
 public TextBox(Texture2D texture, V2DInstance inst)
     : base(texture, inst)
 {
     if (inst.Definition is V2DText)
     {
         sb = new StringBuilder();
         V2DText t = (V2DText)inst.Definition;
         textAtoms = new List<TextAtom>();
         for (int i = 0; i < t.TextRuns.Count; i++)
         {
             TextAtom ta = new TextAtom(this.X, this.Y, t.TextRuns[i]);
             textAtoms.Add(ta);
             sb.Append(ta.Text);
         }
         RecreateTextRuns();
     }
 }
Пример #5
0
        public V2DGenericTransform[] TransformsConversion(V2DInstance obj, List<Transform> trs)
        {
            V2DGenericTransform[] result = new V2DGenericTransform[trs.Count];
            if (trs.Count > 0)
            {
                MatrixComponents firstMc = trs[0].Matrix.GetMatrixComponents();
                float firstAlpha = trs[0].Alpha;
                obj.X += firstMc.TranslateX;
                obj.Y += firstMc.TranslateY;
                obj.Rotation += (float)(firstMc.Rotation * Math.PI / 180);
                obj.ScaleX *= firstMc.ScaleX;
                obj.ScaleY *= firstMc.ScaleY;
                obj.Alpha *= firstAlpha;

                for (int i = 0; i < trs.Count; i++)
                {
                    Transform tin = trs[i];

                    uint sf = (uint)Math.Round(tin.StartTime / (1000d / v2dWorld.FrameRate));
                    uint ef = (uint)Math.Round(tin.EndTime / (1000d / v2dWorld.FrameRate)) - 1;
                    MatrixComponents mc = tin.Matrix.GetMatrixComponents();
                    V2DGenericTransform tout = new V2DGenericTransform(
                        sf,
                        ef,
                        mc.ScaleX / firstMc.ScaleX,
                        mc.ScaleY / firstMc.ScaleY,
                        (float)(mc.Rotation * Math.PI / 180) - (float)(firstMc.Rotation * Math.PI / 180),
                        mc.TranslateX - firstMc.TranslateX,
                        mc.TranslateY - firstMc.TranslateY,
                        tin.Alpha / firstAlpha);

                    //V2DTransform tout = new V2DTransform(
                    //    (uint)Math.Floor(tin.StartTime / (1000d / v2dWorld.FrameRate)),
                    //    (uint)Math.Floor(tin.EndTime / (1000d / v2dWorld.FrameRate)),
                    //    new V2DMatrix(  tin.Matrix.ScaleX, tin.Matrix.Rotate0, tin.Matrix.Rotate1, tin.Matrix.ScaleX,
                    //                    tin.Matrix.TranslateX, tin.Matrix.TranslateY),
                    //    tin.Alpha);

                    tout.IsTweening = tin.IsTweening;

                    result[i] = tout;
                }
            }
            return result;
        }
Пример #6
0
        public void Init()
        {
            V2DDefinition ground = new V2DDefinition();
            ground.Name = V2D.ROOT_NAME;
            ground.FrameCount = 1;

            V2DInstance inst = new V2DInstance();
            inst.DefinitionName = ground.Name;
            inst.InstanceName = V2D.ROOT_NAME;
            inst.Definition = ground;
            inst.Transform = Matrix.Identitiy.GetDrawing2DMatrix().Elements;
            inst.TotalFrames = (int)curVo.GetFrameFromMilliseconds(curVo.Root.Duration);

            parentStack.Push(inst);
            root = inst;
        }
Пример #7
0
 //public bool CanJump = false;
 //private bool isJumping = false;
 //private bool isJumpingUp = false;
 public SmuckPlayer(Texture2D texture, V2DInstance instance)
     : base(texture, instance)
 {
 }
Пример #8
0
 private bool IsPointInside(V2DInstance inst, Point p)
 {
     bool result = false;
     System.Drawing.Drawing2D.Matrix m = ((Matrix)inst.UserData).GetDrawing2DMatrix();
     m.Invert();
     System.Drawing.PointF[] p2 = new System.Drawing.PointF[] { new System.Drawing.PointF(p.X, p.Y) };
     m.TransformPoints(p2);
     Point tp = new Point(p2[0].X, p2[0].Y);
     for (int i = 0; i < inst.Definition.V2DShapes.Count; i++)
     {
         if (Shapes[i].IsPointInside(tp))
         {
             result = true;
             break;
         }
     }
     return result;
 }
Пример #9
0
 public ExitPanel(Texture2D texture, V2DInstance inst)
     : base(texture, inst)
 {
 }
 public LaserParticleEffect(Texture2D texture, V2DInstance inst)
     : base(texture, inst)
 {
 }
Пример #11
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);
        }
Пример #12
0
 public V2DSprite(Texture2D texture, V2DInstance instance) : base(texture, instance)
 {
 }
Пример #13
0
 public Smasher(Texture2D texture, V2DInstance instance)
     : base(texture, instance)
 {
 }
Пример #14
0
 public ChooseLevelPanel(Texture2D texture, V2DInstance inst)
     : base(texture, inst)
 {
 }
Пример #15
0
 public PausedPanel(Texture2D texture, V2DInstance inst)
     : base(texture, inst)
 {
 }
Пример #16
0
 public LobbyPanel(Texture2D texture, V2DInstance inst)
     : base(texture, inst)
 {
 }
Пример #17
0
 public StarParticles(Texture2D texture, V2DInstance inst)
     : base(texture, inst)
 {
 }
Пример #18
0
 public MainMenuPanel(Texture2D texture, V2DInstance inst)
     : base(texture, inst)
 {
 }
Пример #19
0
 public HighScorePanel(Texture2D texture, V2DInstance inst)
     : base(texture, inst)
 {
     gameName = V2DGame.instance.GetType().Name;
     containerName = gameName + "Container";
 }
Пример #20
0
 public Walker(Texture2D texture, V2DInstance instance)
     : base(texture, instance)
 {
 }
Пример #21
0
 public SpaceVehicle(Texture2D texture, V2DInstance instance)
     : base(texture, instance)
 {
 }
 public InstructionsPanel(Texture2D texture, V2DInstance inst)
     : base(texture, inst)
 {
 }
Пример #23
0
 public Pig(Texture2D texture, V2DInstance instance)
     : base(texture, instance)
 {
 }
Пример #24
0
        private V2DInstance FindRootInstance(V2DInstance inst, string rootName)
        {
            // look through higher level instances first
            V2DInstance result = null;

            if (inst.InstanceName == rootName)
            {
                result = inst;
            }
            else if (inst.Definition != null)
            {
                for (int i = 0; i < inst.Definition.Instances.Count; i++)
                {
                    if (inst.Definition.Instances[i].InstanceName == rootName)
                    {
                        result = inst.Definition.Instances[i];
                        break;
                    }
                }
            }

            if (result == null && inst.Definition != null)
            {
                for (int i = 0; i < inst.Definition.Instances.Count; i++)
                {
                    result = FindRootInstance(inst.Definition.Instances[i], rootName);
                    if (result != null)
                    {
                        break;
                    }
                }
            }

            if (result == null)
            {
                throw new Exception("Could not find root instance: " + rootName + " in " + inst.InstanceName + ".");
            }
            return result;
        }
 public Target(Texture2D texture, V2DInstance instance)
     : base(texture, instance)
 {
 }
Пример #26
0
        private V2DInstance CreateInstance(Instance inst, V2DDefinition def)
        {
            V2DInstance result = new V2DInstance();

            result.InstanceName = inst.Name;
            result.Definition = def;
            result.DefinitionName = def.Name;
            result.Depth = (int)inst.Depth;
            result.StartFrame = curVo.GetFrameFromMillisecondsGetFrame(inst.StartTime);
            result.TotalFrames = curVo.GetFrameFromMillisecondsGetFrame(inst.EndTime - inst.StartTime);
            Matrix m = inst.Transformations[0].Matrix;
            result.UserData = m;
            AddSymbolImage(inst, def);

            curDef.Instances.Add(result);
            return result;
        }
Пример #27
0
 public ScoreView(Texture2D texture, V2DInstance instance)
     : base(texture, instance)
 {
 }
Пример #28
0
 public VideoPanel(Texture2D texture, V2DInstance inst)
     : base(texture, inst)
 {
 }
Пример #29
0
 public virtual Sprite CreateDefaultObject(Texture2D texture, V2DInstance inst)
 {
     return new Sprite(texture, inst);
 }
Пример #30
0
 public PressButton(Texture2D texture, V2DInstance instance)
     : base(texture, instance)
 {
 }
Пример #31
0
 public ParticleGroup(Texture2D texture, V2DInstance inst)
     : base(texture, inst)
 {
 }
Пример #32
0
 public V2DSprite(Texture2D texture, V2DInstance instance)
     : base(texture, instance)
 {
 }