mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 01:23:24 +08:00
Fix styling, private tabClosed, remove type check
This commit is contained in:
parent
024d3cc10a
commit
e92c1ca009
@ -133,7 +133,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
private class TestTabControl : ChannelTabControl
|
private class TestTabControl : ChannelTabControl
|
||||||
{
|
{
|
||||||
protected override TabItem<Channel> CreateTabItem(Channel value) => new TestChannelTabItem(value) { OnRequestClose = TabCloseRequested };
|
protected override TabItem<Channel> CreateTabItem(Channel value) => new TestChannelTabItem(value);
|
||||||
|
|
||||||
public new IReadOnlyDictionary<Channel, TabItem<Channel>> TabMap => base.TabMap;
|
public new IReadOnlyDictionary<Channel, TabItem<Channel>> TabMap => base.TabMap;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,8 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
// performTabSort might've made selectorTab's position wonky, fix it
|
// performTabSort might've made selectorTab's position wonky, fix it
|
||||||
TabContainer.SetLayoutPosition(selectorTab, float.MaxValue);
|
TabContainer.SetLayoutPosition(selectorTab, float.MaxValue);
|
||||||
|
|
||||||
|
((ChannelTabItem)item).OnRequestClose += tabCloseRequested;
|
||||||
|
|
||||||
base.AddTabItem(item, addToDropdown);
|
base.AddTabItem(item, addToDropdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,10 +59,10 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
switch (value.Type)
|
switch (value.Type)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return new ChannelTabItem(value) { OnRequestClose = TabCloseRequested };
|
return new ChannelTabItem(value);
|
||||||
|
|
||||||
case ChannelType.PM:
|
case ChannelType.PM:
|
||||||
return new PrivateChannelTabItem(value) { OnRequestClose = TabCloseRequested };
|
return new PrivateChannelTabItem(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +105,7 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
selectorTab.Active.Value = false;
|
selectorTab.Active.Value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void TabCloseRequested(TabItem<Channel> tab)
|
private void tabCloseRequested(TabItem<Channel> tab)
|
||||||
{
|
{
|
||||||
int totalTabs = TabContainer.Count - 1; // account for selectorTab
|
int totalTabs = TabContainer.Count - 1; // account for selectorTab
|
||||||
int currentIndex = MathHelper.Clamp(TabContainer.IndexOf(tab), 1, totalTabs);
|
int currentIndex = MathHelper.Clamp(TabContainer.IndexOf(tab), 1, totalTabs);
|
||||||
|
@ -158,13 +158,12 @@ namespace osu.Game.Overlays
|
|||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
},
|
},
|
||||||
ChannelTabControl = CreateChannelTabControl().With(d =>
|
ChannelTabControl = CreateChannelTabControl().With(d =>
|
||||||
{
|
{
|
||||||
d.Anchor = Anchor.BottomLeft;
|
d.Anchor = Anchor.BottomLeft;
|
||||||
d.Origin = Anchor.BottomLeft;
|
d.Origin = Anchor.BottomLeft;
|
||||||
d.RelativeSizeAxes = Axes.Both;
|
d.RelativeSizeAxes = Axes.Both;
|
||||||
d.OnRequestLeave = channelManager.LeaveChannel;
|
d.OnRequestLeave = channelManager.LeaveChannel;
|
||||||
}
|
}),
|
||||||
),
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user