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
Signed-off-by: MATRIX-feather <[email protected]>
  • Loading branch information
MATRIX-feather committed Jun 16, 2022
2 parents 85abb6b + 2c11021 commit bdb4ac7
Show file tree
Hide file tree
Showing 337 changed files with 7,757 additions and 5,403 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
]
},
"ppy.localisationanalyser.tools": {
"version": "2022.417.0",
"version": "2022.607.0",
"commands": [
"localisation"
]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sentry-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
SENTRY_URL: https://sentry.ppy.sh/
with:
environment: production
version: ${{ github.ref }}
version: osu@${{ github.ref_name }}
2 changes: 1 addition & 1 deletion .github/workflows_/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
run: dotnet build -c Debug -warnaserror osu.Desktop.slnf

- name: Test
run: dotnet test $pwd/*.Tests/bin/Debug/*/*.Tests.dll --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx"
run: dotnet test $pwd/**/*.Tests/bin/Debug/*/*.Tests.dll --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx"
shell: pwsh

# Attempt to upload results even if test fails.
Expand Down
15 changes: 14 additions & 1 deletion Mvis.Plugin.CollectionSupport/CollectionHepler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Audio;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Game;
using osu.Game.Beatmaps;
using osu.Game.Collections;
using osu.Game.Overlays;
using osu.Game.Screens.LLin.Misc;
using osu.Game.Screens.LLin.Plugins;
using osu.Game.Screens.LLin.Plugins.Config;
using osu.Game.Screens.LLin.Plugins.Types;
Expand Down Expand Up @@ -260,6 +262,9 @@ private WorkingBeatmap getBeatmap(List<IBeatmapSetInfo> list, WorkingBeatmap pre
return newBeatmap;
}

[Resolved]
private BeatmapHashResolver hashResolver { get; set; }

///<summary>
///用来更新<see cref="beatmapList"/>
///</summary>
Expand All @@ -271,8 +276,16 @@ private void updateBeatmaps(BeatmapCollection collection)

if (collection == null) return;

foreach (var item in collection.Beatmaps)
foreach (string hash in collection.BeatmapHashes)
{
var item = hashResolver.ResolveHash(hash);

if (item == null)
{
Logger.Log($"{hash}解析到的谱面是null,将不会继续处理此Hash");
continue;
}

//获取当前BeatmapSet
var currentSet = item.BeatmapSet;
//进行比对,如果beatmapList中不存在,则添加。
Expand Down
13 changes: 11 additions & 2 deletions Mvis.Plugin.CollectionSupport/Sidebar/BeatmapPiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
Expand Down Expand Up @@ -129,14 +130,14 @@ private void load()
{
new OsuSpriteText
{
Text = Beatmap.Metadata.TitleUnicode,
Text = getRomanisableStringFor(Beatmap.Metadata.TitleUnicode, Beatmap.Metadata.Title),
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 20),
RelativeSizeAxes = Axes.X,
Truncate = true
},
new OsuSpriteText
{
Text = Beatmap.Metadata.ArtistUnicode,
Text = getRomanisableStringFor(Beatmap.Metadata.ArtistUnicode, Beatmap.Metadata.Artist),
Font = OsuFont.GetFont(weight: FontWeight.Bold),
RelativeSizeAxes = Axes.X,
Truncate = true
Expand Down Expand Up @@ -174,6 +175,14 @@ private void load()
}, true);
}

private RomanisableString getRomanisableStringFor(string original, string romanised)
{
string original1 = string.IsNullOrEmpty(original) ? romanised : original;
string romanised1 = string.IsNullOrEmpty(romanised) ? original : romanised;

return new RomanisableString(original, romanised1);
}

private void OnActiveChanged(ValueChangedEvent<bool> v)
{
switch (v.NewValue)
Expand Down
9 changes: 8 additions & 1 deletion Mvis.Plugin.CollectionSupport/Sidebar/CollectionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.LLin.Misc;
using osuTK;

namespace Mvis.Plugin.CollectionSupport.Sidebar
Expand Down Expand Up @@ -116,6 +117,9 @@ protected override void LoadComplete()
collection.BindValueChanged(OnCollectionChanged);
}

[Resolved]
private BeatmapHashResolver hashResolver { get; set; }

private void OnCollectionChanged(ValueChangedEvent<BeatmapCollection> v)
{
var c = v.NewValue;
Expand All @@ -129,8 +133,11 @@ private void OnCollectionChanged(ValueChangedEvent<BeatmapCollection> v)
beatmapSets.Clear();

//From CollectionHelper.cs
foreach (var item in c.Beatmaps)
foreach (string hash in c.BeatmapHashes)
{
var item = hashResolver.ResolveHash(hash);
if (item == null) continue;

//获取当前BeatmapSet
var currentSet = item.BeatmapSet;

Expand Down
9 changes: 8 additions & 1 deletion Mvis.Plugin.CollectionSupport/Sidebar/CollectionPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,18 @@ private void onStateChanged(ValueChangedEvent<ActiveState> v)
}
}

[Resolved]
private BeatmapHashResolver hashResolver { get; set; }

private void sortBeatmapCollection()
{
//From CollectionHelper.cs
foreach (var item in Collection.Beatmaps)
foreach (string hash in Collection.BeatmapHashes)
{
var item = hashResolver.ResolveHash(hash);

if (item == null) continue;

//获取当前BeatmapSet
var currentSet = item.BeatmapSet;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Collections;
using osu.Game.Graphics.Containers;
using osu.Game.Screens.LLin;
Expand Down Expand Up @@ -133,6 +134,9 @@ private void updateSelectedPanel(ValueChangedEvent<CollectionPanel> v)
selectedpanel = v.NewValue;
}

[Resolved]
private BeatmapManager bm { get; set; }

private void searchForCurrentSelection()
{
prevPanel?.Reset(true);
Expand All @@ -144,7 +148,7 @@ private void searchForCurrentSelection()
}

if (selectedpanel != null
&& collectionHelper.CurrentCollection.Value.Beatmaps.Count != 0)
&& collectionHelper.CurrentCollection.Value.BeatmapHashes.Count != 0)
selectedpanel.State.Value = ActiveState.Active;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 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.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
Expand Down Expand Up @@ -41,7 +42,7 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
return new[] { new EmptyFreeformModAutoplay() };

default:
return new Mod[] { null };
return Array.Empty<Mod>();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 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.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
Expand Down Expand Up @@ -37,7 +38,7 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
return new[] { new PippidonModAutoplay() };

default:
return new Mod[] { null };
return Array.Empty<Mod>();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 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.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
Expand Down Expand Up @@ -34,7 +35,7 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
return new[] { new EmptyScrollingModAutoplay() };

default:
return new Mod[] { null };
return Array.Empty<Mod>();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 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.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
Expand Down Expand Up @@ -34,7 +35,7 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
return new[] { new PippidonModAutoplay() };

default:
return new Mod[] { null };
return Array.Empty<Mod>();
}
}

Expand Down
4 changes: 2 additions & 2 deletions osu.Android.props
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
<Reference Include="Java.Interop" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.527.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.616.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. -->
<PackageReference Include="Realm" Version="10.11.2" />
<PackageReference Include="Realm" Version="10.14.0" />
</ItemGroup>
</Project>
13 changes: 11 additions & 2 deletions osu.Android/osu.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\osu.Android.props" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
Expand All @@ -13,12 +13,17 @@
<AssemblyName>osu.Android</AssemblyName>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<AndroidSupportedAbis>armeabi-v7a;x86;arm64-v8a</AndroidSupportedAbis>
<EnableLLVM>false</EnableLLVM> <!-- This currently causes random lockups during gameplay. https://github.com/mono/mono/issues/18973 -->
<EnableLLVM>false</EnableLLVM>
<!-- This currently causes random lockups during gameplay. https://github.com/mono/mono/issues/18973 -->
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<MandroidI18n>cjk;mideast;other;rare;west</MandroidI18n>
<AndroidDexTool>d8</AndroidDexTool>
<AndroidLinkTool>r8</AndroidLinkTool>
<AotAssemblies>false</AotAssemblies>
<EnableLLVM>false</EnableLLVM>
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
<BundleAssemblies>false</BundleAssemblies>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AndroidLinkMode>None</AndroidLinkMode>
Expand All @@ -39,6 +44,10 @@
<Project>{c5bddb48-6717-4830-bd88-d130421149b0}</Project>
<Name>osu.Framework.Android</Name>
</ProjectReference>
<ProjectReference Include="..\..\osu-framework\osu.Framework\osu.Framework.csproj">
<Project>{c5bddb48-6711-4830-bd88-d130421149b0}</Project>
<Name>osu.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\M.Resources\M.Resources.csproj">
<Project>{0b00e068-854f-4e2b-826e-d6c1cfc02490}</Project>
<Name>M.Resources</Name>
Expand Down
46 changes: 43 additions & 3 deletions osu.Desktop/DiscordRichPresence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Logging;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Extensions;
using osu.Game.Online.API;
Expand All @@ -30,6 +31,9 @@ internal class DiscordRichPresence : Component

private IBindable<APIUser> user;

[Resolved]
private IAPIProvider api { get; set; }

private readonly IBindable<UserStatus> status = new Bindable<UserStatus>();
private readonly IBindable<UserActivity> activity = new Bindable<UserActivity>();

Expand All @@ -41,7 +45,7 @@ internal class DiscordRichPresence : Component
};

[BackgroundDependencyLoader]
private void load(IAPIProvider provider, OsuConfigManager config)
private void load(OsuConfigManager config)
{
client = new DiscordRpcClient(client_id)
{
Expand All @@ -57,7 +61,8 @@ private void load(IAPIProvider provider, OsuConfigManager config)

config.BindWith(OsuSetting.DiscordRichPresence, privacyMode);

(user = provider.LocalUser.GetBoundCopy()).BindValueChanged(u =>
user = api.LocalUser.GetBoundCopy();
user.BindValueChanged(u =>
{
status.UnbindBindings();
status.BindTo(u.NewValue.Status);
Expand Down Expand Up @@ -95,6 +100,22 @@ private void updateStatus()
{
presence.State = truncate(activity.Value.Status);
presence.Details = truncate(getDetails(activity.Value));

if (getBeatmap(activity.Value) is IBeatmapInfo beatmap && beatmap.OnlineID > 0)
{
presence.Buttons = new[]
{
new Button
{
Label = "View beatmap",
Url = $@"{api.WebsiteRootUrl}/beatmapsets/{beatmap.BeatmapSet?.OnlineID}#{ruleset.Value.ShortName}/{beatmap.OnlineID}"
}
};
}
else
{
presence.Buttons = null;
}
}
else
{
Expand All @@ -106,7 +127,12 @@ private void updateStatus()
if (privacyMode.Value == DiscordRichPresenceMode.Limited)
presence.Assets.LargeImageText = string.Empty;
else
presence.Assets.LargeImageText = $"{user.Value.Username}" + (user.Value.Statistics?.GlobalRank > 0 ? $" (全球排名 #{user.Value.Statistics.GlobalRank:N0})" : string.Empty);
{
if (user.Value.RulesetsStatistics != null && user.Value.RulesetsStatistics.TryGetValue(ruleset.Value.ShortName, out UserStatistics statistics))
presence.Assets.LargeImageText = $"{user.Value.Username}" + (statistics.GlobalRank > 0 ? $" (全球排名#{statistics.GlobalRank:N0})" : string.Empty);
else
presence.Assets.LargeImageText = $"{user.Value.Username}" + (user.Value.Statistics?.GlobalRank > 0 ? $" (全球排名 #{user.Value.Statistics.GlobalRank:N0})" : string.Empty);
}

// update ruleset
presence.Assets.SmallImageKey = ruleset.Value.IsLegacyRuleset() ? $"mode_{ruleset.Value.OnlineID}" : "mode_custom";
Expand Down Expand Up @@ -136,6 +162,20 @@ private string truncate(string str)
});
}

private IBeatmapInfo getBeatmap(UserActivity activity)
{
switch (activity)
{
case UserActivity.InGame game:
return game.BeatmapInfo;

case UserActivity.Editing edit:
return edit.BeatmapInfo;
}

return null;
}

private string getDetails(UserActivity activity)
{
switch (activity)
Expand Down
Loading

0 comments on commit bdb4ac7

Please sign in to comment.