2017-02-20 00:41:51 +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
|
|
|
|
|
|
|
|
|
|
using osu.Game.Modes;
|
|
|
|
|
using osu.Game.Modes.Objects;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps
|
|
|
|
|
{
|
|
|
|
|
public abstract class DifficultyCalculator
|
|
|
|
|
{
|
|
|
|
|
protected abstract PlayMode PlayMode { get; }
|
|
|
|
|
|
|
|
|
|
protected double TimeRate = 1;
|
|
|
|
|
|
2017-02-25 02:36:17 +08:00
|
|
|
|
protected abstract double CalculateInternal(Dictionary<String, String> categoryDifficulty);
|
2017-02-20 00:41:51 +08:00
|
|
|
|
|
|
|
|
|
private void loadTiming()
|
|
|
|
|
{
|
|
|
|
|
// TODO: Handle mods
|
|
|
|
|
int audioRate = 100;
|
|
|
|
|
TimeRate = audioRate / 100.0;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-25 02:36:17 +08:00
|
|
|
|
public double Calculate(Dictionary<string, string> categoryDifficulty = null)
|
2017-02-20 00:41:51 +08:00
|
|
|
|
{
|
|
|
|
|
loadTiming();
|
2017-02-25 02:36:17 +08:00
|
|
|
|
double difficulty = CalculateInternal(categoryDifficulty);
|
2017-02-20 00:41:51 +08:00
|
|
|
|
return difficulty;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public abstract class DifficultyCalculator<T> : DifficultyCalculator where T : HitObject
|
|
|
|
|
{
|
|
|
|
|
protected List<T> Objects;
|
|
|
|
|
|
|
|
|
|
protected abstract HitObjectConverter<T> Converter { get; }
|
|
|
|
|
|
2017-03-07 09:59:19 +08:00
|
|
|
|
protected DifficultyCalculator(Beatmap beatmap)
|
2017-02-20 00:41:51 +08:00
|
|
|
|
{
|
|
|
|
|
Objects = Converter.Convert(beatmap);
|
|
|
|
|
PreprocessHitObjects();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void PreprocessHitObjects()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|