Merge branch 'master' into fix-sliderhead-depth

This commit is contained in:
Dean Herbert 2017-09-13 16:19:37 +09:00 committed by GitHub
commit e37a354db0
4 changed files with 45 additions and 18 deletions

View File

@ -100,6 +100,11 @@ namespace osu.Game.Beatmaps
public bool Equals(BeatmapInfo other)
{
if (ID == 0 || other?.ID == 0)
// one of the two BeatmapInfos we are comparing isn't sourced from a database.
// fall back to reference equality.
return ReferenceEquals(this, other);
return ID == other?.ID;
}

View File

@ -12,8 +12,10 @@ using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Framework.MathUtils;
using osu.Framework.Threading;
using osu.Game.Configuration;
using osu.Game.Graphics;
@ -56,7 +58,7 @@ namespace osu.Game.Overlays
private readonly Box chatBackground;
private readonly Box tabBackground;
private Bindable<double> chatHeight;
public Bindable<double> ChatHeight { get; internal set; }
private readonly Container channelSelectionContainer;
private readonly ChannelSelectionOverlay channelSelection;
@ -177,18 +179,11 @@ namespace osu.Game.Overlays
if (state == Visibility.Visible)
{
textbox.HoldFocus = false;
if (1f - chatHeight.Value < channel_selection_min_height)
{
chatContainer.ResizeHeightTo(1f - channel_selection_min_height, 800, Easing.OutQuint);
channelSelectionContainer.ResizeHeightTo(channel_selection_min_height, 800, Easing.OutQuint);
channelSelection.Show();
chatHeight.Value = 1f - channel_selection_min_height;
}
if (1f - ChatHeight.Value < channel_selection_min_height)
transformChatHeightTo(1f - channel_selection_min_height, 800, Easing.OutQuint);
}
else
{
textbox.HoldFocus = true;
}
};
}
@ -202,7 +197,7 @@ namespace osu.Game.Overlays
if (!isDragging)
return base.OnDragStart(state);
startDragChatHeight = chatHeight.Value;
startDragChatHeight = ChatHeight.Value;
return true;
}
@ -212,7 +207,13 @@ namespace osu.Game.Overlays
{
Trace.Assert(state.Mouse.PositionMouseDown != null);
chatHeight.Value = startDragChatHeight - (state.Mouse.Position.Y - state.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y;
double targetChatHeight = startDragChatHeight - (state.Mouse.Position.Y - state.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y;
// If the channel selection screen is shown, mind its minimum height
if (channelSelection.State == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height)
targetChatHeight = 1f - channel_selection_min_height;
ChatHeight.Value = targetChatHeight;
}
return true;
@ -272,14 +273,14 @@ namespace osu.Game.Overlays
this.api = api;
api.Register(this);
chatHeight = config.GetBindable<double>(OsuSetting.ChatDisplayHeight);
chatHeight.ValueChanged += h =>
ChatHeight = config.GetBindable<double>(OsuSetting.ChatDisplayHeight);
ChatHeight.ValueChanged += h =>
{
chatContainer.Height = (float)h;
channelSelectionContainer.Height = 1f - (float)h;
tabBackground.FadeTo(h == 1 ? 1 : 0.8f, 200);
};
chatHeight.TriggerChange();
ChatHeight.TriggerChange();
chatBackground.Colour = colours.ChatBlue;
}
@ -501,5 +502,26 @@ namespace osu.Game.Overlays
api.Queue(req);
}
private void transformChatHeightTo(double newChatHeight, double duration = 0, Easing easing = Easing.None)
{
this.TransformTo(this.PopulateTransform(new TransformChatHeight(), newChatHeight, duration, easing));
}
private class TransformChatHeight : Transform<double, ChatOverlay>
{
private double valueAt(double time)
{
if (time < StartTime) return StartValue;
if (time >= EndTime) return EndValue;
return Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
}
public override string TargetMember => "ChatHeight.Value";
protected override void Apply(ChatOverlay d, double time) => d.ChatHeight.Value = valueAt(time);
protected override void ReadIntoStartValue(ChatOverlay d) => StartValue = d.ChatHeight.Value;
}
}
}

View File

@ -414,8 +414,8 @@ namespace osu.Game.Overlays.Profile
scoreNumberText.Add(createScoreNumberText(user.Statistics.TotalHits.ToString(@"#,0")));
scoreText.Add(createScoreText("Max Combo"));
scoreNumberText.Add(createScoreNumberText(user.Statistics.MaxCombo.ToString(@"#,0")));
scoreText.Add(createScoreText("Replay Watched by Others"));
scoreNumberText.Add(createScoreNumberText(user.Statistics.ReplayWatched.ToString(@"#,0")));
scoreText.Add(createScoreText("Replays Watched by Others"));
scoreNumberText.Add(createScoreNumberText(user.Statistics.ReplaysWatched.ToString(@"#,0")));
gradeSS.DisplayCount = user.Statistics.GradesCount.SS;
gradeSS.Show();

View File

@ -44,7 +44,7 @@ namespace osu.Game.Users
public int MaxCombo;
[JsonProperty(@"replays_watched_by_others")]
public int ReplayWatched;
public int ReplaysWatched;
[JsonProperty(@"grade_counts")]
public Grades GradesCount;