예제 #1
0
        internal JumpToItem(JumpTo parent, Beatmap thisMap, int index)
        {
            set     = parent;
            map     = thisMap;
            mapText = new pText(thisMap.SortTitleAuto, 20, new Vector2(0, index * ITEM_HEIGHT + 5), 2, true, Color.White);

            colourBackground = new pBox(new Vector2(0, index * ITEM_HEIGHT), new Vector2((640 * GameBase.WindowManager.WidthWidescreenRatio) - JumpTo.PADDING * 3, ITEM_HEIGHT), 1, new Color(50, 50, 50))
            {
                Alpha       = 0.01f,
                Additive    = true,
                HandleInput = true,
                ClickRequiresConfirmation = true,
            };

            colourBackground.OnHover     += colourBackground_OnHover;
            colourBackground.OnHoverLost += colourBackground_OnHoverLost;
            colourBackground.OnClick     += colourBackground_OnClick;
        }
예제 #2
0
        internal void Initialize(StreamingContext context)
        {
            string description = string.Format("{0} Chart, {1} Beatmaps", new CultureInfo("en-US", false).TextInfo.ToTitleCase(type), beatmaps.Count);

            string leader = "No leader yet!\nYou are not ranked on this chart!";
            bool   active = true;

            spriteManager.Add(new pText(name, 20, new Vector2(PADDING * 2 + HEIGHT, 0), 1, true, Color.White));
            spriteManager.Add(new pText(description, 12, new Vector2(PADDING * 2 + HEIGHT, 20), 1, true, new Color(144, 238, 254)));
            spriteManager.Add(new pText(leader, 14, new Vector2(PADDING * 2 + HEIGHT, HEIGHT), 1, true, Color.White)
            {
                Origin = Origins.BottomLeft
            });

            //chart image
            pSpriteDynamic background = new pSpriteDynamic(@"https://s.ppy.sh/a/3103765_1378920280.png", null, 0, new Vector2(PADDING, 0), 0.2f);

            background.MaxDimension = HEIGHT * 1.6f;
            spriteManager.Add(background);

            for (int i = 0; i < beatmaps.Count; i++)
            {
                const int thumb_size = 40;
                float     xPos       = PADDING * 2 + i * (thumb_size + 2);

                pSpriteDynamic b = new pSpriteDynamic(General.STATIC_WEB_ROOT_BEATMAP + @"/thumb/" + beatmaps[i].beatmapset_id + @".jpg", null, 0, new Vector2(xPos, PADDING), 0.2f);
                b.MaxDimension = thumb_size * 1.6f;
                b.Field        = Fields.TopRight;
                b.Origin       = Origins.TopRight;
                spriteManager.Add(b);

                if (!beatmaps[i].passed)
                {
                    spriteManager.Add(new pTextAwesome(FontAwesome.circle_o, 14, new Vector2(xPos + thumb_size / 2, thumb_size + 5 + PADDING))
                    {
                        InitialColour = new Color(253, 202, 55), Field = Fields.TopRight
                    });
                }
                else
                {
                    spriteManager.Add(new pTextAwesome(FontAwesome.check_circle_o, 14, new Vector2(xPos + thumb_size / 2, thumb_size + 5))
                    {
                        InitialColour = new Color(172, 219, 39), Field = Fields.TopRight
                    });
                }
            }

            //active light
            if (end_date >= DateTime.Now)
            {
                spriteManager.Add(new pBox(new Vector2(0, 0), new Vector2(10, HEIGHT), 0.1f, new Color(172, 219, 39)));
            }

            pBox colourBackground = new pBox(new Vector2(PADDING, 0), new Vector2(GameBase.WindowManager.WidthScaled - Charts.PADDING * 2, HEIGHT), 1, new Color(50, 50, 50))
            {
                Alpha       = 0.01f,
                Additive    = true,
                HandleInput = true,
                ClickRequiresConfirmation = true
            };

            colourBackground.OnClick += delegate { };
            colourBackground.OnHover += delegate
            {
                colourBackground.Alpha = 1;
                colourBackground.FadeTo(0.6f, 500, EasingTypes.In);
            };
            colourBackground.OnHoverLost += delegate
            {
                colourBackground.FadeTo(0.01f, 500, EasingTypes.In);
            };

            spriteManager.Add(colourBackground);


            //separator (move out?)
            spriteManager.Add(new pBox(new Vector2(PADDING, HEIGHT + 5), new Vector2(GameBase.WindowManager.WidthScaled - Charts.PADDING * 2, 1), 0, new Color(110, 96, 103)));
        }