mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Use CurrentChannel == null
to show the channel selector
This commit is contained in:
@ -6,7 +6,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@ -19,11 +18,9 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
{
|
||||
public class ChannelList : Container
|
||||
{
|
||||
public Action<Channel>? OnRequestSelect;
|
||||
public Action<Channel?>? OnRequestSelect;
|
||||
public Action<Channel>? OnRequestLeave;
|
||||
|
||||
public readonly BindableBool SelectorActive = new BindableBool();
|
||||
|
||||
private readonly Dictionary<Channel, ChannelListItem> channelMap = new Dictionary<Channel, ChannelListItem>();
|
||||
|
||||
private ChannelListItemFlow publicChannelFlow = null!;
|
||||
@ -56,7 +53,7 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
new ChannelListSelector
|
||||
{
|
||||
Margin = new MarginPadding { Bottom = 10 },
|
||||
SelectorActive = { BindTarget = SelectorActive },
|
||||
Action = () => OnRequestSelect?.Invoke(null),
|
||||
},
|
||||
privateChannelFlow = new ChannelListItemFlow("DIRECT MESSAGES"),
|
||||
},
|
||||
@ -73,7 +70,6 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
ChannelListItem item = new ChannelListItem(channel);
|
||||
item.OnRequestSelect += chan => OnRequestSelect?.Invoke(chan);
|
||||
item.OnRequestLeave += chan => OnRequestLeave?.Invoke(chan);
|
||||
item.SelectorActive.BindTarget = SelectorActive;
|
||||
|
||||
ChannelListItemFlow flow = getFlowForChannel(channel);
|
||||
channelMap.Add(channel, item);
|
||||
|
@ -31,8 +31,6 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
|
||||
public readonly BindableBool Unread = new BindableBool();
|
||||
|
||||
public readonly BindableBool SelectorActive = new BindableBool();
|
||||
|
||||
private Box hoverBox = null!;
|
||||
private Box selectBox = null!;
|
||||
private OsuSpriteText text = null!;
|
||||
@ -127,7 +125,6 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
base.LoadComplete();
|
||||
|
||||
selectedChannel.BindValueChanged(_ => updateState(), true);
|
||||
SelectorActive.BindValueChanged(_ => updateState(), true);
|
||||
Unread.BindValueChanged(_ => updateState(), true);
|
||||
}
|
||||
|
||||
@ -163,7 +160,7 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
bool selected = selectedChannel.Value == Channel && !SelectorActive.Value;
|
||||
bool selected = selectedChannel.Value == Channel;
|
||||
|
||||
if (selected)
|
||||
selectBox.FadeIn(300, Easing.OutQuint);
|
||||
|
@ -12,17 +12,19 @@ using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.Chat;
|
||||
|
||||
namespace osu.Game.Overlays.Chat.ChannelList
|
||||
{
|
||||
public class ChannelListSelector : OsuClickableContainer
|
||||
{
|
||||
public readonly BindableBool SelectorActive = new BindableBool();
|
||||
|
||||
private Box hoverBox = null!;
|
||||
private Box selectBox = null!;
|
||||
private OsuSpriteText text = null!;
|
||||
|
||||
[Resolved]
|
||||
private Bindable<Channel> currentChannel { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||
|
||||
@ -69,9 +71,9 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
SelectorActive.BindValueChanged(selector =>
|
||||
currentChannel.BindValueChanged(channel =>
|
||||
{
|
||||
if (selector.NewValue)
|
||||
if (channel.NewValue == null)
|
||||
{
|
||||
text.FadeColour(colourProvider.Content1, 300, Easing.OutQuint);
|
||||
selectBox.FadeIn(300, Easing.OutQuint);
|
||||
@ -82,8 +84,6 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
selectBox.FadeOut(200, Easing.OutQuint);
|
||||
}
|
||||
}, true);
|
||||
|
||||
Action = () => SelectorActive.Value = true;
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
|
Reference in New Issue
Block a user