2017-03-25 06:02:24 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-03-26 06:33:03 +08:00
|
|
|
|
using OpenTK;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
using osu.Framework.Allocation;
|
2017-03-25 06:02:24 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2017-03-26 06:33:03 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2017-03-25 06:02:24 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2017-04-02 00:12:44 +08:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2017-04-04 01:28:05 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2017-03-26 06:33:03 +08:00
|
|
|
|
using System.Linq;
|
2017-04-24 18:17:11 +08:00
|
|
|
|
using osu.Game.Online.API;
|
|
|
|
|
using osu.Game.Online.API.Requests;
|
|
|
|
|
using osu.Framework.Threading;
|
2017-06-20 13:54:23 +08:00
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2017-09-08 01:53:53 +08:00
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
|
using osu.Game.Screens.Select.Details;
|
2017-07-26 12:22:46 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
2017-03-25 06:02:24 +08:00
|
|
|
|
|
2017-04-04 01:28:05 +08:00
|
|
|
|
namespace osu.Game.Screens.Select
|
2017-03-25 06:02:24 +08:00
|
|
|
|
{
|
2017-03-30 23:32:18 +08:00
|
|
|
|
public class BeatmapDetails : Container
|
2017-03-25 06:02:24 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
private const float spacing = 10;
|
|
|
|
|
private const float transition_duration = 250;
|
|
|
|
|
|
|
|
|
|
private readonly FillFlowContainer top, statsFlow;
|
|
|
|
|
private readonly AdvancedStats advanced;
|
|
|
|
|
private readonly DetailBox ratingsContainer;
|
|
|
|
|
private readonly UserRatings ratings;
|
|
|
|
|
private readonly ScrollContainer metadataScroll;
|
|
|
|
|
private readonly MetadataSection description, source, tags;
|
|
|
|
|
private readonly Container failRetryContainer;
|
|
|
|
|
private readonly FailRetryGraph failRetryGraph;
|
|
|
|
|
private readonly DimmedLoadingAnimation loading;
|
|
|
|
|
|
|
|
|
|
private APIAccess api;
|
2017-03-29 02:18:56 +08:00
|
|
|
|
|
2017-04-24 18:17:11 +08:00
|
|
|
|
private ScheduledDelegate pendingBeatmapSwitch;
|
2017-09-08 02:09:50 +08:00
|
|
|
|
|
2017-03-26 06:33:03 +08:00
|
|
|
|
private BeatmapInfo beatmap;
|
|
|
|
|
public BeatmapInfo Beatmap
|
2017-03-25 06:02:24 +08:00
|
|
|
|
{
|
2017-06-07 22:00:14 +08:00
|
|
|
|
get { return beatmap; }
|
2017-03-25 06:02:24 +08:00
|
|
|
|
set
|
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
if (value == beatmap) return;
|
2017-03-26 06:33:03 +08:00
|
|
|
|
beatmap = value;
|
2017-04-08 01:27:14 +08:00
|
|
|
|
|
2017-04-24 18:17:11 +08:00
|
|
|
|
pendingBeatmapSwitch?.Cancel();
|
2017-09-08 01:53:53 +08:00
|
|
|
|
pendingBeatmapSwitch = Schedule(updateStatistics);
|
2017-04-24 18:17:11 +08:00
|
|
|
|
}
|
2017-03-29 02:18:56 +08:00
|
|
|
|
}
|
2017-03-28 23:12:54 +08:00
|
|
|
|
|
2017-03-30 23:32:18 +08:00
|
|
|
|
public BeatmapDetails()
|
2017-03-25 06:02:24 +08:00
|
|
|
|
{
|
2017-03-26 06:33:03 +08:00
|
|
|
|
Children = new Drawable[]
|
2017-03-25 06:02:24 +08:00
|
|
|
|
{
|
2017-03-26 06:33:03 +08:00
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-09-08 01:53:53 +08:00
|
|
|
|
Colour = Color4.Black.Opacity(0.5f),
|
2017-03-26 06:33:03 +08:00
|
|
|
|
},
|
2017-09-08 01:53:53 +08:00
|
|
|
|
new Container
|
2017-03-25 06:02:24 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding { Horizontal = spacing },
|
2017-03-30 23:32:18 +08:00
|
|
|
|
Children = new Drawable[]
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
top = new FillFlowContainer
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2017-09-08 01:53:53 +08:00
|
|
|
|
Direction = FillDirection.Horizontal,
|
2017-03-28 23:12:54 +08:00
|
|
|
|
Children = new Drawable[]
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
statsFlow = new FillFlowContainer
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2017-09-08 01:53:53 +08:00
|
|
|
|
Width = 0.5f,
|
|
|
|
|
Spacing = new Vector2(spacing),
|
|
|
|
|
Padding = new MarginPadding { Right = spacing / 2 },
|
2017-06-07 19:53:37 +08:00
|
|
|
|
Children = new[]
|
2017-03-28 23:12:54 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
new DetailBox
|
|
|
|
|
{
|
|
|
|
|
Child = advanced = new AdvancedStats
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Padding = new MarginPadding { Horizontal = spacing, Top = spacing * 2, Bottom = spacing },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
ratingsContainer = new DetailBox
|
|
|
|
|
{
|
|
|
|
|
Child = ratings = new UserRatings
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 134,
|
|
|
|
|
Padding = new MarginPadding { Horizontal = spacing, Top = spacing },
|
|
|
|
|
},
|
|
|
|
|
},
|
2017-03-28 23:12:54 +08:00
|
|
|
|
},
|
2017-03-26 06:33:03 +08:00
|
|
|
|
},
|
2017-09-08 01:53:53 +08:00
|
|
|
|
metadataScroll = new ScrollContainer
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2017-09-08 01:53:53 +08:00
|
|
|
|
Width = 0.5f,
|
|
|
|
|
ScrollbarVisible = false,
|
|
|
|
|
Padding = new MarginPadding { Left = spacing / 2 },
|
|
|
|
|
Child = new FillFlowContainer
|
2017-04-12 16:52:24 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
LayoutDuration = transition_duration,
|
|
|
|
|
Spacing = new Vector2(spacing * 2),
|
|
|
|
|
Margin = new MarginPadding { Top = spacing * 2 },
|
|
|
|
|
Children = new[]
|
2017-03-28 23:12:54 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
description = new MetadataSection("Description")
|
2017-03-28 23:12:54 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
TextColour = Color4.White.Opacity(0.75f),
|
2017-03-28 23:12:54 +08:00
|
|
|
|
},
|
2017-09-08 01:53:53 +08:00
|
|
|
|
source = new MetadataSection("Source")
|
|
|
|
|
{
|
|
|
|
|
TextColour = Color4.White.Opacity(0.75f),
|
|
|
|
|
},
|
|
|
|
|
tags = new MetadataSection("Tags"),
|
2017-03-29 02:18:56 +08:00
|
|
|
|
},
|
2017-03-28 23:12:54 +08:00
|
|
|
|
},
|
2017-03-26 06:33:03 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2017-09-08 01:53:53 +08:00
|
|
|
|
failRetryContainer = new Container
|
2017-03-30 23:32:18 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
2017-03-30 23:32:18 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2017-04-08 02:19:03 +08:00
|
|
|
|
Children = new Drawable[]
|
2017-03-30 23:32:18 +08:00
|
|
|
|
{
|
2017-04-08 02:19:03 +08:00
|
|
|
|
new OsuSpriteText
|
2017-03-30 23:32:18 +08:00
|
|
|
|
{
|
2017-04-08 02:19:03 +08:00
|
|
|
|
Text = "Points of Failure",
|
2017-09-08 01:53:53 +08:00
|
|
|
|
Font = @"Exo2.0-Bold",
|
|
|
|
|
TextSize = 14,
|
2017-03-30 23:32:18 +08:00
|
|
|
|
},
|
2017-09-08 01:53:53 +08:00
|
|
|
|
failRetryGraph = new FailRetryGraph
|
2017-03-30 23:32:18 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding { Top = 14 + spacing / 2 },
|
2017-03-30 23:32:18 +08:00
|
|
|
|
},
|
2017-09-08 01:53:53 +08:00
|
|
|
|
},
|
2017-03-29 02:18:56 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
2017-06-12 15:40:53 +08:00
|
|
|
|
},
|
2017-09-08 01:53:53 +08:00
|
|
|
|
loading = new DimmedLoadingAnimation
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
2017-03-25 06:02:24 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2017-09-08 01:53:53 +08:00
|
|
|
|
private void load(OsuColour colours, APIAccess api)
|
2017-03-25 06:02:24 +08:00
|
|
|
|
{
|
2017-04-24 18:17:11 +08:00
|
|
|
|
this.api = api;
|
2017-09-08 01:53:53 +08:00
|
|
|
|
tags.TextColour = colours.Yellow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void UpdateAfterChildren()
|
|
|
|
|
{
|
|
|
|
|
base.UpdateAfterChildren();
|
|
|
|
|
|
|
|
|
|
metadataScroll.Height = statsFlow.DrawHeight;
|
|
|
|
|
failRetryContainer.Height = DrawHeight - Padding.TotalVertical - (top.DrawHeight + spacing / 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateStatistics()
|
|
|
|
|
{
|
|
|
|
|
if (Beatmap == null)
|
|
|
|
|
{
|
|
|
|
|
clearStats();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-04-24 18:17:11 +08:00
|
|
|
|
|
2017-09-08 01:53:53 +08:00
|
|
|
|
ratingsContainer.FadeIn(transition_duration);
|
|
|
|
|
advanced.Beatmap = Beatmap;
|
2017-11-27 15:48:12 +08:00
|
|
|
|
description.Text = Beatmap.Version;
|
|
|
|
|
source.Text = Beatmap.Metadata.Source;
|
|
|
|
|
tags.Text = Beatmap.Metadata.Tags;
|
2017-09-08 01:53:53 +08:00
|
|
|
|
|
|
|
|
|
var requestedBeatmap = Beatmap;
|
|
|
|
|
if (requestedBeatmap.Metrics == null)
|
|
|
|
|
{
|
|
|
|
|
var lookup = new GetBeatmapDetailsRequest(requestedBeatmap);
|
|
|
|
|
lookup.Success += res =>
|
|
|
|
|
{
|
|
|
|
|
if (beatmap != requestedBeatmap)
|
|
|
|
|
//the beatmap has been changed since we started the lookup.
|
|
|
|
|
return;
|
2017-03-28 23:12:54 +08:00
|
|
|
|
|
2017-09-08 01:53:53 +08:00
|
|
|
|
requestedBeatmap.Metrics = res;
|
|
|
|
|
Schedule(() => displayMetrics(res));
|
|
|
|
|
};
|
|
|
|
|
lookup.Failure += e => Schedule(() => displayMetrics(null));
|
2017-03-28 23:12:54 +08:00
|
|
|
|
|
2017-09-08 01:53:53 +08:00
|
|
|
|
api.Queue(lookup);
|
|
|
|
|
loading.Show();
|
|
|
|
|
}
|
2017-03-30 23:32:18 +08:00
|
|
|
|
|
2017-09-08 01:53:53 +08:00
|
|
|
|
displayMetrics(requestedBeatmap.Metrics, false);
|
2017-03-26 06:33:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-09-08 01:53:53 +08:00
|
|
|
|
private void displayMetrics(BeatmapMetrics metrics, bool failOnMissing = true)
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-09-09 01:15:28 +08:00
|
|
|
|
var hasRatings = metrics?.Ratings?.Any() ?? false;
|
2017-09-09 01:25:41 +08:00
|
|
|
|
var hasRetriesFails = (metrics?.Retries?.Any() ?? false) && (metrics.Fails?.Any() ?? false);
|
2017-03-26 06:33:03 +08:00
|
|
|
|
|
2017-09-08 01:53:53 +08:00
|
|
|
|
if (failOnMissing) loading.Hide();
|
2017-04-04 23:27:08 +08:00
|
|
|
|
|
2017-09-08 01:53:53 +08:00
|
|
|
|
if (hasRatings)
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
ratings.Metrics = metrics;
|
|
|
|
|
ratings.FadeIn(transition_duration);
|
|
|
|
|
}
|
|
|
|
|
else if (failOnMissing)
|
|
|
|
|
{
|
|
|
|
|
ratings.Metrics = new BeatmapMetrics
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
Ratings = new int[10],
|
|
|
|
|
};
|
2017-03-26 06:33:03 +08:00
|
|
|
|
}
|
2017-09-08 02:09:50 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ratings.FadeTo(0.25f, transition_duration);
|
|
|
|
|
}
|
2017-03-26 06:33:03 +08:00
|
|
|
|
|
2017-09-08 01:53:53 +08:00
|
|
|
|
if (hasRetriesFails)
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
failRetryGraph.Metrics = metrics;
|
|
|
|
|
failRetryContainer.FadeIn(transition_duration);
|
|
|
|
|
}
|
|
|
|
|
else if (failOnMissing)
|
|
|
|
|
{
|
|
|
|
|
failRetryGraph.Metrics = new BeatmapMetrics
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
Fails = new int[100],
|
|
|
|
|
Retries = new int[100],
|
|
|
|
|
};
|
2017-03-26 06:33:03 +08:00
|
|
|
|
}
|
2017-09-08 02:09:50 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
failRetryContainer.FadeTo(0.25f, transition_duration);
|
|
|
|
|
}
|
2017-09-08 01:53:53 +08:00
|
|
|
|
}
|
2017-03-26 06:33:03 +08:00
|
|
|
|
|
2017-09-08 01:53:53 +08:00
|
|
|
|
private void clearStats()
|
|
|
|
|
{
|
2017-11-27 15:48:12 +08:00
|
|
|
|
description.Text = null;
|
|
|
|
|
source.Text = null;
|
|
|
|
|
tags.Text = null;
|
|
|
|
|
|
2017-09-08 01:53:53 +08:00
|
|
|
|
advanced.Beatmap = new BeatmapInfo
|
|
|
|
|
{
|
|
|
|
|
StarDifficulty = 0,
|
2017-10-19 13:05:11 +08:00
|
|
|
|
BaseDifficulty = new BeatmapDifficulty
|
2017-09-08 01:53:53 +08:00
|
|
|
|
{
|
|
|
|
|
CircleSize = 0,
|
|
|
|
|
DrainRate = 0,
|
|
|
|
|
OverallDifficulty = 0,
|
|
|
|
|
ApproachRate = 0,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
loading.Hide();
|
|
|
|
|
ratingsContainer.FadeOut(transition_duration);
|
|
|
|
|
failRetryContainer.FadeOut(transition_duration);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class DetailBox : Container
|
|
|
|
|
{
|
|
|
|
|
private readonly Container content;
|
|
|
|
|
protected override Container<Drawable> Content => content;
|
|
|
|
|
|
|
|
|
|
public DetailBox()
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-04-10 22:42:23 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
2017-09-08 01:53:53 +08:00
|
|
|
|
|
|
|
|
|
InternalChildren = new Drawable[]
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
new Box
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-09-08 01:53:53 +08:00
|
|
|
|
Colour = Color4.Black.Opacity(0.5f),
|
2017-03-26 06:33:03 +08:00
|
|
|
|
},
|
2017-09-08 01:53:53 +08:00
|
|
|
|
content = new Container
|
2017-03-26 06:33:03 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2017-03-26 06:33:03 +08:00
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
2017-03-25 06:02:24 +08:00
|
|
|
|
}
|
2017-04-08 01:27:14 +08:00
|
|
|
|
|
2017-09-08 01:53:53 +08:00
|
|
|
|
private class MetadataSection : Container
|
2017-04-08 01:27:14 +08:00
|
|
|
|
{
|
2017-11-27 15:52:26 +08:00
|
|
|
|
private readonly FillFlowContainer textContainer;
|
2017-11-27 15:18:09 +08:00
|
|
|
|
private TextFlowContainer textFlow;
|
2017-04-08 01:27:14 +08:00
|
|
|
|
|
2017-11-29 19:13:00 +08:00
|
|
|
|
public MetadataSection(string title)
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
Alpha = 0;
|
|
|
|
|
|
|
|
|
|
InternalChild = textContainer = new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Spacing = new Vector2(spacing / 2),
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Child = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = title,
|
|
|
|
|
Font = @"Exo2.0-Bold",
|
|
|
|
|
TextSize = 14,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
textFlow = new TextFlowContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-10 22:42:23 +08:00
|
|
|
|
public string Text
|
2017-04-08 01:27:14 +08:00
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
2017-04-10 22:42:23 +08:00
|
|
|
|
if (string.IsNullOrEmpty(value))
|
2017-04-08 01:27:14 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
this.FadeOut(transition_duration);
|
|
|
|
|
return;
|
2017-04-08 01:27:14 +08:00
|
|
|
|
}
|
2017-09-08 01:53:53 +08:00
|
|
|
|
|
2017-11-27 15:48:47 +08:00
|
|
|
|
setTextAsync(value);
|
2017-04-08 01:27:14 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-27 15:48:47 +08:00
|
|
|
|
private void setTextAsync(string text)
|
2017-11-27 15:18:09 +08:00
|
|
|
|
{
|
2017-11-29 19:07:00 +08:00
|
|
|
|
LoadComponentAsync(new TextFlowContainer(s => s.TextSize = 14)
|
2017-11-27 15:18:09 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Colour = textFlow.Colour,
|
2017-11-29 19:07:00 +08:00
|
|
|
|
Text = text
|
|
|
|
|
}, loaded =>
|
2017-11-27 15:18:09 +08:00
|
|
|
|
{
|
2017-11-29 19:07:00 +08:00
|
|
|
|
textFlow?.Expire();
|
|
|
|
|
textContainer.Add(textFlow = loaded);
|
|
|
|
|
|
|
|
|
|
// fade in if we haven't yet.
|
|
|
|
|
this.FadeIn(transition_duration);
|
2017-11-27 15:18:09 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-08 01:53:53 +08:00
|
|
|
|
public Color4 TextColour
|
2017-04-08 01:27:14 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
get { return textFlow.Colour; }
|
|
|
|
|
set { textFlow.Colour = value; }
|
2017-04-08 01:27:14 +08:00
|
|
|
|
}
|
2017-09-08 01:53:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class DimmedLoadingAnimation : VisibilityContainer
|
|
|
|
|
{
|
|
|
|
|
private readonly LoadingAnimation loading;
|
|
|
|
|
|
|
|
|
|
public DimmedLoadingAnimation()
|
|
|
|
|
{
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
2017-04-08 01:27:14 +08:00
|
|
|
|
{
|
2017-09-08 01:53:53 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Black.Opacity(0.5f),
|
|
|
|
|
},
|
|
|
|
|
loading = new LoadingAnimation(),
|
2017-04-08 01:27:14 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
2017-09-08 01:53:53 +08:00
|
|
|
|
|
|
|
|
|
protected override void PopIn()
|
|
|
|
|
{
|
|
|
|
|
this.FadeIn(transition_duration, Easing.OutQuint);
|
|
|
|
|
loading.State = Visibility.Visible;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void PopOut()
|
|
|
|
|
{
|
|
|
|
|
this.FadeOut(transition_duration, Easing.OutQuint);
|
|
|
|
|
loading.State = Visibility.Hidden;
|
|
|
|
|
}
|
2017-04-08 01:27:14 +08:00
|
|
|
|
}
|
2017-03-25 06:02:24 +08:00
|
|
|
|
}
|
2017-04-24 17:34:27 +08:00
|
|
|
|
}
|