mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 18:32:55 +08:00
Merge branch 'master' into more-beatmap-info
# Conflicts: # osu.Game/Screens/Select/BeatmapInfoWedge.cs
This commit is contained in:
commit
77558abf58
16
.vscode/launch.json
vendored
16
.vscode/launch.json
vendored
@ -2,13 +2,25 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "Launch",
|
"name": "Launch VisualTests",
|
||||||
"type": "mono",
|
"type": "mono",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${workspaceRoot}/osu.Desktop.VisualTests/bin/Debug/osu!.exe",
|
"program": "${workspaceRoot}/osu.Desktop.VisualTests/bin/Debug/osu!.exe",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceRoot}",
|
"cwd": "${workspaceRoot}",
|
||||||
"preLaunchTask": "",
|
"preLaunchTask": "build",
|
||||||
|
"runtimeExecutable": null,
|
||||||
|
"env": {},
|
||||||
|
"externalConsole": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Launch Desktop",
|
||||||
|
"type": "mono",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceRoot}/osu.Desktop/bin/Debug/osu!.exe",
|
||||||
|
"args": [],
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"preLaunchTask": "build",
|
||||||
"runtimeExecutable": null,
|
"runtimeExecutable": null,
|
||||||
"env": {},
|
"env": {},
|
||||||
"externalConsole": false
|
"externalConsole": false
|
||||||
|
9
ISSUE_TEMPLATE.md
Normal file
9
ISSUE_TEMPLATE.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
osu!lazer is currently in early stages of development and is not yet ready for end users. Please avoid creating issues or bugs if you do not personally intend to fix them. Some acceptable topics include:
|
||||||
|
|
||||||
|
- Discussions about technical design decisions
|
||||||
|
- Bugs that you have found and are personally willing and able to fix
|
||||||
|
- TODO lists of smaller tasks around larger features
|
||||||
|
|
||||||
|
Basically, issues are not a place for you to get help. They are a place for developers to collaborate on the game.
|
||||||
|
|
||||||
|
If your issue qualifies, replace this text with a detailed description of your issue with as much relevant information as you can provide.
|
@ -6,6 +6,10 @@
|
|||||||
|
|
||||||
Rhythm is just a *click* away. The future of osu! and the beginning of an open era!
|
Rhythm is just a *click* away. The future of osu! and the beginning of an open era!
|
||||||
|
|
||||||
|
# Status
|
||||||
|
|
||||||
|
This is still heavily under development and is not intended for end-user use. This repository is intended for developer collaboration. You're welcome to try and use it but please do not submit bug reports without a patch. Please do not ask for help building or using this software.
|
||||||
|
|
||||||
# Requirements
|
# Requirements
|
||||||
|
|
||||||
- A desktop platform which can compile .NET 4.5.
|
- A desktop platform which can compile .NET 4.5.
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit cea7e88cad687a6a6613655ddd74be3f15bf49db
|
Subproject commit 2f03fae533293bf255a942569c07396f853378f3
|
@ -1 +1 @@
|
|||||||
Subproject commit e24414a277e407ae2438e4b6d9fa9c7992dd6485
|
Subproject commit 7c42cf0a565ca125edcf335fabcb2ba3961d202d
|
@ -18,7 +18,7 @@ namespace osu.Desktop.VisualTests
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
using (BasicGameHost host = Host.GetSuitableHost(@"osu-visual-tests"))
|
using (BasicGameHost host = Host.GetSuitableHost(@"osu"))
|
||||||
{
|
{
|
||||||
Ruleset.Register(new OsuRuleset());
|
Ruleset.Register(new OsuRuleset());
|
||||||
Ruleset.Register(new TaikoRuleset());
|
Ruleset.Register(new TaikoRuleset());
|
||||||
|
@ -42,14 +42,13 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
var h = new HitCircle
|
var h = new HitCircle
|
||||||
{
|
{
|
||||||
StartTime = Clock.CurrentTime + 1000 + i * 80,
|
StartTime = Clock.CurrentTime + 600 + i * 80,
|
||||||
Position = new Vector2((i - count / 2) * 14),
|
Position = new Vector2((i - count / 2) * 14),
|
||||||
};
|
};
|
||||||
|
|
||||||
DrawableHitCircle d = new DrawableHitCircle(h)
|
DrawableHitCircle d = new DrawableHitCircle(h)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Depth = i,
|
Depth = i,
|
||||||
State = ArmedState.Hit,
|
State = ArmedState.Hit,
|
||||||
Judgement = new OsuJudgementInfo { Result = HitResult.Hit }
|
Judgement = new OsuJudgementInfo { Result = HitResult.Hit }
|
||||||
|
@ -5,6 +5,14 @@ using osu.Framework.GameModes.Testing;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
{
|
{
|
||||||
@ -18,22 +26,68 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
base.Reset();
|
base.Reset();
|
||||||
|
|
||||||
Children = new[]
|
KeyCounterCollection kc = new KeyCounterCollection
|
||||||
{
|
{
|
||||||
new KeyCounterCollection
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
IsCounting = true,
|
||||||
|
Children = new KeyCounter[]
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
new KeyCounterKeyboard(@"Z", Key.Z),
|
||||||
Anchor = Anchor.Centre,
|
new KeyCounterKeyboard(@"X", Key.X),
|
||||||
IsCounting = true,
|
new KeyCounterMouse(@"M1", MouseButton.Left),
|
||||||
Children = new KeyCounter[]
|
new KeyCounterMouse(@"M2", MouseButton.Right),
|
||||||
{
|
|
||||||
new KeyCounterKeyboard(@"Z", Key.Z),
|
|
||||||
new KeyCounterKeyboard(@"X", Key.X),
|
|
||||||
new KeyCounterMouse(@"M1", MouseButton.Left),
|
|
||||||
new KeyCounterMouse(@"M2", MouseButton.Right),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
BindableInt bindable = new BindableInt { MinValue = 0, MaxValue = 200, Default = 50 };
|
||||||
|
bindable.ValueChanged += delegate { kc.FadeTime = bindable.Value; };
|
||||||
|
AddButton("Add Random", () =>
|
||||||
|
{
|
||||||
|
Key key = (Key)((int)Key.A + RNG.Next(26));
|
||||||
|
kc.Add(new KeyCounterKeyboard(key.ToString(), key));
|
||||||
|
});
|
||||||
|
ButtonsContainer.Add(new SpriteText { Text = "FadeTime" });
|
||||||
|
ButtonsContainer.Add(new TestSliderBar<int>
|
||||||
|
{
|
||||||
|
Width = 150,
|
||||||
|
Height = 10,
|
||||||
|
SelectionColor = Color4.Orange,
|
||||||
|
Bindable = bindable
|
||||||
|
});
|
||||||
|
Add(kc);
|
||||||
|
}
|
||||||
|
private class TestSliderBar<T> : SliderBar<T> where T : struct
|
||||||
|
{
|
||||||
|
public Color4 Color
|
||||||
|
{
|
||||||
|
get { return Box.Colour; }
|
||||||
|
set { Box.Colour = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color4 SelectionColor
|
||||||
|
{
|
||||||
|
get { return SelectionBox.Colour; }
|
||||||
|
set { SelectionBox.Colour = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected readonly Box SelectionBox;
|
||||||
|
protected readonly Box Box;
|
||||||
|
|
||||||
|
public TestSliderBar()
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
Box = new Box { RelativeSizeAxes = Axes.Both },
|
||||||
|
SelectionBox = new Box { RelativeSizeAxes = Axes.Both }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateValue(float value)
|
||||||
|
{
|
||||||
|
SelectionBox.ScaleTo(
|
||||||
|
new Vector2(value, 1),
|
||||||
|
300, EasingTypes.OutQuint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,11 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
if (oldDb != null)
|
if (oldDb != null)
|
||||||
|
{
|
||||||
Dependencies.Cache(oldDb, true);
|
Dependencies.Cache(oldDb, true);
|
||||||
|
db = null;
|
||||||
|
}
|
||||||
|
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,12 +53,12 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
return new BeatmapSetInfo
|
return new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
BeatmapSetID = 1234 + i,
|
OnlineBeatmapSetID = 1234 + i,
|
||||||
Hash = "d8e8fca2dc0f896fd7cb4cb0031ba249",
|
Hash = "d8e8fca2dc0f896fd7cb4cb0031ba249",
|
||||||
Path = string.Empty,
|
Path = string.Empty,
|
||||||
Metadata = new BeatmapMetadata
|
Metadata = new BeatmapMetadata
|
||||||
{
|
{
|
||||||
BeatmapSetID = 1234 + i,
|
OnlineBeatmapSetID = 1234 + i,
|
||||||
Artist = "MONACA",
|
Artist = "MONACA",
|
||||||
Title = "Black Song",
|
Title = "Black Song",
|
||||||
Author = "Some Guy",
|
Author = "Some Guy",
|
||||||
@ -63,7 +67,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
{
|
{
|
||||||
BeatmapID = 1234 + i,
|
OnlineBeatmapID = 1234 + i,
|
||||||
Mode = PlayMode.Osu,
|
Mode = PlayMode.Osu,
|
||||||
Path = "normal.osu",
|
Path = "normal.osu",
|
||||||
Version = "Normal",
|
Version = "Normal",
|
||||||
@ -74,7 +78,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
},
|
},
|
||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
{
|
{
|
||||||
BeatmapID = 1235 + i,
|
OnlineBeatmapID = 1235 + i,
|
||||||
Mode = PlayMode.Osu,
|
Mode = PlayMode.Osu,
|
||||||
Path = "hard.osu",
|
Path = "hard.osu",
|
||||||
Version = "Hard",
|
Version = "Hard",
|
||||||
@ -85,7 +89,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
},
|
},
|
||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
{
|
{
|
||||||
BeatmapID = 1236 + i,
|
OnlineBeatmapID = 1236 + i,
|
||||||
Mode = PlayMode.Osu,
|
Mode = PlayMode.Osu,
|
||||||
Path = "insane.osu",
|
Path = "insane.osu",
|
||||||
Version = "Insane",
|
Version = "Insane",
|
||||||
|
@ -29,19 +29,17 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(BeatmapDatabase db)
|
private void load(BeatmapDatabase db)
|
||||||
{
|
{
|
||||||
beatmap = db.GetWorkingBeatmap(db.Query<BeatmapInfo>().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault());
|
var beatmapInfo = db.Query<BeatmapInfo>().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault();
|
||||||
|
if (beatmapInfo != null)
|
||||||
|
beatmap = db.GetWorkingBeatmap(beatmapInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
base.Reset();
|
base.Reset();
|
||||||
|
|
||||||
//ensure we are at offset 0
|
if (beatmap?.Track == null)
|
||||||
Clock = new FramedClock();
|
|
||||||
|
|
||||||
if (beatmap == null)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
var objects = new List<HitObject>();
|
var objects = new List<HitObject>();
|
||||||
|
|
||||||
int time = 1500;
|
int time = 1500;
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Modes.Catch
|
|||||||
|
|
||||||
protected override PlayMode PlayMode => PlayMode.Catch;
|
protected override PlayMode PlayMode => PlayMode.Catch;
|
||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor() => null;
|
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => null;
|
||||||
|
|
||||||
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
|
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Modes.Mania
|
|||||||
|
|
||||||
protected override PlayMode PlayMode => PlayMode.Mania;
|
protected override PlayMode PlayMode => PlayMode.Mania;
|
||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor() => null;
|
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => null;
|
||||||
|
|
||||||
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
|
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
Colour = osuObject.Colour,
|
Colour = osuObject.Colour,
|
||||||
Hit = () =>
|
Hit = () =>
|
||||||
{
|
{
|
||||||
|
if (Judgement.Result.HasValue) return false;
|
||||||
|
|
||||||
((PositionalJudgementInfo)Judgement).PositionOffset = Vector2.Zero; //todo: set to correct value
|
((PositionalJudgementInfo)Judgement).PositionOffset = Vector2.Zero; //todo: set to correct value
|
||||||
UpdateJudgement(true);
|
UpdateJudgement(true);
|
||||||
return true;
|
return true;
|
||||||
@ -134,7 +136,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
FadeOut(TIME_FADEOUT / 5);
|
FadeOut(TIME_FADEOUT / 5);
|
||||||
break;
|
break;
|
||||||
case ArmedState.Hit:
|
case ArmedState.Hit:
|
||||||
const double flash_in = 30;
|
const double flash_in = 40;
|
||||||
|
|
||||||
flash.FadeTo(0.8f, flash_in);
|
flash.FadeTo(0.8f, flash_in);
|
||||||
flash.Delay(flash_in);
|
flash.Delay(flash_in);
|
||||||
|
@ -13,6 +13,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
|||||||
{
|
{
|
||||||
public class Triangles : Container<Triangle>
|
public class Triangles : Container<Triangle>
|
||||||
{
|
{
|
||||||
|
public override bool HandleInput => false;
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
@ -101,9 +101,11 @@ namespace osu.Game.Modes.Osu.Objects
|
|||||||
cumulativeLength.Add(l);
|
cumulativeLength.Add(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: Figure out if the following code is needed in some cases. Judging by the map
|
||||||
|
// "Transform" http://osu.ppy.sh/s/484689 it seems like we should _not_ be doing this.
|
||||||
// Lengthen slider curves that are too short compared to what's
|
// Lengthen slider curves that are too short compared to what's
|
||||||
// in the .osu file.
|
// in the .osu file.
|
||||||
if (l < Length && calculatedPath.Count > 1)
|
/*if (l < Length && calculatedPath.Count > 1)
|
||||||
{
|
{
|
||||||
Vector2 diff = calculatedPath[calculatedPath.Count - 1] - calculatedPath[calculatedPath.Count - 2];
|
Vector2 diff = calculatedPath[calculatedPath.Count - 1] - calculatedPath[calculatedPath.Count - 2];
|
||||||
double d = diff.Length;
|
double d = diff.Length;
|
||||||
@ -113,7 +115,7 @@ namespace osu.Game.Modes.Osu.Objects
|
|||||||
|
|
||||||
calculatedPath[calculatedPath.Count - 1] += diff * (float)((Length - l) / d);
|
calculatedPath[calculatedPath.Count - 1] += diff * (float)((Length - l) / d);
|
||||||
cumulativeLength[calculatedPath.Count - 1] = Length;
|
cumulativeLength[calculatedPath.Count - 1] = Length;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Calculate()
|
public void Calculate()
|
||||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Modes.Osu
|
|||||||
|
|
||||||
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
|
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
|
||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor();
|
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => new OsuScoreProcessor(hitObjectCount);
|
||||||
|
|
||||||
protected override PlayMode PlayMode => PlayMode.Osu;
|
protected override PlayMode PlayMode => PlayMode.Osu;
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
//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 System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using osu.Game.Modes.Osu.Objects.Drawables;
|
using osu.Game.Modes.Osu.Objects.Drawables;
|
||||||
|
|
||||||
@ -13,6 +8,12 @@ namespace osu.Game.Modes.Osu
|
|||||||
{
|
{
|
||||||
class OsuScoreProcessor : ScoreProcessor
|
class OsuScoreProcessor : ScoreProcessor
|
||||||
{
|
{
|
||||||
|
public OsuScoreProcessor(int hitObjectCount)
|
||||||
|
: base(hitObjectCount)
|
||||||
|
{
|
||||||
|
Health.Value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void UpdateCalculations(JudgementInfo judgement)
|
protected override void UpdateCalculations(JudgementInfo judgement)
|
||||||
{
|
{
|
||||||
if (judgement != null)
|
if (judgement != null)
|
||||||
@ -21,9 +22,11 @@ namespace osu.Game.Modes.Osu
|
|||||||
{
|
{
|
||||||
case HitResult.Hit:
|
case HitResult.Hit:
|
||||||
Combo.Value++;
|
Combo.Value++;
|
||||||
|
Health.Value += 0.1f;
|
||||||
break;
|
break;
|
||||||
case HitResult.Miss:
|
case HitResult.Miss:
|
||||||
Combo.Value = 0;
|
Combo.Value = 0;
|
||||||
|
Health.Value -= 0.2f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Modes.Taiko
|
|||||||
|
|
||||||
protected override PlayMode PlayMode => PlayMode.Taiko;
|
protected override PlayMode PlayMode => PlayMode.Taiko;
|
||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor() => null;
|
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => null;
|
||||||
|
|
||||||
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
|
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,8 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
OsuLegacyDecoder.Register();
|
OsuLegacyDecoder.Register();
|
||||||
Ruleset.Register(new OsuRuleset());
|
Ruleset.Register(new OsuRuleset());
|
||||||
}
|
}
|
||||||
[Test]
|
|
||||||
|
[Test]
|
||||||
public void TestDecodeMetadata()
|
public void TestDecodeMetadata()
|
||||||
{
|
{
|
||||||
var decoder = new OsuLegacyDecoder();
|
var decoder = new OsuLegacyDecoder();
|
||||||
@ -31,7 +32,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
var beatmap = decoder.Decode(new StreamReader(stream));
|
var beatmap = decoder.Decode(new StreamReader(stream));
|
||||||
var meta = beatmap.BeatmapInfo.Metadata;
|
var meta = beatmap.BeatmapInfo.Metadata;
|
||||||
Assert.AreEqual(241526, meta.BeatmapSetID);
|
Assert.AreEqual(241526, meta.OnlineBeatmapSetID);
|
||||||
Assert.AreEqual("Soleily", meta.Artist);
|
Assert.AreEqual("Soleily", meta.Artist);
|
||||||
Assert.AreEqual("Soleily", meta.ArtistUnicode);
|
Assert.AreEqual("Soleily", meta.ArtistUnicode);
|
||||||
Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);
|
Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);
|
||||||
@ -125,7 +126,8 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
public void TestDecodeHitObjects()
|
[Test]
|
||||||
|
public void TestDecodeHitObjects()
|
||||||
{
|
{
|
||||||
var decoder = new OsuLegacyDecoder();
|
var decoder = new OsuLegacyDecoder();
|
||||||
using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
|
using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
|
||||||
|
@ -83,7 +83,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
Action waitAction = () =>
|
Action waitAction = () =>
|
||||||
{
|
{
|
||||||
while ((resultSets = osu.Dependencies.Get<BeatmapDatabase>()
|
while ((resultSets = osu.Dependencies.Get<BeatmapDatabase>()
|
||||||
.Query<BeatmapSetInfo>().Where(s => s.BeatmapSetID == 241526)).Count() != 1)
|
.Query<BeatmapSetInfo>().Where(s => s.OnlineBeatmapSetID == 241526)).Count() != 1)
|
||||||
Thread.Sleep(1);
|
Thread.Sleep(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
waitAction = () =>
|
waitAction = () =>
|
||||||
{
|
{
|
||||||
while ((resultBeatmaps = osu.Dependencies.Get<BeatmapDatabase>()
|
while ((resultBeatmaps = osu.Dependencies.Get<BeatmapDatabase>()
|
||||||
.Query<BeatmapInfo>().Where(s => s.BeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12)
|
.Query<BeatmapInfo>().Where(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12)
|
||||||
Thread.Sleep(1);
|
Thread.Sleep(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count());
|
Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count());
|
||||||
|
|
||||||
foreach (BeatmapInfo b in resultBeatmaps)
|
foreach (BeatmapInfo b in resultBeatmaps)
|
||||||
Assert.IsTrue(set.Beatmaps.Any(c => c.BeatmapID == b.BeatmapID));
|
Assert.IsTrue(set.Beatmaps.Any(c => c.OnlineBeatmapID == b.OnlineBeatmapID));
|
||||||
|
|
||||||
Assert.IsTrue(set.Beatmaps.Count > 0);
|
Assert.IsTrue(set.Beatmaps.Count > 0);
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
{
|
{
|
||||||
var reader = new OszArchiveReader(osz);
|
var reader = new OszArchiveReader(osz);
|
||||||
var meta = reader.ReadMetadata();
|
var meta = reader.ReadMetadata();
|
||||||
Assert.AreEqual(241526, meta.BeatmapSetID);
|
Assert.AreEqual(241526, meta.OnlineBeatmapSetID);
|
||||||
Assert.AreEqual("Soleily", meta.Artist);
|
Assert.AreEqual("Soleily", meta.Artist);
|
||||||
Assert.AreEqual("Soleily", meta.ArtistUnicode);
|
Assert.AreEqual("Soleily", meta.ArtistUnicode);
|
||||||
Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);
|
Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);
|
||||||
@ -65,7 +65,8 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
Assert.AreEqual("Renatus", meta.TitleUnicode);
|
Assert.AreEqual("Renatus", meta.TitleUnicode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[Test]
|
|
||||||
|
[Test]
|
||||||
public void TestReadFile()
|
public void TestReadFile()
|
||||||
{
|
{
|
||||||
using (var osz = Resource.OpenResource("Beatmaps.241526 Soleily - Renatus.osz"))
|
using (var osz = Resource.OpenResource("Beatmaps.241526 Soleily - Renatus.osz"))
|
||||||
|
@ -18,7 +18,8 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game)
|
private void load(OsuGameBase game)
|
||||||
{
|
{
|
||||||
Texture = working.Background;
|
if (working.Background != null)
|
||||||
|
Texture = working.Background;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Drawables
|
namespace osu.Game.Beatmaps.Drawables
|
||||||
@ -19,12 +20,16 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Action<BeatmapGroup, BeatmapInfo> SelectionChanged;
|
public Action<BeatmapGroup, BeatmapInfo> SelectionChanged;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fires when one of our difficulties is clicked when already selected. Should start playing the map.
|
||||||
|
/// </summary>
|
||||||
|
public Action<BeatmapInfo> StartRequested;
|
||||||
|
|
||||||
public BeatmapSetHeader Header;
|
public BeatmapSetHeader Header;
|
||||||
|
|
||||||
private BeatmapGroupState state;
|
private BeatmapGroupState state;
|
||||||
|
|
||||||
public List<BeatmapPanel> BeatmapPanels;
|
public List<BeatmapPanel> BeatmapPanels;
|
||||||
private WorkingBeatmap beatmap;
|
|
||||||
|
|
||||||
public BeatmapGroupState State
|
public BeatmapGroupState State
|
||||||
{
|
{
|
||||||
@ -48,16 +53,14 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
SelectedPanel.State = PanelSelectedState.NotSelected;
|
SelectedPanel.State = PanelSelectedState.NotSelected;
|
||||||
|
|
||||||
foreach (BeatmapPanel panel in BeatmapPanels)
|
foreach (BeatmapPanel panel in BeatmapPanels)
|
||||||
panel.FadeOut(250);
|
panel.FadeOut(300, EasingTypes.OutQuint);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeatmapGroup(WorkingBeatmap beatmap)
|
public BeatmapGroup(WorkingBeatmap beatmap, BeatmapSetInfo set = null)
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
|
||||||
|
|
||||||
Header = new BeatmapSetHeader(beatmap)
|
Header = new BeatmapSetHeader(beatmap)
|
||||||
{
|
{
|
||||||
GainedSelection = headerGainedSelection,
|
GainedSelection = headerGainedSelection,
|
||||||
@ -68,6 +71,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
{
|
{
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
GainedSelection = panelGainedSelection,
|
GainedSelection = panelGainedSelection,
|
||||||
|
StartRequested = p => { StartRequested?.Invoke(p.Beatmap); },
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
@ -1,62 +1,70 @@
|
|||||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
//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 System;
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Colour;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Primitives;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.Textures;
|
|
||||||
using osu.Framework.MathUtils;
|
|
||||||
using osu.Game.Database;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Graphics.Backgrounds;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Drawables
|
|
||||||
{
|
|
||||||
class BeatmapPanel : Panel
|
|
||||||
{
|
|
||||||
public BeatmapInfo Beatmap;
|
|
||||||
private Sprite background;
|
|
||||||
|
|
||||||
public Action<BeatmapPanel> GainedSelection;
|
|
||||||
|
|
||||||
Color4 deselectedColour = new Color4(20, 43, 51, 255);
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Colour;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Backgrounds;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps.Drawables
|
||||||
|
{
|
||||||
|
class BeatmapPanel : Panel
|
||||||
|
{
|
||||||
|
public BeatmapInfo Beatmap;
|
||||||
|
private Sprite background;
|
||||||
|
|
||||||
|
public Action<BeatmapPanel> GainedSelection;
|
||||||
|
public Action<BeatmapPanel> StartRequested;
|
||||||
|
|
||||||
protected override void Selected()
|
protected override void Selected()
|
||||||
{
|
{
|
||||||
base.Selected();
|
base.Selected();
|
||||||
GainedSelection?.Invoke(this);
|
GainedSelection?.Invoke(this);
|
||||||
|
|
||||||
background.ColourInfo = ColourInfo.GradientVertical(
|
background.ColourInfo = ColourInfo.GradientVertical(
|
||||||
new Color4(20, 43, 51, 255),
|
new Color4(20, 43, 51, 255),
|
||||||
new Color4(40, 86, 102, 255));
|
new Color4(40, 86, 102, 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Deselected()
|
protected override void Deselected()
|
||||||
{
|
{
|
||||||
base.Deselected();
|
base.Deselected();
|
||||||
|
|
||||||
background.Colour = deselectedColour;
|
background.Colour = new Color4(20, 43, 51, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeatmapPanel(BeatmapInfo beatmap)
|
protected override bool OnClick(InputState state)
|
||||||
|
{
|
||||||
|
if (State == PanelSelectedState.Selected)
|
||||||
|
StartRequested?.Invoke(this);
|
||||||
|
|
||||||
|
return base.OnClick(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BeatmapPanel(BeatmapInfo beatmap)
|
||||||
{
|
{
|
||||||
Beatmap = beatmap;
|
Beatmap = beatmap;
|
||||||
Height *= 0.60f;
|
Height *= 0.60f;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
background = new Box
|
background = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
new Triangles
|
new Triangles
|
||||||
{
|
{
|
||||||
// The border is drawn in the shader of the children. Being additive, triangles would over-emphasize
|
// The border is drawn in the shader of the children. Being additive, triangles would over-emphasize
|
||||||
// the border wherever they cross it, and thus they get their own masking container without a border.
|
// the border wherever they cross it, and thus they get their own masking container without a border.
|
||||||
@ -64,70 +72,70 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
CornerRadius = Content.CornerRadius,
|
CornerRadius = Content.CornerRadius,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
BlendingMode = BlendingMode.Additive,
|
BlendingMode = BlendingMode.Additive,
|
||||||
Colour = deselectedColour,
|
Colour = new Color4(20, 43, 51, 255),
|
||||||
},
|
},
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
{
|
{
|
||||||
Padding = new MarginPadding(5),
|
Padding = new MarginPadding(5),
|
||||||
Direction = FlowDirection.HorizontalOnly,
|
Direction = FlowDirection.HorizontalOnly,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(159, 198, 0, 255))
|
new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(159, 198, 0, 255))
|
||||||
{
|
{
|
||||||
Scale = new Vector2(1.8f),
|
Scale = new Vector2(1.8f),
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
},
|
},
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
{
|
{
|
||||||
Padding = new MarginPadding { Left = 5 },
|
Padding = new MarginPadding { Left = 5 },
|
||||||
Spacing = new Vector2(0, 5),
|
Spacing = new Vector2(0, 5),
|
||||||
Direction = FlowDirection.VerticalOnly,
|
Direction = FlowDirection.VerticalOnly,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
{
|
{
|
||||||
Direction = FlowDirection.HorizontalOnly,
|
Direction = FlowDirection.HorizontalOnly,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Spacing = new Vector2(4, 0),
|
Spacing = new Vector2(4, 0),
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new SpriteText
|
new SpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-Medium",
|
Font = @"Exo2.0-Medium",
|
||||||
Text = beatmap.Version,
|
Text = beatmap.Version,
|
||||||
TextSize = 20,
|
TextSize = 20,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft
|
Origin = Anchor.BottomLeft
|
||||||
},
|
},
|
||||||
new SpriteText
|
new SpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-Medium",
|
Font = @"Exo2.0-Medium",
|
||||||
Text = "mapped by",
|
Text = "mapped by",
|
||||||
TextSize = 16,
|
TextSize = 16,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft
|
Origin = Anchor.BottomLeft
|
||||||
},
|
},
|
||||||
new SpriteText
|
new SpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-MediumItalic",
|
Font = @"Exo2.0-MediumItalic",
|
||||||
Text = $"{(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author}",
|
Text = $"{(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author}",
|
||||||
TextSize = 16,
|
TextSize = 16,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft
|
Origin = Anchor.BottomLeft
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new StarCounter { Count = beatmap.BaseDifficulty?.OverallDifficulty ?? 5, StarSize = 8 }
|
new StarCounter { Count = beatmap.BaseDifficulty?.OverallDifficulty ?? 5, StarSize = 8 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,74 +1,74 @@
|
|||||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
//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 System;
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Drawables
|
namespace osu.Game.Beatmaps.Drawables
|
||||||
{
|
{
|
||||||
class BeatmapSetHeader : Panel
|
class BeatmapSetHeader : Panel
|
||||||
{
|
{
|
||||||
public Action<BeatmapSetHeader> GainedSelection;
|
public Action<BeatmapSetHeader> GainedSelection;
|
||||||
private SpriteText title, artist;
|
private SpriteText title, artist;
|
||||||
private OsuConfigManager config;
|
private OsuConfigManager config;
|
||||||
private Bindable<bool> preferUnicode;
|
private Bindable<bool> preferUnicode;
|
||||||
private WorkingBeatmap beatmap;
|
private WorkingBeatmap beatmap;
|
||||||
|
|
||||||
public BeatmapSetHeader(WorkingBeatmap beatmap)
|
public BeatmapSetHeader(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new PanelBackground(beatmap)
|
new PanelBackground(beatmap)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
{
|
{
|
||||||
Direction = FlowDirection.VerticalOnly,
|
Direction = FlowDirection.VerticalOnly,
|
||||||
Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 },
|
Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 },
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
title = new SpriteText
|
title = new SpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-BoldItalic",
|
Font = @"Exo2.0-BoldItalic",
|
||||||
Text = beatmap.BeatmapSetInfo.Metadata.Title,
|
Text = beatmap.BeatmapSetInfo.Metadata.Title,
|
||||||
TextSize = 22,
|
TextSize = 22,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
artist = new SpriteText
|
artist = new SpriteText
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Top = -1 },
|
Margin = new MarginPadding { Top = -1 },
|
||||||
Font = @"Exo2.0-SemiBoldItalic",
|
Font = @"Exo2.0-SemiBoldItalic",
|
||||||
Text = beatmap.BeatmapSetInfo.Metadata.Artist,
|
Text = beatmap.BeatmapSetInfo.Metadata.Artist,
|
||||||
TextSize = 17,
|
TextSize = 17,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Top = 5 },
|
Margin = new MarginPadding { Top = 5 },
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(159, 198, 0, 255)),
|
new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(159, 198, 0, 255)),
|
||||||
new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(246, 101, 166, 255)),
|
new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(246, 101, 166, 255)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -81,8 +81,8 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
{
|
{
|
||||||
base.Selected();
|
base.Selected();
|
||||||
GainedSelection?.Invoke(this);
|
GainedSelection?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
@ -90,31 +90,32 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
|
|
||||||
preferUnicode = config.GetBindable<bool>(OsuConfig.ShowUnicode);
|
preferUnicode = config.GetBindable<bool>(OsuConfig.ShowUnicode);
|
||||||
preferUnicode.ValueChanged += preferUnicode_changed;
|
preferUnicode.ValueChanged += preferUnicode_changed;
|
||||||
preferUnicode_changed(preferUnicode, null);
|
preferUnicode_changed(preferUnicode, null);
|
||||||
}
|
}
|
||||||
private void preferUnicode_changed(object sender, EventArgs e)
|
|
||||||
{
|
private void preferUnicode_changed(object sender, EventArgs e)
|
||||||
title.Text = config.GetUnicodeString(beatmap.BeatmapSetInfo.Metadata.Title, beatmap.BeatmapSetInfo.Metadata.TitleUnicode);
|
{
|
||||||
artist.Text = config.GetUnicodeString(beatmap.BeatmapSetInfo.Metadata.Artist, beatmap.BeatmapSetInfo.Metadata.ArtistUnicode);
|
title.Text = config.GetUnicodeString(beatmap.BeatmapSetInfo.Metadata.Title, beatmap.BeatmapSetInfo.Metadata.TitleUnicode);
|
||||||
|
artist.Text = config.GetUnicodeString(beatmap.BeatmapSetInfo.Metadata.Artist, beatmap.BeatmapSetInfo.Metadata.ArtistUnicode);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
if (preferUnicode != null)
|
if (preferUnicode != null)
|
||||||
preferUnicode.ValueChanged -= preferUnicode_changed;
|
preferUnicode.ValueChanged -= preferUnicode_changed;
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
class PanelBackground : BufferedContainer
|
class PanelBackground : BufferedContainer
|
||||||
{
|
{
|
||||||
private readonly WorkingBeatmap working;
|
private readonly WorkingBeatmap working;
|
||||||
|
|
||||||
public PanelBackground(WorkingBeatmap working)
|
public PanelBackground(WorkingBeatmap working)
|
||||||
{
|
{
|
||||||
this.working = working;
|
this.working = working;
|
||||||
|
|
||||||
CacheDrawnFrameBuffer = true;
|
CacheDrawnFrameBuffer = true;
|
||||||
|
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
@ -128,34 +129,37 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
// The left half with no gradient applied
|
// The left half with no gradient applied
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
Width = 0.4f,
|
Width = 0.4f,
|
||||||
},
|
},
|
||||||
// Piecewise-linear gradient with 3 segments to make it appear smoother
|
// Piecewise-linear gradient with 3 segments to make it appear smoother
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ColourInfo = ColourInfo.GradientHorizontal(Color4.Black, new Color4(0f, 0f, 0f, 0.9f)),
|
ColourInfo = ColourInfo.GradientHorizontal(
|
||||||
|
Color4.Black, new Color4(0f, 0f, 0f, 0.9f)),
|
||||||
Width = 0.05f,
|
Width = 0.05f,
|
||||||
},
|
},
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ColourInfo = ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.9f), new Color4(0f, 0f, 0f, 0.1f)),
|
ColourInfo = ColourInfo.GradientHorizontal(
|
||||||
|
new Color4(0f, 0f, 0f, 0.9f), new Color4(0f, 0f, 0f, 0.1f)),
|
||||||
Width = 0.2f,
|
Width = 0.2f,
|
||||||
},
|
},
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ColourInfo = ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.1f), new Color4(0, 0, 0, 0)),
|
ColourInfo = ColourInfo.GradientHorizontal(
|
||||||
|
new Color4(0f, 0f, 0f, 0.1f), new Color4(0, 0, 0, 0)),
|
||||||
Width = 0.05f,
|
Width = 0.05f,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -172,6 +176,6 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
ForceRedraw();
|
ForceRedraw();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,6 +8,7 @@ using osu.Framework.Graphics.Transformations;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Drawables
|
namespace osu.Game.Beatmaps.Drawables
|
||||||
{
|
{
|
||||||
@ -98,7 +99,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
Type = EdgeEffectType.Shadow,
|
Type = EdgeEffectType.Shadow,
|
||||||
Offset = new Vector2(1),
|
Offset = new Vector2(1),
|
||||||
Radius = 10,
|
Radius = 10,
|
||||||
Colour = new Color4(0, 0, 0, 100),
|
Colour = Color4.Black.Opacity(100),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using osu.Game.Modes.Objects;
|
using osu.Game.Modes.Objects;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Formats
|
namespace osu.Game.Beatmaps.Formats
|
||||||
{
|
{
|
||||||
@ -44,11 +45,11 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
public virtual void ApplyColours(Beatmap b)
|
public virtual void ApplyColours(Beatmap b)
|
||||||
{
|
{
|
||||||
List<Color4> colours = b.ComboColors ?? new List<Color4>() {
|
List<Color4> colours = b.ComboColors ?? new List<Color4> {
|
||||||
new Color4(17, 136, 170, 255),
|
new Color4(17, 136, 170, 255),
|
||||||
new Color4(102,136,0, 255),
|
new Color4(102, 136, 0, 255),
|
||||||
new Color4(204,102,0, 255),
|
new Color4(204, 102, 0, 255),
|
||||||
new Color4(121,9,13, 255),
|
new Color4(121, 9, 13, 255),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (colours.Count == 0) return;
|
if (colours.Count == 0) return;
|
||||||
|
@ -26,6 +26,10 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
AddDecoder<OsuLegacyDecoder>(@"osu file format v11");
|
AddDecoder<OsuLegacyDecoder>(@"osu file format v11");
|
||||||
AddDecoder<OsuLegacyDecoder>(@"osu file format v10");
|
AddDecoder<OsuLegacyDecoder>(@"osu file format v10");
|
||||||
AddDecoder<OsuLegacyDecoder>(@"osu file format v9");
|
AddDecoder<OsuLegacyDecoder>(@"osu file format v9");
|
||||||
|
AddDecoder<OsuLegacyDecoder>(@"osu file format v8");
|
||||||
|
AddDecoder<OsuLegacyDecoder>(@"osu file format v7");
|
||||||
|
AddDecoder<OsuLegacyDecoder>(@"osu file format v6");
|
||||||
|
AddDecoder<OsuLegacyDecoder>(@"osu file format v5");
|
||||||
// TODO: Not sure how far back to go, or differences between versions
|
// TODO: Not sure how far back to go, or differences between versions
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,11 +136,11 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
beatmap.BeatmapInfo.Metadata.Tags = val;
|
beatmap.BeatmapInfo.Metadata.Tags = val;
|
||||||
break;
|
break;
|
||||||
case @"BeatmapID":
|
case @"BeatmapID":
|
||||||
beatmap.BeatmapInfo.BeatmapID = int.Parse(val);
|
beatmap.BeatmapInfo.OnlineBeatmapID = int.Parse(val);
|
||||||
break;
|
break;
|
||||||
case @"BeatmapSetID":
|
case @"BeatmapSetID":
|
||||||
beatmap.BeatmapInfo.BeatmapSetID = int.Parse(val);
|
beatmap.BeatmapInfo.OnlineBeatmapSetID = int.Parse(val);
|
||||||
metadata.BeatmapSetID = int.Parse(val);
|
metadata.OnlineBeatmapSetID = int.Parse(val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
if (background != null) return background;
|
if (background != null) return background;
|
||||||
|
|
||||||
|
if (BeatmapInfo.Metadata?.BackgroundFile == null) return null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var reader = GetReader())
|
using (var reader = GetReader())
|
||||||
@ -67,6 +69,7 @@ namespace osu.Game.Beatmaps
|
|||||||
set { lock (beatmapLock) beatmap = value; }
|
set { lock (beatmapLock) beatmap = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ArchiveReader trackReader;
|
||||||
private AudioTrack track;
|
private AudioTrack track;
|
||||||
private object trackLock = new object();
|
private object trackLock = new object();
|
||||||
public AudioTrack Track
|
public AudioTrack Track
|
||||||
@ -79,12 +82,11 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var reader = GetReader())
|
//store a reference to the reader as we may continue accessing the stream in the background.
|
||||||
{
|
trackReader = GetReader();
|
||||||
var trackData = reader?.GetStream(BeatmapInfo.Metadata.AudioFile);
|
var trackData = trackReader?.GetStream(BeatmapInfo.Metadata.AudioFile);
|
||||||
if (trackData != null)
|
if (trackData != null)
|
||||||
track = new AudioTrackBass(trackData);
|
track = new AudioTrackBass(trackData);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
using System;
|
|
||||||
namespace osu.Game.Configuration
|
|
||||||
{
|
|
||||||
public enum FrameSync
|
|
||||||
{
|
|
||||||
VSync = 1,
|
|
||||||
Limit120 = 0,
|
|
||||||
Unlimited = 2,
|
|
||||||
CompletelyUnlimited = 4,
|
|
||||||
Custom = 5
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,8 +13,7 @@ namespace osu.Game.Configuration
|
|||||||
protected override void InitialiseDefaults()
|
protected override void InitialiseDefaults()
|
||||||
{
|
{
|
||||||
#pragma warning disable CS0612 // Type or member is obsolete
|
#pragma warning disable CS0612 // Type or member is obsolete
|
||||||
Set(OsuConfig.Width, 1366, 640);
|
|
||||||
Set(OsuConfig.Height, 768, 480);
|
|
||||||
Set(OsuConfig.MouseSpeed, 1.0);
|
Set(OsuConfig.MouseSpeed, 1.0);
|
||||||
|
|
||||||
Set(OsuConfig.Username, string.Empty);
|
Set(OsuConfig.Username, string.Empty);
|
||||||
@ -24,11 +23,7 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuConfig.PlayMode, PlayMode.Osu);
|
Set(OsuConfig.PlayMode, PlayMode.Osu);
|
||||||
|
|
||||||
Set(OsuConfig.BeatmapDirectory, @"Songs"); // TODO: use this
|
Set(OsuConfig.BeatmapDirectory, @"Songs"); // TODO: use this
|
||||||
|
|
||||||
Set(OsuConfig.VolumeUniversal, 0.8, 0, 1);
|
|
||||||
Set(OsuConfig.VolumeMusic, 1.0, 0, 1);
|
|
||||||
Set(OsuConfig.VolumeEffect, 1.0, 0, 1);
|
|
||||||
|
|
||||||
Set(OsuConfig.AllowPublicInvites, true);
|
Set(OsuConfig.AllowPublicInvites, true);
|
||||||
Set(OsuConfig.AutoChatHide, true);
|
Set(OsuConfig.AutoChatHide, true);
|
||||||
Set(OsuConfig.AutomaticDownload, true);
|
Set(OsuConfig.AutomaticDownload, true);
|
||||||
@ -56,7 +51,7 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuConfig.DisplayCityLocation, false);
|
Set(OsuConfig.DisplayCityLocation, false);
|
||||||
Set(OsuConfig.DistanceSpacingEnabled, true);
|
Set(OsuConfig.DistanceSpacingEnabled, true);
|
||||||
Set(OsuConfig.EditorTip, 0);
|
Set(OsuConfig.EditorTip, 0);
|
||||||
Set(OsuConfig.VideoEditor, Get<bool>(OsuConfig.Fullscreen));
|
Set(OsuConfig.VideoEditor, true);
|
||||||
Set(OsuConfig.EditorDefaultSkin, false);
|
Set(OsuConfig.EditorDefaultSkin, false);
|
||||||
Set(OsuConfig.EditorSnakingSliders, true);
|
Set(OsuConfig.EditorSnakingSliders, true);
|
||||||
Set(OsuConfig.EditorHitAnimations, false);
|
Set(OsuConfig.EditorHitAnimations, false);
|
||||||
@ -104,9 +99,7 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuConfig.EditorBeatDivisor, 1, 1, 16);
|
Set(OsuConfig.EditorBeatDivisor, 1, 1, 16);
|
||||||
Set(OsuConfig.EditorGridSize, 32, 4, 32);
|
Set(OsuConfig.EditorGridSize, 32, 4, 32);
|
||||||
Set(OsuConfig.EditorGridSizeDesign, 32, 4, 32);
|
Set(OsuConfig.EditorGridSizeDesign, 32, 4, 32);
|
||||||
Set(OsuConfig.HeightFullscreen, 9999, 240, 9999);
|
|
||||||
Set(OsuConfig.CustomFrameLimit, 240, 240, 999);
|
Set(OsuConfig.CustomFrameLimit, 240, 240, 999);
|
||||||
Set(OsuConfig.WidthFullscreen, 9999, 320, 9999);
|
|
||||||
Set(OsuConfig.MsnIntegration, false);
|
Set(OsuConfig.MsnIntegration, false);
|
||||||
Set(OsuConfig.MyPcSucks, false);
|
Set(OsuConfig.MyPcSucks, false);
|
||||||
Set(OsuConfig.NotifyFriends, true);
|
Set(OsuConfig.NotifyFriends, true);
|
||||||
@ -142,7 +135,6 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuConfig.YahooIntegration, false);
|
Set(OsuConfig.YahooIntegration, false);
|
||||||
Set(OsuConfig.ForceFrameFlush, false);
|
Set(OsuConfig.ForceFrameFlush, false);
|
||||||
Set(OsuConfig.DetectPerformanceIssues, true);
|
Set(OsuConfig.DetectPerformanceIssues, true);
|
||||||
Set(OsuConfig.Fullscreen, true);
|
|
||||||
Set(OsuConfig.MenuMusic, true);
|
Set(OsuConfig.MenuMusic, true);
|
||||||
Set(OsuConfig.MenuVoice, true);
|
Set(OsuConfig.MenuVoice, true);
|
||||||
Set(OsuConfig.MenuParallax, true);
|
Set(OsuConfig.MenuParallax, true);
|
||||||
@ -163,10 +155,6 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuConfig.SaveUsername, true);
|
Set(OsuConfig.SaveUsername, true);
|
||||||
//Set(OsuConfig.TreeSortMode, TreeGroupMode.Show_All);
|
//Set(OsuConfig.TreeSortMode, TreeGroupMode.Show_All);
|
||||||
//Set(OsuConfig.TreeSortMode2, TreeSortMode.Title);
|
//Set(OsuConfig.TreeSortMode2, TreeSortMode.Title);
|
||||||
Set(OsuConfig.Letterboxing, Get<bool>(OsuConfig.Fullscreen));
|
|
||||||
Set(OsuConfig.LetterboxPositionX, 0, -100, 100);
|
|
||||||
Set(OsuConfig.LetterboxPositionY, 0, -100, 100);
|
|
||||||
Set(OsuConfig.FrameSync, FrameSync.Limit120);
|
|
||||||
bool unicodeDefault = false;
|
bool unicodeDefault = false;
|
||||||
switch (Get<string>(OsuConfig.Language))
|
switch (Get<string>(OsuConfig.Language))
|
||||||
{
|
{
|
||||||
@ -202,9 +190,6 @@ namespace osu.Game.Configuration
|
|||||||
Token,
|
Token,
|
||||||
// Imported from old osu:
|
// Imported from old osu:
|
||||||
BeatmapDirectory,
|
BeatmapDirectory,
|
||||||
VolumeUniversal,
|
|
||||||
VolumeEffect,
|
|
||||||
VolumeMusic,
|
|
||||||
AllowPublicInvites,
|
AllowPublicInvites,
|
||||||
AutoChatHide,
|
AutoChatHide,
|
||||||
AutomaticDownload,
|
AutomaticDownload,
|
||||||
@ -281,11 +266,7 @@ namespace osu.Game.Configuration
|
|||||||
EditorBeatDivisor,
|
EditorBeatDivisor,
|
||||||
EditorGridSize,
|
EditorGridSize,
|
||||||
EditorGridSizeDesign,
|
EditorGridSizeDesign,
|
||||||
Height,
|
|
||||||
Width,
|
|
||||||
HeightFullscreen,
|
|
||||||
CustomFrameLimit,
|
CustomFrameLimit,
|
||||||
WidthFullscreen,
|
|
||||||
MsnIntegration,
|
MsnIntegration,
|
||||||
MyPcSucks,
|
MyPcSucks,
|
||||||
NotifyFriends,
|
NotifyFriends,
|
||||||
@ -321,7 +302,6 @@ namespace osu.Game.Configuration
|
|||||||
YahooIntegration,
|
YahooIntegration,
|
||||||
ForceFrameFlush,
|
ForceFrameFlush,
|
||||||
DetectPerformanceIssues,
|
DetectPerformanceIssues,
|
||||||
Fullscreen,
|
|
||||||
MenuMusic,
|
MenuMusic,
|
||||||
MenuVoice,
|
MenuVoice,
|
||||||
MenuParallax,
|
MenuParallax,
|
||||||
@ -345,10 +325,6 @@ namespace osu.Game.Configuration
|
|||||||
SaveUsername,
|
SaveUsername,
|
||||||
TreeSortMode,
|
TreeSortMode,
|
||||||
TreeSortMode2,
|
TreeSortMode2,
|
||||||
Letterboxing,
|
|
||||||
LetterboxPositionX,
|
|
||||||
LetterboxPositionY,
|
|
||||||
FrameSync,
|
|
||||||
ShowUnicode,
|
ShowUnicode,
|
||||||
PermanentSongInfo,
|
PermanentSongInfo,
|
||||||
Ticker,
|
Ticker,
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
@ -35,14 +36,39 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
if (connection == null)
|
if (connection == null)
|
||||||
{
|
{
|
||||||
connection = storage.GetDatabase(@"beatmaps");
|
try
|
||||||
connection.CreateTable<BeatmapMetadata>();
|
{
|
||||||
connection.CreateTable<BaseDifficulty>();
|
connection = prepareConnection();
|
||||||
connection.CreateTable<BeatmapSetInfo>();
|
}
|
||||||
connection.CreateTable<BeatmapInfo>();
|
catch
|
||||||
|
{
|
||||||
|
Console.WriteLine(@"Failed to initialise the beatmap database! Trying again with a clean database...");
|
||||||
|
storage.DeleteDatabase(@"beatmaps");
|
||||||
|
connection = prepareConnection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SQLiteConnection prepareConnection()
|
||||||
|
{
|
||||||
|
var conn = storage.GetDatabase(@"beatmaps");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
conn.CreateTable<BeatmapMetadata>();
|
||||||
|
conn.CreateTable<BaseDifficulty>();
|
||||||
|
conn.CreateTable<BeatmapSetInfo>();
|
||||||
|
conn.CreateTable<BeatmapInfo>();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
conn.Close();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
return conn;
|
||||||
|
}
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
foreach (var setInfo in Query<BeatmapSetInfo>())
|
foreach (var setInfo in Query<BeatmapSetInfo>())
|
||||||
@ -69,7 +95,8 @@ namespace osu.Game.Database
|
|||||||
using (var reader = ArchiveReader.GetReader(storage, path))
|
using (var reader = ArchiveReader.GetReader(storage, path))
|
||||||
metadata = reader.ReadMetadata();
|
metadata = reader.ReadMetadata();
|
||||||
|
|
||||||
if (connection.Table<BeatmapSetInfo>().Count(b => b.BeatmapSetID == metadata.BeatmapSetID) != 0)
|
if (metadata.OnlineBeatmapSetID.HasValue &&
|
||||||
|
connection.Table<BeatmapSetInfo>().Count(b => b.OnlineBeatmapSetID == metadata.OnlineBeatmapSetID) != 0)
|
||||||
return; // TODO: Update this beatmap instead
|
return; // TODO: Update this beatmap instead
|
||||||
|
|
||||||
if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader
|
if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader
|
||||||
@ -86,7 +113,7 @@ namespace osu.Game.Database
|
|||||||
}
|
}
|
||||||
var beatmapSet = new BeatmapSetInfo
|
var beatmapSet = new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
BeatmapSetID = metadata.BeatmapSetID,
|
OnlineBeatmapSetID = metadata.OnlineBeatmapSetID,
|
||||||
Beatmaps = new List<BeatmapInfo>(),
|
Beatmaps = new List<BeatmapInfo>(),
|
||||||
Path = path,
|
Path = path,
|
||||||
Hash = hash,
|
Hash = hash,
|
||||||
@ -139,18 +166,18 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
public BeatmapSetInfo GetBeatmapSet(int id)
|
public BeatmapSetInfo GetBeatmapSet(int id)
|
||||||
{
|
{
|
||||||
return Query<BeatmapSetInfo>().FirstOrDefault(s => s.BeatmapSetID == id);
|
return Query<BeatmapSetInfo>().FirstOrDefault(s => s.OnlineBeatmapSetID == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null)
|
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null)
|
||||||
{
|
{
|
||||||
var beatmapSetInfo = Query<BeatmapSetInfo>().FirstOrDefault(s => s.BeatmapSetID == beatmapInfo.BeatmapSetID);
|
var beatmapSetInfo = Query<BeatmapSetInfo>().FirstOrDefault(s => s.ID == beatmapInfo.BeatmapSetInfoID);
|
||||||
|
|
||||||
//we need metadata
|
//we need metadata
|
||||||
GetChildren(beatmapSetInfo);
|
GetChildren(beatmapSetInfo);
|
||||||
|
|
||||||
if (beatmapSetInfo == null)
|
if (beatmapSetInfo == null)
|
||||||
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetID} is not in the local database.");
|
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database.");
|
||||||
|
|
||||||
if (beatmapInfo.Metadata == null)
|
if (beatmapInfo.Metadata == null)
|
||||||
beatmapInfo.Metadata = beatmapSetInfo.Metadata;
|
beatmapInfo.Metadata = beatmapSetInfo.Metadata;
|
||||||
|
@ -13,11 +13,15 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
public class BeatmapInfo : IEquatable<BeatmapInfo>
|
public class BeatmapInfo : IEquatable<BeatmapInfo>
|
||||||
{
|
{
|
||||||
[PrimaryKey]
|
[PrimaryKey, AutoIncrement]
|
||||||
public int BeatmapID { get; set; }
|
public int ID { get; set; }
|
||||||
|
|
||||||
|
public int? OnlineBeatmapID { get; set; } = null;
|
||||||
|
|
||||||
|
public int? OnlineBeatmapSetID { get; set; } = null;
|
||||||
|
|
||||||
[ForeignKey(typeof(BeatmapSetInfo))]
|
[ForeignKey(typeof(BeatmapSetInfo))]
|
||||||
public int BeatmapSetID { get; set; }
|
public int BeatmapSetInfoID { get; set; }
|
||||||
|
|
||||||
[ManyToOne]
|
[ManyToOne]
|
||||||
public BeatmapSetInfo BeatmapSet { get; set; }
|
public BeatmapSetInfo BeatmapSet { get; set; }
|
||||||
@ -71,7 +75,7 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
public bool Equals(BeatmapInfo other)
|
public bool Equals(BeatmapInfo other)
|
||||||
{
|
{
|
||||||
return BeatmapID == other?.BeatmapID;
|
return ID == other?.ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AudioEquals(BeatmapInfo other) => other != null &&
|
public bool AudioEquals(BeatmapInfo other) => other != null &&
|
||||||
|
@ -9,8 +9,9 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
[PrimaryKey, AutoIncrement]
|
[PrimaryKey, AutoIncrement]
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
|
|
||||||
public int BeatmapSetID { get; set; }
|
public int? OnlineBeatmapSetID { get; set; } = null;
|
||||||
|
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string TitleUnicode { get; set; }
|
public string TitleUnicode { get; set; }
|
||||||
public string Artist { get; set; }
|
public string Artist { get; set; }
|
||||||
|
@ -10,20 +10,22 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
public class BeatmapSetInfo
|
public class BeatmapSetInfo
|
||||||
{
|
{
|
||||||
[PrimaryKey]
|
[PrimaryKey, AutoIncrement]
|
||||||
public int BeatmapSetID { get; set; }
|
public int ID { get; set; }
|
||||||
|
|
||||||
|
public int? OnlineBeatmapSetID { get; set; } = null;
|
||||||
|
|
||||||
[OneToOne(CascadeOperations = CascadeOperation.All)]
|
[OneToOne(CascadeOperations = CascadeOperation.All)]
|
||||||
public BeatmapMetadata Metadata { get; set; }
|
public BeatmapMetadata Metadata { get; set; }
|
||||||
|
|
||||||
[NotNull, ForeignKey(typeof(BeatmapMetadata))]
|
[NotNull, ForeignKey(typeof(BeatmapMetadata))]
|
||||||
public int BeatmapMetadataID { get; set; }
|
public int BeatmapMetadataID { get; set; }
|
||||||
|
|
||||||
[OneToMany(CascadeOperations = CascadeOperation.All)]
|
[OneToMany(CascadeOperations = CascadeOperation.All)]
|
||||||
public List<BeatmapInfo> Beatmaps { get; set; }
|
public List<BeatmapInfo> Beatmaps { get; set; }
|
||||||
|
|
||||||
public string Hash { get; set; }
|
public string Hash { get; set; }
|
||||||
|
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
{
|
{
|
||||||
public class Triangles : Container<Triangle>
|
public class Triangles : Container<Triangle>
|
||||||
{
|
{
|
||||||
|
public override bool HandleInput => false;
|
||||||
|
|
||||||
public Triangles()
|
public Triangles()
|
||||||
{
|
{
|
||||||
Alpha = 0.3f;
|
Alpha = 0.3f;
|
||||||
|
61
osu.Game/Graphics/OsuColour.cs
Normal file
61
osu.Game/Graphics/OsuColour.cs
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
using System;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Graphics.Colour;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics
|
||||||
|
{
|
||||||
|
public static class OsuColourExtensions
|
||||||
|
{
|
||||||
|
public static Color4 Opacity(this Color4 color, float a) => new Color4(color.R, color.G, color.B, a);
|
||||||
|
public static Color4 Opacity(this Color4 color, byte a) => new Color4(color.R, color.G, color.B, a / 255f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class OsuColour
|
||||||
|
{
|
||||||
|
public static Color4 Gray(float amt) => new Color4(amt, amt, amt, 1f);
|
||||||
|
public static Color4 Gray(byte amt) => new Color4(amt, amt, amt, 255);
|
||||||
|
|
||||||
|
private static Color4 FromHex(string hex)
|
||||||
|
{
|
||||||
|
return new Color4(
|
||||||
|
Convert.ToByte(hex.Substring(0, 2), 16),
|
||||||
|
Convert.ToByte(hex.Substring(2, 2), 16),
|
||||||
|
Convert.ToByte(hex.Substring(4, 2), 16),
|
||||||
|
255);
|
||||||
|
}
|
||||||
|
|
||||||
|
// See https://github.com/ppy/osu-web/blob/master/resources/assets/less/colors.less
|
||||||
|
|
||||||
|
public Color4 PurpleLighter = FromHex(@"eeeeff");
|
||||||
|
public Color4 PurpleLight = FromHex(@"aa88ff");
|
||||||
|
public Color4 Purple = FromHex(@"8866ee");
|
||||||
|
public Color4 PurpleDark = FromHex(@"6644cc");
|
||||||
|
public Color4 PurpleDarker = FromHex(@"441188");
|
||||||
|
|
||||||
|
public Color4 PinkLighter = FromHex(@"ffddee");
|
||||||
|
public Color4 PinkLight = FromHex(@"ff99cc");
|
||||||
|
public Color4 Pink = FromHex(@"ff66aa");
|
||||||
|
public Color4 PinkDark = FromHex(@"cc5288");
|
||||||
|
public Color4 PinkDarker = FromHex(@"bb1177");
|
||||||
|
|
||||||
|
public Color4 BlueLighter = FromHex(@"ddffff");
|
||||||
|
public Color4 BlueLight = FromHex(@"99eeff");
|
||||||
|
public Color4 Blue = FromHex(@"66ccff");
|
||||||
|
public Color4 BlueDark = FromHex(@"44aadd");
|
||||||
|
public Color4 BlueDarker = FromHex(@"2299bb");
|
||||||
|
|
||||||
|
public Color4 YellowLighter = FromHex(@"ffffdd");
|
||||||
|
public Color4 YellowLight = FromHex(@"ffdd55");
|
||||||
|
public Color4 Yellow = FromHex(@"ffcc22");
|
||||||
|
public Color4 YellowDark = FromHex(@"eeaa00");
|
||||||
|
public Color4 YellowDarker = FromHex(@"cc6600");
|
||||||
|
|
||||||
|
public Color4 GreenLighter = FromHex(@"eeffcc");
|
||||||
|
public Color4 GreenLight = FromHex(@"b3d944");
|
||||||
|
public Color4 Green = FromHex(@"88b300");
|
||||||
|
public Color4 GreenDark = FromHex(@"668800");
|
||||||
|
public Color4 GreenDarker = FromHex(@"445500");
|
||||||
|
|
||||||
|
public Color4 Red = FromHex(@"fc4549");
|
||||||
|
}
|
||||||
|
}
|
@ -27,62 +27,13 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
private const float shear = 0.1f;
|
private const float shear = 0.1f;
|
||||||
|
|
||||||
private static readonly Vector2 size_extended = new Vector2(140, 50);
|
public static readonly Vector2 SIZE_EXTENDED = new Vector2(140, 50);
|
||||||
private static readonly Vector2 size_retracted = new Vector2(100, 50);
|
public static readonly Vector2 SIZE_RETRACTED = new Vector2(100, 50);
|
||||||
private AudioSample sampleClick;
|
private AudioSample sampleClick;
|
||||||
|
|
||||||
public BackButton()
|
public BackButton()
|
||||||
{
|
{
|
||||||
Size = size_retracted;
|
Size = SIZE_RETRACTED;
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Width = 0.4f,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
leftBox = new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = new Color4(195, 40, 140, 255),
|
|
||||||
Shear = new Vector2(shear, 0),
|
|
||||||
},
|
|
||||||
icon = new TextAwesome
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
TextSize = 25,
|
|
||||||
Icon = FontAwesome.fa_osu_left_o
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Width = 0.6f,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
rightBox = new Box
|
|
||||||
{
|
|
||||||
Colour = new Color4(238, 51, 153, 255),
|
|
||||||
Origin = Anchor.TopLeft,
|
|
||||||
Anchor = Anchor.TopLeft,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Shear = new Vector2(shear, 0),
|
|
||||||
EdgeSmoothness = new Vector2(1.5f, 0),
|
|
||||||
},
|
|
||||||
new SpriteText
|
|
||||||
{
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Text = @"Back",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => leftBox.Contains(screenSpacePos) || rightBox.Contains(screenSpacePos);
|
public override bool Contains(Vector2 screenSpacePos) => leftBox.Contains(screenSpacePos) || rightBox.Contains(screenSpacePos);
|
||||||
@ -91,7 +42,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
icon.ClearTransformations();
|
icon.ClearTransformations();
|
||||||
|
|
||||||
ResizeTo(size_extended, transform_time, EasingTypes.OutElastic);
|
ResizeTo(SIZE_EXTENDED, transform_time, EasingTypes.OutElastic);
|
||||||
|
|
||||||
int duration = 0; //(int)(Game.Audio.BeatLength / 2);
|
int duration = 0; //(int)(Game.Audio.BeatLength / 2);
|
||||||
if (duration == 0) duration = pulse_length;
|
if (duration == 0) duration = pulse_length;
|
||||||
@ -118,7 +69,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
icon.ClearTransformations();
|
icon.ClearTransformations();
|
||||||
|
|
||||||
ResizeTo(size_retracted, transform_time, EasingTypes.OutElastic);
|
ResizeTo(SIZE_RETRACTED, transform_time, EasingTypes.OutElastic);
|
||||||
|
|
||||||
int duration = 0; //(int)(Game.Audio.BeatLength);
|
int duration = 0; //(int)(Game.Audio.BeatLength);
|
||||||
if (duration == 0) duration = pulse_length * 2;
|
if (duration == 0) duration = pulse_length * 2;
|
||||||
@ -140,9 +91,57 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio, OsuColour colours)
|
||||||
{
|
{
|
||||||
sampleClick = audio.Sample.Get(@"Menu/menuback");
|
sampleClick = audio.Sample.Get(@"Menu/menuback");
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Width = 0.4f,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
leftBox = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colours.PinkDark,
|
||||||
|
Shear = new Vector2(shear, 0),
|
||||||
|
},
|
||||||
|
icon = new TextAwesome
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
TextSize = 25,
|
||||||
|
Icon = FontAwesome.fa_osu_left_o
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Width = 0.6f,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
rightBox = new Box
|
||||||
|
{
|
||||||
|
Colour = colours.Pink,
|
||||||
|
Origin = Anchor.TopLeft,
|
||||||
|
Anchor = Anchor.TopLeft,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Shear = new Vector2(shear, 0),
|
||||||
|
EdgeSmoothness = new Vector2(1.5f, 0),
|
||||||
|
},
|
||||||
|
new SpriteText
|
||||||
|
{
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Text = @"Back",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(InputState state)
|
protected override bool OnClick(InputState state)
|
||||||
@ -151,7 +150,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Shear = new Vector2(shear, 0),
|
Shear = new Vector2(shear, 0),
|
||||||
Colour = new Color4(255, 255, 255, 128),
|
Colour = Color4.White.Opacity(0.5f),
|
||||||
};
|
};
|
||||||
Add(flash);
|
Add(flash);
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
@ -12,7 +13,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
public OsuButton()
|
public OsuButton()
|
||||||
{
|
{
|
||||||
Height = 25;
|
Height = 25;
|
||||||
Colour = new Color4(14, 132, 165, 255);
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
Colour = colours.BlueDark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,6 @@
|
|||||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
//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;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
@ -9,10 +8,6 @@ using osu.Framework.Graphics.Transformations;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -64,7 +59,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected T prevCount;
|
|
||||||
protected T count;
|
protected T count;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -78,7 +72,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
prevCount = count;
|
|
||||||
count = value;
|
count = value;
|
||||||
if (IsLoaded)
|
if (IsLoaded)
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
protected set;
|
protected set;
|
||||||
}
|
}
|
||||||
|
|
||||||
private double animationDelay => 150;
|
private double animationDelay => 80;
|
||||||
|
|
||||||
private double scalingDuration => 500;
|
private double scalingDuration => 500;
|
||||||
private EasingTypes scalingEasing => EasingTypes.OutElasticHalf;
|
private EasingTypes scalingEasing => EasingTypes.OutElasticHalf;
|
||||||
|
@ -43,6 +43,8 @@ namespace osu.Game.Modes.Objects.Drawables
|
|||||||
state = value;
|
state = value;
|
||||||
|
|
||||||
UpdateState(state);
|
UpdateState(state);
|
||||||
|
if (IsLoaded)
|
||||||
|
Expire();
|
||||||
|
|
||||||
if (State == ArmedState.Hit)
|
if (State == ArmedState.Hit)
|
||||||
PlaySample();
|
PlaySample();
|
||||||
@ -54,8 +56,8 @@ namespace osu.Game.Modes.Objects.Drawables
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
string hitType = (HitObject.Sample.Type == SampleType.None ? SampleType.Normal : HitObject.Sample.Type).ToString().ToLower();
|
string hitType = ((HitObject.Sample?.Type ?? SampleType.None) == SampleType.None ? SampleType.Normal : HitObject.Sample.Type).ToString().ToLower();
|
||||||
string sampleSet = HitObject.Sample.Set.ToString().ToLower();
|
string sampleSet = (HitObject.Sample?.Set ?? SampleSet.Normal).ToString().ToLower();
|
||||||
|
|
||||||
sample = audio.Sample.Get($@"Gameplay/{sampleSet}-hit{hitType}");
|
sample = audio.Sample.Get($@"Gameplay/{sampleSet}-hit{hitType}");
|
||||||
}
|
}
|
||||||
@ -75,6 +77,8 @@ namespace osu.Game.Modes.Objects.Drawables
|
|||||||
|
|
||||||
//force application of the state that was set before we loaded.
|
//force application of the state that was set before we loaded.
|
||||||
UpdateState(State);
|
UpdateState(State);
|
||||||
|
|
||||||
|
Expire(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Samples;
|
using osu.Game.Beatmaps.Samples;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Objects
|
namespace osu.Game.Modes.Objects
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Modes
|
|||||||
|
|
||||||
public abstract ScoreOverlay CreateScoreOverlay();
|
public abstract ScoreOverlay CreateScoreOverlay();
|
||||||
|
|
||||||
public abstract ScoreProcessor CreateScoreProcessor();
|
public abstract ScoreProcessor CreateScoreProcessor(int hitObjectCount);
|
||||||
|
|
||||||
public abstract HitRenderer CreateHitRendererWith(List<HitObject> objects);
|
public abstract HitRenderer CreateHitRendererWith(List<HitObject> objects);
|
||||||
|
|
||||||
|
@ -15,5 +15,6 @@ namespace osu.Game.Modes
|
|||||||
public double Accuracy { get; set; }
|
public double Accuracy { get; set; }
|
||||||
public double Combo { get; set; }
|
public double Combo { get; set; }
|
||||||
public double MaxCombo { get; set; }
|
public double MaxCombo { get; set; }
|
||||||
|
public double Health { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,22 +18,46 @@ namespace osu.Game.Modes
|
|||||||
TotalScore = TotalScore,
|
TotalScore = TotalScore,
|
||||||
Combo = Combo,
|
Combo = Combo,
|
||||||
MaxCombo = HighestCombo,
|
MaxCombo = HighestCombo,
|
||||||
Accuracy = Accuracy
|
Accuracy = Accuracy,
|
||||||
|
Health = Health,
|
||||||
};
|
};
|
||||||
|
|
||||||
public readonly BindableDouble TotalScore = new BindableDouble { MinValue = 0 };
|
public readonly BindableDouble TotalScore = new BindableDouble { MinValue = 0 };
|
||||||
|
|
||||||
public readonly BindableDouble Accuracy = new BindableDouble { MinValue = 0, MaxValue = 1 };
|
public readonly BindableDouble Accuracy = new BindableDouble { MinValue = 0, MaxValue = 1 };
|
||||||
|
|
||||||
|
public readonly BindableDouble Health = new BindableDouble { MinValue = 0, MaxValue = 1 };
|
||||||
|
|
||||||
public readonly BindableInt Combo = new BindableInt();
|
public readonly BindableInt Combo = new BindableInt();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Are we allowed to fail?
|
||||||
|
/// </summary>
|
||||||
|
protected bool CanFail => true;
|
||||||
|
|
||||||
|
protected bool HasFailed { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when we reach a failing health of zero.
|
||||||
|
/// </summary>
|
||||||
|
public event Action Failed;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Keeps track of the highest combo ever achieved in this play.
|
||||||
|
/// This is handled automatically by ScoreProcessor.
|
||||||
|
/// </summary>
|
||||||
public readonly BindableInt HighestCombo = new BindableInt();
|
public readonly BindableInt HighestCombo = new BindableInt();
|
||||||
|
|
||||||
public readonly List<JudgementInfo> Judgements = new List<JudgementInfo>();
|
public readonly List<JudgementInfo> Judgements;
|
||||||
|
|
||||||
public ScoreProcessor()
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="ScoreProcessor"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObjectCount">Number of HitObjects. It is used for specifying Judgements collection Capacity</param>
|
||||||
|
public ScoreProcessor(int hitObjectCount = 0)
|
||||||
{
|
{
|
||||||
Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); };
|
Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); };
|
||||||
|
Judgements = new List<JudgementInfo>(hitObjectCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddJudgement(JudgementInfo judgement)
|
public void AddJudgement(JudgementInfo judgement)
|
||||||
@ -43,6 +67,11 @@ namespace osu.Game.Modes
|
|||||||
UpdateCalculations(judgement);
|
UpdateCalculations(judgement);
|
||||||
|
|
||||||
judgement.ComboAtHit = (ulong)Combo.Value;
|
judgement.ComboAtHit = (ulong)Combo.Value;
|
||||||
|
if (Health.Value == Health.MinValue && !HasFailed)
|
||||||
|
{
|
||||||
|
HasFailed = true;
|
||||||
|
Failed?.Invoke();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
44
osu.Game/Modes/UI/HealthDisplay.cs
Normal file
44
osu.Game/Modes/UI/HealthDisplay.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.UI
|
||||||
|
{
|
||||||
|
public class HealthDisplay : Container
|
||||||
|
{
|
||||||
|
private Box background;
|
||||||
|
private Box fill;
|
||||||
|
|
||||||
|
public BindableDouble Current = new BindableDouble() { MinValue = 0, MaxValue = 1 };
|
||||||
|
|
||||||
|
public HealthDisplay()
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
background = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.Gray,
|
||||||
|
},
|
||||||
|
fill = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.White,
|
||||||
|
Scale = new Vector2(0, 1),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Current.ValueChanged += current_ValueChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void current_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
fill.ScaleTo(new Vector2((float)Current, 1), 200, EasingTypes.OutQuint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,8 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Modes.Objects;
|
using osu.Game.Modes.Objects;
|
||||||
|
using OpenTK;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
|
||||||
namespace osu.Game.Modes.UI
|
namespace osu.Game.Modes.UI
|
||||||
{
|
{
|
||||||
@ -15,12 +17,19 @@ namespace osu.Game.Modes.UI
|
|||||||
public ComboCounter ComboCounter;
|
public ComboCounter ComboCounter;
|
||||||
public ScoreCounter ScoreCounter;
|
public ScoreCounter ScoreCounter;
|
||||||
public PercentageCounter AccuracyCounter;
|
public PercentageCounter AccuracyCounter;
|
||||||
|
public HealthDisplay HealthDisplay;
|
||||||
public Score Score { get; set; }
|
public Score Score { get; set; }
|
||||||
|
|
||||||
protected abstract KeyCounterCollection CreateKeyCounter();
|
protected abstract KeyCounterCollection CreateKeyCounter();
|
||||||
protected abstract ComboCounter CreateComboCounter();
|
protected abstract ComboCounter CreateComboCounter();
|
||||||
protected abstract PercentageCounter CreateAccuracyCounter();
|
protected abstract PercentageCounter CreateAccuracyCounter();
|
||||||
protected abstract ScoreCounter CreateScoreCounter();
|
protected abstract ScoreCounter CreateScoreCounter();
|
||||||
|
protected virtual HealthDisplay CreateHealthDisplay() => new HealthDisplay
|
||||||
|
{
|
||||||
|
Size = new Vector2(0.5f, 20),
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Padding = new MarginPadding(5)
|
||||||
|
};
|
||||||
|
|
||||||
public virtual void OnHit(HitObject h)
|
public virtual void OnHit(HitObject h)
|
||||||
{
|
{
|
||||||
@ -44,6 +53,7 @@ namespace osu.Game.Modes.UI
|
|||||||
ComboCounter = CreateComboCounter(),
|
ComboCounter = CreateComboCounter(),
|
||||||
ScoreCounter = CreateScoreCounter(),
|
ScoreCounter = CreateScoreCounter(),
|
||||||
AccuracyCounter = CreateAccuracyCounter(),
|
AccuracyCounter = CreateAccuracyCounter(),
|
||||||
|
HealthDisplay = CreateHealthDisplay(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +63,7 @@ namespace osu.Game.Modes.UI
|
|||||||
processor.TotalScore.ValueChanged += delegate { ScoreCounter?.Set((ulong)processor.TotalScore.Value); };
|
processor.TotalScore.ValueChanged += delegate { ScoreCounter?.Set((ulong)processor.TotalScore.Value); };
|
||||||
processor.Accuracy.ValueChanged += delegate { AccuracyCounter?.Set((float)processor.Accuracy.Value); };
|
processor.Accuracy.ValueChanged += delegate { AccuracyCounter?.Set((float)processor.Accuracy.Value); };
|
||||||
processor.Combo.ValueChanged += delegate { ComboCounter?.Set((ulong)processor.Combo.Value); };
|
processor.Combo.ValueChanged += delegate { ComboCounter?.Set((ulong)processor.Combo.Value); };
|
||||||
|
HealthDisplay?.Current.Weld(processor.Health);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Online.Chat.Drawables
|
|||||||
{
|
{
|
||||||
Text = Message.Timestamp.LocalDateTime.ToLongTimeString(),
|
Text = Message.Timestamp.LocalDateTime.ToLongTimeString(),
|
||||||
TextSize = text_size,
|
TextSize = text_size,
|
||||||
Colour = new Color4(128, 128, 128, 255)
|
Colour = Color4.Gray
|
||||||
},
|
},
|
||||||
new SpriteText
|
new SpriteText
|
||||||
{
|
{
|
||||||
|
@ -2,16 +2,12 @@
|
|||||||
//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 System;
|
using System;
|
||||||
using System.Threading;
|
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.GameModes;
|
using osu.Framework.GameModes;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using OpenTK;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Platform;
|
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Framework;
|
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Game.Input;
|
using osu.Game.Input;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
@ -25,7 +21,6 @@ using osu.Game.Modes;
|
|||||||
using osu.Game.Overlays.Toolbar;
|
using osu.Game.Overlays.Toolbar;
|
||||||
using osu.Game.Screens;
|
using osu.Game.Screens;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osu.Game.Screens.Play;
|
|
||||||
|
|
||||||
namespace osu.Game
|
namespace osu.Game
|
||||||
{
|
{
|
||||||
@ -55,13 +50,6 @@ namespace osu.Game
|
|||||||
this.args = args;
|
this.args = args;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetHost(BasicGameHost host)
|
|
||||||
{
|
|
||||||
base.SetHost(host);
|
|
||||||
|
|
||||||
host.Size = new Vector2(Config.Get<int>(OsuConfig.Width), Config.Get<int>(OsuConfig.Height));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ToggleOptions() => options.ToggleVisibility();
|
public void ToggleOptions() => options.ToggleVisibility();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -78,12 +66,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
Dependencies.Cache(this);
|
Dependencies.Cache(this);
|
||||||
|
|
||||||
//attach our bindables to the audio subsystem.
|
PlayMode = LocalConfig.GetBindable<PlayMode>(OsuConfig.PlayMode);
|
||||||
Audio.Volume.Weld(Config.GetBindable<double>(OsuConfig.VolumeUniversal));
|
|
||||||
Audio.VolumeSample.Weld(Config.GetBindable<double>(OsuConfig.VolumeEffect));
|
|
||||||
Audio.VolumeTrack.Weld(Config.GetBindable<double>(OsuConfig.VolumeMusic));
|
|
||||||
|
|
||||||
PlayMode = Config.GetBindable<PlayMode>(OsuConfig.PlayMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -110,11 +93,9 @@ namespace osu.Game
|
|||||||
|
|
||||||
(modeStack = new Intro()).Preload(this, d =>
|
(modeStack = new Intro()).Preload(this, d =>
|
||||||
{
|
{
|
||||||
mainContent.Add(d);
|
|
||||||
|
|
||||||
modeStack.ModePushed += modeAdded;
|
modeStack.ModePushed += modeAdded;
|
||||||
modeStack.Exited += modeRemoved;
|
modeStack.Exited += modeRemoved;
|
||||||
modeStack.DisplayAsRoot();
|
mainContent.Add(modeStack);
|
||||||
});
|
});
|
||||||
|
|
||||||
//overlay elements
|
//overlay elements
|
||||||
@ -241,17 +222,5 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
modeChanged(newMode);
|
modeChanged(newMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
|
|
||||||
{
|
|
||||||
if (!base.Invalidate(invalidation, source, shallPropagate)) return false;
|
|
||||||
|
|
||||||
if (Parent != null)
|
|
||||||
{
|
|
||||||
Config.Set(OsuConfig.Width, DrawSize.X);
|
|
||||||
Config.Set(OsuConfig.Height, DrawSize.Y);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Beatmaps.IO;
|
using osu.Game.Beatmaps.IO;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Graphics.Processing;
|
using osu.Game.Graphics.Processing;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
@ -21,7 +22,7 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
public class OsuGameBase : BaseGame, IOnlineComponent
|
public class OsuGameBase : BaseGame, IOnlineComponent
|
||||||
{
|
{
|
||||||
internal OsuConfigManager Config;
|
protected OsuConfigManager LocalConfig;
|
||||||
|
|
||||||
protected override string MainResourceFile => @"osu.Game.Resources.dll";
|
protected override string MainResourceFile => @"osu.Game.Resources.dll";
|
||||||
|
|
||||||
@ -39,8 +40,9 @@ namespace osu.Game
|
|||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Dependencies.Cache(this);
|
Dependencies.Cache(this);
|
||||||
Dependencies.Cache(Config);
|
Dependencies.Cache(LocalConfig);
|
||||||
Dependencies.Cache(new BeatmapDatabase(Host.Storage, Host));
|
Dependencies.Cache(new BeatmapDatabase(Host.Storage, Host));
|
||||||
|
Dependencies.Cache(new OsuColour());
|
||||||
|
|
||||||
//this completely overrides the framework default. will need to change once we make a proper FontStore.
|
//this completely overrides the framework default. will need to change once we make a proper FontStore.
|
||||||
Dependencies.Cache(Fonts = new FontStore { ScaleAdjust = 0.01f }, true);
|
Dependencies.Cache(Fonts = new FontStore { ScaleAdjust = 0.01f }, true);
|
||||||
@ -67,9 +69,9 @@ namespace osu.Game
|
|||||||
|
|
||||||
Dependencies.Cache(API = new APIAccess
|
Dependencies.Cache(API = new APIAccess
|
||||||
{
|
{
|
||||||
Username = Config.Get<string>(OsuConfig.Username),
|
Username = LocalConfig.Get<string>(OsuConfig.Username),
|
||||||
Password = Config.Get<string>(OsuConfig.Password),
|
Password = LocalConfig.Get<string>(OsuConfig.Password),
|
||||||
Token = Config.Get<string>(OsuConfig.Token)
|
Token = LocalConfig.Get<string>(OsuConfig.Token)
|
||||||
});
|
});
|
||||||
|
|
||||||
API.Register(this);
|
API.Register(this);
|
||||||
@ -80,8 +82,8 @@ namespace osu.Game
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case APIState.Online:
|
case APIState.Online:
|
||||||
Config.Set(OsuConfig.Username, Config.Get<bool>(OsuConfig.SaveUsername) ? API.Username : string.Empty);
|
LocalConfig.Set(OsuConfig.Username, LocalConfig.Get<bool>(OsuConfig.SaveUsername) ? API.Username : string.Empty);
|
||||||
Config.Set(OsuConfig.Password, Config.Get<bool>(OsuConfig.SavePassword) ? API.Password : string.Empty);
|
LocalConfig.Set(OsuConfig.Password, LocalConfig.Get<bool>(OsuConfig.SavePassword) ? API.Password : string.Empty);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,8 +103,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
public override void SetHost(BasicGameHost host)
|
public override void SetHost(BasicGameHost host)
|
||||||
{
|
{
|
||||||
if (Config == null)
|
if (LocalConfig == null)
|
||||||
Config = new OsuConfigManager(host.Storage);
|
LocalConfig = new OsuConfigManager(host.Storage);
|
||||||
base.SetHost(host);
|
base.SetHost(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,10 +117,10 @@ namespace osu.Game
|
|||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
//refresh token may have changed.
|
//refresh token may have changed.
|
||||||
if (Config != null && API != null)
|
if (LocalConfig != null && API != null)
|
||||||
{
|
{
|
||||||
Config.Set(OsuConfig.Token, API.Token);
|
LocalConfig.Set(OsuConfig.Token, API.Token);
|
||||||
Config.Save();
|
LocalConfig.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
|
@ -13,6 +13,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Online.Chat;
|
using osu.Game.Online.Chat;
|
||||||
@ -45,7 +46,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
Depth = float.MaxValue,
|
Depth = float.MaxValue,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = new Color4(0.1f, 0.1f, 0.1f, 0.4f),
|
Colour = OsuColour.Gray(0.1f).Opacity(0.4f),
|
||||||
},
|
},
|
||||||
content = new Container
|
content = new Container
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,6 @@ namespace osu.Game.Overlays
|
|||||||
private TrackManager trackManager;
|
private TrackManager trackManager;
|
||||||
private Bindable<WorkingBeatmap> beatmapSource;
|
private Bindable<WorkingBeatmap> beatmapSource;
|
||||||
private Bindable<bool> preferUnicode;
|
private Bindable<bool> preferUnicode;
|
||||||
private OsuConfigManager config;
|
|
||||||
private WorkingBeatmap current;
|
private WorkingBeatmap current;
|
||||||
private BeatmapDatabase beatmaps;
|
private BeatmapDatabase beatmaps;
|
||||||
private BaseGame game;
|
private BaseGame game;
|
||||||
@ -56,7 +55,7 @@ namespace osu.Game.Overlays
|
|||||||
EdgeEffect = new EdgeEffect
|
EdgeEffect = new EdgeEffect
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Shadow,
|
Type = EdgeEffectType.Shadow,
|
||||||
Colour = new Color4(0, 0, 0, 40),
|
Colour = Color4.Black.Opacity(40),
|
||||||
Radius = 5,
|
Radius = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -65,6 +64,32 @@ namespace osu.Game.Overlays
|
|||||||
Origin = Anchor.TopRight;
|
Origin = Anchor.TopRight;
|
||||||
Position = start_position;
|
Position = start_position;
|
||||||
Margin = new MarginPadding(10);
|
Margin = new MarginPadding(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnDragStart(InputState state) => true;
|
||||||
|
|
||||||
|
protected override bool OnDrag(InputState state)
|
||||||
|
{
|
||||||
|
Vector2 change = (state.Mouse.Position - state.Mouse.PositionMouseDown.Value);
|
||||||
|
|
||||||
|
// Diminish the drag distance as we go further to simulate "rubber band" feeling.
|
||||||
|
change *= (float)Math.Pow(change.Length, 0.7f) / change.Length;
|
||||||
|
|
||||||
|
MoveTo(start_position + change);
|
||||||
|
return base.OnDrag(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnDragEnd(InputState state)
|
||||||
|
{
|
||||||
|
MoveTo(start_position, 800, EasingTypes.OutElastic);
|
||||||
|
return base.OnDragEnd(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuGameBase osuGame, OsuConfigManager config, BeatmapDatabase beatmaps, AudioManager audio,
|
||||||
|
TextureStore textures, OsuColour colours)
|
||||||
|
{
|
||||||
|
unicodeString = config.GetUnicodeString;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -171,38 +196,14 @@ namespace osu.Game.Overlays
|
|||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Height = 10,
|
Height = 10,
|
||||||
Colour = new Color4(255, 204, 34, 255),
|
Colour = colours.Yellow,
|
||||||
SeekRequested = seek
|
SeekRequested = seek
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnDragStart(InputState state) => true;
|
|
||||||
|
|
||||||
protected override bool OnDrag(InputState state)
|
|
||||||
{
|
|
||||||
Vector2 change = (state.Mouse.Position - state.Mouse.PositionMouseDown.Value);
|
|
||||||
|
|
||||||
// Diminish the drag distance as we go further to simulate "rubber band" feeling.
|
|
||||||
change *= (float)Math.Pow(change.Length, 0.7f) / change.Length;
|
|
||||||
|
|
||||||
MoveTo(start_position + change);
|
|
||||||
return base.OnDrag(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnDragEnd(InputState state)
|
|
||||||
{
|
|
||||||
MoveTo(start_position, 800, EasingTypes.OutElastic);
|
|
||||||
return base.OnDragEnd(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuGameBase osuGame, BeatmapDatabase beatmaps, AudioManager audio, TextureStore textures)
|
|
||||||
{
|
|
||||||
this.beatmaps = beatmaps;
|
this.beatmaps = beatmaps;
|
||||||
trackManager = osuGame.Audio.Track;
|
trackManager = osuGame.Audio.Track;
|
||||||
config = osuGame.Config;
|
preferUnicode = config.GetBindable<bool>(OsuConfig.ShowUnicode);
|
||||||
preferUnicode = osuGame.Config.GetBindable<bool>(OsuConfig.ShowUnicode);
|
|
||||||
preferUnicode.ValueChanged += preferUnicode_changed;
|
preferUnicode.ValueChanged += preferUnicode_changed;
|
||||||
|
|
||||||
beatmapSource = osuGame.Beatmap ?? new Bindable<WorkingBeatmap>();
|
beatmapSource = osuGame.Beatmap ?? new Bindable<WorkingBeatmap>();
|
||||||
@ -318,13 +319,13 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
if (beatmap.Beatmap == null)
|
if (beatmap?.Beatmap == null)
|
||||||
//todo: we may need to display some default text here (currently in the constructor).
|
//todo: we may need to display some default text here (currently in the constructor).
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata;
|
BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata;
|
||||||
title.Text = config.GetUnicodeString(metadata.Title, metadata.TitleUnicode);
|
title.Text = unicodeString(metadata.Title, metadata.TitleUnicode);
|
||||||
artist.Text = config.GetUnicodeString(metadata.Artist, metadata.ArtistUnicode);
|
artist.Text = unicodeString(metadata.Artist, metadata.ArtistUnicode);
|
||||||
});
|
});
|
||||||
|
|
||||||
MusicControllerBackground newBackground;
|
MusicControllerBackground newBackground;
|
||||||
@ -353,6 +354,8 @@ namespace osu.Game.Overlays
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Func<string, string, string> unicodeString;
|
||||||
|
|
||||||
private void seek(float position)
|
private void seek(float position)
|
||||||
{
|
{
|
||||||
current?.Track?.Seek(current.Track.Length * position);
|
current?.Track?.Seek(current.Track.Length * position);
|
||||||
@ -393,7 +396,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
sprite = new Sprite
|
sprite = new Sprite
|
||||||
{
|
{
|
||||||
Colour = new Color4(150, 150, 150, 255),
|
Colour = OsuColour.Gray(150),
|
||||||
FillMode = FillMode.Fill,
|
FillMode = FillMode.Fill,
|
||||||
},
|
},
|
||||||
new Box
|
new Box
|
||||||
@ -402,7 +405,7 @@ namespace osu.Game.Overlays
|
|||||||
Height = 50,
|
Height = 50,
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Colour = new Color4(0, 0, 0, 127)
|
Colour = Color4.Black.Opacity(0.5f)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ using osu.Framework.Graphics.UserInterface;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options
|
namespace osu.Game.Overlays.Options
|
||||||
{
|
{
|
||||||
@ -140,26 +141,13 @@ namespace osu.Game.Overlays.Options
|
|||||||
private Box fill;
|
private Box fill;
|
||||||
|
|
||||||
const float border_width = 3;
|
const float border_width = 3;
|
||||||
|
private Color4 glowingColour, idleColour;
|
||||||
Color4 hoverColour = new Color4(255, 221, 238, 255);
|
|
||||||
Color4 defaultColour = new Color4(255, 102, 170, 255);
|
|
||||||
Color4 glowColour = new Color4(187, 17, 119, 0);
|
|
||||||
|
|
||||||
public Light()
|
public Light()
|
||||||
{
|
{
|
||||||
Size = new Vector2(40, 12);
|
Size = new Vector2(40, 12);
|
||||||
|
|
||||||
Masking = true;
|
Masking = true;
|
||||||
|
|
||||||
Colour = defaultColour;
|
|
||||||
|
|
||||||
EdgeEffect = new EdgeEffect
|
|
||||||
{
|
|
||||||
Colour = glowColour,
|
|
||||||
Type = EdgeEffectType.Glow,
|
|
||||||
Radius = 10,
|
|
||||||
Roundness = 8,
|
|
||||||
};
|
|
||||||
|
|
||||||
CornerRadius = Height / 2;
|
CornerRadius = Height / 2;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
@ -176,19 +164,36 @@ namespace osu.Game.Overlays.Options
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
Colour = idleColour = colours.Pink;
|
||||||
|
glowingColour = colours.PinkLighter;
|
||||||
|
|
||||||
|
EdgeEffect = new EdgeEffect
|
||||||
|
{
|
||||||
|
Colour = colours.PinkDarker,
|
||||||
|
Type = EdgeEffectType.Glow,
|
||||||
|
Radius = 10,
|
||||||
|
Roundness = 8,
|
||||||
|
};
|
||||||
|
|
||||||
|
FadeGlowTo(0);
|
||||||
|
}
|
||||||
|
|
||||||
public bool Glowing
|
public bool Glowing
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
FadeColour(hoverColour, 500, EasingTypes.OutQuint);
|
FadeColour(glowingColour, 500, EasingTypes.OutQuint);
|
||||||
FadeGlowTo(1, 500, EasingTypes.OutQuint);
|
FadeGlowTo(1, 500, EasingTypes.OutQuint);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FadeGlowTo(0, 500);
|
FadeGlowTo(0, 500);
|
||||||
FadeColour(defaultColour, 500);
|
FadeColour(idleColour, 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -11,6 +13,7 @@ using osu.Framework.Graphics.Primitives;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options
|
namespace osu.Game.Overlays.Options
|
||||||
{
|
{
|
||||||
@ -68,9 +71,6 @@ namespace osu.Game.Overlays.Options
|
|||||||
Direction = FlowDirection.VerticalOnly;
|
Direction = FlowDirection.VerticalOnly;
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
var items = typeof(T).GetFields().Where(f => !f.IsSpecialName).Zip(
|
|
||||||
(T[])Enum.GetValues(typeof(T)), (a, b) => new Tuple<string, T>(
|
|
||||||
a.GetCustomAttribute<DescriptionAttribute>()?.Description ?? a.Name, b));
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
text = new SpriteText { Alpha = 0 },
|
text = new SpriteText { Alpha = 0 },
|
||||||
@ -78,7 +78,7 @@ namespace osu.Game.Overlays.Options
|
|||||||
{
|
{
|
||||||
Margin = new MarginPadding { Top = 5 },
|
Margin = new MarginPadding { Top = 5 },
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Items = items.Select(item => new StyledDropDownMenuItem<T>(item.Item1, item.Item2))
|
Items = (T[])Enum.GetValues(typeof(T)),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
dropdown.ValueChanged += Dropdown_ValueChanged;
|
dropdown.ValueChanged += Dropdown_ValueChanged;
|
||||||
@ -92,6 +92,17 @@ namespace osu.Game.Overlays.Options
|
|||||||
{
|
{
|
||||||
return new StyledDropDownComboBox();
|
return new StyledDropDownComboBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override IEnumerable<DropDownMenuItem<U>> GetDropDownItems(IEnumerable<U> values)
|
||||||
|
{
|
||||||
|
return values.Select(v =>
|
||||||
|
{
|
||||||
|
var field = typeof(U).GetField(Enum.GetName(typeof(U), v));
|
||||||
|
return new StyledDropDownMenuItem<U>(
|
||||||
|
field.GetCustomAttribute<DescriptionAttribute>()?.Description ?? field.Name, v);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public StyledDropDownMenu()
|
public StyledDropDownMenu()
|
||||||
{
|
{
|
||||||
@ -101,7 +112,7 @@ namespace osu.Game.Overlays.Options
|
|||||||
|
|
||||||
protected override void AnimateOpen()
|
protected override void AnimateOpen()
|
||||||
{
|
{
|
||||||
foreach (StyledDropDownMenuItem<U> child in DropDownList.Children)
|
foreach (StyledDropDownMenuItem<U> child in DropDownItemsContainer.Children)
|
||||||
{
|
{
|
||||||
child.FadeIn(200);
|
child.FadeIn(200);
|
||||||
child.ResizeTo(new Vector2(1, 24), 200);
|
child.ResizeTo(new Vector2(1, 24), 200);
|
||||||
@ -111,7 +122,7 @@ namespace osu.Game.Overlays.Options
|
|||||||
|
|
||||||
protected override void AnimateClose()
|
protected override void AnimateClose()
|
||||||
{
|
{
|
||||||
foreach (StyledDropDownMenuItem<U> child in DropDownList.Children)
|
foreach (StyledDropDownMenuItem<U> child in DropDownItemsContainer.Children)
|
||||||
{
|
{
|
||||||
child.ResizeTo(new Vector2(1, 0), 200);
|
child.ResizeTo(new Vector2(1, 0), 200);
|
||||||
child.FadeOut(200);
|
child.FadeOut(200);
|
||||||
@ -121,12 +132,35 @@ namespace osu.Game.Overlays.Options
|
|||||||
|
|
||||||
private class StyledDropDownComboBox : DropDownComboBox
|
private class StyledDropDownComboBox : DropDownComboBox
|
||||||
{
|
{
|
||||||
protected override Color4 BackgroundColour => new Color4(255, 255, 255, 100);
|
private SpriteText label;
|
||||||
protected override Color4 BackgroundColourHover => Color4.HotPink;
|
protected override string Label
|
||||||
|
{
|
||||||
|
get { return label.Text; }
|
||||||
|
set { label.Text = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public StyledDropDownComboBox()
|
public StyledDropDownComboBox()
|
||||||
{
|
{
|
||||||
Foreground.Padding = new MarginPadding(4);
|
Foreground.Padding = new MarginPadding(4);
|
||||||
|
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
label = new SpriteText(),
|
||||||
|
new TextAwesome
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.fa_chevron_down,
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
Margin = new MarginPadding { Right = 4 },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
BackgroundColour = Color4.Black.Opacity(0.5f);
|
||||||
|
BackgroundColourHover = colours.PinkDarker;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,29 +171,36 @@ namespace osu.Game.Overlays.Options
|
|||||||
AutoSizeAxes = Axes.None;
|
AutoSizeAxes = Axes.None;
|
||||||
Height = 0;
|
Height = 0;
|
||||||
Foreground.Padding = new MarginPadding(2);
|
Foreground.Padding = new MarginPadding(2);
|
||||||
|
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new FlowContainer
|
||||||
|
{
|
||||||
|
Direction = FlowDirection.HorizontalOnly,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new TextAwesome
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.fa_chevron_right,
|
||||||
|
Colour = Color4.Black,
|
||||||
|
Margin = new MarginPadding { Right = 3 },
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
},
|
||||||
|
new SpriteText { Text = text }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSelectChange()
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
if (!IsLoaded)
|
BackgroundColour = Color4.Black.Opacity(0.5f);
|
||||||
return;
|
BackgroundColourHover = colours.PinkDarker;
|
||||||
|
BackgroundColourSelected = Color4.Black.Opacity(0.5f);
|
||||||
FormatBackground();
|
|
||||||
FormatCaret();
|
|
||||||
FormatLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void FormatCaret()
|
|
||||||
{
|
|
||||||
(Caret as SpriteText).Text = IsSelected ? @"+" : @"-";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void FormatLabel()
|
|
||||||
{
|
|
||||||
if (IsSelected)
|
|
||||||
(Label as SpriteText).Text = @"*" + Value + @"*";
|
|
||||||
else
|
|
||||||
(Label as SpriteText).Text = Value.ToString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Options.Graphics
|
|||||||
protected override string Header => "Layout";
|
protected override string Header => "Layout";
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config)
|
private void load(FrameworkConfigManager config)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -24,22 +24,22 @@ namespace osu.Game.Overlays.Options.Graphics
|
|||||||
new CheckBoxOption
|
new CheckBoxOption
|
||||||
{
|
{
|
||||||
LabelText = "Fullscreen mode",
|
LabelText = "Fullscreen mode",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.Fullscreen),
|
Bindable = config.GetBindable<bool>(FrameworkConfig.Fullscreen),
|
||||||
},
|
},
|
||||||
new CheckBoxOption
|
new CheckBoxOption
|
||||||
{
|
{
|
||||||
LabelText = "Letterboxing",
|
LabelText = "Letterboxing",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.Letterboxing),
|
Bindable = config.GetBindable<bool>(FrameworkConfig.Letterboxing),
|
||||||
},
|
},
|
||||||
new SliderOption<int>
|
new SliderOption<int>
|
||||||
{
|
{
|
||||||
LabelText = "Horizontal position",
|
LabelText = "Horizontal position",
|
||||||
Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.LetterboxPositionX)
|
Bindable = (BindableInt)config.GetBindable<int>(FrameworkConfig.LetterboxPositionX)
|
||||||
},
|
},
|
||||||
new SliderOption<int>
|
new SliderOption<int>
|
||||||
{
|
{
|
||||||
LabelText = "Vertical position",
|
LabelText = "Vertical position",
|
||||||
Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.LetterboxPositionY)
|
Bindable = (BindableInt)config.GetBindable<int>(FrameworkConfig.LetterboxPositionY)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
@ -15,7 +16,7 @@ namespace osu.Game.Overlays.Options.Graphics
|
|||||||
protected override string Header => "Renderer";
|
protected override string Header => "Renderer";
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager osuConfig, FrameworkConfigManager config)
|
||||||
{
|
{
|
||||||
// NOTE: Compatability mode omitted
|
// NOTE: Compatability mode omitted
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -24,22 +25,22 @@ namespace osu.Game.Overlays.Options.Graphics
|
|||||||
new DropdownOption<FrameSync>
|
new DropdownOption<FrameSync>
|
||||||
{
|
{
|
||||||
LabelText = "Frame limiter",
|
LabelText = "Frame limiter",
|
||||||
Bindable = config.GetBindable<FrameSync>(OsuConfig.FrameSync)
|
Bindable = config.GetBindable<FrameSync>(FrameworkConfig.FrameSync)
|
||||||
},
|
},
|
||||||
new CheckBoxOption
|
new CheckBoxOption
|
||||||
{
|
{
|
||||||
LabelText = "Show FPS counter",
|
LabelText = "Show FPS counter",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.FpsCounter),
|
Bindable = osuConfig.GetBindable<bool>(OsuConfig.FpsCounter),
|
||||||
},
|
},
|
||||||
new CheckBoxOption
|
new CheckBoxOption
|
||||||
{
|
{
|
||||||
LabelText = "Reduce dropped frames",
|
LabelText = "Reduce dropped frames",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.ForceFrameFlush),
|
Bindable = osuConfig.GetBindable<bool>(OsuConfig.ForceFrameFlush),
|
||||||
},
|
},
|
||||||
new CheckBoxOption
|
new CheckBoxOption
|
||||||
{
|
{
|
||||||
LabelText = "Detect performance issues",
|
LabelText = "Detect performance issues",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.DetectPerformanceIssues),
|
Bindable = osuConfig.GetBindable<bool>(OsuConfig.DetectPerformanceIssues),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ namespace osu.Game.Overlays.Options.Input
|
|||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SpriteText { Text = "Sensitivity: TODO slider" },
|
|
||||||
new SliderOption<double>
|
new SliderOption<double>
|
||||||
{
|
{
|
||||||
LabelText = "Sensitivity",
|
LabelText = "Sensitivity",
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
@ -19,14 +20,16 @@ namespace osu.Game.Overlays.Options
|
|||||||
public abstract FontAwesome Icon { get; }
|
public abstract FontAwesome Icon { get; }
|
||||||
public abstract string Header { get; }
|
public abstract string Header { get; }
|
||||||
|
|
||||||
|
private SpriteText headerLabel;
|
||||||
|
|
||||||
public OptionsSection()
|
public OptionsSection()
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Top = 20 };
|
Margin = new MarginPadding { Top = 20 };
|
||||||
|
|
||||||
const int headerSize = 26, headerMargin = 25;
|
|
||||||
const int borderSize = 2;
|
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
|
||||||
|
const int headerSize = 26, headerMargin = 25;
|
||||||
|
const int borderSize = 2;
|
||||||
AddInternal(new Drawable[]
|
AddInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
@ -48,10 +51,9 @@ namespace osu.Game.Overlays.Options
|
|||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new SpriteText
|
headerLabel = new SpriteText
|
||||||
{
|
{
|
||||||
TextSize = headerSize,
|
TextSize = headerSize,
|
||||||
Colour = new Color4(247, 198, 35, 255),
|
|
||||||
Text = Header,
|
Text = Header,
|
||||||
},
|
},
|
||||||
content = new FlowContainer
|
content = new FlowContainer
|
||||||
@ -66,5 +68,11 @@ namespace osu.Game.Overlays.Options
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
headerLabel.Colour = colours.Pink;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
@ -55,44 +56,49 @@ namespace osu.Game.Overlays.Options
|
|||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
backgroundBox = new Box
|
backgroundBox = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
BlendingMode = BlendingMode.Additive,
|
||||||
|
Colour = OsuColour.Gray(60),
|
||||||
|
Alpha = 0,
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Width = OptionsSidebar.default_width,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Children = new[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
drawableIcon = new TextAwesome
|
||||||
BlendingMode = BlendingMode.Additive,
|
|
||||||
Colour = new Color4(60, 60, 60, 255),
|
|
||||||
Alpha = 0,
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
Width = OptionsSidebar.default_width,
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
Children = new[]
|
|
||||||
{
|
{
|
||||||
drawableIcon = new TextAwesome
|
Anchor = Anchor.Centre,
|
||||||
{
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
},
|
||||||
Origin = Anchor.Centre,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
headerText = new SpriteText
|
|
||||||
{
|
|
||||||
Position = new Vector2(OptionsSidebar.default_width + 10, 0),
|
|
||||||
Anchor = Anchor.CentreLeft,
|
|
||||||
Origin = Anchor.CentreLeft,
|
|
||||||
},
|
|
||||||
selectionIndicator = new Box
|
|
||||||
{
|
|
||||||
Alpha = 0,
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
Width = 5,
|
|
||||||
Anchor = Anchor.CentreRight,
|
|
||||||
Origin = Anchor.CentreRight,
|
|
||||||
Colour = new Color4(247, 198, 35, 255)
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
headerText = new SpriteText
|
||||||
|
{
|
||||||
|
Position = new Vector2(OptionsSidebar.default_width + 10, 0),
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
},
|
||||||
|
selectionIndicator = new Box
|
||||||
|
{
|
||||||
|
Alpha = 0,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = 5,
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
selectionIndicator.Colour = colours.Pink;
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnClick(InputState state)
|
protected override bool OnClick(InputState state)
|
||||||
{
|
{
|
||||||
Action?.Invoke();
|
Action?.Invoke();
|
||||||
|
@ -62,7 +62,6 @@ namespace osu.Game.Overlays.Options
|
|||||||
LabelText = "Always use skin cursor",
|
LabelText = "Always use skin cursor",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.UseSkinCursor)
|
Bindable = config.GetBindable<bool>(OsuConfig.UseSkinCursor)
|
||||||
},
|
},
|
||||||
new SpriteText { Text = "Cursor size: TODO slider" },
|
|
||||||
new SliderOption<double>
|
new SliderOption<double>
|
||||||
{
|
{
|
||||||
LabelText = "Cursor size",
|
LabelText = "Cursor size",
|
||||||
|
@ -1,53 +1,172 @@
|
|||||||
using System;
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Input;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options
|
namespace osu.Game.Overlays.Options
|
||||||
{
|
{
|
||||||
public class SliderOption<T> : FlowContainer where T : struct,
|
public class SliderOption<T> : FlowContainer where T : struct
|
||||||
IComparable, IFormattable, IConvertible, IComparable<T>, IEquatable<T>
|
{
|
||||||
{
|
private SliderBar<T> slider;
|
||||||
private SliderBar<T> slider;
|
private SpriteText text;
|
||||||
private SpriteText text;
|
|
||||||
|
public string LabelText
|
||||||
public string LabelText
|
{
|
||||||
{
|
get { return text.Text; }
|
||||||
get { return text.Text; }
|
set
|
||||||
set
|
{
|
||||||
{
|
text.Text = value;
|
||||||
text.Text = value;
|
text.Alpha = string.IsNullOrEmpty(value) ? 0 : 1;
|
||||||
text.Alpha = string.IsNullOrEmpty(value) ? 0 : 1;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public BindableNumber<T> Bindable
|
||||||
public BindableNumber<T> Bindable
|
{
|
||||||
{
|
get { return slider.Bindable; }
|
||||||
get { return slider.Bindable; }
|
set { slider.Bindable = value; }
|
||||||
set { slider.Bindable = value; }
|
}
|
||||||
}
|
|
||||||
|
public SliderOption()
|
||||||
public SliderOption()
|
{
|
||||||
{
|
Direction = FlowDirection.VerticalOnly;
|
||||||
Direction = FlowDirection.VerticalOnly;
|
RelativeSizeAxes = Axes.X;
|
||||||
RelativeSizeAxes = Axes.X;
|
AutoSizeAxes = Axes.Y;
|
||||||
AutoSizeAxes = Axes.Y;
|
Children = new Drawable[]
|
||||||
Children = new Drawable[]
|
{
|
||||||
{
|
text = new SpriteText { Alpha = 0 },
|
||||||
text = new SpriteText { Alpha = 0 },
|
slider = new OsuSliderBar<T>
|
||||||
slider = new SliderBar<T>
|
{
|
||||||
{
|
Margin = new MarginPadding { Top = 5 },
|
||||||
Margin = new MarginPadding { Top = 5 },
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = 10,
|
}
|
||||||
RelativeSizeAxes = Axes.X,
|
};
|
||||||
Color = Color4.White,
|
}
|
||||||
SelectionColor = new Color4(255, 102, 170, 255),
|
|
||||||
}
|
private class OsuSliderBar<U> : SliderBar<U> where U : struct
|
||||||
};
|
{
|
||||||
}
|
private AudioSample sample;
|
||||||
}
|
private double lastSampleTime;
|
||||||
}
|
|
||||||
|
private Container nub;
|
||||||
|
private Box leftBox, rightBox;
|
||||||
|
|
||||||
|
private float innerWidth
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return DrawWidth - Height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public OsuSliderBar()
|
||||||
|
{
|
||||||
|
Height = 22;
|
||||||
|
Padding = new MarginPadding { Left = Height / 2, Right = Height / 2 };
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
leftBox = new Box
|
||||||
|
{
|
||||||
|
Height = 2,
|
||||||
|
RelativeSizeAxes = Axes.None,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
},
|
||||||
|
rightBox = new Box
|
||||||
|
{
|
||||||
|
Height = 2,
|
||||||
|
RelativeSizeAxes = Axes.None,
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
Alpha = 0.5f,
|
||||||
|
},
|
||||||
|
nub = new Container
|
||||||
|
{
|
||||||
|
Width = Height,
|
||||||
|
Height = Height,
|
||||||
|
CornerRadius = Height / 2,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
AutoSizeAxes = Axes.None,
|
||||||
|
RelativeSizeAxes = Axes.None,
|
||||||
|
Masking = true,
|
||||||
|
BorderThickness = 3,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(AudioManager audio, OsuColour colours)
|
||||||
|
{
|
||||||
|
sample = audio.Sample.Get(@"Sliderbar/sliderbar");
|
||||||
|
leftBox.Colour = colours.Pink;
|
||||||
|
rightBox.Colour = colours.Pink;
|
||||||
|
nub.BorderColour = colours.Pink;
|
||||||
|
(nub.Children.First() as Box).Colour = colours.Pink.Opacity(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void playSample()
|
||||||
|
{
|
||||||
|
if (Clock == null || Clock.CurrentTime - lastSampleTime <= 50)
|
||||||
|
return;
|
||||||
|
lastSampleTime = Clock.CurrentTime;
|
||||||
|
sample.Frequency.Value = 1 + NormalizedValue * 0.2f;
|
||||||
|
sample.Play();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
|
{
|
||||||
|
if (args.Key == Key.Left || args.Key == Key.Right)
|
||||||
|
playSample();
|
||||||
|
return base.OnKeyDown(state, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnClick(InputState state)
|
||||||
|
{
|
||||||
|
playSample();
|
||||||
|
return base.OnClick(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnDrag(InputState state)
|
||||||
|
{
|
||||||
|
playSample();
|
||||||
|
return base.OnDrag(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
leftBox.Scale = new Vector2(MathHelper.Clamp(
|
||||||
|
nub.DrawPosition.X - nub.DrawWidth / 2 + 2, 0, innerWidth), 1);
|
||||||
|
rightBox.Scale = new Vector2(MathHelper.Clamp(
|
||||||
|
innerWidth - nub.DrawPosition.X - nub.DrawWidth / 2 + 2, 0, innerWidth), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateValue(float value)
|
||||||
|
{
|
||||||
|
nub.MoveToX(innerWidth * value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -23,6 +23,7 @@ using osu.Game.Overlays.Options.Graphics;
|
|||||||
using osu.Game.Overlays.Options.Input;
|
using osu.Game.Overlays.Options.Input;
|
||||||
using osu.Game.Overlays.Options.Online;
|
using osu.Game.Overlays.Options.Online;
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
@ -45,6 +46,13 @@ namespace osu.Game.Overlays
|
|||||||
private float lastKnownScroll;
|
private float lastKnownScroll;
|
||||||
|
|
||||||
public OptionsOverlay()
|
public OptionsOverlay()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Y;
|
||||||
|
AutoSizeAxes = Axes.X;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
|
private void load(OsuGame game, OsuColour colours)
|
||||||
{
|
{
|
||||||
sections = new OptionsSection[]
|
sections = new OptionsSection[]
|
||||||
{
|
{
|
||||||
@ -58,10 +66,6 @@ namespace osu.Game.Overlays
|
|||||||
new OnlineSection(),
|
new OnlineSection(),
|
||||||
new MaintenanceSection(),
|
new MaintenanceSection(),
|
||||||
};
|
};
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Y;
|
|
||||||
AutoSizeAxes = Axes.X;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
@ -94,7 +98,7 @@ namespace osu.Game.Overlays
|
|||||||
},
|
},
|
||||||
new SpriteText
|
new SpriteText
|
||||||
{
|
{
|
||||||
Colour = new Color4(255, 102, 170, 255),
|
Colour = colours.Pink,
|
||||||
Text = "Change the way osu! behaves",
|
Text = "Change the way osu! behaves",
|
||||||
TextSize = 18,
|
TextSize = 18,
|
||||||
Margin = new MarginPadding { Left = CONTENT_MARGINS, Bottom = 30 },
|
Margin = new MarginPadding { Left = CONTENT_MARGINS, Bottom = 30 },
|
||||||
@ -123,11 +127,7 @@ namespace osu.Game.Overlays
|
|||||||
).ToArray()
|
).ToArray()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
|
||||||
private void load(OsuGame game)
|
|
||||||
{
|
|
||||||
scrollContainer.Padding = new MarginPadding { Top = game?.Toolbar.DrawHeight ?? 0 };
|
scrollContainer.Padding = new MarginPadding { Top = game?.Toolbar.DrawHeight ?? 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
solidBackground = new Box
|
solidBackground = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = new Color4(0.1f, 0.1f, 0.1f, 1),
|
Colour = OsuColour.Gray(0.1f),
|
||||||
Alpha = alpha_normal,
|
Alpha = alpha_normal,
|
||||||
},
|
},
|
||||||
gradientBackground = new Box
|
gradientBackground = new Box
|
||||||
@ -75,7 +75,8 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Height = 90,
|
Height = 90,
|
||||||
ColourInfo = ColourInfo.GradientVertical(new Color4(0.1f, 0.1f, 0.1f, 0.5f), new Color4(0.1f, 0.1f, 0.1f, 0f)),
|
ColourInfo = ColourInfo.GradientVertical(
|
||||||
|
OsuColour.Gray(0.1f).Opacity(0.5f), OsuColour.Gray(0.1f).Opacity(0)),
|
||||||
},
|
},
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
HoverBackground = new Box
|
HoverBackground = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = new Color4(80, 80, 80, 180),
|
Colour = OsuColour.Gray(80).Opacity(180),
|
||||||
BlendingMode = BlendingMode.Additive,
|
BlendingMode = BlendingMode.Additive,
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
},
|
},
|
||||||
@ -144,7 +144,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
{
|
{
|
||||||
Action?.Invoke();
|
Action?.Invoke();
|
||||||
sampleClick.Play();
|
sampleClick.Play();
|
||||||
HoverBackground.FlashColour(new Color4(255, 255, 255, 100), 500, EasingTypes.OutQuint);
|
HoverBackground.FlashColour(Color4.White.Opacity(100), 500, EasingTypes.OutQuint);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = new Color4(30, 30, 30, 255)
|
Colour = OsuColour.Gray(30)
|
||||||
},
|
},
|
||||||
new Triangles
|
new Triangles
|
||||||
{
|
{
|
||||||
|
@ -13,6 +13,7 @@ using osu.Game.Graphics.Backgrounds;
|
|||||||
using osu.Game.Modes;
|
using osu.Game.Modes;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@ using osu.Game.Configuration;
|
|||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
{
|
{
|
||||||
@ -41,7 +42,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
Add(StateBackground = new Box
|
Add(StateBackground = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = new Color4(150, 150, 150, 180),
|
Colour = OsuColour.Gray(150).Opacity(180),
|
||||||
BlendingMode = BlendingMode.Additive,
|
BlendingMode = BlendingMode.Additive,
|
||||||
Depth = 2,
|
Depth = 2,
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
|
@ -16,6 +16,7 @@ using osu.Game.Configuration;
|
|||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
{
|
{
|
||||||
@ -73,7 +74,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
{
|
{
|
||||||
Type = EdgeEffectType.Shadow,
|
Type = EdgeEffectType.Shadow,
|
||||||
Radius = 4,
|
Radius = 4,
|
||||||
Colour = new Color4(0, 0, 0, 0.1f),
|
Colour = Color4.Black.Opacity(0.1f),
|
||||||
};
|
};
|
||||||
|
|
||||||
Masking = true;
|
Masking = true;
|
||||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
EdgeEffect = new EdgeEffect
|
EdgeEffect = new EdgeEffect
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Shadow,
|
Type = EdgeEffectType.Shadow,
|
||||||
Colour = new Color4(0, 0, 0, 0.2f),
|
Colour = Color4.Black.Opacity(0.2f),
|
||||||
Roundness = 5,
|
Roundness = 5,
|
||||||
Radius = 8,
|
Radius = 8,
|
||||||
},
|
},
|
||||||
|
@ -72,7 +72,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Size = new Vector2(2, 1),
|
Size = new Vector2(2, 1),
|
||||||
Colour = new Color4(50, 50, 50, 255),
|
Colour = OsuColour.Gray(50),
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
},
|
},
|
||||||
|
@ -65,9 +65,10 @@ namespace osu.Game.Screens.Menu
|
|||||||
bgm.Looping = true;
|
bgm.Looping = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void OnEntering(GameMode last)
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.OnEntering(last);
|
||||||
|
|
||||||
Scheduler.Add(delegate
|
Scheduler.Add(delegate
|
||||||
{
|
{
|
||||||
welcome.Play();
|
welcome.Play();
|
||||||
|
@ -130,7 +130,7 @@ namespace osu.Game.Screens
|
|||||||
{
|
{
|
||||||
if (nextOsu != null)
|
if (nextOsu != null)
|
||||||
//We need to use MakeCurrent in case we are jumping up multiple game modes.
|
//We need to use MakeCurrent in case we are jumping up multiple game modes.
|
||||||
nextOsu.Background.MakeCurrent();
|
nextOsu.Background?.MakeCurrent();
|
||||||
else
|
else
|
||||||
Background.Exit();
|
Background.Exit();
|
||||||
}
|
}
|
||||||
|
45
osu.Game/Screens/Play/FailDialog.cs
Normal file
45
osu.Game/Screens/Play/FailDialog.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.GameModes;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using osu.Game.Modes;
|
||||||
|
using osu.Game.Screens.Backgrounds;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Play
|
||||||
|
{
|
||||||
|
class FailDialog : OsuGameMode
|
||||||
|
{
|
||||||
|
protected override BackgroundMode CreateBackground() => new BackgroundModeBeatmap(Beatmap);
|
||||||
|
|
||||||
|
private static readonly Vector2 BACKGROUND_BLUR = new Vector2(20);
|
||||||
|
|
||||||
|
public FailDialog()
|
||||||
|
{
|
||||||
|
Add(new SpriteText
|
||||||
|
{
|
||||||
|
Text = "You failed!",
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
TextSize = 50
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnEntering(GameMode last)
|
||||||
|
{
|
||||||
|
base.OnEntering(last);
|
||||||
|
Background.Schedule(() => (Background as BackgroundModeBeatmap)?.BlurTo(BACKGROUND_BLUR, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnExiting(GameMode next)
|
||||||
|
{
|
||||||
|
Background.Schedule(() => Background.FadeColour(Color4.White, 500));
|
||||||
|
return base.OnExiting(next);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -21,6 +21,10 @@ using OpenTK;
|
|||||||
using osu.Framework.GameModes;
|
using osu.Framework.GameModes;
|
||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using System;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
@ -28,7 +32,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
public bool Autoplay;
|
public bool Autoplay;
|
||||||
|
|
||||||
protected override BackgroundMode CreateBackground() => null;
|
protected override BackgroundMode CreateBackground() => new BackgroundModeBeatmap(Beatmap);
|
||||||
|
|
||||||
internal override bool ShowOverlays => false;
|
internal override bool ShowOverlays => false;
|
||||||
|
|
||||||
@ -42,10 +46,12 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private ScoreProcessor scoreProcessor;
|
private ScoreProcessor scoreProcessor;
|
||||||
private HitRenderer hitRenderer;
|
private HitRenderer hitRenderer;
|
||||||
|
private Bindable<int> dimLevel;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game)
|
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
|
dimLevel = config.GetBindable<int>(OsuConfig.DimLevel);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Beatmap == null)
|
if (Beatmap == null)
|
||||||
@ -87,12 +93,16 @@ namespace osu.Game.Screens.Play
|
|||||||
ruleset = Ruleset.GetRuleset(usablePlayMode);
|
ruleset = Ruleset.GetRuleset(usablePlayMode);
|
||||||
|
|
||||||
var scoreOverlay = ruleset.CreateScoreOverlay();
|
var scoreOverlay = ruleset.CreateScoreOverlay();
|
||||||
scoreOverlay.BindProcessor(scoreProcessor = ruleset.CreateScoreProcessor());
|
scoreOverlay.BindProcessor(scoreProcessor = ruleset.CreateScoreProcessor(beatmap.HitObjects.Count));
|
||||||
|
|
||||||
hitRenderer = ruleset.CreateHitRendererWith(beatmap.HitObjects);
|
hitRenderer = ruleset.CreateHitRendererWith(beatmap.HitObjects);
|
||||||
|
|
||||||
|
//bind HitRenderer to ScoreProcessor and ourselves (for a pass situation)
|
||||||
hitRenderer.OnJudgement += scoreProcessor.AddJudgement;
|
hitRenderer.OnJudgement += scoreProcessor.AddJudgement;
|
||||||
hitRenderer.OnAllJudged += hitRenderer_OnAllJudged;
|
hitRenderer.OnAllJudged += onPass;
|
||||||
|
|
||||||
|
//bind ScoreProcessor to ourselves (for a fail situation)
|
||||||
|
scoreProcessor.Failed += onFail;
|
||||||
|
|
||||||
if (Autoplay)
|
if (Autoplay)
|
||||||
hitRenderer.Schedule(() => hitRenderer.DrawableObjects.ForEach(h => h.State = ArmedState.Hit));
|
hitRenderer.Schedule(() => hitRenderer.DrawableObjects.ForEach(h => h.State = ArmedState.Hit));
|
||||||
@ -127,7 +137,7 @@ namespace osu.Game.Screens.Play
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hitRenderer_OnAllJudged()
|
private void onPass()
|
||||||
{
|
{
|
||||||
Delay(1000);
|
Delay(1000);
|
||||||
Schedule(delegate
|
Schedule(delegate
|
||||||
@ -140,44 +150,40 @@ namespace osu.Game.Screens.Play
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onFail()
|
||||||
|
{
|
||||||
|
Content.FadeColour(Color4.Red, 500);
|
||||||
|
sourceClock.Stop();
|
||||||
|
|
||||||
|
Delay(500);
|
||||||
|
Schedule(delegate
|
||||||
|
{
|
||||||
|
ValidForResume = false;
|
||||||
|
Push(new FailDialog());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnEntering(GameMode last)
|
protected override void OnEntering(GameMode last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
|
|
||||||
(Background as BackgroundModeBeatmap)?.BlurTo(Vector2.Zero, 1000);
|
(Background as BackgroundModeBeatmap)?.BlurTo(Vector2.Zero, 1000);
|
||||||
|
Background?.FadeTo((100f- dimLevel)/100, 1000);
|
||||||
|
|
||||||
Content.Alpha = 0;
|
Content.Alpha = 0;
|
||||||
|
dimLevel.ValueChanged += dimChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PlayerInputManager : UserInputManager
|
protected override bool OnExiting(GameMode next)
|
||||||
{
|
{
|
||||||
public PlayerInputManager(BasicGameHost host)
|
dimLevel.ValueChanged -= dimChanged;
|
||||||
: base(host)
|
Background?.FadeTo(1f, 200);
|
||||||
{
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool leftViaKeyboard;
|
private void dimChanged(object sender, EventArgs e)
|
||||||
bool rightViaKeyboard;
|
{
|
||||||
|
Background?.FadeTo((100f - dimLevel) / 100, 800);
|
||||||
protected override void TransformState(InputState state)
|
|
||||||
{
|
|
||||||
base.TransformState(state);
|
|
||||||
|
|
||||||
MouseState mouse = (MouseState)state.Mouse;
|
|
||||||
|
|
||||||
if (state.Keyboard != null)
|
|
||||||
{
|
|
||||||
leftViaKeyboard = state.Keyboard.Keys.Contains(Key.Z);
|
|
||||||
rightViaKeyboard = state.Keyboard.Keys.Contains(Key.X);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state.Mouse != null)
|
|
||||||
{
|
|
||||||
if (leftViaKeyboard) mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = true;
|
|
||||||
if (rightViaKeyboard) mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
56
osu.Game/Screens/Play/PlayerInputManager.cs
Normal file
56
osu.Game/Screens/Play/PlayerInputManager.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
using OpenTK.Input;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.Platform;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Play
|
||||||
|
{
|
||||||
|
class PlayerInputManager : UserInputManager
|
||||||
|
{
|
||||||
|
public PlayerInputManager(BasicGameHost host)
|
||||||
|
: base(host)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool leftViaKeyboard;
|
||||||
|
bool rightViaKeyboard;
|
||||||
|
Bindable<bool> mouseDisabled;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuConfigManager config)
|
||||||
|
{
|
||||||
|
mouseDisabled = config.GetBindable<bool>(OsuConfig.MouseDisableButtons)
|
||||||
|
?? new Bindable<bool>(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void TransformState(InputState state)
|
||||||
|
{
|
||||||
|
base.TransformState(state);
|
||||||
|
|
||||||
|
if (state.Keyboard != null)
|
||||||
|
{
|
||||||
|
leftViaKeyboard = state.Keyboard.Keys.Contains(Key.Z);
|
||||||
|
rightViaKeyboard = state.Keyboard.Keys.Contains(Key.X);
|
||||||
|
}
|
||||||
|
|
||||||
|
var mouse = (Framework.Input.MouseState)state.Mouse;
|
||||||
|
if (state.Mouse != null)
|
||||||
|
{
|
||||||
|
if (mouseDisabled.Value)
|
||||||
|
{
|
||||||
|
mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = false;
|
||||||
|
mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (leftViaKeyboard)
|
||||||
|
mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = true;
|
||||||
|
if (rightViaKeyboard)
|
||||||
|
mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -69,6 +69,7 @@ namespace osu.Game.Screens.Select
|
|||||||
(beatmapInfoContainer = new BufferedContainer
|
(beatmapInfoContainer = new BufferedContainer
|
||||||
{
|
{
|
||||||
Depth = newDepth,
|
Depth = newDepth,
|
||||||
|
PixelSnapping = true,
|
||||||
CacheDrawnFrameBuffer = true,
|
CacheDrawnFrameBuffer = true,
|
||||||
Shear = -Shear,
|
Shear = -Shear,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -87,7 +88,7 @@ namespace osu.Game.Screens.Select
|
|||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ColourInfo = ColourInfo.GradientVertical(Color4.White, new Color4(1f, 1f, 1f, 0.3f)),
|
ColourInfo = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)),
|
||||||
Children = new []
|
Children = new []
|
||||||
{
|
{
|
||||||
// Zoomed-in and cropped beatmap background
|
// Zoomed-in and cropped beatmap background
|
||||||
@ -100,66 +101,66 @@ namespace osu.Game.Screens.Select
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Text for beatmap info
|
// Text for beatmap info
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Direction = FlowDirection.VerticalOnly,
|
Direction = FlowDirection.VerticalOnly,
|
||||||
Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 },
|
Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 },
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SpriteText
|
new SpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-MediumItalic",
|
Font = @"Exo2.0-MediumItalic",
|
||||||
Text = beatmapSetInfo.Metadata.Artist + " -- " + beatmapSetInfo.Metadata.Title,
|
Text = beatmapSetInfo.Metadata.Artist + " -- " + beatmapSetInfo.Metadata.Title,
|
||||||
TextSize = 28,
|
TextSize = 28,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
new SpriteText
|
new SpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-MediumItalic",
|
Font = @"Exo2.0-MediumItalic",
|
||||||
Text = beatmapInfo.Version,
|
Text = beatmapInfo.Version,
|
||||||
TextSize = 17,
|
TextSize = 17,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Top = 10 },
|
Margin = new MarginPadding { Top = 10 },
|
||||||
Direction = FlowDirection.HorizontalOnly,
|
Direction = FlowDirection.HorizontalOnly,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new []
|
Children = new []
|
||||||
{
|
{
|
||||||
new SpriteText
|
new SpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-Medium",
|
Font = @"Exo2.0-Medium",
|
||||||
Text = "mapped by ",
|
Text = "mapped by ",
|
||||||
TextSize = 15,
|
TextSize = 15,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
new SpriteText
|
new SpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
Text = beatmapSetInfo.Metadata.Author,
|
Text = beatmapSetInfo.Metadata.Author,
|
||||||
TextSize = 15,
|
TextSize = 15,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Top = 20 },
|
Margin = new MarginPadding { Top = 20 },
|
||||||
Spacing = new Vector2(40,0),
|
Spacing = new Vector2(40,0),
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
infoLabel(FontAwesome.fa_clock_o, length),
|
infoLabel(FontAwesome.fa_clock_o, length),
|
||||||
infoLabel(FontAwesome.fa_circle, bpm),
|
infoLabel(FontAwesome.fa_circle, bpm),
|
||||||
infoLabel(FontAwesome.fa_dot_circle_o, hitCircles),
|
infoLabel(FontAwesome.fa_dot_circle_o, hitCircles),
|
||||||
infoLabel(FontAwesome.fa_circle_o, sliders),
|
infoLabel(FontAwesome.fa_circle_o, sliders),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}).Preload(game, delegate(Drawable d)
|
}).Preload(game, delegate(Drawable d)
|
||||||
@ -194,8 +195,8 @@ namespace osu.Game.Screens.Select
|
|||||||
return new Container
|
return new Container
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new TextAwesome
|
new TextAwesome
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.fa_square,
|
Icon = FontAwesome.fa_square,
|
||||||
@ -208,14 +209,14 @@ namespace osu.Game.Screens.Select
|
|||||||
Colour = new Color4(255,221,85,255),
|
Colour = new Color4(255,221,85,255),
|
||||||
Scale = new Vector2(0.8f,0.8f)
|
Scale = new Vector2(0.8f,0.8f)
|
||||||
},
|
},
|
||||||
new SpriteText
|
new SpriteText
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding {Left = 13},
|
Margin = new MarginPadding {Left = 13},
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
Colour = new Color4(255,221,85,255),
|
Colour = new Color4(255,221,85,255),
|
||||||
Text = text,
|
Text = text,
|
||||||
TextSize = 17,
|
TextSize = 17,
|
||||||
Origin = Anchor.CentreLeft
|
Origin = Anchor.CentreLeft
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -14,6 +14,9 @@ using osu.Framework.Extensions.IEnumerableExtensions;
|
|||||||
using osu.Framework.Lists;
|
using osu.Framework.Lists;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using OpenTK.Input;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
@ -244,5 +247,58 @@ namespace osu.Game.Screens.Select
|
|||||||
updatePanel(p, halfHeight);
|
updatePanel(p, halfHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
|
{
|
||||||
|
int direction = 0;
|
||||||
|
bool skipDifficulties = false;
|
||||||
|
|
||||||
|
switch (args.Key)
|
||||||
|
{
|
||||||
|
case Key.Up:
|
||||||
|
direction = -1;
|
||||||
|
break;
|
||||||
|
case Key.Down:
|
||||||
|
direction = 1;
|
||||||
|
break;
|
||||||
|
case Key.Left:
|
||||||
|
direction = -1;
|
||||||
|
skipDifficulties = true;
|
||||||
|
break;
|
||||||
|
case Key.Right:
|
||||||
|
direction = 1;
|
||||||
|
skipDifficulties = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (direction != 0)
|
||||||
|
{
|
||||||
|
int index = SelectedGroup.BeatmapPanels.IndexOf(SelectedPanel) + direction;
|
||||||
|
|
||||||
|
if (!skipDifficulties && index >= 0 && index < SelectedGroup.BeatmapPanels.Count)
|
||||||
|
//changing difficulty panel, not set.
|
||||||
|
SelectGroup(SelectedGroup, SelectedGroup.BeatmapPanels[index]);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
index = (groups.IndexOf(SelectedGroup) + direction + groups.Count) % groups.Count;
|
||||||
|
SelectBeatmap(groups[index].BeatmapPanels.First().Beatmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.OnKeyDown(state, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SelectRandom()
|
||||||
|
{
|
||||||
|
if (groups.Count < 1)
|
||||||
|
return;
|
||||||
|
BeatmapGroup group = groups[RNG.Next(groups.Count)];
|
||||||
|
BeatmapPanel panel = group?.BeatmapPanels.First();
|
||||||
|
if (panel == null)
|
||||||
|
return;
|
||||||
|
SelectGroup(group, panel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
115
osu.Game/Screens/Select/Footer.cs
Normal file
115
osu.Game/Screens/Select/Footer.cs
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Screens.Menu;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Select
|
||||||
|
{
|
||||||
|
public class Footer : Container
|
||||||
|
{
|
||||||
|
private Box modeLight;
|
||||||
|
|
||||||
|
private const float play_song_select_button_width = 100;
|
||||||
|
private const float play_song_select_button_height = 50;
|
||||||
|
|
||||||
|
public const int TRANSITION_LENGTH = 300;
|
||||||
|
|
||||||
|
private const float padding = 80;
|
||||||
|
|
||||||
|
public Action OnBack;
|
||||||
|
public Action OnStart;
|
||||||
|
|
||||||
|
private FlowContainer buttons;
|
||||||
|
|
||||||
|
public void AddButton(string text, Color4 colour, Action action)
|
||||||
|
{
|
||||||
|
var button = new FooterButton
|
||||||
|
{
|
||||||
|
Text = text,
|
||||||
|
Height = play_song_select_button_height,
|
||||||
|
Width = play_song_select_button_width,
|
||||||
|
SelectedColour = colour,
|
||||||
|
DeselectedColour = colour.Opacity(0.5f),
|
||||||
|
};
|
||||||
|
|
||||||
|
button.Hovered = () => updateModeLight(button);
|
||||||
|
button.HoverLost = () => updateModeLight();
|
||||||
|
button.Action = action;
|
||||||
|
buttons.Add(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateModeLight(FooterButton button = null)
|
||||||
|
{
|
||||||
|
modeLight.FadeColour(button?.SelectedColour ?? Color4.Transparent, TRANSITION_LENGTH, EasingTypes.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Footer()
|
||||||
|
{
|
||||||
|
const float bottomToolHeight = 50;
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
Height = bottomToolHeight;
|
||||||
|
Anchor = Anchor.BottomCentre;
|
||||||
|
Origin = Anchor.BottomCentre;
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Size = Vector2.One,
|
||||||
|
Colour = Color4.Black.Opacity(0.5f),
|
||||||
|
},
|
||||||
|
modeLight = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 3,
|
||||||
|
Position = new Vector2(0, -3),
|
||||||
|
},
|
||||||
|
new OsuLogo()
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomRight,
|
||||||
|
Scale = new Vector2(0.4f),
|
||||||
|
Position = new Vector2(-70, -25),
|
||||||
|
Action = () => OnStart?.Invoke()
|
||||||
|
},
|
||||||
|
new BackButton
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
Action = () => OnBack?.Invoke(),
|
||||||
|
},
|
||||||
|
new FlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
Position = new Vector2(BackButton.SIZE_EXTENDED.X + padding, 0),
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
AutoSizeAxes = Axes.X,
|
||||||
|
Direction = FlowDirection.HorizontalOnly,
|
||||||
|
Spacing = new Vector2(padding, 0),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
|
||||||
|
buttons = new FlowContainer
|
||||||
|
{
|
||||||
|
Direction = FlowDirection.HorizontalOnly,
|
||||||
|
Spacing = new Vector2(0.2f, 0),
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
updateModeLight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
117
osu.Game/Screens/Select/FooterButton.cs
Normal file
117
osu.Game/Screens/Select/FooterButton.cs
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
//Copyright (c) 2007-2016 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.Framework.Input;
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Select
|
||||||
|
{
|
||||||
|
public class FooterButton : ClickableContainer
|
||||||
|
{
|
||||||
|
private static readonly Vector2 shearing = new Vector2(0.15f, 0);
|
||||||
|
|
||||||
|
public string Text
|
||||||
|
{
|
||||||
|
get { return spriteText?.Text; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (spriteText != null)
|
||||||
|
spriteText.Text = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color4 deselectedColour;
|
||||||
|
public Color4 DeselectedColour
|
||||||
|
{
|
||||||
|
get { return deselectedColour; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
deselectedColour = value;
|
||||||
|
if(light.Colour != SelectedColour)
|
||||||
|
light.Colour = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color4 selectedColour;
|
||||||
|
public Color4 SelectedColour
|
||||||
|
{
|
||||||
|
get { return selectedColour; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
selectedColour = value;
|
||||||
|
box.Colour = selectedColour;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private SpriteText spriteText;
|
||||||
|
private Box box;
|
||||||
|
private Box light;
|
||||||
|
|
||||||
|
public FooterButton()
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
box = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Shear = shearing,
|
||||||
|
EdgeSmoothness = new Vector2(2, 0),
|
||||||
|
Colour = Color4.White,
|
||||||
|
Alpha = 0,
|
||||||
|
},
|
||||||
|
light = new Box
|
||||||
|
{
|
||||||
|
Shear = shearing,
|
||||||
|
Height = 4,
|
||||||
|
EdgeSmoothness = new Vector2(2, 0),
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
},
|
||||||
|
spriteText = new SpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action Hovered;
|
||||||
|
public Action HoverLost;
|
||||||
|
|
||||||
|
protected override bool OnHover(InputState state)
|
||||||
|
{
|
||||||
|
Hovered?.Invoke();
|
||||||
|
light.ScaleTo(new Vector2(1, 2), Footer.TRANSITION_LENGTH, EasingTypes.OutQuint);
|
||||||
|
light.FadeColour(SelectedColour, Footer.TRANSITION_LENGTH, EasingTypes.OutQuint);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(InputState state)
|
||||||
|
{
|
||||||
|
HoverLost?.Invoke();
|
||||||
|
light.ScaleTo(new Vector2(1, 1), Footer.TRANSITION_LENGTH, EasingTypes.OutQuint);
|
||||||
|
light.FadeColour(DeselectedColour, Footer.TRANSITION_LENGTH, EasingTypes.OutQuint);
|
||||||
|
box.FadeOut(Footer.TRANSITION_LENGTH, EasingTypes.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||||
|
{
|
||||||
|
box.FadeTo(0.3f, Footer.TRANSITION_LENGTH * 2, EasingTypes.OutQuint);
|
||||||
|
return base.OnMouseDown(state, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnClick(InputState state)
|
||||||
|
{
|
||||||
|
box.ClearTransformations();
|
||||||
|
box.Alpha = 1;
|
||||||
|
box.FadeOut(Footer.TRANSITION_LENGTH * 3, EasingTypes.OutQuint);
|
||||||
|
return base.OnClick(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -14,12 +14,10 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Modes;
|
using osu.Game.Modes;
|
||||||
using osu.Game.Screens.Backgrounds;
|
using osu.Game.Screens.Backgrounds;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
@ -28,6 +26,9 @@ using osu.Framework.Audio.Sample;
|
|||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using OpenTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
@ -50,6 +51,8 @@ namespace osu.Game.Screens.Select
|
|||||||
private AudioSample sampleChangeDifficulty;
|
private AudioSample sampleChangeDifficulty;
|
||||||
private AudioSample sampleChangeBeatmap;
|
private AudioSample sampleChangeBeatmap;
|
||||||
|
|
||||||
|
private Footer footer;
|
||||||
|
|
||||||
class WedgeBackground : Container
|
class WedgeBackground : Container
|
||||||
{
|
{
|
||||||
public WedgeBackground()
|
public WedgeBackground()
|
||||||
@ -60,7 +63,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Size = new Vector2(1, 0.5f),
|
Size = new Vector2(1, 0.5f),
|
||||||
Colour = new Color4(0, 0, 0, 0.5f),
|
Colour = Color4.Black.Opacity(0.5f),
|
||||||
Shear = new Vector2(0.15f, 0),
|
Shear = new Vector2(0.15f, 0),
|
||||||
EdgeSmoothness = new Vector2(2, 0),
|
EdgeSmoothness = new Vector2(2, 0),
|
||||||
},
|
},
|
||||||
@ -70,7 +73,7 @@ namespace osu.Game.Screens.Select
|
|||||||
RelativePositionAxes = Axes.Y,
|
RelativePositionAxes = Axes.Y,
|
||||||
Size = new Vector2(1, -0.5f),
|
Size = new Vector2(1, -0.5f),
|
||||||
Position = new Vector2(0, 1),
|
Position = new Vector2(0, 1),
|
||||||
Colour = new Color4(0, 0, 0, 0.5f),
|
Colour = Color4.Black.Opacity(0.5f),
|
||||||
Shear = new Vector2(-0.15f, 0),
|
Shear = new Vector2(-0.15f, 0),
|
||||||
EdgeSmoothness = new Vector2(2, 0),
|
EdgeSmoothness = new Vector2(2, 0),
|
||||||
},
|
},
|
||||||
@ -78,10 +81,37 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlaySongSelect()
|
Player player;
|
||||||
|
|
||||||
|
private void start()
|
||||||
|
{
|
||||||
|
if (player != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//in the future we may want to move this logic to a PlayerLoader gamemode or similar, so we can rely on the SongSelect transition
|
||||||
|
//and provide a better loading experience (at the moment song select is still accepting input during preload).
|
||||||
|
player = new Player
|
||||||
|
{
|
||||||
|
BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap,
|
||||||
|
PreferredPlayMode = playMode.Value
|
||||||
|
};
|
||||||
|
|
||||||
|
player.Preload(Game, delegate
|
||||||
|
{
|
||||||
|
if (!Push(player))
|
||||||
|
{
|
||||||
|
player = null;
|
||||||
|
//error occured?
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
|
private void load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game,
|
||||||
|
OsuGame osuGame, OsuColour colours)
|
||||||
{
|
{
|
||||||
const float carouselWidth = 640;
|
const float carouselWidth = 640;
|
||||||
const float bottomToolHeight = 50;
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new ParallaxContainer
|
new ParallaxContainer
|
||||||
@ -112,49 +142,17 @@ namespace osu.Game.Screens.Select
|
|||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Margin = new MarginPadding { Top = 20, Right = 20, },
|
Margin = new MarginPadding { Top = 20, Right = 20, },
|
||||||
},
|
},
|
||||||
new Container
|
footer = new Footer()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
OnBack = Exit,
|
||||||
Height = bottomToolHeight,
|
OnStart = start,
|
||||||
Anchor = Anchor.BottomCentre,
|
|
||||||
Origin = Anchor.BottomCentre,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Size = Vector2.One,
|
|
||||||
Colour = new Color4(0, 0, 0, 0.5f),
|
|
||||||
},
|
|
||||||
new BackButton
|
|
||||||
{
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
//RelativeSizeAxes = Axes.Y,
|
|
||||||
Action = () => Exit()
|
|
||||||
},
|
|
||||||
new Button
|
|
||||||
{
|
|
||||||
Anchor = Anchor.CentreRight,
|
|
||||||
Origin = Anchor.CentreRight,
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
Width = 100,
|
|
||||||
Text = "Play",
|
|
||||||
Colour = new Color4(238, 51, 153, 255),
|
|
||||||
Action = () => Push(new Player
|
|
||||||
{
|
|
||||||
BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap,
|
|
||||||
PreferredPlayMode = playMode.Value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
footer.AddButton(@"mods", colours.Yellow, null);
|
||||||
private void load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game, OsuGame osuGame)
|
footer.AddButton(@"random", colours.Green, carousel.SelectRandom);
|
||||||
{
|
footer.AddButton(@"options", colours.Blue, null);
|
||||||
|
|
||||||
if (osuGame != null)
|
if (osuGame != null)
|
||||||
{
|
{
|
||||||
playMode = osuGame.PlayMode;
|
playMode = osuGame.PlayMode;
|
||||||
@ -190,15 +188,14 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
Content.FadeInFromZero(250);
|
Content.FadeInFromZero(250);
|
||||||
|
|
||||||
beatmapInfoWedge.MoveTo(wedged_container_start_position + new Vector2(-100, 50));
|
beatmapInfoWedge.MoveToX(wedged_container_start_position.X - 50);
|
||||||
beatmapInfoWedge.RotateTo(10);
|
beatmapInfoWedge.MoveToX(wedged_container_start_position.X, 800, EasingTypes.OutQuint);
|
||||||
|
|
||||||
beatmapInfoWedge.MoveTo(wedged_container_start_position, 800, EasingTypes.OutQuint);
|
|
||||||
beatmapInfoWedge.RotateTo(0, 800, EasingTypes.OutQuint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResuming(GameMode last)
|
protected override void OnResuming(GameMode last)
|
||||||
{
|
{
|
||||||
|
player = null;
|
||||||
|
|
||||||
changeBackground(Beatmap);
|
changeBackground(Beatmap);
|
||||||
ensurePlayingSelected();
|
ensurePlayingSelected();
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
@ -265,14 +262,10 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
//todo: change background in selectionChanged instead; support per-difficulty backgrounds.
|
//todo: change background in selectionChanged instead; support per-difficulty backgrounds.
|
||||||
changeBackground(beatmap);
|
changeBackground(beatmap);
|
||||||
|
|
||||||
selectBeatmap(beatmap.BeatmapInfo);
|
selectBeatmap(beatmap.BeatmapInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectBeatmap(BeatmapInfo beatmap)
|
private void selectBeatmap(BeatmapInfo beatmap) => carousel.SelectBeatmap(beatmap);
|
||||||
{
|
|
||||||
carousel.SelectBeatmap(beatmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// selection has been changed as the result of interaction with the carousel.
|
/// selection has been changed as the result of interaction with the carousel.
|
||||||
@ -283,7 +276,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
if (!beatmap.Equals(Beatmap?.BeatmapInfo))
|
if (!beatmap.Equals(Beatmap?.BeatmapInfo))
|
||||||
{
|
{
|
||||||
if (beatmap.BeatmapSetID == Beatmap?.BeatmapInfo.BeatmapSetID)
|
if (beatmap.BeatmapSetInfoID == Beatmap?.BeatmapInfo.BeatmapSetInfoID)
|
||||||
sampleChangeDifficulty.Play();
|
sampleChangeDifficulty.Play();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -295,33 +288,37 @@ namespace osu.Game.Screens.Select
|
|||||||
ensurePlayingSelected(beatmapSetChange);
|
ensurePlayingSelected(beatmapSetChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ensurePlayingSelected(bool preview = false)
|
private void ensurePlayingSelected(bool preview = false)
|
||||||
{
|
{
|
||||||
AudioTrack track = null;
|
AudioTrack track = Beatmap?.Track;
|
||||||
|
|
||||||
await Task.Run(() => track = Beatmap?.Track);
|
if (track != null)
|
||||||
|
|
||||||
Schedule(delegate
|
|
||||||
{
|
{
|
||||||
if (track != null)
|
trackManager.SetExclusive(track);
|
||||||
{
|
if (preview)
|
||||||
trackManager.SetExclusive(track);
|
track.Seek(Beatmap.Beatmap.Metadata.PreviewTime);
|
||||||
if (preview)
|
track.Start();
|
||||||
track.Seek(Beatmap.Beatmap.Metadata.PreviewTime);
|
}
|
||||||
track.Start();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addBeatmapSet(BeatmapSetInfo beatmapSet, BaseGame game)
|
private void addBeatmapSet(BeatmapSetInfo beatmapSet, BaseGame game)
|
||||||
{
|
{
|
||||||
beatmapSet = database.GetWithChildren<BeatmapSetInfo>(beatmapSet.BeatmapSetID);
|
beatmapSet = database.GetWithChildren<BeatmapSetInfo>(beatmapSet.ID);
|
||||||
beatmapSet.Beatmaps.ForEach(b => database.GetChildren(b));
|
beatmapSet.Beatmaps.ForEach(b =>
|
||||||
|
{
|
||||||
|
database.GetChildren(b);
|
||||||
|
if (b.Metadata == null) b.Metadata = beatmapSet.Metadata;
|
||||||
|
});
|
||||||
|
|
||||||
beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.BaseDifficulty.OverallDifficulty).ToList();
|
beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.BaseDifficulty.OverallDifficulty).ToList();
|
||||||
|
|
||||||
var beatmap = database.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault());
|
var beatmap = new WorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault(), beatmapSet, database);
|
||||||
|
|
||||||
var group = new BeatmapGroup(beatmap) { SelectionChanged = selectionChanged };
|
var group = new BeatmapGroup(beatmap)
|
||||||
|
{
|
||||||
|
SelectionChanged = selectionChanged,
|
||||||
|
StartRequested = b => start()
|
||||||
|
};
|
||||||
|
|
||||||
//for the time being, let's completely load the difficulty panels in the background.
|
//for the time being, let's completely load the difficulty panels in the background.
|
||||||
//this likely won't scale so well, but allows us to completely async the loading flow.
|
//this likely won't scale so well, but allows us to completely async the loading flow.
|
||||||
@ -348,5 +345,17 @@ namespace osu.Game.Screens.Select
|
|||||||
addBeatmapSet(beatmapSet, game);
|
addBeatmapSet(beatmapSet, game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
|
{
|
||||||
|
switch (args.Key)
|
||||||
|
{
|
||||||
|
case Key.Enter:
|
||||||
|
start();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.OnKeyDown(state, args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<Compile Include="Modes\Objects\HitObjectParser.cs" />
|
<Compile Include="Modes\Objects\HitObjectParser.cs" />
|
||||||
<Compile Include="Modes\Score.cs" />
|
<Compile Include="Modes\Score.cs" />
|
||||||
<Compile Include="Modes\ScoreProcesssor.cs" />
|
<Compile Include="Modes\ScoreProcesssor.cs" />
|
||||||
|
<Compile Include="Modes\UI\HealthDisplay.cs" />
|
||||||
<Compile Include="Online\API\IOnlineComponent.cs" />
|
<Compile Include="Online\API\IOnlineComponent.cs" />
|
||||||
<Compile Include="Online\API\Requests\GetUserRequest.cs" />
|
<Compile Include="Online\API\Requests\GetUserRequest.cs" />
|
||||||
<Compile Include="Overlays\DragBar.cs" />
|
<Compile Include="Overlays\DragBar.cs" />
|
||||||
@ -115,6 +116,8 @@
|
|||||||
<Compile Include="Screens\Multiplayer\Lobby.cs" />
|
<Compile Include="Screens\Multiplayer\Lobby.cs" />
|
||||||
<Compile Include="Screens\Multiplayer\Match.cs" />
|
<Compile Include="Screens\Multiplayer\Match.cs" />
|
||||||
<Compile Include="Screens\Multiplayer\MatchCreate.cs" />
|
<Compile Include="Screens\Multiplayer\MatchCreate.cs" />
|
||||||
|
<Compile Include="Screens\Play\FailDialog.cs" />
|
||||||
|
<Compile Include="Screens\Play\PlayerInputManager.cs" />
|
||||||
<Compile Include="Screens\Select\CarouselContainer.cs" />
|
<Compile Include="Screens\Select\CarouselContainer.cs" />
|
||||||
<Compile Include="Screens\Select\MatchSongSelect.cs" />
|
<Compile Include="Screens\Select\MatchSongSelect.cs" />
|
||||||
<Compile Include="Screens\OsuGameMode.cs" />
|
<Compile Include="Screens\OsuGameMode.cs" />
|
||||||
@ -229,8 +232,10 @@
|
|||||||
<Compile Include="Configuration\ScoreMeterType.cs" />
|
<Compile Include="Configuration\ScoreMeterType.cs" />
|
||||||
<Compile Include="Configuration\ReleaseStream.cs" />
|
<Compile Include="Configuration\ReleaseStream.cs" />
|
||||||
<Compile Include="Configuration\ScreenshotFormat.cs" />
|
<Compile Include="Configuration\ScreenshotFormat.cs" />
|
||||||
<Compile Include="Configuration\FrameSync.cs" />
|
|
||||||
<Compile Include="Configuration\ConfineMouseMode.cs" />
|
<Compile Include="Configuration\ConfineMouseMode.cs" />
|
||||||
|
<Compile Include="Graphics\OsuColour.cs" />
|
||||||
|
<Compile Include="Screens\Select\FooterButton.cs" />
|
||||||
|
<Compile Include="Screens\Select\Footer.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
|
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
|
||||||
@ -259,4 +264,4 @@
|
|||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
</Target>
|
</Target>
|
||||||
-->
|
-->
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue
Block a user