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-taiko

This commit is contained in:
smoogipoo 2019-02-19 17:43:28 +09:00
commit 6433ecf6aa
2 changed files with 6 additions and 19 deletions

View File

@ -4,7 +4,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Screens;
using osu.Game.Screens.Multi; using osu.Game.Screens.Multi;
using osu.Game.Screens.Multi.Lounge; using osu.Game.Screens.Multi.Lounge;
using osu.Game.Screens.Multi.Lounge.Components; using osu.Game.Screens.Multi.Lounge.Components;
@ -26,8 +25,6 @@ namespace osu.Game.Tests.Visual
Multiplayer multi = new Multiplayer(); Multiplayer multi = new Multiplayer();
AddStep(@"show", () => LoadScreen(multi)); 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) protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate)
{ {
var attributes = CreateDifficultyAttributes(); var skills = CreateSkills();
attributes.Mods = mods;
if (!beatmap.HitObjects.Any()) if (!beatmap.HitObjects.Any())
return attributes; return CreateDifficultyAttributes(beatmap, mods, skills, clockRate);
var difficultyHitObjects = CreateDifficultyHitObjects(beatmap, clockRate).OrderBy(h => h.BaseObject.StartTime).ToList(); var difficultyHitObjects = CreateDifficultyHitObjects(beatmap, clockRate).OrderBy(h => h.BaseObject.StartTime).ToList();
var skills = CreateSkills();
double sectionLength = SectionLength * clockRate; double sectionLength = SectionLength * clockRate;
@ -60,9 +58,7 @@ namespace osu.Game.Rulesets.Difficulty
foreach (Skill s in skills) foreach (Skill s in skills)
s.SaveCurrentPeak(); s.SaveCurrentPeak();
PopulateAttributes(attributes, beatmap, skills, clockRate); return CreateDifficultyAttributes(beatmap, mods, skills, clockRate);
return attributes;
} }
/// <summary> /// <summary>
@ -108,13 +104,13 @@ namespace osu.Game.Rulesets.Difficulty
protected virtual Mod[] DifficultyAdjustmentMods => Array.Empty<Mod>(); protected virtual Mod[] DifficultyAdjustmentMods => Array.Empty<Mod>();
/// <summary> /// <summary>
/// Populates <see cref="DifficultyAttributes"/> after difficulty has been processed. /// Creates <see cref="DifficultyAttributes"/> to describe beatmap's calculated difficulty.
/// </summary> /// </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="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="skills">The skills which processed the difficulty.</param>
/// <param name="clockRate">The rate at which the gameplay clock is run at.</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> /// <summary>
/// Enumerates <see cref="DifficultyHitObject"/>s to be processed from <see cref="HitObject"/>s in the <see cref="IBeatmap"/>. /// 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> /// </summary>
/// <returns>The <see cref="Skill"/>s.</returns> /// <returns>The <see cref="Skill"/>s.</returns>
protected abstract Skill[] CreateSkills(); protected abstract Skill[] CreateSkills();
/// <summary>
/// Creates an empty <see cref="DifficultyAttributes"/>.
/// </summary>
/// <returns>The empty <see cref="DifficultyAttributes"/>.</returns>
protected abstract DifficultyAttributes CreateDifficultyAttributes();
} }
} }