Exemplo n.º 1
0
 private void load(ProjectEditor editor)
 {
     InternalChildren = new Drawable[]
     {
         new Box
         {
             RelativeSizeAxes = Axes.Both,
             Colour           = new Colour4(106, 100, 104, 255),
         },
         new GridContainer
         {
             RelativeSizeAxes = Axes.Both,
             Content          = new[]
             {
                 new Drawable[]
                 {
                     //Listas de elementos
                     new Container
                     {
                         RelativeSizeAxes = Axes.Both,
                         Children         = new Drawable []
                         {
                             new Box
                             {
                                 RelativeSizeAxes = Axes.Both,
                                 Colour           = Colour4.Gray,
                             },
                             new ProjectObjectManagerContainer <Card>(true)
                             {
                                 Anchor = Anchor.TopLeft,
                                 Origin = Anchor.TopLeft,
                                 Height = 1 / 3f,
                             },
                             new ProjectObjectManagerContainer <Token>(true)
                             {
                                 Anchor = Anchor.CentreLeft,
                                 Origin = Anchor.CentreLeft,
                                 Height = 1 / 3f,
                             },
                             new ProjectObjectManagerContainer <Board>(true)
                             {
                                 Anchor = Anchor.BottomLeft,
                                 Origin = Anchor.BottomLeft,
                                 Height = 1 / 3f,
                             },
                         },
                     },
                     //Area de edición
                     new Container
                     {
                         RelativeSizeAxes = Axes.Both,
                         Children         = new Drawable[]
                         {
                             activeEditContainer = new BasicScrollContainer
                             {
                                 RelativeSizeAxes = Axes.Both,
                                 Child            = new FillFlowContainer
                                 {
                                     RelativeSizeAxes = Axes.X,
                                     AutoSizeAxes     = Axes.Y,
                                     Direction        = FillDirection.Vertical,
                                     Children         = new Drawable[]
                                     {
                                         new Container
                                         {
                                             RelativeSizeAxes = Axes.X,
                                             AutoSizeAxes     = Axes.Y,
                                             Children         = new Drawable[]
                                             {
                                                 new Box
                                                 {
                                                     RelativeSizeAxes = Axes.Both,
                                                     Colour           = Colour4.Cyan,
                                                 },
                                                 new Container
                                                 {
                                                     RelativeSizeAxes = Axes.X,
                                                     AutoSizeAxes     = Axes.Y,
                                                     Padding          = new MarginPadding {
                                                         Horizontal = 60, Vertical = 50
                                                     },
                                                     Children = new Drawable[]
                                                     {
                                                         new ImagePreviewContainer(),
                                                         new SpriteText
                                                         {
                                                             Anchor   = Anchor.TopRight,
                                                             Origin   = Anchor.TopRight,
                                                             Position = new Vector2(-675, 10),
                                                             Text     = @"Nombre:",
                                                             Colour   = Colour4.Black,
                                                         },
                                                         nameTextBox = new BasicTextBox
                                                         {
                                                             Anchor   = Anchor.TopRight,
                                                             Origin   = Anchor.TopRight,
                                                             Position = new Vector2(-250, 0),
                                                             Height   = 35,
                                                             Width    = 400,
                                                         },
                                                         new SpriteText
                                                         {
                                                             Anchor   = Anchor.TopRight,
                                                             Origin   = Anchor.TopRight,
                                                             Position = new Vector2(-675, 80),
                                                             Text     = @"Descripción:",
                                                             Colour   = Colour4.Black,
                                                         },
                                                         descriptionTextBox = new BasicTextBox
                                                         {
                                                             Anchor   = Anchor.TopRight,
                                                             Origin   = Anchor.TopRight,
                                                             Position = new Vector2(-250, 70),
                                                             Height   = 35,
                                                             Width    = 400,
                                                         },
                                                     },
                                                 },
                                             },
                                         },
                                         new Container
                                         {
                                             RelativeSizeAxes = Axes.X,
                                             Height           = 600,
                                             Children         = new Drawable[]
                                             {
                                                 new Box
                                                 {
                                                     RelativeSizeAxes = Axes.Both,
                                                     Colour           = Colour4.Fuchsia,
                                                 },
                                                 elementSize = new Container
                                                 {
                                                     RelativeSizeAxes = Axes.Both,
                                                     Children         = new Drawable[]
                                                     {
                                                         new SpriteText
                                                         {
                                                             Text     = @"Tamaño X:",
                                                             Position = new Vector2(50, 50),
                                                         },
                                                         sizeTextBoxX = new NumericTextBox(4)
                                                         {
                                                             Height   = 35,
                                                             Width    = 75,
                                                             Position = new Vector2(125, 45),
                                                         },
                                                         new SpriteText
                                                         {
                                                             Text     = @"Tamaño Y:",
                                                             Position = new Vector2(50, 100),
                                                         },
                                                         sizeTextBoxY = new NumericTextBox(4)
                                                         {
                                                             Height   = 35,
                                                             Width    = 75,
                                                             Position = new Vector2(125, 95),
                                                         },
                                                     },
                                                 },
                                                 elementSubElements = new Container
                                                 {
                                                     RelativeSizeAxes = Axes.Both,
                                                     Width            = 1 / 3f,
                                                     Anchor           = Anchor.TopRight,
                                                     Origin           = Anchor.TopRight,
                                                     Child            = tilesManagerContainer = new BoardObjectManagerContainer(),
                                                 },
                                             },
                                         },
                                     },
                                 },
                             },
                             tileOverlay,
                             noSelectionContainer = new Container
                             {
                                 RelativeSizeAxes = Axes.Both,
                                 Anchor           = Anchor.Centre,
                                 Origin           = Anchor.Centre,
                                 Child            = new SpriteText
                                 {
                                     Anchor = Anchor.Centre,
                                     Origin = Anchor.Centre,
                                     Text   = @"Selecciona un objeto para editarlo",
                                 },
                             },
                         },
                     },
                 },
             },
             ColumnDimensions = new[]
             {
                 new Dimension(GridSizeMode.Relative, 0.25f),
                 new Dimension(),
             },
         },
     };
     currentEditing.BindTo(editor.CurrentEditingElement);
     currentEditing.BindValueChanged(checkData, true);
 }
Exemplo n.º 2
0
        private void load(ProjectEditor editor)
        {
            InternalChildren = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = new Colour4(106, 100, 104, 255),
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Content          = new[]
                    {
                        new Drawable[]
                        {
                            //Listas de elementos
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = Colour4.Gray,
                                    },
                                    new ProjectObjectManagerContainer <Card>(true)
                                    {
                                        Anchor = Anchor.TopLeft,
                                        Origin = Anchor.TopLeft,
                                        Height = 1 / 3f,
                                    },
                                    new ProjectObjectManagerContainer <Token>(true)
                                    {
                                        Anchor = Anchor.CentreLeft,
                                        Origin = Anchor.CentreLeft,
                                        Height = 1 / 3f,
                                    },
                                    new ProjectObjectManagerContainer <Board>(true)
                                    {
                                        Anchor = Anchor.BottomLeft,
                                        Origin = Anchor.BottomLeft,
                                        Height = 1 / 3f,
                                    },
                                },
                            },
                            //Area de edición
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Children         = new Drawable[]
                                {
                                    activeEditContainer = new BasicScrollContainer
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Child            = new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Children         = new Drawable[]
                                            {
                                                new Container
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Padding          = new MarginPadding {
                                                        Horizontal = 60, Vertical = 50
                                                    },
                                                    Children = new Drawable[]
                                                    {
                                                        visualEditor = new ElementVisualEditorContainer(),
                                                        new SpriteText
                                                        {
                                                            Anchor   = Anchor.TopRight,
                                                            Origin   = Anchor.TopRight,
                                                            Position = new Vector2(-675, 10),
                                                            Text     = @"Nombre:",
                                                        },
                                                        nameTextBox = new BasicTextBox
                                                        {
                                                            CommitOnFocusLost = true,
                                                            Anchor            = Anchor.TopRight,
                                                            Origin            = Anchor.TopRight,
                                                            Position          = new Vector2(-250, 0),
                                                            Height            = 35,
                                                            Width             = 400,
                                                        },
                                                        new SpriteText
                                                        {
                                                            Anchor   = Anchor.TopRight,
                                                            Origin   = Anchor.TopRight,
                                                            Position = new Vector2(-675, 80),
                                                            Text     = @"Descripción:",
                                                        },
                                                        descriptionTextBox = new BasicTextBox
                                                        {
                                                            CommitOnFocusLost = true,
                                                            Anchor            = Anchor.TopRight,
                                                            Origin            = Anchor.TopRight,
                                                            Position          = new Vector2(-250, 70),
                                                            Height            = 35,
                                                            Width             = 400,
                                                        },
                                                        new GamesToGoButton
                                                        {
                                                            Anchor = Anchor.TopRight,
                                                            Origin = Anchor.TopRight,
                                                            Height = 35,
                                                            Width  = 200,
                                                            Text   = @"Borrar Elemento",
                                                            Action = () => editor.DeleteElement(currentEditing.Value),
                                                        },
                                                    },
                                                },
                                                new Container
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    Height           = 600,
                                                    Children         = new Drawable[]
                                                    {
                                                        new FillFlowContainer
                                                        {
                                                            RelativeSizeAxes = Axes.Both,
                                                            Direction        = FillDirection.Full,
                                                            Spacing          = new Vector2(10),
                                                            Padding          = new MarginPadding {
                                                                Horizontal = 50
                                                            },
                                                            Children = new Drawable[]
                                                            {
                                                                elementSize = new VectorTextBoxContainer(4, false)
                                                                {
                                                                    TextX = @"Tamaño X:",
                                                                    TextY = @"Tamaño Y:",
                                                                },
                                                                elementOrientation = new LabeledDropdown <ElementOrientation>
                                                                {
                                                                    Text    = @"Orientación:",
                                                                    Element = new GamesToGoDropdown <ElementOrientation>
                                                                    {
                                                                        Width = 200,
                                                                    },
                                                                },
                                                                elementSideVisible = new LabeledDropdown <ElementSideVisible>
                                                                {
                                                                    Text    = @"Lado visible:",
                                                                    Element = new GamesToGoDropdown <ElementSideVisible>
                                                                    {
                                                                        Width = 200,
                                                                    },
                                                                },
                                                                elementPrivacy = new LabeledDropdown <ElementPrivacy>
                                                                {
                                                                    Text    = @"Privacidad:",
                                                                    Element = new GamesToGoDropdown <ElementPrivacy>
                                                                    {
                                                                        Width = 200,
                                                                    },
                                                                },
                                                                elementPosition = new VectorTextBoxContainer(4, true)
                                                                {
                                                                    TextX = @"Posición en X:",
                                                                    TextY = @"Posición en Y:",
                                                                },
                                                            },
                                                        },
                                                        elementSubElements = new Container
                                                        {
                                                            RelativeSizeAxes = Axes.Both,
                                                            Width            = 1 / 3f,
                                                            Anchor           = Anchor.TopRight,
                                                            Origin           = Anchor.TopRight,
                                                            Child            = tilesManagerContainer = new BoardObjectManagerContainer(),
                                                        },
                                                    },
                                                },
                                            },
                                        },
                                    },
                                    tileOverlay,
                                    noSelectionContainer = new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Anchor           = Anchor.Centre,
                                        Origin           = Anchor.Centre,
                                        Child            = new SpriteText
                                        {
                                            Anchor = Anchor.Centre,
                                            Origin = Anchor.Centre,
                                            Text   = @"Selecciona un objeto para editarlo",
                                        },
                                    },
                                },
                            },
                        },
                    },
                    ColumnDimensions = new[]
                    {
                        new Dimension(GridSizeMode.Relative, 0.25f),
                        new Dimension(),
                    },
                },
            };
            currentEditing.BindTo(editor.CurrentEditingElement);
            currentEditing.BindValueChanged(checkData, true);

            nameTextBox.OnCommit += delegate
            {
                if (currentEditing.Value != null)
                {
                    currentEditing.Value.Name.Value = nameTextBox.Text;
                }
            };

            descriptionTextBox.OnCommit += delegate
            {
                if (currentEditing.Value != null)
                {
                    currentEditing.Value.Description.Value = descriptionTextBox.Text;
                }
            };

            elementPosition.Current.BindValueChanged(_ => visualEditor.UpdatePreview());
            elementOrientation.Current.BindValueChanged(_ => visualEditor.UpdatePreview());
            elementSideVisible.Current.BindValueChanged(_ => visualEditor.UpdatePreview());
            elementSize.Current.BindValueChanged(_ => visualEditor.UpdatePreview());
            tilesManagerContainer.ElementsAdded   = _ => visualEditor.UpdatePreview();
            tilesManagerContainer.ElementsRemoved = _ => visualEditor.UpdatePreview();
        }