Пример #1
0
        public PositionedObjectGueWrapper(PositionedObject frbObject, GraphicalUiElement gumObject) : base()
        {
            var renderable = new InvisibleRenderable();

            renderable.Visible = true;

            GumParent = new GraphicalUiElement();
            GumParent.SetContainedObject(renderable);
            GumParent.XUnits = Gum.Converters.GeneralUnitType.PixelsFromSmall;
            GumParent.YUnits = Gum.Converters.GeneralUnitType.PixelsFromSmall;

            GumParent.XOrigin = HorizontalAlignment.Center;
            GumParent.YOrigin = VerticalAlignment.Center;


            this.FrbObject = frbObject;
            this.GumObject = gumObject;

            gumObject.Parent = GumParent;
        }
Пример #2
0
        internal static bool TryHandleAsBaseType(string baseType, SystemManagers systemManagers, out IRenderable containedObject)
        {
            bool handledAsBaseType = true;

            containedObject = null;

            switch (baseType)
            {
            case "Container":

                if (GraphicalUiElement.ShowLineRectangles)
                {
                    LineRectangle lineRectangle = new LineRectangle(systemManagers);
                    containedObject = lineRectangle;
                }
                else
                {
                    containedObject = new InvisibleRenderable();
                }
                break;

            case "Rectangle":
                LineRectangle rectangle = new LineRectangle(systemManagers);
                rectangle.IsDotted = false;
                containedObject    = rectangle;
                break;

            case "Circle":
                LineCircle circle = new LineCircle(systemManagers);
                circle.CircleOrigin = CircleOrigin.TopLeft;
                containedObject     = circle;
                break;

            case "Polygon":
                LinePolygon polygon = new LinePolygon(systemManagers);
                containedObject = polygon;
                break;

            case "ColoredRectangle":
                SolidRectangle solidRectangle = new SolidRectangle();
                containedObject = solidRectangle;
                break;

            case "Sprite":
                Texture2D texture = null;

                Sprite sprite = new Sprite(texture);
                containedObject = sprite;

                break;

            case "NineSlice":
            {
                NineSlice nineSlice = new NineSlice();
                containedObject = nineSlice;
            }
            break;

            case "Text":
            {
                Text text = new Text(systemManagers, "");
                containedObject = text;
            }
            break;

            default:
                handledAsBaseType = false;
                break;
            }

            return(handledAsBaseType);
        }
        internal static bool TryHandleAsBaseType(string baseType, SystemManagers systemManagers, out IRenderable containedObject)
        {
            bool handledAsBaseType = true;

            containedObject = null;
#if MONOGAME
            switch (baseType)
            {
            case "Container":
            case "Component":     // this should never be set in Gum, but there could be XML errors or someone could have used an old Gum...
                if (GraphicalUiElement.ShowLineRectangles)
                {
                    LineRectangle lineRectangle = new LineRectangle(systemManagers);
                    containedObject = lineRectangle;
                }
                else
                {
                    containedObject = new InvisibleRenderable();
                }
                break;

            case "Rectangle":
                LineRectangle rectangle = new LineRectangle(systemManagers);
                rectangle.IsDotted = false;
                containedObject    = rectangle;
                break;

            case "Circle":
                LineCircle circle = new LineCircle(systemManagers);
                circle.CircleOrigin = CircleOrigin.TopLeft;
                containedObject     = circle;
                break;

            case "Polygon":
                LinePolygon polygon = new LinePolygon(systemManagers);
                containedObject = polygon;
                break;

            case "ColoredRectangle":
                SolidRectangle solidRectangle = new SolidRectangle();
                containedObject = solidRectangle;
                break;

            case "Sprite":
                Texture2D texture = null;

                Sprite sprite = new Sprite(texture);
                containedObject = sprite;

                break;

            case "NineSlice":
            {
                NineSlice nineSlice = new NineSlice();
                containedObject = nineSlice;
            }
            break;

            case "Text":
            {
                Text text = new Text(systemManagers, "");
                containedObject = text;
            }
            break;

            default:
                handledAsBaseType = false;
                break;
            }
#endif
            return(handledAsBaseType);
        }