Ejemplo n.º 1
0
        public RichImage(JSONTable template, ContentManager content)
        {
            layers = new List <RichImageLayer>();

            JSONArray layerTemplate = template.getArray("layers", null);

            if (layerTemplate != null)
            {
                for (int Idx = 0; Idx < layerTemplate.Length; ++Idx)
                {
                    layers.Add(new RichImageLayer_Texture(layerTemplate.getJSON(Idx), content));
                }
            }
            else
            {
                layers.Add(new RichImageLayer_Texture(template, content));
            }
        }
Ejemplo n.º 2
0
        public RichImageLayer_Texture(JSONTable template, ContentManager content)
        {
            texture  = content.Load <Texture2D>(template.getString("texture", "white"));
            color    = template.getString("color", "FFFFFF").toColor();
            drawMode = drawModesByName[template.getString("draw", "default")];
            padding  = template.getInt("padding", 0);

            JSONArray offsetArray = template.getArray("offset", null);

            if (offsetArray == null)
            {
                offset = new Vector2(0, 0);
            }
            else
            {
                offset = offsetArray.toVector2();
            }

            rotation = template.getRotation("rotation", Rotation90.None);

            modifiesRect = (padding != 0 || offset.X != 0 || offset.Y != 0);
        }