ingame options basic logic

This commit is contained in:
EVAST9919 2017-05-17 10:36:57 +03:00
parent 5fb8830e3a
commit 1a4025ab3c
8 changed files with 137 additions and 0 deletions

View File

@ -0,0 +1,29 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Overlays;
using osu.Game.Screens.Play.Options;
namespace osu.Desktop.VisualTests.Tests
{
internal class TestCaseOptionsContainer : TestCase
{
public override string Description => @"Setting visible in replay/auto";
public override void Reset()
{
base.Reset();
Add(new OptionsDisplay()
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
});
}
}
}

View File

@ -196,6 +196,7 @@
<Compile Include="Tests\TestCaseMusicController.cs" />
<Compile Include="Tests\TestCaseNotificationManager.cs" />
<Compile Include="Tests\TestCaseOnScreenDisplay.cs" />
<Compile Include="Tests\TestCaseOptionsContainer.cs" />
<Compile Include="Tests\TestCasePlayer.cs" />
<Compile Include="Tests\TestCaseHitObjects.cs" />
<Compile Include="Tests\TestCaseKeyCounter.cs" />

View File

@ -14,6 +14,7 @@ using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Play.HUD;
using OpenTK.Input;
using osu.Game.Screens.Play.Options;
namespace osu.Game.Screens.Play
{
@ -29,6 +30,7 @@ namespace osu.Game.Screens.Play
public readonly HealthDisplay HealthDisplay;
public readonly SongProgress Progress;
public readonly ModDisplay ModDisplay;
public readonly OptionsDisplay OptionsDisplay;
private Bindable<bool> showKeyCounter;
private Bindable<bool> showHud;
@ -42,6 +44,7 @@ namespace osu.Game.Screens.Play
protected abstract HealthDisplay CreateHealthDisplay();
protected abstract SongProgress CreateProgress();
protected abstract ModDisplay CreateModsContainer();
protected abstract OptionsDisplay CreateOptionsDisplay();
protected HUDOverlay()
{
@ -60,6 +63,7 @@ namespace osu.Game.Screens.Play
HealthDisplay = CreateHealthDisplay(),
Progress = CreateProgress(),
ModDisplay = CreateModsContainer(),
OptionsDisplay = CreateOptionsDisplay(),
}
});
}

View File

@ -0,0 +1,59 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Play.Options
{
public abstract class OptionContainer : Container
{
/// <summary>
/// The title of this option.
/// </summary>
public abstract string Title { get; }
public OptionContainer()
{
Masking = true;
Size = new Vector2(200, 100);
CornerRadius = 5;
BorderColour = Color4.Black;
BorderThickness = 2;
Depth = 10;
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0.5f,
},
new OsuSpriteText
{
Origin = Anchor.TopLeft,
Anchor = Anchor.TopLeft,
Text = Title,
TextSize = 17,
Margin = new MarginPadding { Top = 5, Left = 10 },
Font = @"Exo2.0-Bold",
},
new SimpleButton
{
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
Margin = new MarginPadding { Top = 5, Right = 10 },
Icon = FontAwesome.fa_bars,
Scale = new Vector2(0.7f),
},
};
}
}
}

View File

@ -0,0 +1,21 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Screens.Play.Options
{
public class OptionsDisplay : FillFlowContainer<OptionContainer>
{
public OptionsDisplay()
{
Direction = FillDirection.Vertical;
Spacing = new Vector2(0, 20);
Add(new PlaybackOption());
Add(new PlaybackOption());
Add(new PlaybackOption());
}
}
}

View File

@ -0,0 +1,10 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Screens.Play.Options
{
public class PlaybackOption : OptionContainer
{
public override string Title => "PLAYBACK";
}
}

View File

@ -8,6 +8,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play.HUD;
using OpenTK;
using osu.Game.Screens.Play.Options;
namespace osu.Game.Screens.Play
{
@ -71,6 +72,14 @@ namespace osu.Game.Screens.Play
Margin = new MarginPadding { Top = 20, Right = 10 },
};
protected override OptionsDisplay CreateOptionsDisplay() => new OptionsDisplay
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both,
Margin = new MarginPadding { Top = 100, Right = 10 },
};
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{

View File

@ -74,6 +74,7 @@
<Compile Include="Audio\SampleInfoList.cs" />
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
<Compile Include="Beatmaps\DifficultyCalculator.cs" />
<Compile Include="Graphics\UserInterface\SimpleButton.cs" />
<Compile Include="Online\API\Requests\PostMessageRequest.cs" />
<Compile Include="Online\Chat\ErrorMessage.cs" />
<Compile Include="Overlays\Chat\ChatTabControl.cs" />
@ -231,6 +232,9 @@
<Compile Include="Screens\Charts\ChartInfo.cs" />
<Compile Include="Screens\Edit\Editor.cs" />
<Compile Include="Screens\Play\HotkeyRetryOverlay.cs" />
<Compile Include="Screens\Play\Options\OptionContainer.cs" />
<Compile Include="Screens\Play\Options\OptionsDisplay.cs" />
<Compile Include="Screens\Play\Options\PlaybackOption.cs" />
<Compile Include="Screens\Play\SongProgressInfo.cs" />
<Compile Include="Screens\Play\HUD\ModDisplay.cs" />
<Compile Include="Screens\Play\SquareGraph.cs" />