Beispiel #1
0
        public void ToItem(AGSSerializationContext context, IObject obj)
        {
            obj.ResetScale(InitialWidth, InitialHeight);
            var image = Image.ToItem(context);

            if (image != null)
            {
                obj.Image = image;
                obj.ScaleBy(ScaleX, ScaleY);
            }
            obj.Location = new AGSLocation(Location.Item1, Location.Item2, Location.Item3);
            obj.Anchor   = new PointF(Anchor.Item1, Anchor.Item2);
            obj.Angle    = Angle;
            obj.Tint     = Color.FromHexa(Tint);

            obj.PixelPerfect(IsPixelPerfect);
            AnimationContainer.ToItem(context, obj);
            if (obj.Animation.Frames.Count > 0)
            {
                obj.ScaleBy(obj.ScaleX, obj.ScaleY);
            }
            obj.RenderLayer = RenderLayer.ToItem(context);
            if (WalkPoint != null)
            {
                obj.WalkPoint = new PointF(WalkPoint.Item1, WalkPoint.Item2);
            }
            obj.Properties.CopyFrom(Properties.ToItem(context));
            obj.Enabled           = Enabled;
            obj.Hotspot           = Hotspot;
            obj.IgnoreViewport    = IgnoreViewport;
            obj.IgnoreScalingArea = IgnoreScalingArea;
            obj.Visible           = Visible;

            if (Parent != null)
            {
                var parent = Parent.ToItem(context);
                obj.TreeNode.SetParent(parent.TreeNode);
            }
        }