Ejemplo n.º 1
0
        private void load(ProjectEditor editor, ImagePickerOverlay imagePicker)
        {
            Action = () => imagePicker.QueryImage(imageName);
            Editing.BindTo(editor.CurrentEditingElement.Value.Images[imageName]);

            TextureChanged = newTexture =>
            {
                changeImageText.Text = newTexture == null ? @"Añadir Imagen" : @"Cambiar Imagen";
            };
        }
Ejemplo n.º 2
0
 private void load(ImagePickerOverlay imagePicker, ProjectEditor editor, WorkingProject project)
 {
     if (isProject)
     {
         Action = imagePicker.QueryProjectImage;
         editing.BindTo(project.Image);
         editing.BindValueChanged(i => image.Texture = i.NewValue?.Texture, true);
     }
     else
     {
         Action = () => imagePicker.QueryImage(imageName);
         editing.BindTo(editor.CurrentEditingElement.Value.Images[imageName]);
         editing.BindValueChanged(newVal =>
         {
             if (newVal.NewValue?.Texture != null)
             {
                 if (newVal.NewValue.Texture.Size.X > renderSize.X - 2 || newVal.NewValue.Texture.Size.Y > renderSize.Y - 2)
                 {
                     image.Size             = Vector2.One;
                     image.RelativeSizeAxes = Axes.Both;
                 }
                 else
                 {
                     image.Size             = newVal.NewValue.Texture.Size;
                     image.RelativeSizeAxes = Axes.None;
                 }
             }
             image.Texture = newVal.NewValue?.Texture;
             if (image.Texture == null)
             {
                 changeImageText.Text = @"Añadir Imagen";
                 noImageText.Alpha    = 1;
                 content.Alpha        = 0;
             }
             else
             {
                 changeImageText.Text = @"Cambiar Imagen";
                 noImageText.Alpha    = 0;
                 content.Alpha        = 1;
             }
         }, true);
     }
 }