mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Revert DI usage of ChannelSelectorState
in favour of directly binding BindableBool
SelectorActive
This commit is contained in:
@ -56,6 +56,7 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
new ChannelListSelector
|
||||
{
|
||||
Margin = new MarginPadding { Bottom = 10 },
|
||||
SelectorActive = { BindTarget = SelectorActive },
|
||||
},
|
||||
privateChannelFlow = new ChannelListItemFlow("DIRECT MESSAGES"),
|
||||
},
|
||||
@ -72,6 +73,7 @@ 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);
|
||||
@ -130,10 +132,4 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum ChannelSelectorState
|
||||
{
|
||||
Visibile,
|
||||
Hidden,
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,8 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
|
||||
public readonly BindableBool Unread = new BindableBool();
|
||||
|
||||
public readonly BindableBool SelectorActive = new BindableBool();
|
||||
|
||||
private readonly Channel channel;
|
||||
|
||||
private Box hoverBox = null!;
|
||||
@ -39,9 +41,6 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
[Resolved]
|
||||
private Bindable<Channel> selectedChannel { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private Bindable<ChannelSelectorState> selectorState { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||
|
||||
@ -128,7 +127,7 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
base.LoadComplete();
|
||||
|
||||
selectedChannel.BindValueChanged(_ => updateSelectState(), true);
|
||||
selectorState.BindValueChanged(_ => updateSelectState(), true);
|
||||
SelectorActive.BindValueChanged(_ => updateSelectState(), true);
|
||||
|
||||
Unread.BindValueChanged(change =>
|
||||
{
|
||||
@ -168,7 +167,7 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
|
||||
private void updateSelectState()
|
||||
{
|
||||
if (selectedChannel.Value == channel && selectorState.Value == ChannelSelectorState.Hidden)
|
||||
if (selectedChannel.Value == channel && !SelectorActive.Value)
|
||||
selectBox.FadeIn(300, Easing.OutQuint);
|
||||
else
|
||||
selectBox.FadeOut(200, Easing.OutQuint);
|
||||
|
@ -22,9 +22,6 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
private Box hoverBox = null!;
|
||||
private Box selectBox = null!;
|
||||
|
||||
[Resolved]
|
||||
private Bindable<ChannelSelectorState> selectorState { get; set; } = null!;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
@ -68,15 +65,15 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
selectorState.BindValueChanged(selector =>
|
||||
SelectorActive.BindValueChanged(selector =>
|
||||
{
|
||||
if (selector.NewValue == ChannelSelectorState.Visibile)
|
||||
if (selector.NewValue)
|
||||
selectBox.FadeIn(300, Easing.OutQuint);
|
||||
else
|
||||
selectBox.FadeOut(200, Easing.OutQuint);
|
||||
}, true);
|
||||
|
||||
Action = () => selectorState.Value = ChannelSelectorState.Visibile;
|
||||
Action = () => SelectorActive.Value = true;
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
|
Reference in New Issue
Block a user