1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 19:35:15 +08:00

Merge remote-tracking branch 'origin/master' into diffcalc-fixes

This commit is contained in:
smoogipoo 2019-01-20 13:27:42 +09:00
commit 3db23898df
12 changed files with 191 additions and 117 deletions

View File

@ -11,25 +11,70 @@ We are accepting bug reports (please report with as much detail as possible). Fe
# Requirements # Requirements
- A desktop platform with the [.NET Core SDK 2.2](https://www.microsoft.com/net/learn/get-started) or higher installed. - A desktop platform with the [.NET Core SDK 2.2](https://www.microsoft.com/net/learn/get-started) or higher installed.
- When working with the codebase, we recommend using an IDE with intellisense and syntax highlighting, such as [Visual Studio Community Edition](https://www.visualstudio.com/) (Windows), [Visual Studio Code](https://code.visualstudio.com/) (with the C# plugin installed) or [Jetbrains Rider](https://www.jetbrains.com/rider/) (commercial). - When working with the codebase, we recommend using an IDE with intellisense and syntax highlighting, such as [Visual Studio 2017+](https://visualstudio.microsoft.com/vs/), [Jetbrains Rider](https://www.jetbrains.com/rider/) or [Visual Studio Code](https://code.visualstudio.com/).
# Building and running # Running osu!
If you are not interested in developing the game, please head over to the [releases](https://github.com/ppy/osu/releases) to download a precompiled build with automatic updating enabled (download and run the install executable for your platform). ## Releases
Clone the repository including submodules If you are not interested in developing the game, please head over to the [releases](https://github.com/ppy/osu/releases) to download a precompiled build with automatic updating enabled.
`git clone --recurse-submodules https://github.com/ppy/osu` - Windows (x64) users should download and run `install.exe`.
- macOS users (10.12 "Sierra" and higher) should download and run `osu.app.zip`.
- iOS users can join the [TestFlight beta program](https://t.co/xQJmHkfC18).
Build and run If your platform is not listed above, there is still a chance you can manually build it by following the instructions below.
- Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included) ## Downloading the source code
- From command line using `dotnet run --project osu.Desktop`. When building for non-development purposes, add `-c Release` to gain higher performance.
- To run with code analysis, instead use `powershell ./build.ps1` or `build.sh`. This is currently only supported under windows due to [resharper cli shortcomings](https://youtrack.jetbrains.com/issue/RSRP-410004). Alternative, you can install resharper or use rider to get inline support in your IDE of choice.
Note: If you run from command line under linux, you will need to prefix the output folder to your `LD_LIBRARY_PATH`. See `.vscode/launch.json` for an example Clone the repository **including submodules**:
If you run into issues building you may need to restore nuget packages (commonly via `dotnet restore`). Visual Studio Code users must run `Restore` task from debug tab before attempt to build. ```shell
git clone --recurse-submodules https://github.com/ppy/osu
cd osu
```
> If you forgot the `--recurse-submodules` option, run this command inside the `osu` directory:
>
> `git submodule update --init --recursive`
To update the source code to the latest commit, run the following command inside the `osu` directory:
```shell
git pull --recurse-submodules
```
## Building
Build configurations for the recommended IDEs (listed above) are included. You should use the provided Build/Run functionality of your IDE to get things going. When testing or building new components, it's highly encouraged you use the `VisualTests` project/configuration. More information on this provided below.
> Visual Studio Code users must run the `Restore` task before any build attempt.
You can also build and run osu! from the command-line with a single command:
```shell
dotnet run --project osu.Desktop
```
If you are not interested in debugging osu!, you can add `-c Release` to gain performance. In this case, you must replace `Debug` with `Release` in any commands mentioned in this document.
If the build fails, try to restore nuget packages with `dotnet restore`.
### A note for Linux users
On Linux, the environment variable `LD_LIBRARY_PATH` must point to the build directory, located at `osu.Desktop/bin/Debug/$NETCORE_VERSION`.
`$NETCORE_VERSION` is the version of .NET Core SDK. You can have it with `grep TargetFramework osu.Desktop/osu.Desktop.csproj | sed -r 's/.*>(.*)<\/.*/\1/'`.
For example, you can run osu! with the following command:
```shell
LD_LIBRARY_PATH="$(pwd)/osu.Desktop/bin/Debug/netcoreapp2.2" dotnet run --project osu.Desktop
```
## Code analysis
Code analysis can be run with `powershell ./build.ps1` or `build.sh`. This is currently only supported under windows due to [resharper cli shortcomings](https://youtrack.jetbrains.com/issue/RSRP-410004). Alternative, you can install resharper or use rider to get inline support in your IDE of choice.
# Contributing # Contributing

View File

@ -57,6 +57,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty
s.Process(h); s.Process(h);
} }
// The peak strain will not be saved for the last section in the above loop
foreach (Skill s in skills)
s.SaveCurrentPeak();
double aimRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier; double aimRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier;
double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier; double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier;
double starRating = aimRating + speedRating + Math.Abs(aimRating - speedRating) / 2; double starRating = aimRating + speedRating + Math.Abs(aimRating - speedRating) / 2;

View File

@ -28,6 +28,8 @@ namespace osu.Game.Graphics.Containers
private readonly Container content; private readonly Container content;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
private readonly Container sizableContainer; private readonly Container sizableContainer;
private Drawable backgroundLayer; private Drawable backgroundLayer;
@ -41,7 +43,7 @@ namespace osu.Game.Graphics.Containers
this.targetMode = targetMode; this.targetMode = targetMode;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
InternalChild = sizableContainer = new Container InternalChild = sizableContainer = new AlwaysInputContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Both, RelativePositionAxes = Axes.Both,
@ -55,6 +57,8 @@ namespace osu.Game.Graphics.Containers
private readonly bool applyUIScale; private readonly bool applyUIScale;
private Bindable<float> uiScale; private Bindable<float> uiScale;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
public ScalingDrawSizePreservingFillContainer(bool applyUIScale) public ScalingDrawSizePreservingFillContainer(bool applyUIScale)
{ {
this.applyUIScale = applyUIScale; this.applyUIScale = applyUIScale;
@ -143,5 +147,15 @@ namespace osu.Game.Graphics.Containers
sizableContainer.MoveTo(targetPosition, 500, Easing.OutQuart); sizableContainer.MoveTo(targetPosition, 500, Easing.OutQuart);
sizableContainer.ResizeTo(targetSize, 500, Easing.OutQuart).OnComplete(_ => { sizableContainer.Masking = requiresMasking; }); sizableContainer.ResizeTo(targetSize, 500, Easing.OutQuart).OnComplete(_ => { sizableContainer.Masking = requiresMasking; });
} }
private class AlwaysInputContainer : Container
{
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
public AlwaysInputContainer()
{
RelativeSizeAxes = Axes.Both;
}
}
} }
} }

View File

@ -92,6 +92,12 @@ namespace osu.Game.Graphics.UserInterface
AccentColour = colours.Pink; AccentColour = colours.Pink;
} }
protected override void LoadComplete()
{
updateTooltipText(Current.Value);
base.LoadComplete();
}
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
Nub.Glowing = true; Nub.Glowing = true;

View File

@ -5,7 +5,6 @@ using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Input.Events;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -78,66 +77,15 @@ namespace osu.Game.Overlays.Settings.Sections.Input
private class SensitivitySetting : SettingsSlider<double, SensitivitySlider> private class SensitivitySetting : SettingsSlider<double, SensitivitySlider>
{ {
public override Bindable<double> Bindable
{
get { return ((SensitivitySlider)Control).Sensitivity; }
set
{
BindableDouble doubleValue = (BindableDouble)value;
// create a second layer of bindable so we can only handle state changes when not being dragged.
((SensitivitySlider)Control).Sensitivity = doubleValue;
// this bindable will still act as the "interactive" bindable displayed during a drag.
base.Bindable = new BindableDouble(doubleValue.Value)
{
Default = doubleValue.Default,
MinValue = doubleValue.MinValue,
MaxValue = doubleValue.MaxValue
};
// one-way binding to update the sliderbar with changes from external actions.
doubleValue.DisabledChanged += disabled => base.Bindable.Disabled = disabled;
doubleValue.ValueChanged += newValue => base.Bindable.Value = newValue;
}
}
public SensitivitySetting() public SensitivitySetting()
{ {
KeyboardStep = 0.01f; KeyboardStep = 0.01f;
TransferValueOnCommit = true;
} }
} }
private class SensitivitySlider : OsuSliderBar<double> private class SensitivitySlider : OsuSliderBar<double>
{ {
public Bindable<double> Sensitivity;
public SensitivitySlider()
{
Current.ValueChanged += newValue =>
{
if (!isDragging && Sensitivity != null)
Sensitivity.Value = newValue;
};
}
private bool isDragging;
protected override bool OnDragStart(DragStartEvent e)
{
isDragging = true;
return base.OnDragStart(e);
}
protected override bool OnDragEnd(DragEndEvent e)
{
isDragging = false;
Current.TriggerChange();
return base.OnDragEnd(e);
}
public override string TooltipText => Current.Disabled ? "Enable raw input to adjust sensitivity" : Current.Value.ToString(@"0.##x"); public override string TooltipText => Current.Disabled ? "Enable raw input to adjust sensitivity" : Current.Value.ToString(@"0.##x");
} }
} }

View File

@ -2,10 +2,14 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Framework.Threading; using osu.Framework.Threading;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Backgrounds;
using osu.Game.Online.API;
using osu.Game.Skinning;
using osu.Game.Users;
namespace osu.Game.Screens.Backgrounds namespace osu.Game.Screens.Backgrounds
{ {
@ -16,11 +20,21 @@ namespace osu.Game.Screens.Backgrounds
private string backgroundName => $@"Menu/menu-background-{currentDisplay % background_count + 1}"; private string backgroundName => $@"Menu/menu-background-{currentDisplay % background_count + 1}";
private Bindable<User> user;
private Bindable<Skin> skin;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load(IAPIProvider api, SkinManager skinManager)
{ {
user = api.LocalUser.GetBoundCopy();
skin = skinManager.CurrentSkin.GetBoundCopy();
user.ValueChanged += _ => Next();
skin.ValueChanged += _ => Next();
currentDisplay = RNG.Next(0, background_count); currentDisplay = RNG.Next(0, background_count);
display(new Background(backgroundName));
Next();
} }
private void display(Background newBackground) private void display(Background newBackground)
@ -39,8 +53,33 @@ namespace osu.Game.Screens.Backgrounds
nextTask?.Cancel(); nextTask?.Cancel();
nextTask = Scheduler.AddDelayed(() => nextTask = Scheduler.AddDelayed(() =>
{ {
LoadComponentAsync(new Background(backgroundName) { Depth = currentDisplay }, display); Background background;
if (user.Value?.IsSupporter ?? false)
background = new SkinnedBackground(skin.Value, backgroundName);
else
background = new Background(backgroundName);
background.Depth = currentDisplay;
LoadComponentAsync(background, display);
}, 100); }, 100);
} }
private class SkinnedBackground : Background
{
private readonly Skin skin;
public SkinnedBackground(Skin skin, string fallbackTextureName) : base(fallbackTextureName)
{
this.skin = skin;
}
[BackgroundDependencyLoader]
private void load()
{
Sprite.Texture = skin.GetTexture("menu-background") ?? Sprite.Texture;
}
}
} }
} }

View File

@ -93,10 +93,14 @@ namespace osu.Game.Screens.Multi.Lounge.Components
Host.BindValueChanged(v => Host.BindValueChanged(v =>
{ {
hostText.Clear(); hostText.Clear();
flagContainer.Clear();
if (v != null)
{
hostText.AddText("hosted by "); hostText.AddText("hosted by ");
hostText.AddLink(v.Username, null, LinkAction.OpenUserProfile, v.Id.ToString(), "Open profile", s => s.Font = "Exo2.0-BoldItalic"); hostText.AddLink(v.Username, null, LinkAction.OpenUserProfile, v.Id.ToString(), "Open profile", s => s.Font = "Exo2.0-BoldItalic");
flagContainer.Child = new DrawableFlag(v.Country) { RelativeSizeAxes = Axes.Both }; flagContainer.Child = new DrawableFlag(v.Country) { RelativeSizeAxes = Axes.Both };
}
}); });
ParticipantCount.BindValueChanged(v => summary.Text = $"{v:#,0}{" participant".Pluralize(v == 1)}"); ParticipantCount.BindValueChanged(v => summary.Text = $"{v:#,0}{" participant".Pluralize(v == 1)}");

View File

@ -266,7 +266,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
private void updateParticipants() private void updateParticipants()
{ {
var roomId = room.RoomID.Value ?? 0; var roomId = room?.RoomID.Value ?? 0;
request?.Cancel(); request?.Cancel();
@ -297,6 +297,12 @@ namespace osu.Game.Screens.Multi.Lounge.Components
api.Queue(request); api.Queue(request);
} }
protected override void Dispose(bool isDisposing)
{
request?.Cancel();
base.Dispose(isDisposing);
}
private class UserTile : CompositeDrawable, IHasTooltip private class UserTile : CompositeDrawable, IHasTooltip
{ {
private readonly User user; private readonly User user;

View File

@ -51,6 +51,8 @@ namespace osu.Game.Screens.Multi.Match
MatchChatDisplay chat; MatchChatDisplay chat;
Components.Header header; Components.Header header;
Info info;
GridContainer bottomRow;
MatchSettingsOverlay settings; MatchSettingsOverlay settings;
Children = new Drawable[] Children = new Drawable[]
@ -61,10 +63,10 @@ namespace osu.Game.Screens.Multi.Match
Content = new[] Content = new[]
{ {
new Drawable[] { header = new Components.Header(room) { Depth = -1 } }, new Drawable[] { header = new Components.Header(room) { Depth = -1 } },
new Drawable[] { new Info(room) { OnStart = onStart } }, new Drawable[] { info = new Info(room) { OnStart = onStart } },
new Drawable[] new Drawable[]
{ {
new GridContainer bottomRow = new GridContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Content = new[] Content = new[]
@ -109,10 +111,19 @@ namespace osu.Game.Screens.Multi.Match
header.OnRequestSelectBeatmap = () => Push(new MatchSongSelect { Selected = addPlaylistItem }); header.OnRequestSelectBeatmap = () => Push(new MatchSongSelect { Selected = addPlaylistItem });
header.Tabs.Current.ValueChanged += t => header.Tabs.Current.ValueChanged += t =>
{ {
const float fade_duration = 500;
if (t is SettingsMatchPage) if (t is SettingsMatchPage)
{
settings.Show(); settings.Show();
info.FadeOut(fade_duration, Easing.OutQuint);
bottomRow.FadeOut(fade_duration, Easing.OutQuint);
}
else else
{
settings.Hide(); settings.Hide();
info.FadeIn(fade_duration, Easing.OutQuint);
bottomRow.FadeIn(fade_duration, Easing.OutQuint);
}
}; };
chat.Exit += Exit; chat.Exit += Exit;

View File

@ -53,10 +53,8 @@ namespace osu.Game.Screens.Multi
Duration.UnbindFrom(room.Duration); Duration.UnbindFrom(room.Duration);
} }
room = value; room = value ?? new Room();
if (room != null)
{
RoomID.BindTo(room.RoomID); RoomID.BindTo(room.RoomID);
Name.BindTo(room.Name); Name.BindTo(room.Name);
Host.BindTo(room.Host); Host.BindTo(room.Host);
@ -71,7 +69,6 @@ namespace osu.Game.Screens.Multi
Duration.BindTo(room.Duration); Duration.BindTo(room.Duration);
} }
} }
}
private void updatePlaylist() private void updatePlaylist()
{ {

View File

@ -24,8 +24,6 @@ namespace osu.Game.Screens.Play
{ {
private const int duration = 100; private const int duration = 100;
private readonly Container content;
public readonly KeyCounterCollection KeyCounter; public readonly KeyCounterCollection KeyCounter;
public readonly RollingCounter<int> ComboCounter; public readonly RollingCounter<int> ComboCounter;
public readonly ScoreCounter ScoreCounter; public readonly ScoreCounter ScoreCounter;
@ -37,6 +35,7 @@ namespace osu.Game.Screens.Play
public readonly PlayerSettingsOverlay PlayerSettingsOverlay; public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
private Bindable<bool> showHud; private Bindable<bool> showHud;
private readonly Container visibilityContainer;
private readonly BindableBool replayLoaded = new BindableBool(); private readonly BindableBool replayLoaded = new BindableBool();
private static bool hasShownNotificationOnce; private static bool hasShownNotificationOnce;
@ -45,12 +44,12 @@ namespace osu.Game.Screens.Play
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Add(content = new Container
{
RelativeSizeAxes = Axes.Both,
AlwaysPresent = true, // The hud may be hidden but certain elements may need to still be updated
Children = new Drawable[] Children = new Drawable[]
{ {
visibilityContainer = new Container {
RelativeSizeAxes = Axes.Both,
AlwaysPresent = true, // The hud may be hidden but certain elements may need to still be updated
Children = new Drawable[] {
ComboCounter = CreateComboCounter(), ComboCounter = CreateComboCounter(),
ScoreCounter = CreateScoreCounter(), ScoreCounter = CreateScoreCounter(),
AccuracyCounter = CreateAccuracyCounter(), AccuracyCounter = CreateAccuracyCounter(),
@ -58,6 +57,8 @@ namespace osu.Game.Screens.Play
Progress = CreateProgress(), Progress = CreateProgress(),
ModDisplay = CreateModsContainer(), ModDisplay = CreateModsContainer(),
PlayerSettingsOverlay = CreatePlayerSettingsOverlay(), PlayerSettingsOverlay = CreatePlayerSettingsOverlay(),
}
},
new FillFlowContainer new FillFlowContainer
{ {
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
@ -71,8 +72,7 @@ namespace osu.Game.Screens.Play
HoldToQuit = CreateHoldForMenuButton(), HoldToQuit = CreateHoldForMenuButton(),
} }
} }
} };
});
BindProcessor(scoreProcessor); BindProcessor(scoreProcessor);
BindRulesetContainer(rulesetContainer); BindRulesetContainer(rulesetContainer);
@ -91,7 +91,7 @@ namespace osu.Game.Screens.Play
private void load(OsuConfigManager config, NotificationOverlay notificationOverlay) private void load(OsuConfigManager config, NotificationOverlay notificationOverlay)
{ {
showHud = config.GetBindable<bool>(OsuSetting.ShowInterface); showHud = config.GetBindable<bool>(OsuSetting.ShowInterface);
showHud.ValueChanged += hudVisibility => content.FadeTo(hudVisibility ? 1 : 0, duration); showHud.ValueChanged += hudVisibility => visibilityContainer.FadeTo(hudVisibility ? 1 : 0, duration);
showHud.TriggerChange(); showHud.TriggerChange();
if (!showHud && !hasShownNotificationOnce) if (!showHud && !hasShownNotificationOnce)

View File

@ -18,7 +18,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="ppy.osu.Framework" Version="2019.116.0" /> <PackageReference Include="ppy.osu.Framework" Version="2019.117.0" />
<PackageReference Include="SharpCompress" Version="0.22.0" /> <PackageReference Include="SharpCompress" Version="0.22.0" />
<PackageReference Include="NUnit" Version="3.11.0" /> <PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" /> <PackageReference Include="SharpRaven" Version="2.4.0" />