Exemple #1
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="view"></param>
        /// <param name="container"></param>
        public CurrentlySearchingInterface(DownloadScreenView view, DownloadScrollContainer container)
        {
            View             = view;
            Size             = new ScalableVector2(container.Width - 4, 100);
            Tint             = Color.Black;
            Alpha            = 0.85f;
            SetChildrenAlpha = false;

            Icon = new Sprite
            {
                Parent    = this,
                Alignment = Alignment.TopLeft,
                Image     = FontAwesome.Get(FontAwesomeIcon.fa_magnifying_glass),
                Size      = new ScalableVector2(18, 18),
                Y         = 18,
            };

            Header = new SpriteText(Fonts.Exo2SemiBold, "Searching For Mapsets...", 14)
            {
                Parent    = Icon,
                Alignment = Alignment.MidLeft,
                X         = Icon.Width + 10
            };

            Icon.X = Width / 2f - Header.Width / 2f - 10 - Icon.Width / 2f;

            CreateLoadingWheel();
            View.SearchBox.IsSearching.ValueChanged += OnIsSearchingValueChanged;
        }
Exemple #2
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        public DownloadableMapset(DownloadScrollContainer container, JToken mapset)
        {
            Container = container;
            Mapset    = mapset;
            MapsetId  = (int)Mapset["id"];

            Size  = new ScalableVector2(container.Width - 2, HEIGHT);
            Image = UserInterface.DownloadItem;

            Banner = new Sprite
            {
                Parent    = this,
                X         = 0,
                Size      = new ScalableVector2(900 / 3.6f, Height),
                Alignment = Alignment.MidLeft,
                Alpha     = 0
            };

            AlreadyOwned = new SpriteTextBitmap(FontsBitmap.GothamRegular, "Already Owned")
            {
                Parent    = Banner,
                Alignment = Alignment.MidCenter,
                UsePreviousSpriteBatchOptions = true,
                FontSize = 14
            };

            // Check if the mapset is already owned.
            var set = MapDatabaseCache.FindSet(MapsetId);

            IsAlreadyOwned     = set != null;
            AlreadyOwned.Alpha = IsAlreadyOwned ? 1 : 0;

            Title = new SpriteTextBitmap(FontsBitmap.GothamRegular, $"{Mapset["title"]}")
            {
                Parent   = this,
                X        = Banner.X + Banner.Width + 15,
                Y        = 10,
                Alpha    = IsAlreadyOwned ? 0.65f : 1,
                FontSize = 16
            };

            Artist = new SpriteTextBitmap(FontsBitmap.GothamRegular, $"{Mapset["artist"]}")
            {
                Parent   = this,
                X        = Title.X,
                Y        = Title.Y + Title.Height + 5,
                Alpha    = IsAlreadyOwned ? 0.65f : 1,
                FontSize = 14
            };

            var gameModes = Mapset["game_modes"].ToList();
            var modes     = new List <string>();

            if (gameModes.Contains(1))
            {
                modes.Add("4K");
            }

            if (gameModes.Contains(2))
            {
                modes.Add("7K");
            }

            Modes = new SpriteTextBitmap(FontsBitmap.GothamRegular, string.Join(" & ", modes) + " | ")
            {
                Parent   = this,
                X        = Artist.X,
                Y        = Artist.Y + Artist.Height + 5,
                Alpha    = IsAlreadyOwned ? 0.65f : 1,
                FontSize = 14
            };

            Creator = new SpriteTextBitmap(FontsBitmap.GothamRegular, $"Created By: {Mapset["creator_username"]}")
            {
                Parent    = this,
                Alignment = Alignment.BotRight,
                Position  = new ScalableVector2(-10, -5),
                Alpha     = IsAlreadyOwned ? 0.65f : 1,
                FontSize  = 14
            };

            var lowestDiff  = Mapset["difficulty_range"].ToList().Min();
            var highestDiff = Mapset["difficulty_range"].ToList().Max();

            // ReSharper disable once ObjectCreationAsStatement
            var low = new SpriteTextBitmap(FontsBitmap.GothamRegular, $"{lowestDiff:0.00}")
            {
                Parent   = this,
                X        = Modes.X + Modes.Width + 2,
                Y        = Modes.Y,
                Alpha    = IsAlreadyOwned ? 0.65f : 1,
                FontSize = 14,
                Tint     = ColorHelper.DifficultyToColor((float)lowestDiff)
            };

            if (lowestDiff != highestDiff)
            {
                var high = new SpriteTextBitmap(FontsBitmap.GothamRegular, $" - {highestDiff:0.00}")
                {
                    Parent   = this,
                    X        = low.X + low.Width + 2,
                    Y        = Modes.Y,
                    Alpha    = IsAlreadyOwned ? 0.65f : 1,
                    FontSize = 14,
                    Tint     = ColorHelper.DifficultyToColor((float)highestDiff)
                };
            }
            var badge = new BannerRankedStatus
            {
                Parent    = this,
                Alignment = Alignment.TopRight,
                Position  = new ScalableVector2(-10, 5),
                Alpha     = IsAlreadyOwned ? 0.65f : 1,
            };

            var screen = (DownloadScreen)container.View.Screen;

            badge.UpdateMap(new Map {
                RankedStatus = screen.CurrentRankedStatus
            });
            FetchMapsetBanner();

            // ReSharper disable once ObjectCreationAsStatement
            new Sprite()
            {
                Parent    = this,
                Alignment = Alignment.BotLeft,
                Size      = new ScalableVector2(Width, 1),
                Alpha     = 0.65f
            };

            Progress = new ProgressBar(new Vector2(Width - Banner.Width, Height), 0, 100, 0, Color.Transparent, Colors.MainAccent)
            {
                Parent    = this,
                X         = Banner.X + Banner.Width,
                ActiveBar =
                {
                    UsePreviousSpriteBatchOptions = true,
                    Alpha                         = 0.60f
                },
            };

            Clicked += (sender, args) => OnClicked();
        }
Exemple #3
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        public DownloadableMapset(DownloadScrollContainer container, JToken mapset)
        {
            Container = container;
            Mapset    = mapset;
            MapsetId  = (int)Mapset["id"];

            Size  = new ScalableVector2(container.Width, HEIGHT);
            Tint  = Color.Black;
            Alpha = IsAlreadyOwned ? 0.25f : 0.45f;

            Banner = new Sprite
            {
                Parent    = this,
                X         = 0,
                Size      = new ScalableVector2(900 / 3.6f, Height),
                Alignment = Alignment.MidLeft,
                Alpha     = 0
            };

            AlreadyOwned = new SpriteText(Fonts.SourceSansProBold, "Already Owned", 13)
            {
                Parent    = Banner,
                Alignment = Alignment.MidCenter,
                UsePreviousSpriteBatchOptions = true
            };

            // Check if the mapset is already owned.
            var set = MapDatabaseCache.FindSet(MapsetId);

            IsAlreadyOwned     = set != null;
            AlreadyOwned.Alpha = IsAlreadyOwned ? 1 : 0;

            Progress = new ProgressBar(new Vector2(Width - Banner.Width, Height), 0, 100, 0, Color.Transparent, Colors.MainAccent)
            {
                Parent    = this,
                X         = Banner.X + Banner.Width,
                ActiveBar =
                {
                    UsePreviousSpriteBatchOptions = true,
                    Alpha                         = 0.60f
                },
            };

            Title = new SpriteText(Fonts.SourceSansProBold, $"{Mapset["title"]}", 13)
            {
                Parent = this,
                X      = Banner.X + Banner.Width + 15,
                Y      = 6,
                Alpha  = IsAlreadyOwned ? 0.65f : 1,
            };

            Artist = new SpriteText(Fonts.SourceSansProBold, $"{Mapset["artist"]}", 12)
            {
                Parent = this,
                X      = Title.X,
                Y      = Title.Y + Title.Height,
                Alpha  = IsAlreadyOwned ? 0.65f : 1,
            };

            var gameModes = Mapset["game_modes"].ToList();
            var modes     = new List <string>();

            if (gameModes.Contains(1))
            {
                modes.Add("4K");
            }

            if (gameModes.Contains(2))
            {
                modes.Add("7K");
            }

            Modes = new SpriteText(Fonts.SourceSansProBold, string.Join(" & ", modes), 11)
            {
                Parent = this,
                X      = Artist.X,
                Y      = Artist.Y + Artist.Height + 2,
                Alpha  = IsAlreadyOwned ? 0.65f : 1,
            };

            Creator = new SpriteText(Fonts.SourceSansProSemiBold, $"Created By: {Mapset["creator_username"]}", 11)
            {
                Parent    = this,
                Alignment = Alignment.BotRight,
                Position  = new ScalableVector2(-10, -5),
                Alpha     = IsAlreadyOwned ? 0.65f : 1,
            };

            var badge = new BannerRankedStatus
            {
                Parent    = this,
                Alignment = Alignment.TopRight,
                Position  = new ScalableVector2(-10, 5),
                Alpha     = IsAlreadyOwned ? 0.65f : 1,
            };

            var screen = (DownloadScreen)container.View.Screen;

            badge.UpdateMap(new Map {
                RankedStatus = screen.CurrentRankedStatus
            });
            FetchMapsetBanner();

            Clicked += (sender, args) => OnClicked();
        }