Esempio n. 1
0
        private void load(TextureStore textures)
        {
            if (workingProject == null)
            {
                workingProject = WorkingProject.Parse(null, store, textures, api);
                SaveProject(false);
            }

            initialRelations = workingProject.DatabaseObject.Relations == null ? null : new List <FileRelation>(workingProject.DatabaseObject.Relations);

            InternalChildren = new[]
            {
                new Container
                {
                    Depth            = 4,
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding
                    {
                        Top = 30,
                    },
                    Child = screenContainer = new ScreenStack
                    {
                        RelativeSizeAxes = Axes.Both,
                    },
                },
                new Container
                {
                    Depth            = 3,
                    RelativeSizeAxes = Axes.X,
                    Height           = 30,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = Colour4.Gray,
                        },
                        tabsBar = new EditorTabChanger(),
                        new CloseButton
                        {
                            Action = confirmClose,
                        },
                    },
                },
            };

            tabsBar.Current.ValueChanged       += changeEditorScreen;
            CurrentEditingElement.ValueChanged += _ => tabsBar.Current.Value = tabsBar.Current.Value switch
            {
                EditorScreenOption.Objetos => EditorScreenOption.Objetos,
                EditorScreenOption.Eventos => EditorScreenOption.Eventos,
                _ => EditorScreenOption.Objetos,
            };

            AddInternal(imagePicker);

            tabsBar.Current.Value = EditorScreenOption.Inicio;
        }
Esempio n. 2
0
        private void importProject(OnlineGame onlineProject)
        {
            string relativePath = Path.Combine(@"download", @$ "{onlineProject.Hash}.zip");
            string filename     = store.GetFullPath(relativePath);

            ProjectInfo futureInfo = new ProjectInfo
            {
                File = new File {
                    NewName = Path.GetFileNameWithoutExtension(filename), Type = "project"
                },
                CreatorID        = onlineProject.Creator.ID,
                CommunityStatus  = onlineProject.Status,
                LastEdited       = onlineProject.DateTimeLastEdited,
                MaxNumberPlayers = onlineProject.Maxplayers,
                MinNumberPlayers = onlineProject.Minplayers,
                Name             = onlineProject.Name,
                Description      = onlineProject.Description,
                OnlineProjectID  = onlineProject.Id,
            };

            using (var fileStream = store.GetStream(filename, FileAccess.Read, FileMode.Open))
            {
                using (ZipFile zip = ZipFile.Read(fileStream))
                {
                    foreach (ZipEntry e in zip)
                    {
                        e.Extract(store.GetFullPath("files"), ExtractExistingFileAction.DoNotOverwrite);

                        if (e.FileName == futureInfo.File.NewName)
                        {
                            continue;
                        }

                        var file = database.Files.FirstOrDefault(f => f.NewName == e.FileName) ?? new File {
                            NewName = e.FileName, Type = "image"
                        };
                        futureInfo.Relations.Add(new FileRelation {
                            Project = futureInfo, File = file
                        });
                    }
                }
            }

            database.Add(futureInfo);
            database.SaveChanges();
            futureInfo.ImageRelation = futureInfo.Relations.FirstOrDefault(r => r.File.NewName == onlineProject.Image);
            WorkingProject.Parse(futureInfo, store, textures, api);
            database.SaveChanges();
            store.Delete(relativePath);

            onlineProjectsList.Remove(onlineProjectsList.Children.First(o => o.ID == onlineProject.Id));
            projectsList.Add(new LocalProjectSummaryContainer(futureInfo)
            {
                EditAction = openProject, DeleteAction = deleteProject
            });
        }
Esempio n. 3
0
        private void load(ImagePickerOverlay imagePicker, ProjectEditor editor, WorkingProject project)
        {
            RelativeSizeAxes = Axes.Both;
            CornerRadius     = ImageCornerRadius;
            Masking          = true;

            Container content = new Container
            {
                CornerRadius     = ImageCornerRadius,
                Masking          = true,
                RelativeSizeAxes = Axes.Both,
                Child            = mainContent = new ContainedImage(ShowOutline, ImageCornerRadius)
                {
                    ImageSize        = size,
                    Image            = Editing,
                    RelativeSizeAxes = Axes.Both,
                },
            };

            mainContent.UnderImageContent.Add(CreateContentShadow());

            if ((noContentDrawable = CreateNoSelectionContent()) != null)
            {
                content.Add(noContentDrawable);
            }

            Children = new[]
            {
                CreateMainContent(content),
                hoverContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Alpha            = 0,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = Colour4.Black.Opacity(0.5f),
                        },
                        CreateHoverContent(),
                    },
                },
            };
        }
Esempio n. 4
0
        private void load(Storage store, TextureStore textures)
        {
            workingProject = WorkingProject.Parse(ProjectInfo, store, textures, api);

            editIcon = workingProject == null ? FontAwesome.Solid.ExclamationTriangle : FontAwesome.Solid.Edit;

            ButtonFlowContainer.AddRange(new[]
            {
                new IconButton(FontAwesome.Solid.TrashAlt, Colour4.DarkRed)
                {
                    Action = showConfirmation,
                },
                new IconButton(editIcon, workingProject == null ? FrameworkColour.YellowDark : FrameworkColour.Green)
                {
                    Action = checkValidWorkingProject,
                },
            });

            BottomContainer.Add(new FillFlowContainer
            {
                Direction    = FillDirection.Horizontal,
                Spacing      = new Vector2(MARGIN_SIZE),
                AutoSizeAxes = Axes.Both,
                Children     = new Drawable[]
                {
                    new StatText(FontAwesome.Regular.Clone, ProjectInfo.NumberCards),
                    new StatText(FontAwesome.Solid.Coins, ProjectInfo.NumberTokens),
                    new StatText(FontAwesome.Solid.ChessBoard, ProjectInfo.NumberBoards),
                    new StatText(FontAwesome.Regular.Square, ProjectInfo.NumberBoxes),
                    new StatText(FontAwesome.Solid.Users, $"{ProjectInfo.MinNumberPlayers}{(ProjectInfo.MinNumberPlayers < ProjectInfo.MaxNumberPlayers ? $"-{ProjectInfo.MaxNumberPlayers}" : "")}"),
                    new StatText(FontAwesome.Solid.Tags, $"{ProjectInfo.Tags.GetSetFlags().Length}"),
                },
            });

            ProjectName.Text        = ProjectInfo.Name;
            ProjectDescription.Text = ProjectInfo.Description;
            ProjectImage.Texture    = workingProject?.Image.Value?.Texture;

            var getCreator = new GetUserRequest(ProjectInfo.CreatorID);

            getCreator.Success += u => UsernameBox.Text = @$ "De {u.Username} (Ultima vez editado {ProjectInfo.LastEdited:dd/MM/yyyy HH:mm}) Estado: {ProjectInfo.CommunityStatus.GetDescription()}";
            api.Queue(getCreator);
        }
Esempio n. 5
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);
     }
 }
Esempio n. 6
0
            private void load(ImageFinderOverlay imageFinder, WorkingProject project, TextureStore textures)
            {
                Size            = new Vector2(item_size);
                Masking         = true;
                CornerRadius    = 10;
                BorderThickness = 2;
                BorderColour    = Colour4.White;
                Anchor          = Anchor.CentreLeft;
                Origin          = Anchor.CentreLeft;
                Child           = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Colour4.Black.Opacity(0),
                };

                if (image == null)
                {
                    Add(new SpriteIcon
                    {
                        Anchor = Anchor.Centre,
                        Origin = Anchor.Centre,
                        Size   = new Vector2(60),
                        Icon   = FontAwesome.Solid.Plus,
                    });
                    Action += () => imageFinder.Show(project);
                }
                else
                {
                    Add(new Sprite
                    {
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        RelativeSizeAxes = Axes.Both,
                        FillMode         = FillMode.Fit,
                        Texture          = image.Texture,
                    });
                }
            }
        public TestSceneArgumentDescriptor()
        {
            workingProject  = WorkingProject.Parse(null, null, null, null);
            selectorOverlay = new ArgumentSelectorOverlay();
            var tile1 = new Tile();

            tile1.Name.Value = "Tile 1";
            workingProject.AddElement(tile1);
            var card1 = new Card();

            card1.Name.Value = "Card 1";
            workingProject.AddElement(card1);
            var board1 = new Board();

            board1.Name.Value = "Board 1";
            workingProject.AddElement(board1);
            var token1 = new Token();

            token1.Name.Value = "Token 1";
            workingProject.AddElement(token1);
            var board2 = new Board();

            board2.Name.Value = "Board 2";
            workingProject.AddElement(board2);
            var token2 = new Token();

            token2.Name.Value = "Token 2";
            workingProject.AddElement(token2);
            var card2 = new Card();

            card2.Name.Value = "Card 2";
            workingProject.AddElement(card2);
            var tile2 = new Tile();

            tile2.Name.Value = "Tile 2";
            workingProject.AddElement(tile2);
        }
Esempio n. 8
0
 public ProjectEditor(WorkingProject project)
 {
     workingProject = project;
 }
 private void load(ProjectEditor editor, WorkingProject project)
 {
     BindToList(project.ProjectElements);
     ButtonAction = () => editor.AddElement(new T(), shouldStartEditing);
 }
Esempio n. 10
0
 private void load(WorkingProject project, TileEditorOverlay teo)
 {
     tileEditorOverlay = teo;
     BindToList(project.ProjectElements);
 }
Esempio n. 11
0
 private void createProject()
 {
     openProject(WorkingProject.Parse(null, store, textures, api));
 }
Esempio n. 12
0
 private void openProject(WorkingProject project)
 {
     LoadComponentAsync(new ProjectEditor(project), this.Push);
 }
 private void load(WorkingProject project)
 {
     BindToList(project.ProjectElements);
 }
 private void load(ImagePickerOverlay imagePicker, WorkingProject project)
 {
     Action = imagePicker.QueryProjectImage;
     Editing.BindTo(project.Image);
 }
Esempio n. 15
0
 public void Show(Action <byte[]> onSelection)
 {
     selectionAction = onSelection;
     project         = null;
     base.Show();
 }
Esempio n. 16
0
 public void Show(WorkingProject importProject)
 {
     project         = importProject;
     selectionAction = null;
     base.Show();
 }