mirror of
https://github.com/ppy/osu.git
synced 2025-01-16 00:03:22 +08:00
Merge branch 'master' into display-accuracy
This commit is contained in:
commit
7eec8df2f3
@ -14,7 +14,7 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
{
|
{
|
||||||
public class ChangelogHeader : BreadcrumbControlOverlayHeader
|
public class ChangelogHeader : BreadcrumbControlOverlayHeader
|
||||||
{
|
{
|
||||||
public readonly Bindable<APIChangelogBuild> Current = new Bindable<APIChangelogBuild>();
|
public readonly Bindable<APIChangelogBuild> Build = new Bindable<APIChangelogBuild>();
|
||||||
|
|
||||||
public Action ListingSelected;
|
public Action ListingSelected;
|
||||||
|
|
||||||
@ -25,18 +25,18 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
public ChangelogHeader()
|
public ChangelogHeader()
|
||||||
{
|
{
|
||||||
TabControl.AddItem(listing_string);
|
TabControl.AddItem(listing_string);
|
||||||
TabControl.Current.ValueChanged += e =>
|
Current.ValueChanged += e =>
|
||||||
{
|
{
|
||||||
if (e.NewValue == listing_string)
|
if (e.NewValue == listing_string)
|
||||||
ListingSelected?.Invoke();
|
ListingSelected?.Invoke();
|
||||||
};
|
};
|
||||||
|
|
||||||
Current.ValueChanged += showBuild;
|
Build.ValueChanged += showBuild;
|
||||||
|
|
||||||
Streams.Current.ValueChanged += e =>
|
Streams.Current.ValueChanged += e =>
|
||||||
{
|
{
|
||||||
if (e.NewValue?.LatestBuild != null && !e.NewValue.Equals(Current.Value?.UpdateStream))
|
if (e.NewValue?.LatestBuild != null && !e.NewValue.Equals(Build.Value?.UpdateStream))
|
||||||
Current.Value = e.NewValue.LatestBuild;
|
Build.Value = e.NewValue.LatestBuild;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
if (e.NewValue != null)
|
if (e.NewValue != null)
|
||||||
{
|
{
|
||||||
TabControl.AddItem(e.NewValue.ToString());
|
TabControl.AddItem(e.NewValue.ToString());
|
||||||
TabControl.Current.Value = e.NewValue.ToString();
|
Current.Value = e.NewValue.ToString();
|
||||||
|
|
||||||
updateCurrentStream();
|
updateCurrentStream();
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TabControl.Current.Value = listing_string;
|
Current.Value = listing_string;
|
||||||
Streams.Current.Value = null;
|
Streams.Current.Value = null;
|
||||||
title.Version = null;
|
title.Version = null;
|
||||||
}
|
}
|
||||||
@ -86,10 +86,10 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
|
|
||||||
private void updateCurrentStream()
|
private void updateCurrentStream()
|
||||||
{
|
{
|
||||||
if (Current.Value == null)
|
if (Build.Value == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Streams.Current.Value = Streams.Items.FirstOrDefault(s => s.Name == Current.Value.UpdateStream.Name);
|
Streams.Current.Value = Streams.Items.FirstOrDefault(s => s.Name == Build.Value.UpdateStream.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ChangelogHeaderTitle : ScreenTitle
|
private class ChangelogHeaderTitle : ScreenTitle
|
||||||
|
@ -78,7 +78,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
sampleBack = audio.Samples.Get(@"UI/generic-select-soft");
|
sampleBack = audio.Samples.Get(@"UI/generic-select-soft");
|
||||||
|
|
||||||
Header.Current.BindTo(Current);
|
Header.Build.BindTo(Current);
|
||||||
|
|
||||||
Current.BindValueChanged(e =>
|
Current.BindValueChanged(e =>
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Overlays.News
|
|||||||
|
|
||||||
private NewsHeaderTitle title;
|
private NewsHeaderTitle title;
|
||||||
|
|
||||||
public readonly Bindable<string> Current = new Bindable<string>(null);
|
public readonly Bindable<string> Post = new Bindable<string>(null);
|
||||||
|
|
||||||
public Action ShowFrontPage;
|
public Action ShowFrontPage;
|
||||||
|
|
||||||
@ -22,13 +22,13 @@ namespace osu.Game.Overlays.News
|
|||||||
{
|
{
|
||||||
TabControl.AddItem(front_page_string);
|
TabControl.AddItem(front_page_string);
|
||||||
|
|
||||||
TabControl.Current.ValueChanged += e =>
|
Current.ValueChanged += e =>
|
||||||
{
|
{
|
||||||
if (e.NewValue == front_page_string)
|
if (e.NewValue == front_page_string)
|
||||||
ShowFrontPage?.Invoke();
|
ShowFrontPage?.Invoke();
|
||||||
};
|
};
|
||||||
|
|
||||||
Current.ValueChanged += showPost;
|
Post.ValueChanged += showPost;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showPost(ValueChangedEvent<string> e)
|
private void showPost(ValueChangedEvent<string> e)
|
||||||
@ -39,13 +39,13 @@ namespace osu.Game.Overlays.News
|
|||||||
if (e.NewValue != null)
|
if (e.NewValue != null)
|
||||||
{
|
{
|
||||||
TabControl.AddItem(e.NewValue);
|
TabControl.AddItem(e.NewValue);
|
||||||
TabControl.Current.Value = e.NewValue;
|
Current.Value = e.NewValue;
|
||||||
|
|
||||||
title.IsReadingPost = true;
|
title.IsReadingPost = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TabControl.Current.Value = front_page_string;
|
Current.Value = front_page_string;
|
||||||
title.IsReadingPost = false;
|
title.IsReadingPost = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ namespace osu.Game.Overlays
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
header.Current.BindTo(Current);
|
header.Post.BindTo(Current);
|
||||||
Current.TriggerChange();
|
Current.TriggerChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -17,10 +18,18 @@ namespace osu.Game.Overlays
|
|||||||
/// An overlay header which contains a <see cref="OsuTabControl{T}"/>.
|
/// An overlay header which contains a <see cref="OsuTabControl{T}"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The type of item to be represented by tabs.</typeparam>
|
/// <typeparam name="T">The type of item to be represented by tabs.</typeparam>
|
||||||
public abstract class TabControlOverlayHeader<T> : OverlayHeader
|
public abstract class TabControlOverlayHeader<T> : OverlayHeader, IHasCurrentValue<T>
|
||||||
{
|
{
|
||||||
protected OsuTabControl<T> TabControl;
|
protected OsuTabControl<T> TabControl;
|
||||||
|
|
||||||
|
private readonly BindableWithCurrent<T> current = new BindableWithCurrent<T>();
|
||||||
|
|
||||||
|
public Bindable<T> Current
|
||||||
|
{
|
||||||
|
get => current.Current;
|
||||||
|
set => current.Current = value;
|
||||||
|
}
|
||||||
|
|
||||||
private readonly Box controlBackground;
|
private readonly Box controlBackground;
|
||||||
|
|
||||||
protected TabControlOverlayHeader()
|
protected TabControlOverlayHeader()
|
||||||
@ -35,7 +44,11 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
TabControl = CreateTabControl().With(control => control.Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN })
|
TabControl = CreateTabControl().With(control =>
|
||||||
|
{
|
||||||
|
control.Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN };
|
||||||
|
control.Current = current;
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user