-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add separate window to display map data (Live visualizer) (#46)
* Add: ability to calculate only specific part of beatmap in PpCalculator * Misc: Move BeatmapHelpers to Types project * Misc: Expose map Length & backgroundFile props in WorkingBeatmap * Add: LiveVisualizer plugin thanks to BlackShark for sharing his UI * Misc: make time token available outside of play mode * Fix: ppCalculator crashing when map has too few objects * Misc: allow tokens to be Reset to their default value * Fix: Live tokens not respecting "Clear live tokens after finishing playing" setting
- Loading branch information
Showing
35 changed files
with
3,196 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System; | ||
using System.IO; | ||
using osu.Framework.Audio.Track; | ||
using osu.Framework.Graphics.Textures; | ||
using osu.Game.Beatmaps; | ||
|
@@ -12,6 +10,9 @@ | |
using osu.Game.Rulesets.Mania; | ||
using osu.Game.Rulesets.Osu; | ||
using osu.Game.Rulesets.Taiko; | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
|
||
namespace PpCalculator | ||
{ | ||
|
@@ -22,6 +23,9 @@ public class ProcessorWorkingBeatmap : WorkingBeatmap | |
{ | ||
private readonly Beatmap beatmap; | ||
public int RulesetID => beatmap.BeatmapInfo.RulesetID; | ||
public double Length => beatmap.HitObjects.Any() ? beatmap.HitObjects.Last().StartTime : 0; | ||
|
||
public string BackgroundFile => beatmap.Metadata.BackgroundFile; | ||
/// <summary> | ||
/// Constructs a new <see cref="ProcessorWorkingBeatmap"/> from a .osu file. | ||
/// </summary> | ||
|
@@ -32,7 +36,7 @@ public ProcessorWorkingBeatmap(string file, int? beatmapId = null) | |
{ | ||
} | ||
|
||
private ProcessorWorkingBeatmap(Beatmap beatmap, int? beatmapId = null) | ||
internal ProcessorWorkingBeatmap(Beatmap beatmap, int? beatmapId = null) | ||
: base(beatmap.BeatmapInfo) | ||
{ | ||
this.beatmap = beatmap; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=LiveVisualizer_002EAnnotations/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=osu_005FStreamCompanion_002EAnnotations/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<UserControl x:Class="LiveVisualizer.Chart" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:LiveVisualizer" | ||
xmlns:wpf="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" | ||
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" | ||
|
||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800"> | ||
<Grid> | ||
<Grid.Resources> | ||
<Style TargetType="lvc:LineSeries"> | ||
<Setter Property="StrokeThickness" Value="0"></Setter> | ||
<Setter Property="Stroke" Value="White"></Setter> | ||
<Setter Property="Fill" Value="{Binding FillColor}"></Setter> | ||
<Setter Property="PointGeometrySize" Value="0"></Setter> | ||
<Setter Property="LineSmoothness" Value="1"></Setter> | ||
</Style> | ||
</Grid.Resources> | ||
<wpf:CartesianChart Name="chart" Width="700" Hoverable="False" DataTooltip="{x:Null}" > | ||
|
||
<wpf:CartesianChart.Series> | ||
<lvc:LineSeries Name="LineSeries" Values="{Binding Strains}" PointGeometry="{x:Null}" Fill="{Binding ChartColor}" /> | ||
|
||
</wpf:CartesianChart.Series> | ||
<wpf:CartesianChart.AxisX> | ||
<wpf:Axis IsMerged="True" Foreground="Transparent"> | ||
<wpf:Axis.Separator> | ||
<wpf:Separator StrokeThickness="1" StrokeDashArray="2" IsEnabled="False"> | ||
<!--Here, see the IsEnabled => false--> | ||
<wpf:Separator.Stroke> | ||
<SolidColorBrush Color="{Binding FillColor}" /> | ||
</wpf:Separator.Stroke> | ||
</wpf:Separator> | ||
</wpf:Axis.Separator> | ||
</wpf:Axis> | ||
</wpf:CartesianChart.AxisX> | ||
<wpf:CartesianChart.AxisY> | ||
<lvc:Axis IsMerged="True" MaxValue="{Binding MaxYValue}" MinValue="0"> | ||
<lvc:Axis.Style> | ||
<Style TargetType="lvc:Axis"> | ||
<Style.Triggers> | ||
<DataTrigger Binding="{Binding ShowAxisYSeparator}" Value="False"> | ||
<Setter Property="Foreground" Value="Transparent"></Setter> | ||
</DataTrigger> | ||
</Style.Triggers> | ||
<Style.Setters> | ||
<Setter Property="Foreground" Value="#FFFFFF"></Setter> | ||
</Style.Setters> | ||
</Style> | ||
</lvc:Axis.Style> | ||
<lvc:Axis.Separator> | ||
<lvc:Separator Name="AxisYSeparator" StrokeThickness="1" StrokeDashArray="1" IsEnabled="{Binding ShowAxisYSeparator}" Step="{Binding AxisYStep}" > | ||
<!--Here, see the IsEnabled => false--> | ||
<lvc:Separator.Stroke> | ||
<SolidColorBrush Color="{Binding AxisYSeparatorColor}" /> | ||
</lvc:Separator.Stroke> | ||
</lvc:Separator> | ||
</lvc:Axis.Separator> | ||
</lvc:Axis> | ||
</wpf:CartesianChart.AxisY> | ||
</wpf:CartesianChart> | ||
</Grid> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using LiveCharts; | ||
using LiveCharts.Helpers; | ||
using LiveCharts.Wpf; | ||
using LiveVisualizer.Annotations; | ||
using System; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Runtime.CompilerServices; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using Separator = LiveCharts.Wpf.Separator; | ||
|
||
namespace LiveVisualizer | ||
{ | ||
/// <summary> | ||
/// Interaction logic for Chart.xaml | ||
/// </summary> | ||
public partial class Chart : UserControl | ||
{ | ||
public Chart(IWpfVisualizerData data, string bindingName, bool isProgressChart) | ||
{ | ||
InitializeComponent(); | ||
|
||
var binding = new Binding(bindingName); | ||
binding.Source = data; | ||
LineSeries.SetBinding(Series.FillProperty, binding); | ||
|
||
if (isProgressChart) | ||
{ //Disable drawing of AxisY separator | ||
binding = new Binding(); | ||
AxisYSeparator.SetBinding(Separator.IsEnabledProperty, binding); | ||
AxisYSeparator.SetValue(Separator.StrokeThicknessProperty, 0d); | ||
} | ||
|
||
DataContext = data; | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.