2022-03-28 05:07:52 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using System;
|
2022-05-05 04:17:40 +08:00
|
|
|
using osu.Game.Overlays;
|
2022-05-07 04:36:08 +08:00
|
|
|
using System.Collections.Generic;
|
2022-05-15 02:16:33 +08:00
|
|
|
using System.Linq;
|
2022-05-06 22:31:59 +08:00
|
|
|
using osu.Framework.Graphics;
|
2024-07-10 16:12:52 +08:00
|
|
|
using osu.Framework.Graphics.Containers;
|
2022-05-06 22:31:59 +08:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
2022-03-28 05:07:52 +08:00
|
|
|
using osu.Game.Overlays.Mods;
|
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.OnlinePlay
|
|
|
|
{
|
2022-05-26 04:18:30 +08:00
|
|
|
public partial class FreeModSelectOverlay : ModSelectOverlay
|
2022-03-28 05:07:52 +08:00
|
|
|
{
|
2022-05-15 02:16:33 +08:00
|
|
|
protected override bool AllowCustomisation => false;
|
|
|
|
|
2022-03-28 05:07:52 +08:00
|
|
|
public new Func<Mod, bool> IsValidMod
|
|
|
|
{
|
|
|
|
get => base.IsValidMod;
|
2022-04-18 04:16:59 +08:00
|
|
|
set => base.IsValidMod = m => m.UserPlayable && value.Invoke(m);
|
2022-03-28 05:07:52 +08:00
|
|
|
}
|
|
|
|
|
2024-06-29 13:38:43 +08:00
|
|
|
private FreeModSelectFooterContent? currentFooterContent;
|
|
|
|
|
|
|
|
protected override SelectAllModsButton? SelectAllModsButton => currentFooterContent?.SelectAllModsButton;
|
|
|
|
|
2022-05-11 04:29:57 +08:00
|
|
|
public FreeModSelectOverlay()
|
2022-05-05 04:17:40 +08:00
|
|
|
: base(OverlayColourScheme.Plum)
|
2022-03-28 05:07:52 +08:00
|
|
|
{
|
|
|
|
IsValidMod = _ => true;
|
|
|
|
}
|
|
|
|
|
2022-06-21 18:49:01 +08:00
|
|
|
protected override ModColumn CreateModColumn(ModType modType) => new ModColumn(modType, true);
|
2022-05-06 22:31:59 +08:00
|
|
|
|
2024-07-10 16:12:52 +08:00
|
|
|
public override VisibilityContainer CreateFooterContent() => currentFooterContent = new FreeModSelectFooterContent(this)
|
2024-06-29 13:38:43 +08:00
|
|
|
{
|
|
|
|
Beatmap = { BindTarget = Beatmap },
|
|
|
|
ActiveMods = { BindTarget = ActiveMods },
|
|
|
|
};
|
|
|
|
|
|
|
|
private partial class FreeModSelectFooterContent : ModSelectFooterContent
|
|
|
|
{
|
|
|
|
private readonly FreeModSelectOverlay overlay;
|
|
|
|
|
|
|
|
protected override bool ShowModEffects => false;
|
|
|
|
|
|
|
|
public SelectAllModsButton? SelectAllModsButton;
|
|
|
|
|
|
|
|
public FreeModSelectFooterContent(FreeModSelectOverlay overlay)
|
|
|
|
: base(overlay)
|
|
|
|
{
|
|
|
|
this.overlay = overlay;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override IEnumerable<ShearedButton> CreateButtons()
|
|
|
|
=> base.CreateButtons()
|
|
|
|
.Prepend(SelectAllModsButton = new SelectAllModsButton(overlay)
|
|
|
|
{
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
});
|
|
|
|
}
|
2022-03-28 05:07:52 +08:00
|
|
|
}
|
|
|
|
}
|