mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
changed location of BarGraph to be more generic
This commit is contained in:
@ -5,7 +5,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Screens.Select.Details;
|
using osu.Game.Screens.Select;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
@ -1,15 +1,48 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select.Details
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
public class BeatmapDetailsBar : Container
|
public class BarGraph : FillFlowContainer<Bar>
|
||||||
|
{
|
||||||
|
|
||||||
|
public IEnumerable<float> Values
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
List<float> values = value.ToList();
|
||||||
|
List<Bar> graphBars = Children.ToList();
|
||||||
|
for (int i = 0; i < values.Count; i++)
|
||||||
|
if (graphBars.Count > i)
|
||||||
|
{
|
||||||
|
graphBars[i].Length = values[i] / values.Max();
|
||||||
|
graphBars[i].Width = 1.0f / values.Count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Add(new Bar
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Width = 1.0f / values.Count,
|
||||||
|
Length = values[i] / values.Max(),
|
||||||
|
Direction = BarDirection.BottomToTop,
|
||||||
|
BackgroundColour = new Color4(0, 0, 0, 0),
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Bar : Container
|
||||||
{
|
{
|
||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
private readonly Box bar;
|
private readonly Box bar;
|
||||||
@ -27,7 +60,7 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
length = MathHelper.Clamp(value,0,1);
|
length = MathHelper.Clamp(value, 0, 1);
|
||||||
updateBarLength();
|
updateBarLength();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,9 +103,9 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeatmapDetailsBar()
|
public Bar()
|
||||||
{
|
{
|
||||||
Children = new []
|
Children = new[]
|
||||||
{
|
{
|
||||||
background = new Box
|
background = new Box
|
||||||
{
|
{
|
@ -8,7 +8,6 @@ using osu.Framework.Graphics.Primitives;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Screens.Select.Details;
|
|
||||||
using osu.Game.Screens.Select.Leaderboards;
|
using osu.Game.Screens.Select.Leaderboards;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
|
@ -12,11 +12,12 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select.Details
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
public class BeatmapDetails : Container
|
public class BeatmapDetails : Container
|
||||||
{
|
{
|
||||||
@ -30,13 +31,13 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
private readonly DifficultyRow approachRate;
|
private readonly DifficultyRow approachRate;
|
||||||
private readonly DifficultyRow stars;
|
private readonly DifficultyRow stars;
|
||||||
|
|
||||||
private readonly BeatmapDetailsBar ratingsBar;
|
private readonly Bar ratingsBar;
|
||||||
private readonly OsuSpriteText negativeRatings;
|
private readonly OsuSpriteText negativeRatings;
|
||||||
private readonly OsuSpriteText positiveRatings;
|
private readonly OsuSpriteText positiveRatings;
|
||||||
private readonly BeatmapDetailsGraph ratingsGraph;
|
private readonly BarGraph ratingsGraph;
|
||||||
|
|
||||||
private readonly BeatmapDetailsGraph retryGraph;
|
private readonly BarGraph retryGraph;
|
||||||
private readonly BeatmapDetailsGraph failGraph;
|
private readonly BarGraph failGraph;
|
||||||
|
|
||||||
private BeatmapInfo beatmap;
|
private BeatmapInfo beatmap;
|
||||||
public BeatmapInfo Beatmap
|
public BeatmapInfo Beatmap
|
||||||
@ -267,7 +268,7 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
},
|
},
|
||||||
ratingsBar = new BeatmapDetailsBar
|
ratingsBar = new Bar
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = 5,
|
Height = 5,
|
||||||
@ -301,7 +302,7 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
},
|
},
|
||||||
ratingsGraph = new BeatmapDetailsGraph
|
ratingsGraph = new BarGraph
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
@ -316,17 +317,17 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
Text = "Points of Failure",
|
Text = "Points of Failure",
|
||||||
Font = @"Exo2.0-Medium",
|
Font = @"Exo2.0-Medium",
|
||||||
},
|
},
|
||||||
new Container<BeatmapDetailsGraph>
|
new Container<BarGraph>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Size = new Vector2(1/0.6f, 50),
|
Size = new Vector2(1/0.6f, 50),
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
retryGraph = new BeatmapDetailsGraph
|
retryGraph = new BarGraph
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
failGraph = new BeatmapDetailsGraph
|
failGraph = new BarGraph
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
@ -357,7 +358,7 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
private class DifficultyRow : Container
|
private class DifficultyRow : Container
|
||||||
{
|
{
|
||||||
private readonly OsuSpriteText name;
|
private readonly OsuSpriteText name;
|
||||||
private readonly BeatmapDetailsBar bar;
|
private readonly Bar bar;
|
||||||
private readonly OsuSpriteText valueText;
|
private readonly OsuSpriteText valueText;
|
||||||
|
|
||||||
private float difficultyValue;
|
private float difficultyValue;
|
||||||
@ -421,7 +422,7 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
{
|
{
|
||||||
Font = @"Exo2.0-Medium",
|
Font = @"Exo2.0-Medium",
|
||||||
},
|
},
|
||||||
bar = new BeatmapDetailsBar
|
bar = new Bar
|
||||||
{
|
{
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
@ -447,10 +448,10 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RetryAndFailBar : Container<BeatmapDetailsBar>
|
private class RetryAndFailBar : Container<Bar>
|
||||||
{
|
{
|
||||||
private readonly BeatmapDetailsBar retryBar;
|
private readonly Bar retryBar;
|
||||||
private readonly BeatmapDetailsBar failBar;
|
private readonly Bar failBar;
|
||||||
|
|
||||||
public float RetryLength
|
public float RetryLength
|
||||||
{
|
{
|
||||||
@ -480,14 +481,14 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
{
|
{
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
retryBar = new BeatmapDetailsBar
|
retryBar = new Bar
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Direction = BarDirection.BottomToTop,
|
Direction = BarDirection.BottomToTop,
|
||||||
Length = 0,
|
Length = 0,
|
||||||
BackgroundColour = new Color4(0,0,0,0),
|
BackgroundColour = new Color4(0,0,0,0),
|
||||||
},
|
},
|
||||||
failBar = new BeatmapDetailsBar
|
failBar = new Bar
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Direction = BarDirection.BottomToTop,
|
Direction = BarDirection.BottomToTop,
|
@ -1,41 +0,0 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
using OpenTK.Graphics;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select.Details
|
|
||||||
{
|
|
||||||
public class BeatmapDetailsGraph : FillFlowContainer<BeatmapDetailsBar>
|
|
||||||
{
|
|
||||||
|
|
||||||
public IEnumerable<float> Values
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
List<float> values = value.ToList();
|
|
||||||
List<BeatmapDetailsBar> graphBars = Children.ToList();
|
|
||||||
for (int i = 0; i < values.Count; i++)
|
|
||||||
if (graphBars.Count > i)
|
|
||||||
{
|
|
||||||
graphBars[i].Length = values[i] / values.Max();
|
|
||||||
graphBars[i].Width = 1.0f / values.Count;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Add(new BeatmapDetailsBar
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Width = 1.0f / values.Count,
|
|
||||||
Length = values[i] / values.Max(),
|
|
||||||
Direction = BarDirection.BottomToTop,
|
|
||||||
BackgroundColour = new Color4(0, 0, 0, 0),
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -206,9 +206,8 @@
|
|||||||
<Compile Include="Screens\Play\SkipButton.cs" />
|
<Compile Include="Screens\Play\SkipButton.cs" />
|
||||||
<Compile Include="Modes\UI\StandardComboCounter.cs" />
|
<Compile Include="Modes\UI\StandardComboCounter.cs" />
|
||||||
<Compile Include="Screens\Select\BeatmapCarousel.cs" />
|
<Compile Include="Screens\Select\BeatmapCarousel.cs" />
|
||||||
<Compile Include="Screens\Select\Details\BeatmapDetails.cs" />
|
<Compile Include="Screens\Select\BeatmapDetails.cs" />
|
||||||
<Compile Include="Screens\Select\Details\BeatmapDetailsBar.cs" />
|
<Compile Include="Graphics\UserInterface\BarGraph.cs" />
|
||||||
<Compile Include="Screens\Select\Details\BeatmapDetailsGraph.cs" />
|
|
||||||
<Compile Include="Screens\Select\FilterCriteria.cs" />
|
<Compile Include="Screens\Select\FilterCriteria.cs" />
|
||||||
<Compile Include="Screens\Select\Filter\GroupMode.cs" />
|
<Compile Include="Screens\Select\Filter\GroupMode.cs" />
|
||||||
<Compile Include="Screens\Select\Filter\SortMode.cs" />
|
<Compile Include="Screens\Select\Filter\SortMode.cs" />
|
||||||
@ -391,7 +390,9 @@
|
|||||||
</None>
|
</None>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup>
|
||||||
|
<Folder Include="Screens\Select\Details\" />
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
|
Reference in New Issue
Block a user