示例#1
0
        private void load(TextureStore textures)
        {
            ButtonFlowContainer.Add(editButton = new IconButton(FontAwesome.Solid.Download, Colour4.SkyBlue, true, Colour4.PowderBlue));

            BottomContainer.Add(new SpriteText
            {
                Font = new FontUsage(size: SMALL_TEXT_SIZE),
                Text = @"Este proyecto está en el servidor, descargalo para editarlo!",
            });

            ImageContainer.Add(loadingIcon = new SpriteIcon
            {
                Size             = new Vector2(.7f),
                RelativeSizeAxes = Axes.Both,
                FillMode         = FillMode.Fit,
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                Icon             = FontAwesome.Solid.Spinner,
            });

            editButton.Enabled.Value = false;
            loadingIcon.RotateTo(0).Then().RotateTo(360, 1500).Loop();

            ProjectName.Text         = onlineProject.Name;
            ProjectDescription.Text  = onlineProject.Description;
            editButton.Enabled.Value = true;
            Schedule(async() =>
            {
                var texture = await textures.GetAsync(@$ "https://gamestogo.company/api/Games/DownloadFile/{onlineProject.Image}");

                Schedule(() =>
                {
                    ProjectImage.Texture = texture;
                    loadingIcon.FadeOut();
                });
            });

            editButton.Action += downloadProject;

            var userRequest = new GetUserRequest(onlineProject.Creator.ID);

            userRequest.Success += user => UsernameBox.Text = @$ "De {user.Username} (Ultima vez editado {onlineProject.DateTimeLastEdited:dd/MM/yyyy HH:mm}) Estado: {onlineProject.Status.GetDescription()}";
            api.Queue(userRequest);
        }
示例#2
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);
        }