// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.Collections.Generic; using System.Linq; using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Bindings; using osu.Framework.Threading; using osu.Game.Graphics; using osu.Game.Input.Bindings; using osu.Game.Overlays; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; namespace osu.Game.Screens.Menu { public class ButtonSystem : Container, IStateful, IKeyBindingHandler { public event Action StateChanged; public Action OnEdit; public Action OnExit; public Action OnDirect; public Action OnSolo; public Action OnSettings; public Action OnMulti; public Action OnChart; public Action OnTest; private readonly FlowContainerWithOrigin buttonFlow; //todo: make these non-internal somehow. public const float BUTTON_AREA_HEIGHT = 100; public const float BUTTON_WIDTH = 140f; public const float WEDGE_WIDTH = 20; private OsuLogo logo; public void SetOsuLogo(OsuLogo logo) { this.logo = logo; if (this.logo != null) { this.logo.Action = onOsuLogo; // osuLogo.SizeForFlow relies on loading to be complete. buttonFlow.Position = new Vector2(WEDGE_WIDTH * 2 - (BUTTON_WIDTH + this.logo.SizeForFlow / 4), 0); updateLogoState(); } } private readonly Drawable iconFacade; private readonly Container buttonArea; private readonly Box buttonAreaBackground; private readonly Button backButton; private readonly Button settingsButton; private readonly List