mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:42:55 +08:00
Use float type for chat overlay height
This commit is contained in:
parent
3443a9517f
commit
de6dba9716
@ -31,7 +31,7 @@ namespace osu.Game.Configuration
|
|||||||
|
|
||||||
Set(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation);
|
Set(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation);
|
||||||
|
|
||||||
Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1);
|
Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2f, 1f);
|
||||||
|
|
||||||
// Online settings
|
// Online settings
|
||||||
Set(OsuSetting.Username, string.Empty);
|
Set(OsuSetting.Username, string.Empty);
|
||||||
|
@ -54,7 +54,7 @@ namespace osu.Game.Overlays
|
|||||||
private Box chatBackground;
|
private Box chatBackground;
|
||||||
private Box tabBackground;
|
private Box tabBackground;
|
||||||
|
|
||||||
public Bindable<double> ChatHeight { get; set; }
|
public Bindable<float> ChatHeight { get; set; }
|
||||||
|
|
||||||
private Container channelSelectionContainer;
|
private Container channelSelectionContainer;
|
||||||
protected ChannelSelectionOverlay ChannelSelectionOverlay;
|
protected ChannelSelectionOverlay ChannelSelectionOverlay;
|
||||||
@ -190,14 +190,13 @@ namespace osu.Game.Overlays
|
|||||||
ChannelSelectionOverlay.OnRequestJoin = channel => channelManager.JoinChannel(channel);
|
ChannelSelectionOverlay.OnRequestJoin = channel => channelManager.JoinChannel(channel);
|
||||||
ChannelSelectionOverlay.OnRequestLeave = channelManager.LeaveChannel;
|
ChannelSelectionOverlay.OnRequestLeave = channelManager.LeaveChannel;
|
||||||
|
|
||||||
ChatHeight = config.GetBindable<double>(OsuSetting.ChatDisplayHeight);
|
ChatHeight = config.GetBindable<float>(OsuSetting.ChatDisplayHeight);
|
||||||
ChatHeight.ValueChanged += height =>
|
ChatHeight.BindValueChanged(height =>
|
||||||
{
|
{
|
||||||
chatContainer.Height = (float)height.NewValue;
|
chatContainer.Height = height.NewValue;
|
||||||
channelSelectionContainer.Height = 1f - (float)height.NewValue;
|
channelSelectionContainer.Height = 1f - height.NewValue;
|
||||||
tabBackground.FadeTo(height.NewValue == 1 ? 1 : 0.8f, 200);
|
tabBackground.FadeTo(height.NewValue == 1f ? 1f : 0.8f, 200);
|
||||||
};
|
}, true);
|
||||||
ChatHeight.TriggerChange();
|
|
||||||
|
|
||||||
chatBackground.Colour = colours.ChatBlue;
|
chatBackground.Colour = colours.ChatBlue;
|
||||||
|
|
||||||
@ -273,7 +272,7 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private double startDragChatHeight;
|
private float startDragChatHeight;
|
||||||
private bool isDragging;
|
private bool isDragging;
|
||||||
|
|
||||||
protected override bool OnDragStart(DragStartEvent e)
|
protected override bool OnDragStart(DragStartEvent e)
|
||||||
@ -291,7 +290,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
if (isDragging)
|
if (isDragging)
|
||||||
{
|
{
|
||||||
double targetChatHeight = startDragChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y;
|
float targetChatHeight = startDragChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y;
|
||||||
|
|
||||||
// If the channel selection screen is shown, mind its minimum height
|
// If the channel selection screen is shown, mind its minimum height
|
||||||
if (ChannelSelectionOverlay.State.Value == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height)
|
if (ChannelSelectionOverlay.State.Value == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height)
|
||||||
|
Loading…
Reference in New Issue
Block a user