mirror of
https://github.com/osukey/osukey.git
synced 2025-06-19 10:17:56 +09:00
Remove NewsPostDrawableDate
This commit is contained in:
parent
cddd4f0a97
commit
a72a48624d
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
|
||||||
@ -44,41 +45,51 @@ namespace osu.Game.Overlays.Dashboard.Home.News
|
|||||||
|
|
||||||
protected override Drawable CreateContent(APINewsPost post) => new NewsTitleLink(post);
|
protected override Drawable CreateContent(APINewsPost post) => new NewsTitleLink(post);
|
||||||
|
|
||||||
protected override NewsPostDrawableDate CreateDate(DateTimeOffset date) => new Date(date);
|
protected override Drawable CreateDate(DateTimeOffset date) => new Date(date);
|
||||||
|
}
|
||||||
|
|
||||||
private class Date : NewsPostDrawableDate
|
private class Date : CompositeDrawable, IHasCustomTooltip
|
||||||
|
{
|
||||||
|
public ITooltip GetCustomTooltip() => new DateTooltip();
|
||||||
|
|
||||||
|
public object TooltipContent => date;
|
||||||
|
|
||||||
|
private readonly DateTimeOffset date;
|
||||||
|
|
||||||
|
public Date(DateTimeOffset date)
|
||||||
{
|
{
|
||||||
public Date(DateTimeOffset date)
|
this.date = date;
|
||||||
: base(date)
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OverlayColourProvider colourProvider)
|
||||||
|
{
|
||||||
|
TextFlowContainer textFlow;
|
||||||
|
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
Anchor = Anchor.TopRight;
|
||||||
|
Origin = Anchor.TopRight;
|
||||||
|
InternalChild = textFlow = new TextFlowContainer(t =>
|
||||||
{
|
{
|
||||||
}
|
t.Colour = colourProvider.Light1;
|
||||||
|
})
|
||||||
protected override Drawable CreateDate(DateTimeOffset date, OverlayColourProvider colourProvider)
|
|
||||||
{
|
{
|
||||||
var drawableDate = new TextFlowContainer(t =>
|
Anchor = Anchor.TopRight,
|
||||||
{
|
Origin = Anchor.TopRight,
|
||||||
t.Colour = colourProvider.Light1;
|
AutoSizeAxes = Axes.Both,
|
||||||
})
|
Direction = FillDirection.Horizontal,
|
||||||
{
|
Margin = new MarginPadding { Vertical = 5 }
|
||||||
Anchor = Anchor.TopRight,
|
};
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Horizontal,
|
|
||||||
Margin = new MarginPadding { Vertical = 5 }
|
|
||||||
};
|
|
||||||
|
|
||||||
drawableDate.AddText($"{date:dd} ", t =>
|
textFlow.AddText($"{date:dd}", t =>
|
||||||
{
|
{
|
||||||
t.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold);
|
t.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold);
|
||||||
});
|
});
|
||||||
|
|
||||||
drawableDate.AddText($"{date:MMM}", t =>
|
textFlow.AddText($"{date: MMM}", t =>
|
||||||
{
|
{
|
||||||
t.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Regular);
|
t.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Regular);
|
||||||
});
|
});
|
||||||
|
|
||||||
return drawableDate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using System;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -84,14 +85,14 @@ namespace osu.Game.Overlays.Dashboard.Home.News
|
|||||||
|
|
||||||
private class Footer : HomeNewsPanelFooter
|
private class Footer : HomeNewsPanelFooter
|
||||||
{
|
{
|
||||||
protected override float BarPading => 10;
|
protected override float BarPadding => 10;
|
||||||
|
|
||||||
public Footer(APINewsPost post)
|
public Footer(APINewsPost post)
|
||||||
: base(post)
|
: base(post)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override NewsPostDrawableDate CreateDate(DateTimeOffset date) => new Date(date);
|
protected override Drawable CreateDate(DateTimeOffset date) => new Date(date);
|
||||||
|
|
||||||
protected override Drawable CreateContent(APINewsPost post) => new FillFlowContainer
|
protected override Drawable CreateContent(APINewsPost post) => new FillFlowContainer
|
||||||
{
|
{
|
||||||
@ -114,16 +115,29 @@ namespace osu.Game.Overlays.Dashboard.Home.News
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private class Date : NewsPostDrawableDate
|
private class Date : CompositeDrawable, IHasCustomTooltip
|
||||||
|
{
|
||||||
|
public ITooltip GetCustomTooltip() => new DateTooltip();
|
||||||
|
|
||||||
|
public object TooltipContent => date;
|
||||||
|
|
||||||
|
private readonly DateTimeOffset date;
|
||||||
|
|
||||||
|
public Date(DateTimeOffset date)
|
||||||
{
|
{
|
||||||
public Date(DateTimeOffset date)
|
this.date = date;
|
||||||
: base(date)
|
}
|
||||||
{
|
|
||||||
Margin = new MarginPadding { Top = 10 };
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Drawable CreateDate(DateTimeOffset date, OverlayColourProvider colourProvider) => new FillFlowContainer
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OverlayColourProvider colourProvider)
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
Anchor = Anchor.TopRight;
|
||||||
|
Origin = Anchor.TopRight;
|
||||||
|
Margin = new MarginPadding { Top = 10 };
|
||||||
|
InternalChild = new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
@ -137,7 +151,7 @@ namespace osu.Game.Overlays.Dashboard.Home.News
|
|||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Font = OsuFont.GetFont(weight: FontWeight.Bold), // using Bold since there is no 800 weight alternative
|
Font = OsuFont.GetFont(weight: FontWeight.Bold), // using Bold since there is no 800 weight alternative
|
||||||
Colour = colourProvider.Light1,
|
Colour = colourProvider.Light1,
|
||||||
Text = $"{date: dd}"
|
Text = $"{date:dd}"
|
||||||
},
|
},
|
||||||
new TextFlowContainer(f =>
|
new TextFlowContainer(f =>
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Overlays.Dashboard.Home.News
|
|||||||
{
|
{
|
||||||
public abstract class HomeNewsPanelFooter : CompositeDrawable
|
public abstract class HomeNewsPanelFooter : CompositeDrawable
|
||||||
{
|
{
|
||||||
protected virtual float BarPading { get; } = 0;
|
protected virtual float BarPadding { get; } = 0;
|
||||||
|
|
||||||
private readonly APINewsPost post;
|
private readonly APINewsPost post;
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ namespace osu.Game.Overlays.Dashboard.Home.News
|
|||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Vertical = BarPading },
|
Padding = new MarginPadding { Vertical = BarPadding },
|
||||||
Child = new Box
|
Child = new Box
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
@ -72,7 +72,7 @@ namespace osu.Game.Overlays.Dashboard.Home.News
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract NewsPostDrawableDate CreateDate(DateTimeOffset date);
|
protected abstract Drawable CreateDate(DateTimeOffset date);
|
||||||
|
|
||||||
protected abstract Drawable CreateContent(APINewsPost post);
|
protected abstract Drawable CreateContent(APINewsPost post);
|
||||||
}
|
}
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Cursor;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Dashboard.Home.News
|
|
||||||
{
|
|
||||||
public abstract class NewsPostDrawableDate : CompositeDrawable, IHasCustomTooltip
|
|
||||||
{
|
|
||||||
public ITooltip GetCustomTooltip() => new DateTooltip();
|
|
||||||
|
|
||||||
public object TooltipContent => date;
|
|
||||||
|
|
||||||
private readonly DateTimeOffset date;
|
|
||||||
|
|
||||||
protected NewsPostDrawableDate(DateTimeOffset date)
|
|
||||||
{
|
|
||||||
this.date = date;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OverlayColourProvider colourProvider)
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Both;
|
|
||||||
Anchor = Anchor.TopRight;
|
|
||||||
Origin = Anchor.TopRight;
|
|
||||||
InternalChild = CreateDate(date, colourProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract Drawable CreateDate(DateTimeOffset date, OverlayColourProvider colourProvider);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user