Skip to content
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.

Commit

Permalink
Merge branch 'daily' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
MATRIX-feather committed Aug 21, 2021
2 parents 1e2658b + 93436c4 commit 71c8880
Show file tree
Hide file tree
Showing 264 changed files with 4,993 additions and 3,043 deletions.
8 changes: 4 additions & 4 deletions M.Resources/Localisation/Mvis/Plugins/CloudMusicStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public class CloudMusicStrings

public static LocalisableString Delete => new TranslatableString(getKey(@"delete"), @"删除");

public static LocalisableString SeekToNext => new TranslatableString(getKey(@"seek_next"), @"前往上一拍");
public static LocalisableString SeekToNext => new TranslatableString(getKey(@"seek_next"), @"前往下一拍");

public static LocalisableString SeekToPrev => new TranslatableString(getKey(@"seek_prev"), @"前往下一拍");
public static LocalisableString SeekToPrev => new TranslatableString(getKey(@"seek_prev"), @"前往上一拍");

public static LocalisableString InsertNewLine => new TranslatableString(getKey(@"insert_new_line"), @"插入新歌词");

Expand All @@ -64,9 +64,9 @@ public class CloudMusicStrings

public static LocalisableString LyricTranslated => new TranslatableString(getKey(@"lyric_translated"), @"歌词翻译");

public static LocalisableString LyricTimeToTrack => new TranslatableString(getKey(@"lyric_time_to_track"), @"调整歌曲到歌词时间");
public static LocalisableString LyricTimeToTrack => new TranslatableString(getKey(@"lyric_time_to_track"), @"调整歌词到歌曲时间");

public static LocalisableString TrackTimeToLyric => new TranslatableString(getKey(@"track_time_to_lyric"), @"调整歌词到歌曲时间");
public static LocalisableString TrackTimeToLyric => new TranslatableString(getKey(@"track_time_to_lyric"), @"调整歌曲到歌词时间");

//其他
public static LocalisableString AdjustOffsetToLyric => new TranslatableString(getKey(@"offset_adjust_to_lyric"), @"对其偏移至该歌词");
Expand Down
61 changes: 61 additions & 0 deletions Mvis.Plugin.FakeEditor/Editor/DummyRulesetInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Threading;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI;
using osu.Game.Skinning;

namespace Mvis.Plugin.FakeEditor.Editor
{
/// <summary>
/// From osu.Game/Beatmaps/DummyWorkingBeatmap.cs
/// <see cref="osu.Game.Beatmaps.DummyWorkingBeatmap"/>
/// </summary>
public class DummyRulesetInfo : RulesetInfo
{
public override Ruleset CreateInstance() => new DummyRuleset();

private class DummyRuleset : Ruleset
{
public override IEnumerable<Mod> GetModsFor(ModType type) => Array.Empty<Mod>();

public override ISkin CreateLegacySkinProvider(ISkin skin, IBeatmap beatmap) => new DummySkinProvider();

public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
{
throw new NotImplementedException();
}

public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap)
=> new DummyBeatmapConverter { Beatmap = beatmap };

public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => null;

public override string Description => "desc";

public override string ShortName => "name";

private class DummyBeatmapConverter : IBeatmapConverter
{
public event Action<HitObject, IEnumerable<HitObject>> ObjectConverted;

public IBeatmap Beatmap { get; set; }

public bool CanConvert() => true;

public IBeatmap Convert(CancellationToken cancellationToken = default)
{
foreach (var obj in Beatmap.HitObjects)
ObjectConverted?.Invoke(obj, obj.Yield());

return Beatmap;
}
}
}
}
}
34 changes: 34 additions & 0 deletions Mvis.Plugin.FakeEditor/Editor/DummySkinProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.OpenGL.Textures;
using osu.Framework.Graphics.Textures;
using osu.Game.Audio;
using osu.Game.Skinning;

namespace Mvis.Plugin.FakeEditor.Editor
{
public class DummySkinProvider : ISkin
{
public Drawable GetDrawableComponent(ISkinComponent component)
{
throw new NotImplementedException();
}

public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT)
{
throw new NotImplementedException();
}

public ISample GetSample(ISampleInfo sampleInfo)
{
throw new NotImplementedException();
}

public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
{
throw new NotImplementedException();
}
}
}
8 changes: 5 additions & 3 deletions Mvis.Plugin.FakeEditor/Editor/EditorContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnl
[BackgroundDependencyLoader]
private void load()
{
ruleset = beatmap.BeatmapInfo.Ruleset?.CreateInstance();
//不知道为什么,谱面的Ruleset会是null??????
var rulesetInfo = beatmap.BeatmapInfo.Ruleset ?? new DummyRulesetInfo();
ruleset = rulesetInfo.CreateInstance();

var playableBeatmap = beatmap.GetPlayableBeatmap(beatmap.BeatmapInfo.Ruleset);
var playableBeatmap = beatmap.GetPlayableBeatmap(rulesetInfo);

if (editorBeatmap == null)
{
Expand All @@ -44,7 +46,7 @@ private void load()
dependencies.CacheAs(editorBeatmap);
}

if (ruleset == null)
if (rulesetInfo is DummyRulesetInfo)
return;

beatmapSkinProvider = new BeatmapSkinProvidingContainer(beatmap.Skin);
Expand Down
2 changes: 1 addition & 1 deletion Mvis.Plugin.FakeEditor/FakeEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private void initDependencies(WorkingBeatmap beatmap)

if (EditorClock == null)
{
AddInternal(EditorClock = new EditorClock(beatmap.GetPlayableBeatmap(beatmap.BeatmapInfo.Ruleset), beatDivisor)
AddInternal(EditorClock = new EditorClock(beatmap.GetPlayableBeatmap(beatmap.BeatmapInfo.Ruleset ?? new DummyRulesetInfo()), beatDivisor)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Expand Down
13 changes: 10 additions & 3 deletions Mvis.Plugin.SandboxToPanel/SandboxPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Platform;
using osu.Game.Beatmaps;
using osu.Game.Screens.Mvis.Plugins;
Expand Down Expand Up @@ -62,8 +63,6 @@ private void load()
MvisScreen?.OnBeatmapChanged(onBeatmapChanged, this, true);
};
}

AddInternal(new Particles());
}

private void onIdleAlphaChanged(ValueChangedEvent<float> v)
Expand All @@ -84,7 +83,15 @@ public override PluginSettingsSubSection CreateSettingsSubSection()
public override PluginSidebarSettingsSection CreateSidebarSettingsSection()
=> new RulesetPanelSidebarSection(this);

protected override Drawable CreateContent() => new LayoutController();
protected override Drawable CreateContent() => new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Particles(),
new LayoutController()
}
};

protected override bool OnContentLoaded(Drawable content) => true;

Expand Down
2 changes: 1 addition & 1 deletion osu.Android.props
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<Reference Include="Java.Interop" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.813.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.820.0" />
</ItemGroup>
<ItemGroup Label="Transitive Dependencies">
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
Expand Down
8 changes: 4 additions & 4 deletions osu.Desktop/Windows/GameplayWinKeyBlocker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Platform;
using osu.Game;
using osu.Game.Configuration;
using osu.Game.Screens.Play;

namespace osu.Desktop.Windows
{
public class GameplayWinKeyBlocker : Component
{
private Bindable<bool> disableWinKey;
private Bindable<bool> localUserPlaying;
private IBindable<bool> localUserPlaying;

[Resolved]
private GameHost host { get; set; }

[BackgroundDependencyLoader]
private void load(OsuGame game, OsuConfigManager config)
private void load(ILocalUserPlayInfo localUserInfo, OsuConfigManager config)
{
localUserPlaying = game.LocalUserPlaying.GetBoundCopy();
localUserPlaying = localUserInfo.IsPlaying.GetBoundCopy();
localUserPlaying.BindValueChanged(_ => updateBlocking());

disableWinKey = config.GetBindable<bool>(OsuSetting.GameplayDisableWinKey);
Expand Down
2 changes: 1 addition & 1 deletion osu.Desktop/osu.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Product>osu!(lazer)</Product>
<ApplicationIcon>lazer.ico</ApplicationIcon>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Version>2021.815.0</Version>
<Version>2021.821.0</Version>
<FileVersion>0.0.0</FileVersion>
</PropertyGroup>
<PropertyGroup>
Expand Down
34 changes: 34 additions & 0 deletions osu.Game.Benchmarks/BenchmarkMod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// 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 BenchmarkDotNet.Attributes;
using osu.Game.Rulesets.Osu.Mods;

namespace osu.Game.Benchmarks
{
public class BenchmarkMod : BenchmarkTest
{
private OsuModDoubleTime mod;

[Params(1, 10, 100)]
public int Times { get; set; }

[GlobalSetup]
public void GlobalSetup()
{
mod = new OsuModDoubleTime();
}

[Benchmark]
public int ModHashCode()
{
var hashCode = new HashCode();

for (int i = 0; i < Times; i++)
hashCode.Add(mod);

return hashCode.ToHashCode();
}
}
}
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace osu.Game.Rulesets.Catch.Difficulty.Skills
{
public class Movement : StrainSkill
public class Movement : StrainDecaySkill
{
private const float absolute_player_positioning_error = 16f;
private const float normalized_hitobject_radius = 41.0f;
Expand Down
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace osu.Game.Rulesets.Mania.Difficulty.Skills
{
public class Strain : StrainSkill
public class Strain : StrainDecaySkill
{
private const double individual_decay_base = 0.125;
private const double overall_decay_base = 0.30;
Expand Down Expand Up @@ -71,7 +71,7 @@ protected override double StrainValueOf(DifficultyHitObject current)
return individualStrain + overallStrain - CurrentStrain;
}

protected override double GetPeakStrain(double offset)
protected override double CalculateInitialStrain(double offset)
=> applyDecay(individualStrain, offset - Previous[0].StartTime, individual_decay_base)
+ applyDecay(overallStrain, offset - Previous[0].StartTime, overall_decay_base);

Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Osu/Difficulty/Skills/OsuStrainSkill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace osu.Game.Rulesets.Osu.Difficulty.Skills
{
public abstract class OsuStrainSkill : StrainSkill
public abstract class OsuStrainSkill : StrainDecaySkill
{
/// <summary>
/// The number of sections with the highest strains, which the peak strain reductions will apply to.
Expand Down
11 changes: 7 additions & 4 deletions osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,14 @@ private void updateState(DrawableHitObject hitObject, ArmedState state)

if (hitObject is DrawableHitCircle circle)
{
circle.ApproachCircle
.FadeOutFromOne(EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION * 4)
.Expire();
using (circle.BeginAbsoluteSequence(circle.HitStateUpdateTime))
{
circle.ApproachCircle
.FadeOutFromOne(EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION * 4)
.Expire();

circle.ApproachCircle.ScaleTo(1.1f, 300, Easing.OutQuint);
circle.ApproachCircle.ScaleTo(1.1f, 300, Easing.OutQuint);
}
}

if (hitObject is IHasMainCirclePiece mainPieceContainer)
Expand Down
1 change: 1 addition & 0 deletions osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ private void load(OsuConfigManager config)
protected override bool InterpolateMovements => !disjointTrail;

protected override float IntervalMultiplier => 1 / Math.Max(cursorSize.Value, 1);
protected override bool AvoidDrawingNearCursor => !disjointTrail;

protected override void Update()
{
Expand Down
4 changes: 3 additions & 1 deletion osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ private void resetTime()
protected virtual bool InterpolateMovements => true;

protected virtual float IntervalMultiplier => 1.0f;
protected virtual bool AvoidDrawingNearCursor => false;

private Vector2? lastPosition;
private readonly InputResampler resampler = new InputResampler();
Expand Down Expand Up @@ -171,8 +172,9 @@ protected void AddTrail(Vector2 position)
Vector2 direction = diff / distance;

float interval = partSize.X / 2.5f * IntervalMultiplier;
float stopAt = distance - (AvoidDrawingNearCursor ? interval : 0);

for (float d = interval; d < distance; d += interval)
for (float d = interval; d < stopAt; d += interval)
{
lastPosition = pos1 + direction * d;
addPart(lastPosition.Value);
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Taiko/Difficulty/Skills/Colour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
/// <summary>
/// Calculates the colour coefficient of taiko difficulty.
/// </summary>
public class Colour : StrainSkill
public class Colour : StrainDecaySkill
{
protected override double SkillMultiplier => 1;
protected override double StrainDecayBase => 0.4;
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
/// <summary>
/// Calculates the rhythm coefficient of taiko difficulty.
/// </summary>
public class Rhythm : StrainSkill
public class Rhythm : StrainDecaySkill
{
protected override double SkillMultiplier => 10;
protected override double StrainDecayBase => 0;
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
/// <remarks>
/// The reference play style chosen uses two hands, with full alternating (the hand changes after every hit).
/// </remarks>
public class Stamina : StrainSkill
public class Stamina : StrainDecaySkill
{
protected override double SkillMultiplier => 1;
protected override double StrainDecayBase => 0.4;
Expand Down
Loading

0 comments on commit 71c8880

Please sign in to comment.