Skip to content

Commit

Permalink
Merge pull request #365 from peppy/general-fixes
Browse files Browse the repository at this point in the history
Better screen hierarchy
  • Loading branch information
Tom94 authored Feb 18, 2017
2 parents 6a58d7a + cf8b6c0 commit 7a29603
Show file tree
Hide file tree
Showing 52 changed files with 377 additions and 216 deletions.
2 changes: 1 addition & 1 deletion osu-framework
Submodule osu-framework updated 31 files
+1 −1 osu.Framework.VisualTests/Benchmark.cs
+1 −1 osu.Framework.VisualTests/Tests/TestCaseAutosize.cs
+1 −1 osu.Framework.VisualTests/Tests/TestCaseCheckBoxes.cs
+1 −1 osu.Framework.VisualTests/Tests/TestCaseColourGradient.cs
+1 −1 osu.Framework.VisualTests/Tests/TestCaseDrawablePath.cs
+3 −3 osu.Framework.VisualTests/Tests/TestCaseDropDownBox.cs
+1 −1 osu.Framework.VisualTests/Tests/TestCaseFillModes.cs
+1 −1 osu.Framework.VisualTests/Tests/TestCaseMasking.cs
+1 −1 osu.Framework.VisualTests/Tests/TestCaseNestedHover.cs
+2 −1 osu.Framework.VisualTests/Tests/TestCaseOnlineTextures.cs
+1 −1 osu.Framework.VisualTests/Tests/TestCasePadding.cs
+13 −13 osu.Framework.VisualTests/Tests/TestCaseScreen.cs
+38 −1 osu.Framework.VisualTests/Tests/TestCaseScrollableFlow.cs
+1 −1 osu.Framework.VisualTests/Tests/TestCaseSliderbar.cs
+1 −1 osu.Framework.VisualTests/Tests/TestCaseSmoothedEdges.cs
+2 −1 osu.Framework.VisualTests/Tests/TestCaseSpriteText.cs
+1 −1 osu.Framework.VisualTests/Tests/TestCaseTextBox.cs
+2 −2 osu.Framework.VisualTests/Tests/TestCaseTriangles.cs
+1 −1 osu.Framework.VisualTests/VisualTestGame.cs
+1 −1 osu.Framework.VisualTests/osu.Framework.VisualTests.csproj
+0 −5 osu.Framework/Graphics/Containers/Container.cs
+4 −4 osu.Framework/Graphics/Containers/Container_AutoSize.cs
+1 −1 osu.Framework/Graphics/Containers/FlowContainer.cs
+2 −0 osu.Framework/Graphics/Containers/OverlayContainer.cs
+5 −1 osu.Framework/Graphics/Containers/ScrollContainer.cs
+1 −0 osu.Framework/Graphics/UserInterface/DropDownMenu.cs
+1 −1 osu.Framework/Graphics/Visualisation/TreeContainer.cs
+63 −48 osu.Framework/Screens/Screen.cs
+11 −7 osu.Framework/Screens/Testing/TestBrowser.cs
+3 −3 osu.Framework/Screens/Testing/TestCase.cs
+3 −3 osu.Framework/osu.Framework.csproj
2 changes: 1 addition & 1 deletion osu.Desktop.VisualTests/Benchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Desktop.Platform;
using osu.Framework.GameModes.Testing;
using osu.Framework.Screens.Testing;
using osu.Game;
using osu.Game.Modes;
using osu.Game.Modes.Catch;
Expand Down
2 changes: 1 addition & 1 deletion osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Diagnostics;
using System.Linq;
using osu.Framework;
using osu.Framework.GameModes.Testing;
using osu.Framework.Screens.Testing;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
Expand Down
2 changes: 1 addition & 1 deletion osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System.Collections.Generic;
using osu.Framework.GameModes.Testing;
using osu.Framework.Screens.Testing;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Framework.Timing;
Expand Down
2 changes: 1 addition & 1 deletion osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.Collections.Generic;
using osu.Framework;
using osu.Framework.GameModes.Testing;
using osu.Framework.Screens.Testing;
using osu.Framework.Graphics;
using osu.Framework.Timing;
using OpenTK;
Expand Down
2 changes: 1 addition & 1 deletion osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using osu.Framework.GameModes.Testing;
using osu.Framework.Screens.Testing;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
using OpenTK.Input;
Expand Down
2 changes: 1 addition & 1 deletion osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using osu.Framework.GameModes.Testing;
using osu.Framework.Screens.Testing;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Sprites;
using osu.Game.Screens.Menu;
Expand Down
2 changes: 1 addition & 1 deletion osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using osu.Framework.GameModes.Testing;
using osu.Framework.Screens.Testing;
using osu.Framework.Graphics;
using osu.Framework.Timing;
using osu.Game.Overlays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.GameModes.Testing;
using osu.Framework.Screens.Testing;
using osu.Framework.MathUtils;
using osu.Framework.Timing;
using osu.Game.Overlays;
Expand Down
2 changes: 1 addition & 1 deletion osu.Desktop.VisualTests/Tests/TestCaseOptions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using osu.Framework.GameModes.Testing;
using osu.Framework.Screens.Testing;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
using OpenTK.Input;
Expand Down
2 changes: 1 addition & 1 deletion osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Colour;
using osu.Framework.GameModes.Testing;
using osu.Framework.Screens.Testing;
using osu.Framework.Graphics.UserInterface;

namespace osu.Desktop.VisualTests.Tests
Expand Down
2 changes: 1 addition & 1 deletion osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.Collections.Generic;
using osu.Desktop.VisualTests.Platform;
using osu.Framework.GameModes.Testing;
using osu.Framework.Screens.Testing;
using osu.Game.Database;
using osu.Game.Modes;
using osu.Game.Screens.Select;
Expand Down
4 changes: 2 additions & 2 deletions osu.Desktop.VisualTests/Tests/TestCasePlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.GameModes.Testing;
using osu.Framework.Screens.Testing;
using osu.Framework.MathUtils;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
Expand Down Expand Up @@ -71,7 +71,7 @@ public override void Reset()
Add(new Box
{
RelativeSizeAxes = Framework.Graphics.Axes.Both,
Colour = Color4.Gray,
Colour = Color4.Black,
});

Add(new Player
Expand Down
2 changes: 1 addition & 1 deletion osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System;
using osu.Framework.GameModes.Testing;
using osu.Framework.Screens.Testing;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.MathUtils;
Expand Down
2 changes: 1 addition & 1 deletion osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System;
using osu.Framework.GameModes.Testing;
using osu.Framework.Screens.Testing;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.MathUtils;
Expand Down
2 changes: 1 addition & 1 deletion osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using osu.Framework.GameModes.Testing;
using osu.Framework.Screens.Testing;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
Expand Down
4 changes: 2 additions & 2 deletions osu.Desktop.VisualTests/VisualTestGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using osu.Framework;
using osu.Framework.GameModes.Testing;
using osu.Framework.Screens.Testing;
using osu.Framework.Graphics.Cursor;
using osu.Game.Database;
using osu.Game;
Expand All @@ -21,7 +21,7 @@ protected override void LoadComplete()
{
base.LoadComplete();

(new BackgroundModeDefault() { Depth = 10 }).Preload(this, AddInternal);
(new BackgroundScreenDefault() { Depth = 10 }).Preload(this, AddInternal);

// Have to construct this here, rather than in the constructor, because
// we depend on some dependencies to be loaded within OsuGameBase.load().
Expand Down
14 changes: 12 additions & 2 deletions osu.Desktop/OsuGameDesktop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,32 @@
using osu.Desktop.Overlays;
using System.Reflection;
using System.Drawing;
using osu.Game.Screens.Menu;

namespace osu.Desktop
{
class OsuGameDesktop : OsuGame
{
private VersionManager versionManager;

public override bool IsDeployedBuild => versionManager.IsDeployedBuild;

public OsuGameDesktop(string[] args = null)
: base(args)
{

versionManager = new VersionManager { Depth = int.MinValue };
}

protected override void LoadComplete()
{
base.LoadComplete();

(new VersionManager()).Preload(this, Add);
versionManager.Preload(this);
ModeChanged += m =>
{
if (!versionManager.IsAlive && m is Intro)
Add(versionManager);
};
}

public override void SetHost(BasicGameHost host)
Expand Down
9 changes: 6 additions & 3 deletions osu.Desktop/Overlays/VersionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public class VersionManager : OverlayContainer
private UpdateManager updateManager;
private NotificationManager notification;

AssemblyName assembly = Assembly.GetEntryAssembly().GetName();

public bool IsDeployedBuild => assembly.Version.Major > 0;

protected override bool HideOnEscape => false;

public override bool HandleInput => false;
Expand All @@ -40,14 +44,13 @@ private void load(NotificationManager notification, OsuColour colours, TextureSt
bool isDebug = false;
Debug.Assert(isDebug = true);

var asm = Assembly.GetEntryAssembly().GetName();
string version;
if (asm.Version.Major == 0)
if (!IsDeployedBuild)
{
version = @"local " + (isDebug ? @"debug" : @"release");
}
else
version = $@"{asm.Version.Major}.{asm.Version.Minor}.{asm.Version.Build}";
version = $@"{assembly.Version.Major}.{assembly.Version.Minor}.{assembly.Version.Build}";

Children = new Drawable[]
{
Expand Down
6 changes: 3 additions & 3 deletions osu.Game.Modes.Osu/Objects/Slider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ public override void SetDefaultsFromBeatmap(Beatmap beatmap)
ControlPoint overridePoint;
ControlPoint timingPoint = beatmap.TimingPointAt(StartTime, out overridePoint);
var velocityAdjustment = overridePoint?.VelocityAdjustment ?? 1;
var baseVelocity = 100 * baseDifficulty.SliderMultiplier;
var baseVelocity = 100 * baseDifficulty.SliderMultiplier / velocityAdjustment;

Velocity = baseVelocity / (timingPoint.BeatLength * velocityAdjustment);
TickDistance = baseVelocity / (baseDifficulty.SliderTickRate * velocityAdjustment);
Velocity = baseVelocity / timingPoint.BeatLength;
TickDistance = baseVelocity / baseDifficulty.SliderTickRate;
}

public int RepeatCount = 1;
Expand Down
18 changes: 6 additions & 12 deletions osu.Game/Beatmaps/Beatmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ public ControlPoint TimingPointAt(double time, out ControlPoint overridePoint)
ControlPoint timingPoint = null;
foreach (var controlPoint in ControlPoints)
{
if (controlPoint.Time <= time)
// Some beatmaps have the first timingPoint (accidentally) start after the first HitObject(s).
// This null check makes it so that the first ControlPoint that makes a timing change is used as
// the timingPoint for those HitObject(s).
if (controlPoint.Time <= time || timingPoint == null)
{
if (controlPoint.TimingChange)
{
Expand All @@ -49,19 +52,10 @@ public ControlPoint TimingPointAt(double time, out ControlPoint overridePoint)
}
else overridePoint = controlPoint;
}
// Some beatmaps have the first timingPoint (accidentally) start after the first HitObject(s).
// This branch makes it so that the first ControlPoint that makes a timing change is used as the timingPoint for the HitObject(s).
else if (timingPoint == null && controlPoint.TimingChange)
{
timingPoint = controlPoint;
}
else
{
break;
}
else break;
}

return timingPoint;
return timingPoint ?? ControlPoint.Default;
}
}
}
13 changes: 7 additions & 6 deletions osu.Game/Beatmaps/Timing/ControlPoint.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace osu.Game.Beatmaps.Timing
{
public class ControlPoint
{
public static ControlPoint Default = new ControlPoint
{
BeatLength = 500,
TimingChange = true,
};

public double Time;
public double BeatLength;
public double VelocityAdjustment;
public bool TimingChange;

}

internal enum TimeSignatures
Expand Down
1 change: 1 addition & 0 deletions osu.Game/Online/Chat/Drawables/ChannelDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public ChannelDisplay(Channel channel)
},
new ScrollContainer
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
flow = new FlowContainer
Expand Down
Loading

0 comments on commit 7a29603

Please sign in to comment.