mirror of
https://github.com/ppy/osu
synced 2024-12-13 10:28:17 +00:00
b230b5cfb9
Since the DropDownMenu in the framework has changed it was necessary to update the GetDropDownItems override of OsuDropDownMenu to accomodate the new structure of the framework.
47 lines
1.6 KiB
C#
47 lines
1.6 KiB
C#
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using osu.Framework.Graphics.Transformations;
|
|
using osu.Framework.Graphics.UserInterface;
|
|
using OpenTK;
|
|
using OpenTK.Graphics;
|
|
|
|
namespace osu.Game.Graphics.UserInterface
|
|
{
|
|
public class OsuDropDownMenu<U> : DropDownMenu<U>
|
|
{
|
|
protected override DropDownHeader CreateHeader() => new OsuDropDownHeader();
|
|
|
|
protected override IEnumerable<DropDownMenuItem<U>> GetDropDownItems(IEnumerable<KeyValuePair<string, U>> values)
|
|
=> values.Select(v => new OsuDropDownMenuItem<U>(v.Key, v.Value));
|
|
|
|
public OsuDropDownMenu()
|
|
{
|
|
ContentContainer.CornerRadius = 4;
|
|
ContentBackground.Colour = Color4.Black.Opacity(0.5f);
|
|
}
|
|
|
|
protected override void AnimateOpen()
|
|
{
|
|
ContentContainer.FadeIn(300, EasingTypes.OutQuint);
|
|
}
|
|
|
|
protected override void AnimateClose()
|
|
{
|
|
ContentContainer.FadeOut(300, EasingTypes.OutQuint);
|
|
}
|
|
|
|
protected override void UpdateContentHeight()
|
|
{
|
|
if (State == DropDownMenuState.Opened)
|
|
ContentContainer.ResizeTo(new Vector2(1, ContentHeight), 300, EasingTypes.OutQuint);
|
|
else
|
|
ContentContainer.ResizeTo(new Vector2(1, 0), 300, EasingTypes.OutQuint);
|
|
}
|
|
}
|
|
} |