1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 02:27:25 +08:00

Merge branch 'remove-populateattributes' into new-diffcalc-catch

This commit is contained in:
smoogipoo 2019-02-19 17:40:56 +09:00
commit 419f541ab5
2 changed files with 6 additions and 19 deletions

View File

@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Screens;
using osu.Game.Screens.Multi;
using osu.Game.Screens.Multi.Lounge;
using osu.Game.Screens.Multi.Lounge.Components;
@ -26,8 +25,6 @@ namespace osu.Game.Tests.Visual
Multiplayer multi = new Multiplayer();
AddStep(@"show", () => LoadScreen(multi));
AddWaitStep(5);
AddStep(@"exit", multi.Exit);
}
}
}

View File

@ -25,14 +25,12 @@ namespace osu.Game.Rulesets.Difficulty
protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate)
{
var attributes = CreateDifficultyAttributes();
attributes.Mods = mods;
var skills = CreateSkills();
if (!beatmap.HitObjects.Any())
return attributes;
return CreateDifficultyAttributes(beatmap, mods, skills, clockRate);
var difficultyHitObjects = CreateDifficultyHitObjects(beatmap, clockRate).OrderBy(h => h.BaseObject.StartTime).ToList();
var skills = CreateSkills();
double sectionLength = SectionLength * clockRate;
@ -60,9 +58,7 @@ namespace osu.Game.Rulesets.Difficulty
foreach (Skill s in skills)
s.SaveCurrentPeak();
PopulateAttributes(attributes, beatmap, skills, clockRate);
return attributes;
return CreateDifficultyAttributes(beatmap, mods, skills, clockRate);
}
/// <summary>
@ -108,13 +104,13 @@ namespace osu.Game.Rulesets.Difficulty
protected virtual Mod[] DifficultyAdjustmentMods => Array.Empty<Mod>();
/// <summary>
/// Populates <see cref="DifficultyAttributes"/> after difficulty has been processed.
/// Creates <see cref="DifficultyAttributes"/> to describe beatmap's calculated difficulty.
/// </summary>
/// <param name="attributes">The <see cref="DifficultyAttributes"/> to populate with information about the difficulty of <paramref name="beatmap"/>.</param>
/// <param name="beatmap">The <see cref="IBeatmap"/> whose difficulty was processed.</param>
/// <param name="mods">The <see cref="Mod"/>s that were applied during the process.</param>
/// <param name="skills">The skills which processed the difficulty.</param>
/// <param name="clockRate">The rate at which the gameplay clock is run at.</param>
protected abstract void PopulateAttributes(DifficultyAttributes attributes, IBeatmap beatmap, Skill[] skills, double clockRate);
protected abstract DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate);
/// <summary>
/// Enumerates <see cref="DifficultyHitObject"/>s to be processed from <see cref="HitObject"/>s in the <see cref="IBeatmap"/>.
@ -129,11 +125,5 @@ namespace osu.Game.Rulesets.Difficulty
/// </summary>
/// <returns>The <see cref="Skill"/>s.</returns>
protected abstract Skill[] CreateSkills();
/// <summary>
/// Creates an empty <see cref="DifficultyAttributes"/>.
/// </summary>
/// <returns>The empty <see cref="DifficultyAttributes"/>.</returns>
protected abstract DifficultyAttributes CreateDifficultyAttributes();
}
}