2019-01-24 16:43:03 +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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2019-01-03 11:04:36 +08:00
|
|
|
|
using System;
|
2017-05-21 05:29:57 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-02-12 12:04:46 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2017-05-21 05:29:57 +08:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
using osu.Game.Online.Chat;
|
2021-02-22 16:14:00 +08:00
|
|
|
|
using osuTK;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-07-10 01:42:57 +08:00
|
|
|
|
namespace osu.Game.Overlays.Chat.Selection
|
2017-05-21 05:29:57 +08:00
|
|
|
|
{
|
2017-05-21 07:22:55 +08:00
|
|
|
|
public class ChannelSection : Container, IHasFilterableChildren
|
2017-05-21 05:29:57 +08:00
|
|
|
|
{
|
2017-05-21 08:26:39 +08:00
|
|
|
|
public readonly FillFlowContainer<ChannelListItem> ChannelFlow;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-05-26 15:11:45 +08:00
|
|
|
|
public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children;
|
2019-01-03 11:04:36 +08:00
|
|
|
|
public IEnumerable<string> FilterTerms => Array.Empty<string>();
|
2019-02-28 12:31:40 +08:00
|
|
|
|
|
2017-06-01 09:39:03 +08:00
|
|
|
|
public bool MatchingFilter
|
2017-05-26 14:46:50 +08:00
|
|
|
|
{
|
2019-02-28 12:58:19 +08:00
|
|
|
|
set => this.FadeTo(value ? 1f : 0f, 100);
|
2017-05-21 07:22:55 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2019-03-28 23:29:07 +08:00
|
|
|
|
public bool FilteringActive { get; set; }
|
|
|
|
|
|
2017-05-21 05:29:57 +08:00
|
|
|
|
public IEnumerable<Channel> Channels
|
|
|
|
|
{
|
2019-02-28 12:58:19 +08:00
|
|
|
|
set => ChannelFlow.ChildrenEnumerable = value.Select(c => new ChannelListItem(c));
|
2017-05-21 05:29:57 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-05-21 05:29:57 +08:00
|
|
|
|
public ChannelSection()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-05-21 05:29:57 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2021-02-25 13:08:01 +08:00
|
|
|
|
new OsuSpriteText
|
2017-05-21 05:29:57 +08:00
|
|
|
|
{
|
2019-02-12 12:04:46 +08:00
|
|
|
|
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold),
|
2021-02-22 16:14:00 +08:00
|
|
|
|
Text = "All Channels".ToUpperInvariant()
|
2017-05-21 05:29:57 +08:00
|
|
|
|
},
|
2017-05-21 08:26:39 +08:00
|
|
|
|
ChannelFlow = new FillFlowContainer<ChannelListItem>
|
2017-05-21 05:29:57 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Margin = new MarginPadding { Top = 25 },
|
|
|
|
|
Spacing = new Vector2(0f, 5f),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|