mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 16:27:26 +08:00
commit
7db9e1a8bf
@ -1 +1 @@
|
|||||||
Subproject commit 1f770847b245e6d250e63e60c24e9e84131d15e7
|
Subproject commit 7439250a63dd451f34dbc08ecf68a196cf8e479f
|
@ -12,7 +12,7 @@ namespace osu.Framework.VisualTests
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
BasicGameHost host = Host.GetSuitableHost();
|
BasicGameHost host = Host.GetSuitableHost(@"osu-visual-tests");
|
||||||
host.Add(new VisualTestGame());
|
host.Add(new VisualTestGame());
|
||||||
host.Run();
|
host.Run();
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ using OpenTK;
|
|||||||
using osu.Framework.GameModes.Testing;
|
using osu.Framework.GameModes.Testing;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Transformations;
|
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game;
|
using osu.Game;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
@ -15,7 +14,8 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Online.Chat.Display.osu.Online.Social;
|
using osu.Game.Online.Chat.Display;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Desktop.Tests
|
namespace osu.Desktop.Tests
|
||||||
{
|
{
|
||||||
@ -26,41 +26,29 @@ namespace osu.Desktop.Tests
|
|||||||
public override string Name => @"Chat";
|
public override string Name => @"Chat";
|
||||||
public override string Description => @"Testing API polling";
|
public override string Description => @"Testing API polling";
|
||||||
|
|
||||||
private List<Channel> channels = new List<Channel>();
|
FlowContainer flow;
|
||||||
private FlowContainer flow;
|
|
||||||
|
|
||||||
private Scheduler scheduler = new Scheduler();
|
private Scheduler scheduler = new Scheduler();
|
||||||
|
|
||||||
private APIAccess api => ((OsuGameBase)Game).API;
|
private APIAccess api;
|
||||||
|
|
||||||
private long? lastMessageId;
|
private ChannelDisplay channelDisplay;
|
||||||
|
|
||||||
|
public override void Load(BaseGame game)
|
||||||
|
{
|
||||||
|
base.Load(game);
|
||||||
|
|
||||||
|
api = ((OsuGameBase)game).API;
|
||||||
|
}
|
||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
base.Reset();
|
base.Reset();
|
||||||
|
|
||||||
lastMessageId = null;
|
|
||||||
|
|
||||||
if (api.State != APIAccess.APIState.Online)
|
if (api.State != APIAccess.APIState.Online)
|
||||||
api.OnStateChange += delegate { initializeChannels(); };
|
api.OnStateChange += delegate { initializeChannels(); };
|
||||||
else
|
else
|
||||||
initializeChannels();
|
initializeChannels();
|
||||||
|
|
||||||
Add(new ScrollContainer()
|
|
||||||
{
|
|
||||||
Size = new Vector2(1, 0.5f),
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
flow = new FlowContainer
|
|
||||||
{
|
|
||||||
Direction = FlowDirection.VerticalOnly,
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
LayoutDuration = 100,
|
|
||||||
LayoutEasing = EasingTypes.Out,
|
|
||||||
Padding = new Vector2(1, 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
@ -69,60 +57,87 @@ namespace osu.Desktop.Tests
|
|||||||
base.Update();
|
base.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private long? lastMessageId;
|
||||||
|
|
||||||
|
List<Channel> careChannels;
|
||||||
|
|
||||||
private void initializeChannels()
|
private void initializeChannels()
|
||||||
{
|
{
|
||||||
|
careChannels = new List<Channel>();
|
||||||
|
|
||||||
if (api.State != APIAccess.APIState.Online)
|
if (api.State != APIAccess.APIState.Online)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Add(flow = new FlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Direction = FlowDirection.VerticalOnly
|
||||||
|
});
|
||||||
|
|
||||||
|
SpriteText loading;
|
||||||
|
Add(loading = new SpriteText
|
||||||
|
{
|
||||||
|
Text = @"Loading available channels...",
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
TextSize = 40,
|
||||||
|
});
|
||||||
|
|
||||||
messageRequest?.Cancel();
|
messageRequest?.Cancel();
|
||||||
|
|
||||||
ListChannelsRequest req = new ListChannelsRequest();
|
ListChannelsRequest req = new ListChannelsRequest();
|
||||||
req.Success += delegate (List<Channel> channels)
|
req.Success += delegate (List<Channel> channels)
|
||||||
{
|
{
|
||||||
this.channels = channels;
|
Scheduler.Add(delegate
|
||||||
messageRequest = scheduler.AddDelayed(requestNewMessages, 1000, true);
|
{
|
||||||
|
loading.FadeOut(100);
|
||||||
|
});
|
||||||
|
|
||||||
|
addChannel(channels.Find(c => c.Name == @"#osu"));
|
||||||
|
addChannel(channels.Find(c => c.Name == @"#lobby"));
|
||||||
|
addChannel(channels.Find(c => c.Name == @"#english"));
|
||||||
|
|
||||||
|
messageRequest = scheduler.AddDelayed(() => FetchNewMessages(api), 1000, true);
|
||||||
};
|
};
|
||||||
api.Queue(req);
|
api.Queue(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void requestNewMessages()
|
private void addChannel(Channel channel)
|
||||||
{
|
{
|
||||||
messageRequest.Wait();
|
flow.Add(channelDisplay = new ChannelDisplay(channel)
|
||||||
|
{
|
||||||
|
Size = new Vector2(1, 0.3f)
|
||||||
|
});
|
||||||
|
|
||||||
Channel channel = channels.Find(c => c.Name == "#osu");
|
careChannels.Add(channel);
|
||||||
|
}
|
||||||
|
|
||||||
GetMessagesRequest gm = new GetMessagesRequest(new List<Channel> { channel }, lastMessageId);
|
GetMessagesRequest fetchReq;
|
||||||
gm.Success += delegate (List<Message> messages)
|
|
||||||
|
public void FetchNewMessages(APIAccess api)
|
||||||
|
{
|
||||||
|
if (fetchReq != null) return;
|
||||||
|
|
||||||
|
fetchReq = new GetMessagesRequest(careChannels, lastMessageId);
|
||||||
|
fetchReq.Success += delegate (List<Message> messages)
|
||||||
{
|
{
|
||||||
foreach (Message m in messages)
|
foreach (Message m in messages)
|
||||||
{
|
{
|
||||||
//m.LineWidth = this.Size.X; //this is kinda ugly.
|
careChannels.Find(c => c.Id == m.ChannelId).AddNewMessages(m);
|
||||||
//m.Drawable.Depth = m.Id;
|
|
||||||
//m.Drawable.FadeInFromZero(800);
|
|
||||||
|
|
||||||
//flow.Add(m.Drawable);
|
|
||||||
|
|
||||||
//if (osu.Messages.Count > 50)
|
|
||||||
//{
|
|
||||||
// osu.Messages[0].Drawable.Expire();
|
|
||||||
// osu.Messages.RemoveAt(0);
|
|
||||||
//}
|
|
||||||
flow.Add(new ChatLine(m));
|
|
||||||
channel.Messages.Add(m);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lastMessageId = messages.LastOrDefault()?.Id ?? lastMessageId;
|
lastMessageId = messages.LastOrDefault()?.Id ?? lastMessageId;
|
||||||
|
|
||||||
Debug.Write("success!");
|
Debug.Write("success!");
|
||||||
messageRequest.Continue();
|
fetchReq = null;
|
||||||
};
|
};
|
||||||
gm.Failure += delegate
|
fetchReq.Failure += delegate
|
||||||
{
|
{
|
||||||
Debug.Write("failure!");
|
Debug.Write("failure!");
|
||||||
messageRequest.Continue();
|
fetchReq = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
api.Queue(gm);
|
api.Queue(fetchReq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
159
osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs
Normal file
159
osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
//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.Input;
|
||||||
|
using osu.Framework.GameModes.Testing;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
|
||||||
|
namespace osu.Desktop.Tests
|
||||||
|
{
|
||||||
|
class TestCaseScoreCounter : TestCase
|
||||||
|
{
|
||||||
|
public override string Name => @"ScoreCounter";
|
||||||
|
|
||||||
|
public override string Description => @"Tests multiple counters";
|
||||||
|
|
||||||
|
public override void Reset()
|
||||||
|
{
|
||||||
|
base.Reset();
|
||||||
|
|
||||||
|
ScoreCounter uc = new ScoreCounter
|
||||||
|
{
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
TextSize = 40,
|
||||||
|
RollingDuration = 1000,
|
||||||
|
RollingEasing = EasingTypes.Out,
|
||||||
|
Count = 0,
|
||||||
|
Position = new Vector2(20, 20),
|
||||||
|
LeadingZeroes = 7,
|
||||||
|
};
|
||||||
|
Add(uc);
|
||||||
|
|
||||||
|
StandardComboCounter sc = new StandardComboCounter
|
||||||
|
{
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Position = new Vector2(20, 20),
|
||||||
|
IsRollingProportional = true,
|
||||||
|
RollingDuration = 20,
|
||||||
|
PopOutDuration = 250,
|
||||||
|
Count = 0,
|
||||||
|
TextSize = 40,
|
||||||
|
};
|
||||||
|
Add(sc);
|
||||||
|
|
||||||
|
CatchComboCounter cc = new CatchComboCounter
|
||||||
|
{
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
IsRollingProportional = true,
|
||||||
|
RollingDuration = 20,
|
||||||
|
PopOutDuration = 250,
|
||||||
|
Count = 0,
|
||||||
|
TextSize = 40,
|
||||||
|
};
|
||||||
|
Add(cc);
|
||||||
|
|
||||||
|
AlternativeComboCounter ac = new AlternativeComboCounter
|
||||||
|
{
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Position = new Vector2(20, 80),
|
||||||
|
IsRollingProportional = true,
|
||||||
|
RollingDuration = 20,
|
||||||
|
ScaleFactor = 2,
|
||||||
|
Count = 0,
|
||||||
|
TextSize = 40,
|
||||||
|
};
|
||||||
|
Add(ac);
|
||||||
|
|
||||||
|
|
||||||
|
AccuracyCounter pc = new AccuracyCounter
|
||||||
|
{
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
RollingDuration = 1000,
|
||||||
|
RollingEasing = EasingTypes.Out,
|
||||||
|
Count = 100.0f,
|
||||||
|
Position = new Vector2(20, 60),
|
||||||
|
};
|
||||||
|
Add(pc);
|
||||||
|
|
||||||
|
SpriteText text = new SpriteText
|
||||||
|
{
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Position = new Vector2(20, 190),
|
||||||
|
Text = @"- unset -",
|
||||||
|
};
|
||||||
|
Add(text);
|
||||||
|
|
||||||
|
StarCounter tc = new StarCounter
|
||||||
|
{
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Position = new Vector2(20, 160),
|
||||||
|
};
|
||||||
|
Add(tc);
|
||||||
|
|
||||||
|
AddButton(@"Reset all", delegate
|
||||||
|
{
|
||||||
|
uc.Count = 0;
|
||||||
|
sc.Count = 0;
|
||||||
|
ac.Count = 0;
|
||||||
|
cc.Count = 0;
|
||||||
|
pc.SetCount(0, 0);
|
||||||
|
tc.Count = 0;
|
||||||
|
text.Text = tc.Count.ToString("0.00");
|
||||||
|
});
|
||||||
|
|
||||||
|
AddButton(@"Hit! :D", delegate
|
||||||
|
{
|
||||||
|
uc.Count += 300 + (ulong)(300.0 * (sc.Count > 0 ? sc.Count - 1 : 0) / 25.0);
|
||||||
|
sc.Count++;
|
||||||
|
ac.Count++;
|
||||||
|
cc.CatchFruit(new Color4(
|
||||||
|
Math.Max(0.5f, RNG.NextSingle()),
|
||||||
|
Math.Max(0.5f, RNG.NextSingle()),
|
||||||
|
Math.Max(0.5f, RNG.NextSingle()),
|
||||||
|
1)
|
||||||
|
);
|
||||||
|
pc.Numerator++;
|
||||||
|
pc.Denominator++;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddButton(@"miss...", delegate
|
||||||
|
{
|
||||||
|
sc.Count = 0;
|
||||||
|
ac.Count = 0;
|
||||||
|
cc.Count = 0;
|
||||||
|
pc.Denominator++;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddButton(@"Alter stars", delegate
|
||||||
|
{
|
||||||
|
tc.Count = RNG.NextSingle() * (tc.MaxStars + 1);
|
||||||
|
text.Text = tc.Count.ToString("0.00");
|
||||||
|
});
|
||||||
|
|
||||||
|
AddButton(@"Stop counters", delegate
|
||||||
|
{
|
||||||
|
uc.StopRolling();
|
||||||
|
sc.StopRolling();
|
||||||
|
cc.StopRolling();
|
||||||
|
ac.StopRolling();
|
||||||
|
pc.StopRolling();
|
||||||
|
tc.StopRolling();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,9 +9,9 @@ namespace osu.Framework.VisualTests
|
|||||||
{
|
{
|
||||||
class VisualTestGame : OsuGameBase
|
class VisualTestGame : OsuGameBase
|
||||||
{
|
{
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
Add(new TestBrowser());
|
Add(new TestBrowser());
|
||||||
|
|
||||||
|
@ -140,6 +140,7 @@
|
|||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Tests\TestCaseChatDisplay.cs" />
|
<Compile Include="Tests\TestCaseChatDisplay.cs" />
|
||||||
<Compile Include="Tests\TestCaseGamefield.cs" />
|
<Compile Include="Tests\TestCaseGamefield.cs" />
|
||||||
|
<Compile Include="Tests\TestCaseScoreCounter.cs" />
|
||||||
<Compile Include="Tests\TestCaseKeyCounter.cs" />
|
<Compile Include="Tests\TestCaseKeyCounter.cs" />
|
||||||
<Compile Include="Tests\TestCaseMenuButtonSystem.cs" />
|
<Compile Include="Tests\TestCaseMenuButtonSystem.cs" />
|
||||||
<Compile Include="Tests\TestCaseTextAwesome.cs" />
|
<Compile Include="Tests\TestCaseTextAwesome.cs" />
|
||||||
|
@ -13,7 +13,7 @@ namespace osu.Desktop
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
BasicGameHost host = Host.GetSuitableHost();
|
BasicGameHost host = Host.GetSuitableHost(@"osu");
|
||||||
host.Add(new OsuGame());
|
host.Add(new OsuGame());
|
||||||
host.Run();
|
host.Run();
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Transformations;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes
|
namespace osu.Game.GameModes
|
||||||
{
|
{
|
||||||
@ -30,9 +31,9 @@ namespace osu.Game.GameModes
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
Content.Scale *= 1 + (x_movement_amount / Size.X) * 2;
|
Content.Scale *= 1 + (x_movement_amount / Size.X) * 2;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
//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.Game.Graphics.Background;
|
using osu.Game.Graphics.Background;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Backgrounds
|
namespace osu.Game.GameModes.Backgrounds
|
||||||
@ -14,9 +15,9 @@ namespace osu.Game.GameModes.Backgrounds
|
|||||||
this.textureName = textureName;
|
this.textureName = textureName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
Add(new Background(textureName));
|
Add(new Background(textureName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
//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.Game.Graphics.Background;
|
using osu.Game.Graphics.Background;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Backgrounds
|
namespace osu.Game.GameModes.Backgrounds
|
||||||
{
|
{
|
||||||
public class BackgroundModeDefault : BackgroundMode
|
public class BackgroundModeDefault : BackgroundMode
|
||||||
{
|
{
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
Add(new Background());
|
Add(new Background());
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ using osu.Framework.Graphics.UserInterface;
|
|||||||
using osu.Game.GameModes.Backgrounds;
|
using osu.Game.GameModes.Backgrounds;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes
|
namespace osu.Game.GameModes
|
||||||
{
|
{
|
||||||
@ -77,9 +78,9 @@ namespace osu.Game.GameModes
|
|||||||
Content.FadeIn(transition_time, EasingTypes.OutExpo);
|
Content.FadeIn(transition_time, EasingTypes.OutExpo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
314
osu.Game/GameModes/Menu/Button.cs
Normal file
314
osu.Game/GameModes/Menu/Button.cs
Normal file
@ -0,0 +1,314 @@
|
|||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using OpenTK.Input;
|
||||||
|
using osu.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Drawables;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace osu.Game.GameModes.Menu
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Button designed specifically for the osu!next main menu.
|
||||||
|
/// In order to correctly flow, we have to use a negative margin on the parent container (due to the parallelogram shape).
|
||||||
|
/// </summary>
|
||||||
|
public class Button : AutoSizeContainer, IStateful<ButtonState>
|
||||||
|
{
|
||||||
|
private Container iconText;
|
||||||
|
private WedgedBox box;
|
||||||
|
private Color4 colour;
|
||||||
|
private TextAwesome icon;
|
||||||
|
private string internalName;
|
||||||
|
private readonly FontAwesome symbol;
|
||||||
|
private Action clickAction;
|
||||||
|
private readonly float extraWidth;
|
||||||
|
private Key triggerKey;
|
||||||
|
private string text;
|
||||||
|
|
||||||
|
public override Quad ScreenSpaceInputQuad => box.ScreenSpaceInputQuad;
|
||||||
|
|
||||||
|
public Button(string text, string internalName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown)
|
||||||
|
{
|
||||||
|
this.internalName = internalName;
|
||||||
|
this.symbol = symbol;
|
||||||
|
this.colour = colour;
|
||||||
|
this.clickAction = clickAction;
|
||||||
|
this.extraWidth = extraWidth;
|
||||||
|
this.triggerKey = triggerKey;
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Load(BaseGame game)
|
||||||
|
{
|
||||||
|
base.Load(game);
|
||||||
|
Alpha = 0;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
box = new WedgedBox(new Vector2(ButtonSystem.button_width + Math.Abs(extraWidth), ButtonSystem.button_area_height), ButtonSystem.wedge_width)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Colour = colour,
|
||||||
|
Scale = new Vector2(0, 1)
|
||||||
|
},
|
||||||
|
iconText = new AutoSizeContainer
|
||||||
|
{
|
||||||
|
Position = new Vector2(extraWidth / 2, 0),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
icon = new TextAwesome
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
TextSize = 30,
|
||||||
|
Position = new Vector2(0, 0),
|
||||||
|
Icon = symbol
|
||||||
|
},
|
||||||
|
new SpriteText
|
||||||
|
{
|
||||||
|
Direction = FlowDirection.HorizontalOnly,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
TextSize = 16,
|
||||||
|
Position = new Vector2(0, 35),
|
||||||
|
Text = text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(InputState state)
|
||||||
|
{
|
||||||
|
if (State != ButtonState.Expanded) return true;
|
||||||
|
|
||||||
|
//if (OsuGame.Instance.IsActive)
|
||||||
|
// Game.Audio.PlaySamplePositional($@"menu-{internalName}-hover", @"menuclick");
|
||||||
|
|
||||||
|
box.ScaleTo(new Vector2(1.5f, 1), 500, EasingTypes.OutElastic);
|
||||||
|
|
||||||
|
int duration = 0; //(int)(Game.Audio.BeatLength / 2);
|
||||||
|
if (duration == 0) duration = 250;
|
||||||
|
|
||||||
|
icon.ClearTransformations();
|
||||||
|
|
||||||
|
icon.ScaleTo(1, 500, EasingTypes.OutElasticHalf);
|
||||||
|
|
||||||
|
double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration;
|
||||||
|
double startTime = Time + offset;
|
||||||
|
|
||||||
|
icon.RotateTo(10, offset, EasingTypes.InOutSine);
|
||||||
|
icon.ScaleTo(new Vector2(1, 0.9f), offset, EasingTypes.Out);
|
||||||
|
|
||||||
|
icon.Transforms.Add(new TransformRotation(Clock)
|
||||||
|
{
|
||||||
|
StartValue = -10,
|
||||||
|
EndValue = 10,
|
||||||
|
StartTime = startTime,
|
||||||
|
EndTime = startTime + duration * 2,
|
||||||
|
Easing = EasingTypes.InOutSine,
|
||||||
|
LoopCount = -1,
|
||||||
|
LoopDelay = duration * 2
|
||||||
|
});
|
||||||
|
|
||||||
|
icon.Transforms.Add(new TransformPosition(Clock)
|
||||||
|
{
|
||||||
|
StartValue = Vector2.Zero,
|
||||||
|
EndValue = new Vector2(0, -10),
|
||||||
|
StartTime = startTime,
|
||||||
|
EndTime = startTime + duration,
|
||||||
|
Easing = EasingTypes.Out,
|
||||||
|
LoopCount = -1,
|
||||||
|
LoopDelay = duration
|
||||||
|
});
|
||||||
|
|
||||||
|
icon.Transforms.Add(new TransformScaleVector(Clock)
|
||||||
|
{
|
||||||
|
StartValue = new Vector2(1, 0.9f),
|
||||||
|
EndValue = Vector2.One,
|
||||||
|
StartTime = startTime,
|
||||||
|
EndTime = startTime + duration,
|
||||||
|
Easing = EasingTypes.Out,
|
||||||
|
LoopCount = -1,
|
||||||
|
LoopDelay = duration
|
||||||
|
});
|
||||||
|
|
||||||
|
icon.Transforms.Add(new TransformPosition(Clock)
|
||||||
|
{
|
||||||
|
StartValue = new Vector2(0, -10),
|
||||||
|
EndValue = Vector2.Zero,
|
||||||
|
StartTime = startTime + duration,
|
||||||
|
EndTime = startTime + duration * 2,
|
||||||
|
Easing = EasingTypes.In,
|
||||||
|
LoopCount = -1,
|
||||||
|
LoopDelay = duration
|
||||||
|
});
|
||||||
|
|
||||||
|
icon.Transforms.Add(new TransformScaleVector(Clock)
|
||||||
|
{
|
||||||
|
StartValue = Vector2.One,
|
||||||
|
EndValue = new Vector2(1, 0.9f),
|
||||||
|
StartTime = startTime + duration,
|
||||||
|
EndTime = startTime + duration * 2,
|
||||||
|
Easing = EasingTypes.In,
|
||||||
|
LoopCount = -1,
|
||||||
|
LoopDelay = duration
|
||||||
|
});
|
||||||
|
|
||||||
|
icon.Transforms.Add(new TransformRotation(Clock)
|
||||||
|
{
|
||||||
|
StartValue = 10,
|
||||||
|
EndValue = -10,
|
||||||
|
StartTime = startTime + duration * 2,
|
||||||
|
EndTime = startTime + duration * 4,
|
||||||
|
Easing = EasingTypes.InOutSine,
|
||||||
|
LoopCount = -1,
|
||||||
|
LoopDelay = duration * 2
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(InputState state)
|
||||||
|
{
|
||||||
|
icon.ClearTransformations();
|
||||||
|
icon.RotateTo(0, 500, EasingTypes.Out);
|
||||||
|
icon.MoveTo(Vector2.Zero, 500, EasingTypes.Out);
|
||||||
|
icon.ScaleTo(0.7f, 500, EasingTypes.OutElasticHalf);
|
||||||
|
icon.ScaleTo(Vector2.One, 200, EasingTypes.Out);
|
||||||
|
|
||||||
|
if (State == ButtonState.Expanded)
|
||||||
|
box.ScaleTo(new Vector2(1, 1), 500, EasingTypes.OutElastic);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||||
|
{
|
||||||
|
trigger();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
|
{
|
||||||
|
base.OnKeyDown(state, args);
|
||||||
|
|
||||||
|
if (triggerKey == args.Key && triggerKey != Key.Unknown)
|
||||||
|
{
|
||||||
|
trigger();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void trigger()
|
||||||
|
{
|
||||||
|
//Game.Audio.PlaySamplePositional($@"menu-{internalName}-click", internalName.Contains(@"back") ? @"menuback" : @"menuhit");
|
||||||
|
|
||||||
|
clickAction?.Invoke();
|
||||||
|
|
||||||
|
//box.FlashColour(ColourHelper.Lighten2(colour, 0.7f), 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HandleInput => state != ButtonState.Exploded && box.Scale.X >= 0.8f;
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
iconText.Alpha = MathHelper.Clamp((box.Scale.X - 0.5f) / 0.3f, 0, 1);
|
||||||
|
base.Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ContractStyle;
|
||||||
|
|
||||||
|
ButtonState state;
|
||||||
|
public ButtonState State
|
||||||
|
{
|
||||||
|
get { return state; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
|
||||||
|
if (state == value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
state = value;
|
||||||
|
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case ButtonState.Contracted:
|
||||||
|
switch (ContractStyle)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
box.ScaleTo(new Vector2(0, 1), 500, EasingTypes.OutExpo);
|
||||||
|
FadeOut(500);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
box.ScaleTo(new Vector2(0, 1), 400, EasingTypes.InSine);
|
||||||
|
FadeOut(800);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ButtonState.Expanded:
|
||||||
|
const int expand_duration = 500;
|
||||||
|
box.ScaleTo(new Vector2(1, 1), expand_duration, EasingTypes.OutExpo);
|
||||||
|
FadeIn(expand_duration / 6);
|
||||||
|
break;
|
||||||
|
case ButtonState.Exploded:
|
||||||
|
const int explode_duration = 200;
|
||||||
|
box.ScaleTo(new Vector2(2, 1), explode_duration, EasingTypes.OutExpo);
|
||||||
|
FadeOut(explode_duration / 4 * 3);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ________
|
||||||
|
/// / /
|
||||||
|
/// / /
|
||||||
|
/// /_______/
|
||||||
|
/// </summary>
|
||||||
|
class WedgedBox : Box
|
||||||
|
{
|
||||||
|
float wedgeWidth;
|
||||||
|
|
||||||
|
public WedgedBox(Vector2 boxSize, float wedgeWidth)
|
||||||
|
{
|
||||||
|
Size = boxSize;
|
||||||
|
this.wedgeWidth = wedgeWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Custom DrawQuad used to create the slanted effect.
|
||||||
|
/// </summary>
|
||||||
|
protected override Quad DrawQuad
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Quad q = base.DrawQuad;
|
||||||
|
|
||||||
|
//Will become infinite if we don't limit its maximum size.
|
||||||
|
float wedge = Math.Min(q.Width, wedgeWidth / Scale.X);
|
||||||
|
|
||||||
|
q.TopLeft.X += wedge;
|
||||||
|
q.BottomRight.X -= wedge;
|
||||||
|
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ButtonState
|
||||||
|
{
|
||||||
|
Contracted,
|
||||||
|
Expanded,
|
||||||
|
Exploded
|
||||||
|
}
|
||||||
|
}
|
@ -16,10 +16,11 @@ using osu.Game.Graphics.Containers;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Menu
|
namespace osu.Game.GameModes.Menu
|
||||||
{
|
{
|
||||||
public partial class ButtonSystem : Container
|
public partial class ButtonSystem : Container, IStateful<MenuState>
|
||||||
{
|
{
|
||||||
public Action OnEdit;
|
public Action OnEdit;
|
||||||
public Action OnExit;
|
public Action OnExit;
|
||||||
@ -32,9 +33,10 @@ namespace osu.Game.GameModes.Menu
|
|||||||
|
|
||||||
private FlowContainerWithOrigin buttonFlow;
|
private FlowContainerWithOrigin buttonFlow;
|
||||||
|
|
||||||
const float button_area_height = 100;
|
//todo: make these non-internal somehow.
|
||||||
const float button_width = 140f;
|
internal const float button_area_height = 100;
|
||||||
const float wedge_width = 20;
|
internal const float button_width = 140f;
|
||||||
|
internal const float wedge_width = 20;
|
||||||
|
|
||||||
public const int EXIT_DELAY = 3000;
|
public const int EXIT_DELAY = 3000;
|
||||||
|
|
||||||
@ -49,23 +51,14 @@ namespace osu.Game.GameModes.Menu
|
|||||||
List<Button> buttonsTopLevel = new List<Button>();
|
List<Button> buttonsTopLevel = new List<Button>();
|
||||||
List<Button> buttonsPlay = new List<Button>();
|
List<Button> buttonsPlay = new List<Button>();
|
||||||
|
|
||||||
public enum MenuState
|
|
||||||
{
|
|
||||||
Initial,
|
|
||||||
TopLevel,
|
|
||||||
Play,
|
|
||||||
EnteringMode,
|
|
||||||
Exit,
|
|
||||||
}
|
|
||||||
|
|
||||||
public ButtonSystem()
|
public ButtonSystem()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -88,8 +81,9 @@ namespace osu.Game.GameModes.Menu
|
|||||||
},
|
},
|
||||||
buttonFlow = new FlowContainerWithOrigin
|
buttonFlow = new FlowContainerWithOrigin
|
||||||
{
|
{
|
||||||
|
Direction = FlowDirection.HorizontalOnly,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Padding = new Vector2(-wedge_width, 0),
|
Spacing = new Vector2(-wedge_width, 0),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
settingsButton = new Button(@"settings", @"options", FontAwesome.gear, new Color4(85, 85, 85, 255), OnSettings, -wedge_width, Key.O),
|
settingsButton = new Button(@"settings", @"options", FontAwesome.gear, new Color4(85, 85, 85, 255), OnSettings, -wedge_width, Key.O),
|
||||||
@ -128,16 +122,19 @@ namespace osu.Game.GameModes.Menu
|
|||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Key == Key.Escape)
|
switch (args.Key)
|
||||||
{
|
{
|
||||||
if (State == MenuState.Initial)
|
case Key.Space:
|
||||||
return false;
|
osuLogo.TriggerClick(state);
|
||||||
|
return true;
|
||||||
|
case Key.Escape:
|
||||||
|
if (State == MenuState.Initial)
|
||||||
|
return false;
|
||||||
|
|
||||||
State = MenuState.Initial;
|
State = MenuState.Initial;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
osuLogo.TriggerClick(state);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,10 +205,10 @@ namespace osu.Game.GameModes.Menu
|
|||||||
osuLogo.ScaleTo(1, 800, EasingTypes.OutExpo);
|
osuLogo.ScaleTo(1, 800, EasingTypes.OutExpo);
|
||||||
|
|
||||||
foreach (Button b in buttonsTopLevel)
|
foreach (Button b in buttonsTopLevel)
|
||||||
b.State = Button.ButtonState.Contracted;
|
b.State = ButtonState.Contracted;
|
||||||
|
|
||||||
foreach (Button b in buttonsPlay)
|
foreach (Button b in buttonsPlay)
|
||||||
b.State = Button.ButtonState.Contracted;
|
b.State = ButtonState.Contracted;
|
||||||
break;
|
break;
|
||||||
case MenuState.TopLevel:
|
case MenuState.TopLevel:
|
||||||
buttonAreaBackground.ScaleTo(Vector2.One, 200, EasingTypes.Out);
|
buttonAreaBackground.ScaleTo(Vector2.One, 200, EasingTypes.Out);
|
||||||
@ -226,17 +223,17 @@ namespace osu.Game.GameModes.Menu
|
|||||||
buttonArea.Delay(150, true);
|
buttonArea.Delay(150, true);
|
||||||
|
|
||||||
foreach (Button b in buttonsTopLevel)
|
foreach (Button b in buttonsTopLevel)
|
||||||
b.State = Button.ButtonState.Expanded;
|
b.State = ButtonState.Expanded;
|
||||||
|
|
||||||
foreach (Button b in buttonsPlay)
|
foreach (Button b in buttonsPlay)
|
||||||
b.State = Button.ButtonState.Contracted;
|
b.State = ButtonState.Contracted;
|
||||||
break;
|
break;
|
||||||
case MenuState.Play:
|
case MenuState.Play:
|
||||||
foreach (Button b in buttonsTopLevel)
|
foreach (Button b in buttonsTopLevel)
|
||||||
b.State = Button.ButtonState.Exploded;
|
b.State = ButtonState.Exploded;
|
||||||
|
|
||||||
foreach (Button b in buttonsPlay)
|
foreach (Button b in buttonsPlay)
|
||||||
b.State = Button.ButtonState.Expanded;
|
b.State = ButtonState.Expanded;
|
||||||
break;
|
break;
|
||||||
case MenuState.EnteringMode:
|
case MenuState.EnteringMode:
|
||||||
buttonAreaBackground.ScaleTo(new Vector2(2, 0), 300, EasingTypes.InSine);
|
buttonAreaBackground.ScaleTo(new Vector2(2, 0), 300, EasingTypes.InSine);
|
||||||
@ -247,19 +244,19 @@ namespace osu.Game.GameModes.Menu
|
|||||||
settingsButton.ContractStyle = 1;
|
settingsButton.ContractStyle = 1;
|
||||||
|
|
||||||
foreach (Button b in buttonsTopLevel)
|
foreach (Button b in buttonsTopLevel)
|
||||||
b.State = Button.ButtonState.Contracted;
|
b.State = ButtonState.Contracted;
|
||||||
|
|
||||||
foreach (Button b in buttonsPlay)
|
foreach (Button b in buttonsPlay)
|
||||||
b.State = Button.ButtonState.Contracted;
|
b.State = ButtonState.Contracted;
|
||||||
break;
|
break;
|
||||||
case MenuState.Exit:
|
case MenuState.Exit:
|
||||||
buttonArea.FadeOut(200);
|
buttonArea.FadeOut(200);
|
||||||
|
|
||||||
foreach (Button b in buttonsTopLevel)
|
foreach (Button b in buttonsTopLevel)
|
||||||
b.State = Button.ButtonState.Contracted;
|
b.State = ButtonState.Contracted;
|
||||||
|
|
||||||
foreach (Button b in buttonsPlay)
|
foreach (Button b in buttonsPlay)
|
||||||
b.State = Button.ButtonState.Contracted;
|
b.State = ButtonState.Contracted;
|
||||||
|
|
||||||
osuLogo.Delay(150);
|
osuLogo.Delay(150);
|
||||||
|
|
||||||
@ -269,8 +266,8 @@ namespace osu.Game.GameModes.Menu
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
backButton.State = state == MenuState.Play ? Button.ButtonState.Expanded : Button.ButtonState.Contracted;
|
backButton.State = state == MenuState.Play ? ButtonState.Expanded : ButtonState.Contracted;
|
||||||
settingsButton.State = state == MenuState.TopLevel ? Button.ButtonState.Expanded : Button.ButtonState.Contracted;
|
settingsButton.State = state == MenuState.TopLevel ? ButtonState.Expanded : ButtonState.Contracted;
|
||||||
|
|
||||||
if (lastState == MenuState.Initial)
|
if (lastState == MenuState.Initial)
|
||||||
buttonArea.DelayReset();
|
buttonArea.DelayReset();
|
||||||
@ -285,337 +282,14 @@ namespace osu.Game.GameModes.Menu
|
|||||||
iconFacade.Width = osuLogo.SizeForFlow * 0.5f;
|
iconFacade.Width = osuLogo.SizeForFlow * 0.5f;
|
||||||
base.Update();
|
base.Update();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
public enum MenuState
|
||||||
/// A flow container with an origin based on one of its contained drawables.
|
{
|
||||||
/// </summary>
|
Initial,
|
||||||
private class FlowContainerWithOrigin : FlowContainer
|
TopLevel,
|
||||||
{
|
Play,
|
||||||
/// <summary>
|
EnteringMode,
|
||||||
/// A target drawable which this flowcontainer should be centered around.
|
Exit,
|
||||||
/// This target MUST be in this FlowContainer's *direct* children.
|
|
||||||
/// </summary>
|
|
||||||
internal Drawable CentreTarget;
|
|
||||||
|
|
||||||
public override Anchor Origin => Anchor.Custom;
|
|
||||||
|
|
||||||
public override Vector2 OriginPosition
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (CentreTarget == null)
|
|
||||||
return base.OriginPosition;
|
|
||||||
|
|
||||||
return CentreTarget.Position + CentreTarget.Size / 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public FlowContainerWithOrigin()
|
|
||||||
{
|
|
||||||
Direction = FlowDirection.HorizontalOnly;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Button designed specifically for the osu!next main menu.
|
|
||||||
/// In order to correctly flow, we have to use a negative margin on the parent container (due to the parallelogram shape).
|
|
||||||
/// </summary>
|
|
||||||
private class Button : AutoSizeContainer
|
|
||||||
{
|
|
||||||
private Container iconText;
|
|
||||||
private WedgedBox box;
|
|
||||||
private Color4 colour;
|
|
||||||
private TextAwesome icon;
|
|
||||||
private string internalName;
|
|
||||||
private readonly FontAwesome symbol;
|
|
||||||
private Action clickAction;
|
|
||||||
private readonly float extraWidth;
|
|
||||||
private Key triggerKey;
|
|
||||||
private string text;
|
|
||||||
|
|
||||||
public override Quad ScreenSpaceInputQuad => box.ScreenSpaceInputQuad;
|
|
||||||
|
|
||||||
public Button(string text, string internalName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown)
|
|
||||||
{
|
|
||||||
this.internalName = internalName;
|
|
||||||
this.symbol = symbol;
|
|
||||||
this.colour = colour;
|
|
||||||
this.clickAction = clickAction;
|
|
||||||
this.extraWidth = extraWidth;
|
|
||||||
this.triggerKey = triggerKey;
|
|
||||||
this.text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Load()
|
|
||||||
{
|
|
||||||
base.Load();
|
|
||||||
Alpha = 0;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
box = new WedgedBox(new Vector2(button_width + Math.Abs(extraWidth), button_area_height), wedge_width)
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Colour = colour,
|
|
||||||
Scale = new Vector2(0, 1)
|
|
||||||
},
|
|
||||||
iconText = new AutoSizeContainer
|
|
||||||
{
|
|
||||||
Position = new Vector2(extraWidth / 2, 0),
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
icon = new TextAwesome
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
TextSize = 30,
|
|
||||||
Position = new Vector2(0, 0),
|
|
||||||
Icon = symbol
|
|
||||||
},
|
|
||||||
new SpriteText
|
|
||||||
{
|
|
||||||
Direction = FlowDirection.HorizontalOnly,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
TextSize = 16,
|
|
||||||
Position = new Vector2(0, 35),
|
|
||||||
Text = text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnHover(InputState state)
|
|
||||||
{
|
|
||||||
if (State != ButtonState.Expanded) return true;
|
|
||||||
|
|
||||||
//if (OsuGame.Instance.IsActive)
|
|
||||||
// Game.Audio.PlaySamplePositional($@"menu-{internalName}-hover", @"menuclick");
|
|
||||||
|
|
||||||
box.ScaleTo(new Vector2(1.5f, 1), 500, EasingTypes.OutElastic);
|
|
||||||
|
|
||||||
int duration = 0; //(int)(Game.Audio.BeatLength / 2);
|
|
||||||
if (duration == 0) duration = 250;
|
|
||||||
|
|
||||||
icon.ClearTransformations();
|
|
||||||
|
|
||||||
icon.ScaleTo(1, 500, EasingTypes.OutElasticHalf);
|
|
||||||
|
|
||||||
double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration;
|
|
||||||
double startTime = Time + offset;
|
|
||||||
|
|
||||||
icon.RotateTo(10, offset, EasingTypes.InOutSine);
|
|
||||||
icon.ScaleTo(new Vector2(1, 0.9f), offset, EasingTypes.Out);
|
|
||||||
|
|
||||||
icon.Transforms.Add(new TransformRotation(Clock)
|
|
||||||
{
|
|
||||||
StartValue = -10,
|
|
||||||
EndValue = 10,
|
|
||||||
StartTime = startTime,
|
|
||||||
EndTime = startTime + duration * 2,
|
|
||||||
Easing = EasingTypes.InOutSine,
|
|
||||||
LoopCount = -1,
|
|
||||||
LoopDelay = duration * 2
|
|
||||||
});
|
|
||||||
|
|
||||||
icon.Transforms.Add(new TransformPosition(Clock)
|
|
||||||
{
|
|
||||||
StartValue = Vector2.Zero,
|
|
||||||
EndValue = new Vector2(0, -10),
|
|
||||||
StartTime = startTime,
|
|
||||||
EndTime = startTime + duration,
|
|
||||||
Easing = EasingTypes.Out,
|
|
||||||
LoopCount = -1,
|
|
||||||
LoopDelay = duration
|
|
||||||
});
|
|
||||||
|
|
||||||
icon.Transforms.Add(new TransformScaleVector(Clock)
|
|
||||||
{
|
|
||||||
StartValue = new Vector2(1, 0.9f),
|
|
||||||
EndValue = Vector2.One,
|
|
||||||
StartTime = startTime,
|
|
||||||
EndTime = startTime + duration,
|
|
||||||
Easing = EasingTypes.Out,
|
|
||||||
LoopCount = -1,
|
|
||||||
LoopDelay = duration
|
|
||||||
});
|
|
||||||
|
|
||||||
icon.Transforms.Add(new TransformPosition(Clock)
|
|
||||||
{
|
|
||||||
StartValue = new Vector2(0, -10),
|
|
||||||
EndValue = Vector2.Zero,
|
|
||||||
StartTime = startTime + duration,
|
|
||||||
EndTime = startTime + duration * 2,
|
|
||||||
Easing = EasingTypes.In,
|
|
||||||
LoopCount = -1,
|
|
||||||
LoopDelay = duration
|
|
||||||
});
|
|
||||||
|
|
||||||
icon.Transforms.Add(new TransformScaleVector(Clock)
|
|
||||||
{
|
|
||||||
StartValue = Vector2.One,
|
|
||||||
EndValue = new Vector2(1, 0.9f),
|
|
||||||
StartTime = startTime + duration,
|
|
||||||
EndTime = startTime + duration * 2,
|
|
||||||
Easing = EasingTypes.In,
|
|
||||||
LoopCount = -1,
|
|
||||||
LoopDelay = duration
|
|
||||||
});
|
|
||||||
|
|
||||||
icon.Transforms.Add(new TransformRotation(Clock)
|
|
||||||
{
|
|
||||||
StartValue = 10,
|
|
||||||
EndValue = -10,
|
|
||||||
StartTime = startTime + duration * 2,
|
|
||||||
EndTime = startTime + duration * 4,
|
|
||||||
Easing = EasingTypes.InOutSine,
|
|
||||||
LoopCount = -1,
|
|
||||||
LoopDelay = duration * 2
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnHoverLost(InputState state)
|
|
||||||
{
|
|
||||||
icon.ClearTransformations();
|
|
||||||
icon.RotateTo(0, 500, EasingTypes.Out);
|
|
||||||
icon.MoveTo(Vector2.Zero, 500, EasingTypes.Out);
|
|
||||||
icon.ScaleTo(0.7f, 500, EasingTypes.OutElasticHalf);
|
|
||||||
icon.ScaleTo(Vector2.One, 200, EasingTypes.Out);
|
|
||||||
|
|
||||||
if (State == ButtonState.Expanded)
|
|
||||||
box.ScaleTo(new Vector2(1, 1), 500, EasingTypes.OutElastic);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
|
||||||
{
|
|
||||||
trigger();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
|
||||||
{
|
|
||||||
base.OnKeyDown(state, args);
|
|
||||||
|
|
||||||
if (triggerKey == args.Key && triggerKey != Key.Unknown)
|
|
||||||
{
|
|
||||||
trigger();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void trigger()
|
|
||||||
{
|
|
||||||
//Game.Audio.PlaySamplePositional($@"menu-{internalName}-click", internalName.Contains(@"back") ? @"menuback" : @"menuhit");
|
|
||||||
|
|
||||||
clickAction?.Invoke();
|
|
||||||
|
|
||||||
//box.FlashColour(ColourHelper.Lighten2(colour, 0.7f), 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool HandleInput => state != ButtonState.Exploded && box.Scale.X >= 0.8f;
|
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
iconText.Alpha = MathHelper.Clamp((box.Scale.X - 0.5f) / 0.3f, 0, 1);
|
|
||||||
base.Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int ContractStyle;
|
|
||||||
|
|
||||||
ButtonState state;
|
|
||||||
public ButtonState State
|
|
||||||
{
|
|
||||||
get { return state; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
|
|
||||||
if (state == value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
state = value;
|
|
||||||
|
|
||||||
switch (state)
|
|
||||||
{
|
|
||||||
case ButtonState.Contracted:
|
|
||||||
switch (ContractStyle)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
box.ScaleTo(new Vector2(0, 1), 500, EasingTypes.OutExpo);
|
|
||||||
FadeOut(500);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
box.ScaleTo(new Vector2(0, 1), 400, EasingTypes.InSine);
|
|
||||||
FadeOut(800);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ButtonState.Expanded:
|
|
||||||
const int expand_duration = 500;
|
|
||||||
box.ScaleTo(new Vector2(1, 1), expand_duration, EasingTypes.OutExpo);
|
|
||||||
FadeIn(expand_duration / 6);
|
|
||||||
break;
|
|
||||||
case ButtonState.Exploded:
|
|
||||||
const int explode_duration = 200;
|
|
||||||
box.ScaleTo(new Vector2(2, 1), explode_duration, EasingTypes.OutExpo);
|
|
||||||
FadeOut(explode_duration / 4 * 3);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ButtonState
|
|
||||||
{
|
|
||||||
Contracted,
|
|
||||||
Expanded,
|
|
||||||
Exploded
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ________
|
|
||||||
/// / /
|
|
||||||
/// / /
|
|
||||||
/// /_______/
|
|
||||||
/// </summary>
|
|
||||||
class WedgedBox : Box
|
|
||||||
{
|
|
||||||
float wedgeWidth;
|
|
||||||
|
|
||||||
public WedgedBox(Vector2 boxSize, float wedgeWidth)
|
|
||||||
{
|
|
||||||
Size = boxSize;
|
|
||||||
this.wedgeWidth = wedgeWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Custom DrawQuad used to create the slanted effect.
|
|
||||||
/// </summary>
|
|
||||||
protected override Quad DrawQuad
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
Quad q = base.DrawQuad;
|
|
||||||
|
|
||||||
//Will become infinite if we don't limit its maximum size.
|
|
||||||
float wedge = Math.Min(q.Width, wedgeWidth / Scale.X);
|
|
||||||
|
|
||||||
q.TopLeft.X += wedge;
|
|
||||||
q.BottomRight.X -= wedge;
|
|
||||||
|
|
||||||
return q;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class MenuVisualisation : Drawable
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
31
osu.Game/GameModes/Menu/FlowContainerWithOrigin.cs
Normal file
31
osu.Game/GameModes/Menu/FlowContainerWithOrigin.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using OpenTK;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
|
||||||
|
namespace osu.Game.GameModes.Menu
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A flow container with an origin based on one of its contained drawables.
|
||||||
|
/// </summary>
|
||||||
|
public class FlowContainerWithOrigin : FlowContainer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A target drawable which this flowcontainer should be centered around.
|
||||||
|
/// This target should be a direct child of this FlowContainer.
|
||||||
|
/// </summary>
|
||||||
|
public Drawable CentreTarget;
|
||||||
|
|
||||||
|
public override Anchor Origin => Anchor.Custom;
|
||||||
|
|
||||||
|
public override Vector2 OriginPosition
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (CentreTarget == null)
|
||||||
|
return base.OriginPosition;
|
||||||
|
|
||||||
|
return CentreTarget.Position + CentreTarget.Size / 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
using osu.Game.GameModes.Backgrounds;
|
using osu.Game.GameModes.Backgrounds;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Menu
|
namespace osu.Game.GameModes.Menu
|
||||||
{
|
{
|
||||||
@ -23,9 +24,9 @@ namespace osu.Game.GameModes.Menu
|
|||||||
|
|
||||||
protected override BackgroundMode CreateBackground() => new BackgroundModeEmpty();
|
protected override BackgroundMode CreateBackground() => new BackgroundModeEmpty();
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -39,16 +40,15 @@ namespace osu.Game.GameModes.Menu
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AudioSample welcome = Game.Audio.Sample.Get(@"welcome");
|
AudioSample welcome = game.Audio.Sample.Get(@"welcome");
|
||||||
|
|
||||||
AudioTrack bgm = Game.Audio.Track.Get(@"circles");
|
AudioTrack bgm = game.Audio.Track.Get(@"circles");
|
||||||
bgm.Looping = true;
|
bgm.Looping = true;
|
||||||
|
|
||||||
Scheduler.Add(delegate
|
Scheduler.Add(delegate
|
||||||
{
|
{
|
||||||
welcome.Play();
|
welcome.Play();
|
||||||
}, true);
|
});
|
||||||
|
|
||||||
|
|
||||||
Scheduler.AddDelayed(delegate
|
Scheduler.AddDelayed(delegate
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ namespace osu.Game.GameModes.Menu
|
|||||||
|
|
||||||
logo.ScaleTo(0);
|
logo.ScaleTo(0);
|
||||||
|
|
||||||
logo.ScaleTo(1,5900, EasingTypes.OutQuint);
|
logo.ScaleTo(1, 5900, EasingTypes.OutQuint);
|
||||||
logo.FadeIn(30000, EasingTypes.OutQuint);
|
logo.FadeIn(30000, EasingTypes.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ namespace osu.Game.GameModes.Menu
|
|||||||
protected override void OnResuming(GameMode last)
|
protected override void OnResuming(GameMode last)
|
||||||
{
|
{
|
||||||
//we are just an intro. if we are resumed, we just want to exit after a short delay (to allow the last mode to transition out).
|
//we are just an intro. if we are resumed, we just want to exit after a short delay (to allow the last mode to transition out).
|
||||||
Scheduler.AddDelayed(Exit, 300);
|
Scheduler.AddDelayed(Exit, 600);
|
||||||
|
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +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.Audio.Sample;
|
|
||||||
using osu.Framework.Audio.Track;
|
|
||||||
using osu.Framework.GameModes;
|
using osu.Framework.GameModes;
|
||||||
using osu.Framework.GameModes.Testing;
|
using osu.Framework.GameModes.Testing;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -15,6 +13,7 @@ using osu.Game.GameModes.Multiplayer;
|
|||||||
using osu.Game.GameModes.Play;
|
using osu.Game.GameModes.Play;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Menu
|
namespace osu.Game.GameModes.Menu
|
||||||
{
|
{
|
||||||
@ -25,11 +24,11 @@ namespace osu.Game.GameModes.Menu
|
|||||||
|
|
||||||
protected override BackgroundMode CreateBackground() => new BackgroundModeDefault();
|
protected override BackgroundMode CreateBackground() => new BackgroundModeDefault();
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
OsuGame osu = (OsuGame)Game;
|
OsuGame osu = (OsuGame)game;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -65,7 +64,7 @@ namespace osu.Game.GameModes.Menu
|
|||||||
|
|
||||||
const float length = 400;
|
const float length = 400;
|
||||||
|
|
||||||
buttons.State = ButtonSystem.MenuState.EnteringMode;
|
buttons.State = MenuState.EnteringMode;
|
||||||
|
|
||||||
Content.FadeOut(length, EasingTypes.InSine);
|
Content.FadeOut(length, EasingTypes.InSine);
|
||||||
Content.MoveTo(new Vector2(-800, 0), length, EasingTypes.InSine);
|
Content.MoveTo(new Vector2(-800, 0), length, EasingTypes.InSine);
|
||||||
@ -77,7 +76,7 @@ namespace osu.Game.GameModes.Menu
|
|||||||
|
|
||||||
const float length = 300;
|
const float length = 300;
|
||||||
|
|
||||||
buttons.State = ButtonSystem.MenuState.TopLevel;
|
buttons.State = MenuState.TopLevel;
|
||||||
|
|
||||||
Content.FadeIn(length, EasingTypes.OutQuint);
|
Content.FadeIn(length, EasingTypes.OutQuint);
|
||||||
Content.MoveTo(new Vector2(0, 0), length, EasingTypes.OutQuint);
|
Content.MoveTo(new Vector2(0, 0), length, EasingTypes.OutQuint);
|
||||||
|
13
osu.Game/GameModes/Menu/MenuVisualisation.cs
Normal file
13
osu.Game/GameModes/Menu/MenuVisualisation.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using osu.Framework.Graphics;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace osu.Game.GameModes.Menu
|
||||||
|
{
|
||||||
|
internal class MenuVisualisation : Drawable
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,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.Input;
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Menu
|
namespace osu.Game.GameModes.Menu
|
||||||
{
|
{
|
||||||
@ -17,7 +18,7 @@ namespace osu.Game.GameModes.Menu
|
|||||||
{
|
{
|
||||||
private Sprite logo;
|
private Sprite logo;
|
||||||
private Container logoBounceContainer;
|
private Container logoBounceContainer;
|
||||||
private ButtonSystem.MenuVisualisation vis;
|
private MenuVisualisation vis;
|
||||||
|
|
||||||
public Action Action;
|
public Action Action;
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ namespace osu.Game.GameModes.Menu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
vis = new ButtonSystem.MenuVisualisation
|
vis = new MenuVisualisation
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -82,12 +83,12 @@ namespace osu.Game.GameModes.Menu
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
logo.Texture = Game.Textures.Get(@"Menu/logo");
|
logo.Texture = game.Textures.Get(@"Menu/logo");
|
||||||
ripple.Texture = Game.Textures.Get(@"Menu/logo");
|
ripple.Texture = game.Textures.Get(@"Menu/logo");
|
||||||
|
|
||||||
ripple.ScaleTo(1.1f, 500);
|
ripple.ScaleTo(1.1f, 500);
|
||||||
ripple.FadeOut(500);
|
ripple.FadeOut(500);
|
||||||
|
@ -10,6 +10,7 @@ using osu.Game.Beatmaps.Objects;
|
|||||||
using osu.Game.Beatmaps.Objects.Osu;
|
using osu.Game.Beatmaps.Objects.Osu;
|
||||||
using osu.Game.Beatmaps.Objects.Catch;
|
using osu.Game.Beatmaps.Objects.Catch;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play.Catch
|
namespace osu.Game.GameModes.Play.Catch
|
||||||
{
|
{
|
||||||
@ -24,9 +25,6 @@ namespace osu.Game.GameModes.Play.Catch
|
|||||||
{
|
{
|
||||||
//osu! mode requires all objects to be of CatchBaseHit type.
|
//osu! mode requires all objects to be of CatchBaseHit type.
|
||||||
objects = value.ConvertAll(convertForCatch);
|
objects = value.ConvertAll(convertForCatch);
|
||||||
|
|
||||||
if (Parent != null)
|
|
||||||
Load();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,9 +48,9 @@ namespace osu.Game.GameModes.Play.Catch
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
if (playfield == null)
|
if (playfield == null)
|
||||||
Add(playfield = new CatchPlayfield());
|
Add(playfield = new CatchPlayfield());
|
||||||
@ -66,7 +64,7 @@ namespace osu.Game.GameModes.Play.Catch
|
|||||||
//render stuff!
|
//render stuff!
|
||||||
Sprite s = new Sprite
|
Sprite s = new Sprite
|
||||||
{
|
{
|
||||||
Texture = Game.Textures.Get(@"Menu/logo"),
|
Texture = game.Textures.Get(@"Menu/logo"),
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Scale = new Vector2(0.1f),
|
Scale = new Vector2(0.1f),
|
||||||
RelativePositionAxes = Axes.Y,
|
RelativePositionAxes = Axes.Y,
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics.Drawables;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play.Catch
|
namespace osu.Game.GameModes.Play.Catch
|
||||||
{
|
{
|
||||||
@ -20,9 +21,9 @@ namespace osu.Game.GameModes.Play.Catch
|
|||||||
Origin = Anchor.BottomCentre;
|
Origin = Anchor.BottomCentre;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics.Drawables;
|
|||||||
using osu.Game.Beatmaps.Objects;
|
using osu.Game.Beatmaps.Objects;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
@ -21,9 +22,9 @@ namespace osu.Game.GameModes.Play
|
|||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
Add(new Box()
|
Add(new Box()
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,7 @@ using osu.Game.Beatmaps.Objects;
|
|||||||
using osu.Game.Beatmaps.Objects.Osu;
|
using osu.Game.Beatmaps.Objects.Osu;
|
||||||
using osu.Game.Beatmaps.Objects.Mania;
|
using osu.Game.Beatmaps.Objects.Mania;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play.Mania
|
namespace osu.Game.GameModes.Play.Mania
|
||||||
{
|
{
|
||||||
@ -30,9 +31,6 @@ namespace osu.Game.GameModes.Play.Mania
|
|||||||
{
|
{
|
||||||
//osu! mode requires all objects to be of ManiaBaseHit type.
|
//osu! mode requires all objects to be of ManiaBaseHit type.
|
||||||
objects = value.ConvertAll(convertForMania);
|
objects = value.ConvertAll(convertForMania);
|
||||||
|
|
||||||
if (Parent != null)
|
|
||||||
Load();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,9 +54,9 @@ namespace osu.Game.GameModes.Play.Mania
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
if (playfield == null)
|
if (playfield == null)
|
||||||
Add(playfield = new ManiaPlayfield(columns));
|
Add(playfield = new ManiaPlayfield(columns));
|
||||||
@ -72,7 +70,7 @@ namespace osu.Game.GameModes.Play.Mania
|
|||||||
//render stuff!
|
//render stuff!
|
||||||
Sprite s = new Sprite
|
Sprite s = new Sprite
|
||||||
{
|
{
|
||||||
Texture = Game.Textures.Get(@"Menu/logo"),
|
Texture = game.Textures.Get(@"Menu/logo"),
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Scale = new Vector2(0.1f),
|
Scale = new Vector2(0.1f),
|
||||||
RelativePositionAxes = Axes.Both,
|
RelativePositionAxes = Axes.Both,
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics.Drawables;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play.Mania
|
namespace osu.Game.GameModes.Play.Mania
|
||||||
{
|
{
|
||||||
@ -23,9 +24,9 @@ namespace osu.Game.GameModes.Play.Mania
|
|||||||
Origin = Anchor.BottomCentre;
|
Origin = Anchor.BottomCentre;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
Add(new Box() { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
Add(new Box() { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@ using osu.Framework.Graphics.Transformations;
|
|||||||
using osu.Game.Beatmaps.Objects;
|
using osu.Game.Beatmaps.Objects;
|
||||||
using osu.Game.Beatmaps.Objects.Osu;
|
using osu.Game.Beatmaps.Objects.Osu;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play.Osu
|
namespace osu.Game.GameModes.Play.Osu
|
||||||
{
|
{
|
||||||
@ -20,17 +22,16 @@ namespace osu.Game.GameModes.Play.Osu
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
Debug.Assert(objects == null);
|
||||||
|
|
||||||
//osu! mode requires all objects to be of OsuBaseHit type.
|
//osu! mode requires all objects to be of OsuBaseHit type.
|
||||||
objects = value.ConvertAll(o => (OsuBaseHit)o);
|
objects = value.ConvertAll(o => (OsuBaseHit)o);
|
||||||
|
|
||||||
if (Parent != null)
|
|
||||||
Load();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
if (playfield == null)
|
if (playfield == null)
|
||||||
Add(playfield = new OsuPlayfield());
|
Add(playfield = new OsuPlayfield());
|
||||||
@ -44,7 +45,7 @@ namespace osu.Game.GameModes.Play.Osu
|
|||||||
//render stuff!
|
//render stuff!
|
||||||
Sprite s = new Sprite
|
Sprite s = new Sprite
|
||||||
{
|
{
|
||||||
Texture = Game.Textures.Get(@"Menu/logo"),
|
Texture = game.Textures.Get(@"Menu/logo"),
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Scale = new Vector2(0.1f),
|
Scale = new Vector2(0.1f),
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
|
@ -5,6 +5,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Drawables;
|
using osu.Framework.Graphics.Drawables;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play.Osu
|
namespace osu.Game.GameModes.Play.Osu
|
||||||
{
|
{
|
||||||
@ -18,9 +19,9 @@ namespace osu.Game.GameModes.Play.Osu
|
|||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
Add(new Box()
|
Add(new Box()
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Game.GameModes.Backgrounds;
|
using osu.Game.GameModes.Backgrounds;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
@ -19,11 +20,11 @@ namespace osu.Game.GameModes.Play
|
|||||||
typeof(Player)
|
typeof(Player)
|
||||||
};
|
};
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
OsuGame osu = Game as OsuGame;
|
OsuGame osu = game as OsuGame;
|
||||||
|
|
||||||
playMode = osu.PlayMode;
|
playMode = osu.PlayMode;
|
||||||
playMode.ValueChanged += PlayMode_ValueChanged;
|
playMode.ValueChanged += PlayMode_ValueChanged;
|
||||||
|
@ -20,6 +20,7 @@ using osu.Game.GameModes.Play.Taiko;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
@ -31,9 +32,9 @@ namespace osu.Game.GameModes.Play
|
|||||||
typeof(Results)
|
typeof(Results)
|
||||||
};
|
};
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
List<HitObject> objects = new List<HitObject>();
|
List<HitObject> objects = new List<HitObject>();
|
||||||
|
|
||||||
@ -54,7 +55,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
HitObjects = objects
|
HitObjects = objects
|
||||||
};
|
};
|
||||||
|
|
||||||
OsuGame osu = Game as OsuGame;
|
OsuGame osu = game as OsuGame;
|
||||||
|
|
||||||
switch (osu.PlayMode.Value)
|
switch (osu.PlayMode.Value)
|
||||||
{
|
{
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
//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.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
public class Playfield : Container
|
public class Playfield : Container
|
||||||
{
|
{
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
Masking = true;
|
Masking = true;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ using osu.Game.Beatmaps.Objects;
|
|||||||
using osu.Game.Beatmaps.Objects.Osu;
|
using osu.Game.Beatmaps.Objects.Osu;
|
||||||
using osu.Game.Beatmaps.Objects.Taiko;
|
using osu.Game.Beatmaps.Objects.Taiko;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play.Taiko
|
namespace osu.Game.GameModes.Play.Taiko
|
||||||
{
|
{
|
||||||
@ -24,9 +25,6 @@ namespace osu.Game.GameModes.Play.Taiko
|
|||||||
{
|
{
|
||||||
//osu! mode requires all objects to be of TaikoBaseHit type.
|
//osu! mode requires all objects to be of TaikoBaseHit type.
|
||||||
objects = value.ConvertAll(convertForTaiko);
|
objects = value.ConvertAll(convertForTaiko);
|
||||||
|
|
||||||
if (Parent != null)
|
|
||||||
Load();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,9 +47,9 @@ namespace osu.Game.GameModes.Play.Taiko
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
if (playfield == null)
|
if (playfield == null)
|
||||||
Add(playfield = new TaikoPlayfield());
|
Add(playfield = new TaikoPlayfield());
|
||||||
@ -65,7 +63,7 @@ namespace osu.Game.GameModes.Play.Taiko
|
|||||||
//render stuff!
|
//render stuff!
|
||||||
Sprite s = new Sprite
|
Sprite s = new Sprite
|
||||||
{
|
{
|
||||||
Texture = Game.Textures.Get(@"Menu/logo"),
|
Texture = game.Textures.Get(@"Menu/logo"),
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Scale = new Vector2(0.2f),
|
Scale = new Vector2(0.2f),
|
||||||
RelativePositionAxes = Axes.Both,
|
RelativePositionAxes = Axes.Both,
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics.Drawables;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play.Taiko
|
namespace osu.Game.GameModes.Play.Taiko
|
||||||
{
|
{
|
||||||
@ -20,15 +21,15 @@ namespace osu.Game.GameModes.Play.Taiko
|
|||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
||||||
|
|
||||||
Add(new Sprite
|
Add(new Sprite
|
||||||
{
|
{
|
||||||
Texture = Game.Textures.Get(@"Menu/logo"),
|
Texture = game.Textures.Get(@"Menu/logo"),
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Scale = new Vector2(0.2f),
|
Scale = new Vector2(0.2f),
|
||||||
RelativePositionAxes = Axes.Both,
|
RelativePositionAxes = Axes.Both,
|
||||||
|
@ -8,6 +8,7 @@ using osu.Game.Graphics.Containers;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Background
|
namespace osu.Game.Graphics.Background
|
||||||
{
|
{
|
||||||
@ -24,13 +25,13 @@ namespace osu.Game.Graphics.Background
|
|||||||
Depth = float.MinValue;
|
Depth = float.MinValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
Add(BackgroundSprite = new Sprite
|
Add(BackgroundSprite = new Sprite
|
||||||
{
|
{
|
||||||
Texture = Game.Textures.Get(textureName),
|
Texture = game.Textures.Get(textureName),
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Colour = Color4.DarkGray
|
Colour = Color4.DarkGray
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Containers
|
namespace osu.Game.Graphics.Containers
|
||||||
{
|
{
|
||||||
@ -26,9 +27,9 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected override Container Content => content;
|
protected override Container Content => content;
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseMove(InputState state)
|
protected override bool OnMouseMove(InputState state)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
//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.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
@ -35,15 +36,15 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Sprite
|
new Sprite
|
||||||
{
|
{
|
||||||
Texture = Game.Textures.Get(@"Cursor/cursor")
|
Texture = game.Textures.Get(@"Cursor/cursor")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
102
osu.Game/Graphics/UserInterface/AccuracyCounter.cs
Normal file
102
osu.Game/Graphics/UserInterface/AccuracyCounter.cs
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
//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.Graphics;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Used as an accuracy counter. Represented visually as a percentage, internally as a fraction.
|
||||||
|
/// </summary>
|
||||||
|
public class AccuracyCounter : NumericRollingCounter<float>
|
||||||
|
{
|
||||||
|
protected override Type transformType => typeof(TransformAccuracy);
|
||||||
|
|
||||||
|
private long numerator = 0;
|
||||||
|
public long Numerator
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return numerator;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
numerator = value;
|
||||||
|
updateCount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ulong denominator = 0;
|
||||||
|
public ulong Denominator
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return denominator;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
denominator = value;
|
||||||
|
updateCount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetCount(long num, ulong den)
|
||||||
|
{
|
||||||
|
numerator = num;
|
||||||
|
denominator = den;
|
||||||
|
updateCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateCount()
|
||||||
|
{
|
||||||
|
Count = Denominator == 0 ? 100.0f : (Numerator * 100.0f) / Denominator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ResetCount()
|
||||||
|
{
|
||||||
|
numerator = 0;
|
||||||
|
denominator = 0;
|
||||||
|
updateCount();
|
||||||
|
StopRolling();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string formatCount(float count)
|
||||||
|
{
|
||||||
|
return count.ToString("0.00") + "%";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class TransformAccuracy : Transform<float>
|
||||||
|
{
|
||||||
|
public override float CurrentValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
double time = Time;
|
||||||
|
if (time < StartTime) return StartValue;
|
||||||
|
if (time >= EndTime) return EndValue;
|
||||||
|
|
||||||
|
return Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Apply(Drawable d)
|
||||||
|
{
|
||||||
|
base.Apply(d);
|
||||||
|
(d as AccuracyCounter).VisibleCount = CurrentValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TransformAccuracy(IClock clock)
|
||||||
|
: base(clock)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
91
osu.Game/Graphics/UserInterface/AlternativeComboCounter.cs
Normal file
91
osu.Game/Graphics/UserInterface/AlternativeComboCounter.cs
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
//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;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Allows tint and vertical scaling animation. Used in osu!taiko and osu!mania.
|
||||||
|
/// </summary>
|
||||||
|
public class AlternativeComboCounter : ULongCounter // btw, I'm terribly bad with names... OUENDAN!
|
||||||
|
{
|
||||||
|
public Color4 OriginalColour;
|
||||||
|
public Color4 TintColour = Color4.OrangeRed;
|
||||||
|
public int TintDuration = 250;
|
||||||
|
public float ScaleFactor = 2;
|
||||||
|
public EasingTypes TintEasing = EasingTypes.None;
|
||||||
|
public bool CanAnimateWhenBackwards = false;
|
||||||
|
|
||||||
|
public AlternativeComboCounter() : base()
|
||||||
|
{
|
||||||
|
IsRollingContinuous = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Load(BaseGame game)
|
||||||
|
{
|
||||||
|
base.Load(game);
|
||||||
|
|
||||||
|
countSpriteText.Hide();
|
||||||
|
OriginalColour = Colour;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ResetCount()
|
||||||
|
{
|
||||||
|
SetCountWithoutRolling(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void transformCount(ulong currentValue, ulong newValue)
|
||||||
|
{
|
||||||
|
// Animate rollover only when going backwards
|
||||||
|
if (newValue > currentValue)
|
||||||
|
{
|
||||||
|
updateTransforms(typeof(TransformULongCounter));
|
||||||
|
removeTransforms(typeof(TransformULongCounter));
|
||||||
|
VisibleCount = newValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
transformCount(new TransformULongCounter(Clock), currentValue, newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override ulong getProportionalDuration(ulong currentValue, ulong newValue)
|
||||||
|
{
|
||||||
|
ulong difference = currentValue > newValue ? currentValue - newValue : currentValue - newValue;
|
||||||
|
return difference * RollingDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void transformAnimate()
|
||||||
|
{
|
||||||
|
countSpriteText.FadeColour(TintColour, 0);
|
||||||
|
countSpriteText.ScaleTo(new Vector2(1, ScaleFactor));
|
||||||
|
countSpriteText.FadeColour(OriginalColour, TintDuration, TintEasing);
|
||||||
|
countSpriteText.ScaleTo(new Vector2(1, 1), TintDuration, TintEasing);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void transformVisibleCount(ulong currentValue, ulong newValue)
|
||||||
|
{
|
||||||
|
if (countSpriteText != null)
|
||||||
|
{
|
||||||
|
countSpriteText.Text = newValue.ToString("#,0");
|
||||||
|
if (newValue == 0)
|
||||||
|
{
|
||||||
|
countSpriteText.FadeOut(TintDuration);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
countSpriteText.Show();
|
||||||
|
if (newValue > currentValue || CanAnimateWhenBackwards)
|
||||||
|
{
|
||||||
|
transformAnimate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
osu.Game/Graphics/UserInterface/CatchComboCounter.cs
Normal file
60
osu.Game/Graphics/UserInterface/CatchComboCounter.cs
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
//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.Graphics;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Similar to Standard, but without the 'x' and has tinted pop-ups. Used in osu!catch.
|
||||||
|
/// </summary>
|
||||||
|
public class CatchComboCounter : StandardComboCounter
|
||||||
|
{
|
||||||
|
public CatchComboCounter() : base()
|
||||||
|
{
|
||||||
|
CanPopOutWhenBackwards = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string formatCount(ulong count)
|
||||||
|
{
|
||||||
|
return count.ToString("#,0");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void transformCount(ulong currentValue, ulong newValue)
|
||||||
|
{
|
||||||
|
// Animate rollover only when going backwards
|
||||||
|
if (newValue > currentValue)
|
||||||
|
{
|
||||||
|
updateTransforms(typeof(TransformULongCounter));
|
||||||
|
removeTransforms(typeof(TransformULongCounter));
|
||||||
|
VisibleCount = newValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Backwards pop-up animation has no tint colour
|
||||||
|
popOutSpriteText.Colour = countSpriteText.Colour;
|
||||||
|
transformCount(new TransformULongCounter(Clock), currentValue, newValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Increaces counter and tints pop-out before animation.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="colour">Last grabbed fruit colour.</param>
|
||||||
|
public void CatchFruit(Color4 colour)
|
||||||
|
{
|
||||||
|
popOutSpriteText.Colour = colour;
|
||||||
|
Count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ResetCount()
|
||||||
|
{
|
||||||
|
base.ResetCount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
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;
|
||||||
@ -58,20 +59,20 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Name = name;
|
Name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
buttonSprite = new Sprite
|
buttonSprite = new Sprite
|
||||||
{
|
{
|
||||||
Texture = Game.Textures.Get(@"KeyCounter/key-up"),
|
Texture = game.Textures.Get(@"KeyCounter/key-up"),
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
},
|
},
|
||||||
glowSprite = new Sprite
|
glowSprite = new Sprite
|
||||||
{
|
{
|
||||||
Texture = Game.Textures.Get(@"KeyCounter/key-glow"),
|
Texture = game.Textures.Get(@"KeyCounter/key-glow"),
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Alpha = 0
|
Alpha = 0
|
||||||
|
65
osu.Game/Graphics/UserInterface/NumericRollingCounter.cs
Normal file
65
osu.Game/Graphics/UserInterface/NumericRollingCounter.cs
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
//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;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Skeleton for a numeric counter with a simple roll-up animation.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">Type of the actual counter.</typeparam>
|
||||||
|
public abstract class NumericRollingCounter<T> : RollingCounter<T>
|
||||||
|
{
|
||||||
|
protected SpriteText countSpriteText;
|
||||||
|
|
||||||
|
protected float textSize = 20.0f;
|
||||||
|
public float TextSize
|
||||||
|
{
|
||||||
|
get { return textSize; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
textSize = value;
|
||||||
|
updateTextSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Load(BaseGame game)
|
||||||
|
{
|
||||||
|
base.Load(game);
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
countSpriteText = new SpriteText
|
||||||
|
{
|
||||||
|
Text = formatCount(Count),
|
||||||
|
TextSize = this.TextSize,
|
||||||
|
Anchor = this.Anchor,
|
||||||
|
Origin = this.Origin,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void transformVisibleCount(T currentValue, T newValue)
|
||||||
|
{
|
||||||
|
if (countSpriteText != null)
|
||||||
|
{
|
||||||
|
countSpriteText.Text = formatCount(newValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void updateTextSize()
|
||||||
|
{
|
||||||
|
if (countSpriteText != null)
|
||||||
|
countSpriteText.TextSize = TextSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
241
osu.Game/Graphics/UserInterface/RollingCounter.cs
Normal file
241
osu.Game/Graphics/UserInterface/RollingCounter.cs
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
using osu.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Skeleton for a counter which value rolls-up in a lapse of time.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This class only abstracts the basics to roll-up a value in a lapse of time by using Transforms.
|
||||||
|
/// In order to show a value, you must implement a way to display it, i.e., as a numeric counter or a bar.
|
||||||
|
/// </remarks>
|
||||||
|
/// <typeparam name="T">Type of the actual counter.</typeparam>
|
||||||
|
public abstract class RollingCounter<T> : Container
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Type of the Transform to use.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Must be a subclass of Transform<T>
|
||||||
|
/// </remarks>
|
||||||
|
protected virtual Type transformType => typeof(Transform<T>);
|
||||||
|
|
||||||
|
protected ulong RollingTotalDuration = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If true, each time the Count is updated, it will roll over from the current visible value.
|
||||||
|
/// Else, it will roll up from the current count value.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsRollingContinuous = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If true, the roll-up duration will be proportional to the counter.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsRollingProportional = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If IsRollingProportional = false, duration in milliseconds for the counter roll-up animation for each
|
||||||
|
/// element; else duration in milliseconds for the counter roll-up animation in total.
|
||||||
|
/// </summary>
|
||||||
|
public ulong RollingDuration = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Easing for the counter rollover animation.
|
||||||
|
/// </summary>
|
||||||
|
public EasingTypes RollingEasing = EasingTypes.None;
|
||||||
|
|
||||||
|
protected T prevVisibleCount;
|
||||||
|
protected T visibleCount;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Value shown at the current moment.
|
||||||
|
/// </summary>
|
||||||
|
public virtual T VisibleCount
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return visibleCount;
|
||||||
|
}
|
||||||
|
protected set
|
||||||
|
{
|
||||||
|
prevVisibleCount = visibleCount;
|
||||||
|
if (visibleCount.Equals(value))
|
||||||
|
return;
|
||||||
|
visibleCount = value;
|
||||||
|
transformVisibleCount(prevVisibleCount, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected T prevCount;
|
||||||
|
protected T count;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Actual value of counter.
|
||||||
|
/// </summary>
|
||||||
|
public virtual T Count
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
prevCount = count;
|
||||||
|
count = value;
|
||||||
|
if (Clock != null)
|
||||||
|
{
|
||||||
|
RollingTotalDuration =
|
||||||
|
IsRollingProportional
|
||||||
|
? getProportionalDuration(VisibleCount, value)
|
||||||
|
: RollingDuration;
|
||||||
|
transformCount(IsRollingContinuous ? VisibleCount : prevCount, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected RollingCounter()
|
||||||
|
{
|
||||||
|
Debug.Assert(
|
||||||
|
transformType.IsSubclassOf(typeof(Transform<T>)) || transformType == typeof(Transform<T>),
|
||||||
|
@"transformType should be a subclass of Transform<T>."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Load(BaseGame game)
|
||||||
|
{
|
||||||
|
base.Load(game);
|
||||||
|
removeTransforms(transformType);
|
||||||
|
if (Count == null)
|
||||||
|
ResetCount();
|
||||||
|
VisibleCount = Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets count value, bypassing rollover animation.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="count">New count value.</param>
|
||||||
|
public virtual void SetCountWithoutRolling(T count)
|
||||||
|
{
|
||||||
|
Count = count;
|
||||||
|
StopRolling();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stops rollover animation, forcing the visible count to be the actual count.
|
||||||
|
/// </summary>
|
||||||
|
public virtual void StopRolling()
|
||||||
|
{
|
||||||
|
removeTransforms(transformType);
|
||||||
|
VisibleCount = Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets count to default value.
|
||||||
|
/// </summary>
|
||||||
|
public abstract void ResetCount();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculates the duration of the roll-up animation by using the difference between the current visible value
|
||||||
|
/// and the new final value.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// To be used in conjunction with IsRollingProportional = true.
|
||||||
|
/// Unless a derived class needs to have a proportional rolling, it is not necessary to override this function.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="currentValue">Current visible value.</param>
|
||||||
|
/// <param name="newValue">New final value.</param>
|
||||||
|
/// <returns>Calculated rollover duration in milliseconds.</returns>
|
||||||
|
protected virtual ulong getProportionalDuration(T currentValue, T newValue)
|
||||||
|
{
|
||||||
|
return RollingDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to format counts.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="count">Count to format.</param>
|
||||||
|
/// <returns>Count formatted as a string.</returns>
|
||||||
|
protected virtual string formatCount(T count)
|
||||||
|
{
|
||||||
|
return count.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateTransforms(Type type)
|
||||||
|
{
|
||||||
|
foreach (ITransform t in Transforms.AliveItems)
|
||||||
|
if (t.GetType() == type)
|
||||||
|
t.Apply(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void removeTransforms(Type type)
|
||||||
|
{
|
||||||
|
Transforms.RemoveAll(t => t.GetType() == type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when the count is updated to add a transformer that changes the value of the visible count (i.e.
|
||||||
|
/// implement the rollover animation).
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="currentValue">Count value before modification.</param>
|
||||||
|
/// <param name="newValue">Expected count value after modification-</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// Unless you need to set a custom animation according to the current or new value of the count, the
|
||||||
|
/// recommended approach is to call transformCount(CustomTransformer(Clock), currentValue, newValue), where
|
||||||
|
/// CustomTransformer is of type transformerType.
|
||||||
|
/// By using this approach, there is no need to check if the Clock is not null; this validation is done before
|
||||||
|
/// adding the transformer.
|
||||||
|
/// </remarks>
|
||||||
|
/// <seealso cref="transformType"/>
|
||||||
|
protected virtual void transformCount(T currentValue, T newValue)
|
||||||
|
{
|
||||||
|
object[] parameters = { Clock };
|
||||||
|
transformCount((Transform<T>)Activator.CreateInstance(transformType, parameters), currentValue, newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Intended to be used by transformCount().
|
||||||
|
/// </summary>
|
||||||
|
/// <see cref="transformCount"/>
|
||||||
|
protected void transformCount(Transform<T> transform, T currentValue, T newValue)
|
||||||
|
{
|
||||||
|
Type type = transform.GetType();
|
||||||
|
|
||||||
|
updateTransforms(type);
|
||||||
|
removeTransforms(type);
|
||||||
|
|
||||||
|
if (Clock == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (RollingDuration == 0)
|
||||||
|
{
|
||||||
|
VisibleCount = Count;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
transform.StartTime = Time;
|
||||||
|
transform.EndTime = Time + RollingTotalDuration;
|
||||||
|
transform.StartValue = currentValue;
|
||||||
|
transform.EndValue = newValue;
|
||||||
|
transform.Easing = RollingEasing;
|
||||||
|
|
||||||
|
Transforms.Add(transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This procedure is called each time the visible count value is updated.
|
||||||
|
/// Override to create custom animations.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="currentValue">Visible count value before modification.</param>
|
||||||
|
/// <param name="newValue">Expected visible count value after modification-</param>
|
||||||
|
protected abstract void transformVisibleCount(T currentValue, T newValue);
|
||||||
|
}
|
||||||
|
}
|
32
osu.Game/Graphics/UserInterface/ScoreCounter.cs
Normal file
32
osu.Game/Graphics/UserInterface/ScoreCounter.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
//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;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
public class ScoreCounter : ULongCounter
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// How many leading zeroes the counter will have.
|
||||||
|
/// </summary>
|
||||||
|
public uint LeadingZeroes = 0;
|
||||||
|
|
||||||
|
public override void Load(BaseGame game)
|
||||||
|
{
|
||||||
|
base.Load(game);
|
||||||
|
|
||||||
|
countSpriteText.FixedWidth = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string formatCount(ulong count)
|
||||||
|
{
|
||||||
|
return count.ToString("D" + LeadingZeroes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
110
osu.Game/Graphics/UserInterface/StandardComboCounter.cs
Normal file
110
osu.Game/Graphics/UserInterface/StandardComboCounter.cs
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
//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;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Uses the 'x' symbol and has a pop-out effect while rolling over. Used in osu! standard.
|
||||||
|
/// </summary>
|
||||||
|
public class StandardComboCounter : ULongCounter
|
||||||
|
{
|
||||||
|
public SpriteText popOutSpriteText;
|
||||||
|
|
||||||
|
public ulong PopOutDuration = 0;
|
||||||
|
public float PopOutBigScale = 2.0f;
|
||||||
|
public float PopOutSmallScale = 1.2f;
|
||||||
|
public EasingTypes PopOutEasing = EasingTypes.None;
|
||||||
|
public bool CanPopOutWhenBackwards = false;
|
||||||
|
public float PopOutInitialAlpha = 0.75f;
|
||||||
|
|
||||||
|
public StandardComboCounter() : base()
|
||||||
|
{
|
||||||
|
IsRollingContinuous = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Load(BaseGame game)
|
||||||
|
{
|
||||||
|
base.Load(game);
|
||||||
|
|
||||||
|
countSpriteText.Alpha = 0;
|
||||||
|
Add(popOutSpriteText = new SpriteText
|
||||||
|
{
|
||||||
|
Text = formatCount(Count),
|
||||||
|
Origin = this.Origin,
|
||||||
|
Anchor = this.Anchor,
|
||||||
|
TextSize = this.TextSize,
|
||||||
|
Alpha = 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void updateTextSize()
|
||||||
|
{
|
||||||
|
base.updateTextSize();
|
||||||
|
if (popOutSpriteText != null)
|
||||||
|
popOutSpriteText.TextSize = this.TextSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void transformCount(ulong currentValue, ulong newValue)
|
||||||
|
{
|
||||||
|
// Animate rollover only when going backwards
|
||||||
|
if (newValue > currentValue)
|
||||||
|
{
|
||||||
|
updateTransforms(typeof(TransformULongCounter));
|
||||||
|
removeTransforms(typeof(TransformULongCounter));
|
||||||
|
VisibleCount = newValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
transformCount(new TransformULongCounter(Clock), currentValue, newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override ulong getProportionalDuration(ulong currentValue, ulong newValue)
|
||||||
|
{
|
||||||
|
ulong difference = currentValue > newValue ? currentValue - newValue : currentValue - newValue;
|
||||||
|
return difference * RollingDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string formatCount(ulong count)
|
||||||
|
{
|
||||||
|
return count.ToString("#,0") + "x";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void transformPopOut()
|
||||||
|
{
|
||||||
|
countSpriteText.ScaleTo(PopOutSmallScale);
|
||||||
|
countSpriteText.ScaleTo(1, PopOutDuration, PopOutEasing);
|
||||||
|
|
||||||
|
popOutSpriteText.ScaleTo(PopOutBigScale);
|
||||||
|
popOutSpriteText.FadeTo(PopOutInitialAlpha);
|
||||||
|
popOutSpriteText.ScaleTo(1, PopOutDuration, PopOutEasing);
|
||||||
|
popOutSpriteText.FadeOut(PopOutDuration, PopOutEasing);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void transformVisibleCount(ulong currentValue, ulong newValue)
|
||||||
|
{
|
||||||
|
if (countSpriteText != null && popOutSpriteText != null)
|
||||||
|
{
|
||||||
|
countSpriteText.Text = popOutSpriteText.Text = formatCount(newValue);
|
||||||
|
if (newValue == 0)
|
||||||
|
{
|
||||||
|
countSpriteText.FadeOut(PopOutDuration);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
countSpriteText.Show();
|
||||||
|
if (newValue > currentValue || CanPopOutWhenBackwards)
|
||||||
|
transformPopOut();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
205
osu.Game/Graphics/UserInterface/StarCounter.cs
Normal file
205
osu.Game/Graphics/UserInterface/StarCounter.cs
Normal file
@ -0,0 +1,205 @@
|
|||||||
|
//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 osu.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Shows a float count as stars. Used as star difficulty display.
|
||||||
|
/// </summary>
|
||||||
|
public class StarCounter : RollingCounter<float>
|
||||||
|
{
|
||||||
|
protected override Type transformType => typeof(TransformStarCounter);
|
||||||
|
|
||||||
|
protected Container starContainer;
|
||||||
|
protected List<TextAwesome> stars = new List<TextAwesome>();
|
||||||
|
|
||||||
|
public ulong StarAnimationDuration = 500;
|
||||||
|
public EasingTypes StarAnimationEasing = EasingTypes.OutElasticHalf;
|
||||||
|
public ulong FadeDuration = 100;
|
||||||
|
public float MinStarSize = 0.3f;
|
||||||
|
public float MinStarAlpha = 0.5f;
|
||||||
|
public int MaxStars = 10;
|
||||||
|
public int StarSize = 20;
|
||||||
|
public int StarSpacing = 4;
|
||||||
|
|
||||||
|
public StarCounter() : base()
|
||||||
|
{
|
||||||
|
IsRollingProportional = true;
|
||||||
|
RollingDuration = 150;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override ulong getProportionalDuration(float currentValue, float newValue)
|
||||||
|
{
|
||||||
|
return (ulong)(Math.Abs(currentValue - newValue) * RollingDuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ResetCount()
|
||||||
|
{
|
||||||
|
Count = 0;
|
||||||
|
StopRolling();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Load(BaseGame game)
|
||||||
|
{
|
||||||
|
base.Load(game);
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
starContainer = new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Width = MaxStars * StarSize + Math.Max(MaxStars - 1, 0) * StarSpacing,
|
||||||
|
Height = StarSize,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < MaxStars; i++)
|
||||||
|
{
|
||||||
|
TextAwesome star = new TextAwesome
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.star,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
TextSize = StarSize,
|
||||||
|
Scale = new Vector2(MinStarSize),
|
||||||
|
Alpha = (i == 0) ? 1.0f : MinStarAlpha,
|
||||||
|
Position = new Vector2((StarSize + StarSpacing) * i + (StarSize + StarSpacing) / 2, 0),
|
||||||
|
};
|
||||||
|
|
||||||
|
//todo: user Container<T> once we have it.
|
||||||
|
stars.Add(star);
|
||||||
|
starContainer.Add(star);
|
||||||
|
}
|
||||||
|
|
||||||
|
ResetCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void transformCount(float currentValue, float newValue)
|
||||||
|
{
|
||||||
|
transformStar((int)Math.Floor(currentValue), currentValue, currentValue < newValue);
|
||||||
|
transformCount(new TransformStarCounter(Clock), currentValue, newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateTransformStar(int i)
|
||||||
|
{
|
||||||
|
foreach (ITransform t in stars[i].Transforms.AliveItems)
|
||||||
|
if (t.GetType() == typeof(TransformAlpha) || t.GetType() == typeof(TransformScaleVector))
|
||||||
|
t.Apply(stars[i]);
|
||||||
|
|
||||||
|
stars[i].Transforms.RemoveAll(t =>
|
||||||
|
t.GetType() == typeof(TransformScaleVector) || t.GetType() == typeof(TransformAlpha)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void transformStarScale(int i, TransformScaleVector transform, bool isIncrement, double startTime)
|
||||||
|
{
|
||||||
|
transform.StartTime = startTime;
|
||||||
|
transform.EndTime = transform.StartTime + StarAnimationDuration;
|
||||||
|
transform.StartValue = stars[i].Scale;
|
||||||
|
transform.EndValue = new Vector2(
|
||||||
|
Interpolation.ValueAt(
|
||||||
|
Math.Min(Math.Max(i, Count), i + 1),
|
||||||
|
MinStarSize,
|
||||||
|
1.0f,
|
||||||
|
i,
|
||||||
|
i + 1
|
||||||
|
)
|
||||||
|
);
|
||||||
|
transform.Easing = StarAnimationEasing;
|
||||||
|
|
||||||
|
stars[i].Transforms.Add(transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void transformStarAlpha(int i, TransformAlpha transform, bool isIncrement, double startTime)
|
||||||
|
{
|
||||||
|
transform.StartTime = startTime;
|
||||||
|
//if (!isIncrement)
|
||||||
|
//transform.StartTime += StarAnimationDuration - FadeDuration;
|
||||||
|
transform.EndTime = transform.StartTime + FadeDuration;
|
||||||
|
transform.StartValue = stars[i].Alpha;
|
||||||
|
transform.EndValue = i < Count ? 1.0f : MinStarAlpha;
|
||||||
|
|
||||||
|
stars[i].Transforms.Add(transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void transformStar(int i, float value, bool isIncrement)
|
||||||
|
{
|
||||||
|
if (i >= MaxStars)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Clock == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Calculate time where animation should had started
|
||||||
|
double startTime = Time;
|
||||||
|
// If incrementing, animation should had started when VisibleCount crossed start of star (i)
|
||||||
|
if (isIncrement)
|
||||||
|
startTime -= i == (int)Math.Floor(prevCount) ?
|
||||||
|
getProportionalDuration(prevCount, value) : getProportionalDuration(i, value);
|
||||||
|
// If decrementing, animation should had started when VisibleCount crossed end of star (i + 1)
|
||||||
|
else
|
||||||
|
startTime -= i == (int)Math.Floor(prevCount) ?
|
||||||
|
getProportionalDuration(prevCount, value) : getProportionalDuration(i + 1, value);
|
||||||
|
|
||||||
|
updateTransformStar(i);
|
||||||
|
|
||||||
|
transformStarScale(i, new TransformScaleVector(Clock), isIncrement, startTime);
|
||||||
|
transformStarAlpha(i, new TransformAlpha(Clock), isIncrement, startTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void transformVisibleCount(float currentValue, float newValue)
|
||||||
|
{
|
||||||
|
// Detect increment that passes over an integer value
|
||||||
|
if (Math.Ceiling(currentValue) <= Math.Floor(newValue))
|
||||||
|
for (int i = (int)Math.Ceiling(currentValue); i <= Math.Floor(newValue); i++)
|
||||||
|
transformStar(i, newValue, true);
|
||||||
|
|
||||||
|
// Detect decrement that passes over an integer value
|
||||||
|
if (Math.Floor(currentValue) >= Math.Ceiling(newValue))
|
||||||
|
for (int i = (int)Math.Floor(newValue); i < Math.Floor(currentValue); i++)
|
||||||
|
transformStar(i, newValue, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class TransformStarCounter : Transform<float>
|
||||||
|
{
|
||||||
|
public override float CurrentValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
double time = Time;
|
||||||
|
if (time < StartTime) return StartValue;
|
||||||
|
if (time >= EndTime) return EndValue;
|
||||||
|
|
||||||
|
return Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Apply(Drawable d)
|
||||||
|
{
|
||||||
|
base.Apply(d);
|
||||||
|
(d as StarCounter).VisibleCount = CurrentValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TransformStarCounter(IClock clock)
|
||||||
|
: base(clock)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
59
osu.Game/Graphics/UserInterface/ULongCounter.cs
Normal file
59
osu.Game/Graphics/UserInterface/ULongCounter.cs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
//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.Graphics;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A simple rolling counter that accepts unsigned long values.
|
||||||
|
/// </summary>
|
||||||
|
public class ULongCounter : NumericRollingCounter<ulong>
|
||||||
|
{
|
||||||
|
protected override Type transformType => typeof(TransformULongCounter);
|
||||||
|
|
||||||
|
public override void ResetCount()
|
||||||
|
{
|
||||||
|
SetCountWithoutRolling(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string formatCount(ulong count)
|
||||||
|
{
|
||||||
|
return count.ToString("#,0");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class TransformULongCounter : Transform<ulong>
|
||||||
|
{
|
||||||
|
public override ulong CurrentValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
double time = Time;
|
||||||
|
if (time < StartTime) return StartValue;
|
||||||
|
if (time >= EndTime) return EndValue;
|
||||||
|
|
||||||
|
return (ulong)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Apply(Drawable d)
|
||||||
|
{
|
||||||
|
base.Apply(d);
|
||||||
|
(d as ULongCounter).VisibleCount = CurrentValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TransformULongCounter(IClock clock)
|
||||||
|
: base(clock)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
osu.Game/Input/GlobalHotkeys.cs
Normal file
21
osu.Game/Input/GlobalHotkeys.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//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 osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
|
||||||
|
namespace osu.Game.Input
|
||||||
|
{
|
||||||
|
public class GlobalHotkeys : Drawable
|
||||||
|
{
|
||||||
|
public Func<InputState, KeyDownEventArgs, bool> Handler;
|
||||||
|
|
||||||
|
public override bool HandleInput => true;
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
|
{
|
||||||
|
return Handler(state, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,14 @@
|
|||||||
//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.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Online.API.Requests;
|
||||||
|
|
||||||
namespace osu.Game.Online.Chat
|
namespace osu.Game.Online.Chat
|
||||||
{
|
{
|
||||||
@ -24,9 +30,28 @@ namespace osu.Game.Online.Chat
|
|||||||
|
|
||||||
//internal bool Joined;
|
//internal bool Joined;
|
||||||
|
|
||||||
|
public const int MAX_HISTORY = 100;
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Channel()
|
public Channel()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public event Action<Message[]> NewMessagesArrived;
|
||||||
|
|
||||||
|
public void AddNewMessages(params Message[] messages)
|
||||||
|
{
|
||||||
|
Messages.AddRange(messages);
|
||||||
|
purgeOldMessages();
|
||||||
|
|
||||||
|
NewMessagesArrived?.Invoke(messages);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void purgeOldMessages()
|
||||||
|
{
|
||||||
|
int messageCount = Messages.Count;
|
||||||
|
if (messageCount > MAX_HISTORY)
|
||||||
|
Messages.RemoveRange(0, messageCount - MAX_HISTORY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
81
osu.Game/Online/Chat/Display/ChannelDisplay.cs
Normal file
81
osu.Game/Online/Chat/Display/ChannelDisplay.cs
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
//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 System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using osu.Game.Online.Chat.Display.osu.Online.Social;
|
||||||
|
using OpenTK;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Chat.Display
|
||||||
|
{
|
||||||
|
public class ChannelDisplay : Container
|
||||||
|
{
|
||||||
|
private readonly Channel channel;
|
||||||
|
private FlowContainer flow;
|
||||||
|
|
||||||
|
public ChannelDisplay(Channel channel)
|
||||||
|
{
|
||||||
|
this.channel = channel;
|
||||||
|
newMessages(channel.Messages);
|
||||||
|
channel.NewMessagesArrived += newMessages;
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new SpriteText
|
||||||
|
{
|
||||||
|
Text = channel.Name,
|
||||||
|
TextSize = 50,
|
||||||
|
Alpha = 0.3f,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre
|
||||||
|
},
|
||||||
|
new ScrollContainer
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
flow = new FlowContainer
|
||||||
|
{
|
||||||
|
Direction = FlowDirection.VerticalOnly,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Spacing = new Vector2(1, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
channel.NewMessagesArrived -= newMessages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Load(BaseGame game)
|
||||||
|
{
|
||||||
|
base.Load(game);
|
||||||
|
newMessages(channel.Messages);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void newMessages(IEnumerable<Message> newMessages)
|
||||||
|
{
|
||||||
|
if (!IsLoaded) return;
|
||||||
|
|
||||||
|
var displayMessages = newMessages.Skip(Math.Max(0, newMessages.Count() - Channel.MAX_HISTORY));
|
||||||
|
|
||||||
|
//up to last Channel.MAX_HISTORY messages
|
||||||
|
foreach (Message m in displayMessages)
|
||||||
|
flow.Add(new ChatLine(m));
|
||||||
|
|
||||||
|
while (flow.Children.Count() > Channel.MAX_HISTORY)
|
||||||
|
flow.Remove(flow.Children.First());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,16 @@
|
|||||||
//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.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Drawables;
|
using osu.Framework.Graphics.Drawables;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
|
||||||
namespace osu.Game.Online.Chat.Display
|
namespace osu.Game.Online.Chat.Display
|
||||||
{
|
{
|
||||||
@ -14,48 +18,59 @@ namespace osu.Game.Online.Chat.Display
|
|||||||
{
|
{
|
||||||
public class ChatLine : AutoSizeContainer
|
public class ChatLine : AutoSizeContainer
|
||||||
{
|
{
|
||||||
private readonly Message msg;
|
public readonly Message Message;
|
||||||
|
|
||||||
public ChatLine(Message msg)
|
public ChatLine(Message message)
|
||||||
{
|
{
|
||||||
this.msg = msg;
|
this.Message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
const float padding = 200;
|
||||||
|
const float text_size = 20;
|
||||||
|
|
||||||
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
|
||||||
Add(new Box
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
new Container
|
||||||
Colour = Color4.Aqua,
|
{
|
||||||
Alpha = 0.2f
|
Size = new Vector2(padding, text_size),
|
||||||
});
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
Add(new SpriteText
|
new SpriteText
|
||||||
{
|
{
|
||||||
Text = msg.Timestamp.ToLocalTime().ToLongTimeString(),
|
Text = Message.Timestamp.ToLocalTime().ToLongTimeString(),
|
||||||
Colour = new Color4(128, 128, 128, 255)
|
TextSize = text_size,
|
||||||
});
|
Colour = new Color4(128, 128, 128, 255)
|
||||||
|
},
|
||||||
Add(new SpriteText
|
new SpriteText
|
||||||
{
|
{
|
||||||
Text = msg.User.Name,
|
Text = Message.User.Name,
|
||||||
Origin = Anchor.TopRight,
|
TextSize = text_size,
|
||||||
RelativePositionAxes = Axes.X,
|
Origin = Anchor.TopRight,
|
||||||
Position = new Vector2(0.14f,0),
|
Anchor = Anchor.TopRight,
|
||||||
});
|
}
|
||||||
|
}
|
||||||
Add(new SpriteText
|
},
|
||||||
{
|
new Container
|
||||||
Text = msg.Content,
|
{
|
||||||
RelativePositionAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Position = new Vector2(0.15f, 0),
|
Padding = new MarginPadding { Left = padding + 10 },
|
||||||
RelativeSizeAxes = Axes.X,
|
Children = new Drawable[]
|
||||||
Size = new Vector2(0.85f, 1),
|
{
|
||||||
});
|
new SpriteText
|
||||||
|
{
|
||||||
|
Text = Message.Content,
|
||||||
|
TextSize = text_size,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,10 @@ namespace osu.Game.Online.Chat
|
|||||||
public long Id;
|
public long Id;
|
||||||
|
|
||||||
[JsonProperty(@"user_id")]
|
[JsonProperty(@"user_id")]
|
||||||
public string UserId;
|
public int UserId;
|
||||||
|
|
||||||
[JsonProperty(@"channel_id")]
|
[JsonProperty(@"channel_id")]
|
||||||
public string ChannelId;
|
public int ChannelId;
|
||||||
|
|
||||||
[JsonProperty(@"timestamp")]
|
[JsonProperty(@"timestamp")]
|
||||||
public DateTime Timestamp;
|
public DateTime Timestamp;
|
||||||
|
@ -8,6 +8,7 @@ using osu.Game.Configuration;
|
|||||||
using osu.Game.GameModes.Menu;
|
using osu.Game.GameModes.Menu;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.GameModes;
|
using osu.Game.GameModes;
|
||||||
@ -15,12 +16,17 @@ using osu.Game.Graphics.Background;
|
|||||||
using osu.Game.GameModes.Play;
|
using osu.Game.GameModes.Play;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Framework;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Game.Input;
|
||||||
|
using OpenTK.Input;
|
||||||
|
|
||||||
namespace osu.Game
|
namespace osu.Game
|
||||||
{
|
{
|
||||||
public class OsuGame : OsuGameBase
|
public class OsuGame : OsuGameBase
|
||||||
{
|
{
|
||||||
public Toolbar Toolbar;
|
public Toolbar Toolbar;
|
||||||
|
public ChatConsole Chat;
|
||||||
public MainMenu MainMenu => intro?.ChildGameMode as MainMenu;
|
public MainMenu MainMenu => intro?.ChildGameMode as MainMenu;
|
||||||
private Intro intro;
|
private Intro intro;
|
||||||
|
|
||||||
@ -33,9 +39,9 @@ namespace osu.Game
|
|||||||
host.Size = new Vector2(Config.Get<int>(OsuConfig.Width), Config.Get<int>(OsuConfig.Height));
|
host.Size = new Vector2(Config.Get<int>(OsuConfig.Width), Config.Get<int>(OsuConfig.Height));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
//attach our bindables to the audio subsystem.
|
//attach our bindables to the audio subsystem.
|
||||||
Audio.Volume.Weld(Config.GetBindable<double>(OsuConfig.VolumeGlobal));
|
Audio.Volume.Weld(Config.GetBindable<double>(OsuConfig.VolumeGlobal));
|
||||||
@ -49,17 +55,26 @@ namespace osu.Game
|
|||||||
OnHome = delegate { MainMenu?.MakeCurrent(); },
|
OnHome = delegate { MainMenu?.MakeCurrent(); },
|
||||||
OnSettings = delegate { Options.PoppedOut = !Options.PoppedOut; },
|
OnSettings = delegate { Options.PoppedOut = !Options.PoppedOut; },
|
||||||
OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; },
|
OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; },
|
||||||
Alpha = 0.001f //fixes invalidation fuckup
|
Alpha = 0.001f,
|
||||||
},
|
},
|
||||||
|
Chat = new ChatConsole(API),
|
||||||
new VolumeControl
|
new VolumeControl
|
||||||
{
|
{
|
||||||
VolumeGlobal = Audio.Volume,
|
VolumeGlobal = Audio.Volume,
|
||||||
VolumeSample = Audio.VolumeSample,
|
VolumeSample = Audio.VolumeSample,
|
||||||
VolumeTrack = Audio.VolumeTrack
|
VolumeTrack = Audio.VolumeTrack
|
||||||
|
},
|
||||||
|
new GlobalHotkeys //exists because UserInputManager is at a level below us.
|
||||||
|
{
|
||||||
|
Handler = globalHotkeyPressed
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Toolbar.SetState(ToolbarState.Hidden, true);
|
Toolbar.State = ToolbarState.Hidden;
|
||||||
|
Toolbar.Flush();
|
||||||
|
|
||||||
|
Chat.State = ChatConsoleState.Hidden;
|
||||||
|
Chat.Flush();
|
||||||
|
|
||||||
intro.ModePushed += modeAdded;
|
intro.ModePushed += modeAdded;
|
||||||
intro.Exited += modeRemoved;
|
intro.Exited += modeRemoved;
|
||||||
@ -71,6 +86,18 @@ namespace osu.Game
|
|||||||
Cursor.Alpha = 0;
|
Cursor.Alpha = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool globalHotkeyPressed(InputState state, KeyDownEventArgs args)
|
||||||
|
{
|
||||||
|
switch (args.Key)
|
||||||
|
{
|
||||||
|
case Key.F8:
|
||||||
|
Chat.State = Chat.State == ChatConsoleState.Hidden ? ChatConsoleState.Visible : ChatConsoleState.Hidden;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.OnKeyDown(state, args);
|
||||||
|
}
|
||||||
|
|
||||||
public Action<GameMode> ModeChanged;
|
public Action<GameMode> ModeChanged;
|
||||||
|
|
||||||
private void modeChanged(GameMode newMode)
|
private void modeChanged(GameMode newMode)
|
||||||
@ -82,11 +109,12 @@ namespace osu.Game
|
|||||||
//central game mode change logic.
|
//central game mode change logic.
|
||||||
if (newMode is Player || newMode is Intro)
|
if (newMode is Player || newMode is Intro)
|
||||||
{
|
{
|
||||||
Toolbar.SetState(ToolbarState.Hidden);
|
Toolbar.State = ToolbarState.Hidden;
|
||||||
|
Chat.State = ChatConsoleState.Hidden;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Toolbar.SetState(ToolbarState.Visible);
|
Toolbar.State = ToolbarState.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cursor.FadeIn(100);
|
Cursor.FadeIn(100);
|
||||||
@ -101,7 +129,10 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
if (!intro.DidLoadMenu || intro.ChildGameMode != null)
|
if (!intro.DidLoadMenu || intro.ChildGameMode != null)
|
||||||
{
|
{
|
||||||
intro.MakeCurrent();
|
Scheduler.Add(delegate
|
||||||
|
{
|
||||||
|
intro.MakeCurrent();
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using osu.Framework.GameModes;
|
using osu.Framework;
|
||||||
|
using osu.Framework.GameModes;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
@ -12,7 +13,7 @@ using osu.Game.Overlays;
|
|||||||
|
|
||||||
namespace osu.Game
|
namespace osu.Game
|
||||||
{
|
{
|
||||||
public class OsuGameBase : Framework.Game
|
public class OsuGameBase : BaseGame
|
||||||
{
|
{
|
||||||
internal OsuConfigManager Config = new OsuConfigManager();
|
internal OsuConfigManager Config = new OsuConfigManager();
|
||||||
|
|
||||||
@ -27,9 +28,9 @@ namespace osu.Game
|
|||||||
|
|
||||||
public CursorContainer Cursor;
|
public CursorContainer Cursor;
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
//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.
|
||||||
Fonts = new TextureStore() { ScaleAdjust = 0.01f };
|
Fonts = new TextureStore() { ScaleAdjust = 0.01f };
|
||||||
|
175
osu.Game/Overlays/ChatConsole.cs
Normal file
175
osu.Game/Overlays/ChatConsole.cs
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
//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 System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Drawables;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using osu.Framework.Threading;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Online.API.Requests;
|
||||||
|
using osu.Game.Online.Chat;
|
||||||
|
using osu.Game.Online.Chat.Display;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using OpenTK.Input;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays
|
||||||
|
{
|
||||||
|
public class ChatConsole : Container, IStateful<ChatConsoleState>
|
||||||
|
{
|
||||||
|
private ChannelDisplay channelDisplay;
|
||||||
|
|
||||||
|
private ScheduledDelegate messageRequest;
|
||||||
|
|
||||||
|
private Container content;
|
||||||
|
|
||||||
|
protected override Container Content => content;
|
||||||
|
|
||||||
|
private APIAccess api;
|
||||||
|
|
||||||
|
public ChatConsole(APIAccess api)
|
||||||
|
{
|
||||||
|
this.api = api;
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
Size = new Vector2(1, 300);
|
||||||
|
Anchor = Anchor.BottomLeft;
|
||||||
|
Origin = Anchor.BottomLeft;
|
||||||
|
|
||||||
|
AddInternal(new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Depth = float.MinValue,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = new Color4(0.1f, 0.1f, 0.1f, 0.4f),
|
||||||
|
},
|
||||||
|
content = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Load(BaseGame game)
|
||||||
|
{
|
||||||
|
base.Load(game);
|
||||||
|
initializeChannels();
|
||||||
|
}
|
||||||
|
|
||||||
|
private long? lastMessageId;
|
||||||
|
|
||||||
|
List<Channel> careChannels;
|
||||||
|
|
||||||
|
private void initializeChannels()
|
||||||
|
{
|
||||||
|
careChannels = new List<Channel>();
|
||||||
|
|
||||||
|
//if (api.State != APIAccess.APIState.Online)
|
||||||
|
// return;
|
||||||
|
|
||||||
|
SpriteText loading;
|
||||||
|
Add(loading = new SpriteText
|
||||||
|
{
|
||||||
|
Text = @"Loading available channels...",
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
TextSize = 40,
|
||||||
|
});
|
||||||
|
|
||||||
|
messageRequest?.Cancel();
|
||||||
|
|
||||||
|
ListChannelsRequest req = new ListChannelsRequest();
|
||||||
|
req.Success += delegate (List<Channel> channels)
|
||||||
|
{
|
||||||
|
Scheduler.Add(delegate
|
||||||
|
{
|
||||||
|
loading.FadeOut(100);
|
||||||
|
addChannel(channels.Find(c => c.Name == @"#osu"));
|
||||||
|
});
|
||||||
|
|
||||||
|
//addChannel(channels.Find(c => c.Name == @"#lobby"));
|
||||||
|
//addChannel(channels.Find(c => c.Name == @"#english"));
|
||||||
|
|
||||||
|
messageRequest = Scheduler.AddDelayed(() => FetchNewMessages(api), 1000, true);
|
||||||
|
};
|
||||||
|
api.Queue(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addChannel(Channel channel)
|
||||||
|
{
|
||||||
|
Add(channelDisplay = new ChannelDisplay(channel));
|
||||||
|
careChannels.Add(channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
GetMessagesRequest fetchReq;
|
||||||
|
|
||||||
|
public void FetchNewMessages(APIAccess api)
|
||||||
|
{
|
||||||
|
if (fetchReq != null) return;
|
||||||
|
|
||||||
|
fetchReq = new GetMessagesRequest(careChannels, lastMessageId);
|
||||||
|
fetchReq.Success += delegate (List<Message> messages)
|
||||||
|
{
|
||||||
|
foreach (Message m in messages)
|
||||||
|
{
|
||||||
|
careChannels.Find(c => c.Id == m.ChannelId).AddNewMessages(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
lastMessageId = messages.LastOrDefault()?.Id ?? lastMessageId;
|
||||||
|
|
||||||
|
Debug.Write("success!");
|
||||||
|
fetchReq = null;
|
||||||
|
};
|
||||||
|
fetchReq.Failure += delegate
|
||||||
|
{
|
||||||
|
Debug.Write("failure!");
|
||||||
|
fetchReq = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
api.Queue(fetchReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ChatConsoleState state;
|
||||||
|
|
||||||
|
public ChatConsoleState State
|
||||||
|
{
|
||||||
|
get { return state; }
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
state = value;
|
||||||
|
|
||||||
|
const int transition_length = 500;
|
||||||
|
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case ChatConsoleState.Hidden:
|
||||||
|
MoveToY(-Size.Y, transition_length, EasingTypes.InQuint);
|
||||||
|
FadeOut(transition_length, EasingTypes.InQuint);
|
||||||
|
break;
|
||||||
|
case ChatConsoleState.Visible:
|
||||||
|
MoveToY(0, transition_length, EasingTypes.OutQuint);
|
||||||
|
FadeIn(transition_length, EasingTypes.OutQuint);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ChatConsoleState
|
||||||
|
{
|
||||||
|
Visible,
|
||||||
|
Hidden,
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ using OpenTK;
|
|||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
@ -16,9 +17,9 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
const float width = 300;
|
const float width = 300;
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
Depth = float.MaxValue;
|
Depth = float.MaxValue;
|
||||||
RelativeSizeAxes = Axes.Y;
|
RelativeSizeAxes = Axes.Y;
|
||||||
|
@ -12,10 +12,11 @@ using System;
|
|||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.GameModes.Play;
|
using osu.Game.GameModes.Play;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public class Toolbar : Container
|
public class Toolbar : Container, IStateful<ToolbarState>
|
||||||
{
|
{
|
||||||
const float height = 50;
|
const float height = 50;
|
||||||
|
|
||||||
@ -25,26 +26,34 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private ToolbarModeSelector modeSelector;
|
private ToolbarModeSelector modeSelector;
|
||||||
|
|
||||||
public void SetState(ToolbarState state, bool instant = false)
|
private ToolbarState state;
|
||||||
{
|
|
||||||
int time = instant ? 0 : 200;
|
|
||||||
|
|
||||||
switch (state)
|
public ToolbarState State
|
||||||
|
{
|
||||||
|
get { return state; }
|
||||||
|
set
|
||||||
{
|
{
|
||||||
case ToolbarState.Hidden:
|
state = value;
|
||||||
MoveToY(-Size.Y, time, EasingTypes.InQuint);
|
|
||||||
FadeOut(time);
|
const int transition_time = 200;
|
||||||
break;
|
|
||||||
case ToolbarState.Visible:
|
switch (state)
|
||||||
MoveToY(0, time, EasingTypes.OutQuint);
|
{
|
||||||
FadeIn(time);
|
case ToolbarState.Hidden:
|
||||||
break;
|
MoveToY(-Size.Y, transition_time, EasingTypes.InQuint);
|
||||||
|
FadeOut(transition_time, EasingTypes.InQuint);
|
||||||
|
break;
|
||||||
|
case ToolbarState.Visible:
|
||||||
|
MoveToY(0, transition_time, EasingTypes.OutQuint);
|
||||||
|
FadeIn(transition_time, EasingTypes.OutQuint);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Size = new Vector2(1, height);
|
Size = new Vector2(1, height);
|
||||||
@ -97,7 +106,7 @@ namespace osu.Game.Overlays
|
|||||||
new ToolbarButton
|
new ToolbarButton
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.user,
|
Icon = FontAwesome.user,
|
||||||
Text = ((OsuGame)Game).Config.Get<string>(OsuConfig.Username)
|
Text = ((OsuGame)game).Config.Get<string>(OsuConfig.Username)
|
||||||
},
|
},
|
||||||
new ToolbarButton
|
new ToolbarButton
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,8 @@ using osu.Framework.Input;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
@ -29,7 +31,6 @@ namespace osu.Game.Overlays
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
DrawableText.Text = value;
|
DrawableText.Text = value;
|
||||||
paddingIcon.Alpha = string.IsNullOrEmpty(value) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,110 +56,73 @@ namespace osu.Game.Overlays
|
|||||||
protected TextAwesome DrawableIcon;
|
protected TextAwesome DrawableIcon;
|
||||||
protected SpriteText DrawableText;
|
protected SpriteText DrawableText;
|
||||||
protected Box HoverBackground;
|
protected Box HoverBackground;
|
||||||
private Drawable paddingLeft;
|
|
||||||
private Drawable paddingRight;
|
|
||||||
private Drawable paddingIcon;
|
|
||||||
private FlowContainer tooltipContainer;
|
private FlowContainer tooltipContainer;
|
||||||
private SpriteText tooltip1;
|
private SpriteText tooltip1;
|
||||||
private SpriteText tooltip2;
|
private SpriteText tooltip2;
|
||||||
|
|
||||||
public new float Padding
|
|
||||||
{
|
|
||||||
get { return paddingLeft.Size.X; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
paddingLeft.Size = new Vector2(value, 1);
|
|
||||||
paddingRight.Size = new Vector2(value, 1);
|
|
||||||
tooltipContainer.Position = new Vector2(value, tooltipContainer.Position.Y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ToolbarButton()
|
public ToolbarButton()
|
||||||
{
|
{
|
||||||
HoverBackground = new Box
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
HoverBackground = new Box
|
||||||
Additive = true,
|
|
||||||
Colour = new Color4(60, 60, 60, 255),
|
|
||||||
Alpha = 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
DrawableIcon = new TextAwesome
|
|
||||||
{
|
|
||||||
Anchor = Anchor.CentreLeft,
|
|
||||||
Origin = Anchor.CentreLeft,
|
|
||||||
};
|
|
||||||
|
|
||||||
DrawableText = new SpriteText
|
|
||||||
{
|
|
||||||
Anchor = Anchor.CentreLeft,
|
|
||||||
Origin = Anchor.CentreLeft,
|
|
||||||
};
|
|
||||||
|
|
||||||
tooltipContainer = new FlowContainer
|
|
||||||
{
|
|
||||||
Direction = FlowDirection.VerticalOnly,
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
Position = new Vector2(0, -5),
|
|
||||||
Alpha = 0,
|
|
||||||
Children = new[]
|
|
||||||
{
|
{
|
||||||
tooltip1 = new SpriteText()
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Additive = true,
|
||||||
|
Colour = new Color4(60, 60, 60, 255),
|
||||||
|
Alpha = 0,
|
||||||
|
},
|
||||||
|
new FlowContainer
|
||||||
|
{
|
||||||
|
Direction = FlowDirection.HorizontalOnly,
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
Padding = new MarginPadding { Left = 5, Right = 5 },
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
TextSize = 22,
|
DrawableIcon = new TextAwesome
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
},
|
||||||
|
DrawableText = new SpriteText
|
||||||
|
{
|
||||||
|
Margin = new MarginPadding { Left = 5 },
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
tooltip2 = new SpriteText
|
},
|
||||||
|
tooltipContainer = new FlowContainer
|
||||||
|
{
|
||||||
|
Direction = FlowDirection.VerticalOnly,
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Position = new Vector2(5, -5),
|
||||||
|
Alpha = 0,
|
||||||
|
Children = new[]
|
||||||
{
|
{
|
||||||
TextSize = 15
|
tooltip1 = new SpriteText()
|
||||||
|
{
|
||||||
|
TextSize = 22,
|
||||||
|
},
|
||||||
|
tooltip2 = new SpriteText
|
||||||
|
{
|
||||||
|
TextSize = 15
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
paddingLeft = new Container { RelativeSizeAxes = Axes.Y };
|
|
||||||
paddingRight = new Container { RelativeSizeAxes = Axes.Y };
|
|
||||||
paddingIcon = new Container
|
|
||||||
{
|
|
||||||
Size = new Vector2(5, 0),
|
|
||||||
Alpha = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
Padding = 10;
|
|
||||||
RelativeSizeAxes = Axes.Y;
|
RelativeSizeAxes = Axes.Y;
|
||||||
Size = new Vector2(WIDTH, 1);
|
Size = new Vector2(WIDTH, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
|
||||||
{
|
|
||||||
base.Load();
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
HoverBackground,
|
|
||||||
new FlowContainer
|
|
||||||
{
|
|
||||||
Direction = FlowDirection.HorizontalOnly,
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Origin = Anchor.TopCentre,
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
paddingLeft,
|
|
||||||
DrawableIcon,
|
|
||||||
paddingIcon,
|
|
||||||
DrawableText,
|
|
||||||
paddingRight
|
|
||||||
},
|
|
||||||
},
|
|
||||||
tooltipContainer
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
//todo: find a way to avoid using this (autosize needs to be able to ignore certain drawables.. in this case the tooltip)
|
//todo: find a way to avoid using this (autosize needs to be able to ignore certain drawables.. in this case the tooltip)
|
||||||
Size = new Vector2(WIDTH + DrawableText.Size.X, 1);
|
Size = new Vector2(WIDTH + (DrawableText.IsVisible ? DrawableText.Size.X : 0), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(InputState state)
|
protected override bool OnClick(InputState state)
|
||||||
|
@ -5,6 +5,7 @@ using osu.Framework.Extensions;
|
|||||||
using osu.Game.GameModes.Play;
|
using osu.Game.GameModes.Play;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
@ -42,9 +43,9 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
DrawableIcon.TextSize *= 1.4f;
|
DrawableIcon.TextSize *= 1.4f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Transformations;
|
|||||||
using osu.Game.GameModes.Play;
|
using osu.Game.GameModes.Play;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
@ -29,9 +30,9 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.Y;
|
RelativeSizeAxes = Axes.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Drawables;
|
using osu.Framework.Graphics.Drawables;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game
|
namespace osu.Game
|
||||||
{
|
{
|
||||||
@ -24,9 +25,9 @@ namespace osu.Game
|
|||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
meterContainer = new Container {
|
meterContainer = new Container {
|
||||||
|
@ -76,9 +76,12 @@
|
|||||||
<Compile Include="GameModes\Charts\ChartInfo.cs" />
|
<Compile Include="GameModes\Charts\ChartInfo.cs" />
|
||||||
<Compile Include="GameModes\Edit\Editor.cs" />
|
<Compile Include="GameModes\Edit\Editor.cs" />
|
||||||
<Compile Include="GameModes\GameModeWhiteBox.cs" />
|
<Compile Include="GameModes\GameModeWhiteBox.cs" />
|
||||||
|
<Compile Include="GameModes\Menu\Button.cs" />
|
||||||
|
<Compile Include="GameModes\Menu\FlowContainerWithOrigin.cs" />
|
||||||
<Compile Include="GameModes\Menu\Intro.cs" />
|
<Compile Include="GameModes\Menu\Intro.cs" />
|
||||||
<Compile Include="GameModes\Menu\ButtonSystem.cs" />
|
<Compile Include="GameModes\Menu\ButtonSystem.cs" />
|
||||||
<Compile Include="GameModes\Menu\MainMenu.cs" />
|
<Compile Include="GameModes\Menu\MainMenu.cs" />
|
||||||
|
<Compile Include="GameModes\Menu\MenuVisualisation.cs" />
|
||||||
<Compile Include="GameModes\Menu\OsuLogo.cs" />
|
<Compile Include="GameModes\Menu\OsuLogo.cs" />
|
||||||
<Compile Include="GameModes\Multiplayer\Lobby.cs" />
|
<Compile Include="GameModes\Multiplayer\Lobby.cs" />
|
||||||
<Compile Include="GameModes\Multiplayer\Match.cs" />
|
<Compile Include="GameModes\Multiplayer\Match.cs" />
|
||||||
@ -103,15 +106,25 @@
|
|||||||
<Compile Include="GameModes\Play\Taiko\TaikoHitRenderer.cs" />
|
<Compile Include="GameModes\Play\Taiko\TaikoHitRenderer.cs" />
|
||||||
<Compile Include="GameModes\Play\Taiko\TaikoPlayfield.cs" />
|
<Compile Include="GameModes\Play\Taiko\TaikoPlayfield.cs" />
|
||||||
<Compile Include="GameModes\Edit\EditSongSelect.cs" />
|
<Compile Include="GameModes\Edit\EditSongSelect.cs" />
|
||||||
|
<Compile Include="Input\GlobalHotkeys.cs" />
|
||||||
<Compile Include="Graphics\Background\Background.cs" />
|
<Compile Include="Graphics\Background\Background.cs" />
|
||||||
<Compile Include="Graphics\Containers\ParallaxContainer.cs" />
|
<Compile Include="Graphics\Containers\ParallaxContainer.cs" />
|
||||||
<Compile Include="Graphics\Cursor\OsuCursorContainer.cs" />
|
<Compile Include="Graphics\Cursor\OsuCursorContainer.cs" />
|
||||||
<Compile Include="Graphics\Processing\RatioAdjust.cs" />
|
<Compile Include="Graphics\Processing\RatioAdjust.cs" />
|
||||||
<Compile Include="Graphics\TextAwesome.cs" />
|
<Compile Include="Graphics\TextAwesome.cs" />
|
||||||
|
<Compile Include="Graphics\UserInterface\AlternativeComboCounter.cs" />
|
||||||
|
<Compile Include="Graphics\UserInterface\RollingCounter.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\KeyCounter.cs" />
|
<Compile Include="Graphics\UserInterface\KeyCounter.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\KeyCounterKeyboard.cs" />
|
<Compile Include="Graphics\UserInterface\KeyCounterKeyboard.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\KeyCounterCollection.cs" />
|
<Compile Include="Graphics\UserInterface\KeyCounterCollection.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\KeyCounterMouse.cs" />
|
<Compile Include="Graphics\UserInterface\KeyCounterMouse.cs" />
|
||||||
|
<Compile Include="Graphics\UserInterface\AccuracyCounter.cs" />
|
||||||
|
<Compile Include="Graphics\UserInterface\NumericRollingCounter.cs" />
|
||||||
|
<Compile Include="Graphics\UserInterface\ScoreCounter.cs" />
|
||||||
|
<Compile Include="Graphics\UserInterface\CatchComboCounter.cs" />
|
||||||
|
<Compile Include="Graphics\UserInterface\StandardComboCounter.cs" />
|
||||||
|
<Compile Include="Graphics\UserInterface\StarCounter.cs" />
|
||||||
|
<Compile Include="Graphics\UserInterface\ULongCounter.cs" />
|
||||||
<Compile Include="Online\API\APIAccess.cs" />
|
<Compile Include="Online\API\APIAccess.cs" />
|
||||||
<Compile Include="Online\API\APIRequest.cs" />
|
<Compile Include="Online\API\APIRequest.cs" />
|
||||||
<Compile Include="Online\API\OAuth.cs" />
|
<Compile Include="Online\API\OAuth.cs" />
|
||||||
@ -120,11 +133,13 @@
|
|||||||
<Compile Include="Online\API\SecurePassword.cs" />
|
<Compile Include="Online\API\SecurePassword.cs" />
|
||||||
<Compile Include="Online\API\Requests\ListChannels.cs" />
|
<Compile Include="Online\API\Requests\ListChannels.cs" />
|
||||||
<Compile Include="Online\Chat\Channel.cs" />
|
<Compile Include="Online\Chat\Channel.cs" />
|
||||||
|
<Compile Include="Online\Chat\Display\ChannelDisplay.cs" />
|
||||||
<Compile Include="Online\Chat\Display\ChatLine.cs" />
|
<Compile Include="Online\Chat\Display\ChatLine.cs" />
|
||||||
<Compile Include="Online\Chat\Message.cs" />
|
<Compile Include="Online\Chat\Message.cs" />
|
||||||
<Compile Include="Online\User.cs" />
|
<Compile Include="Online\User.cs" />
|
||||||
<Compile Include="OsuGame.cs" />
|
<Compile Include="OsuGame.cs" />
|
||||||
<Compile Include="OsuGameBase.cs" />
|
<Compile Include="OsuGameBase.cs" />
|
||||||
|
<Compile Include="Overlays\ChatConsole.cs" />
|
||||||
<Compile Include="Overlays\Options.cs" />
|
<Compile Include="Overlays\Options.cs" />
|
||||||
<Compile Include="Overlays\Toolbar.cs" />
|
<Compile Include="Overlays\Toolbar.cs" />
|
||||||
<Compile Include="Overlays\ToolbarButton.cs" />
|
<Compile Include="Overlays\ToolbarButton.cs" />
|
||||||
|
36
osu.sln
36
osu.sln
@ -22,31 +22,38 @@ EndProject
|
|||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Deploy|Any CPU = Deploy|Any CPU
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Release|Any CPU.Build.0 = Release|Any CPU
|
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Release|Any CPU.Build.0 = Release|Any CPU
|
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Release|Any CPU.Build.0 = Release|Any CPU
|
{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Release|Any CPU.Build.0 = Release|Any CPU
|
{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{65DC628F-A640-4111-AB35-3A5652BC1E17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{65DC628F-A640-4111-AB35-3A5652BC1E17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{65DC628F-A640-4111-AB35-3A5652BC1E17}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{65DC628F-A640-4111-AB35-3A5652BC1E17}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{65DC628F-A640-4111-AB35-3A5652BC1E17}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{65DC628F-A640-4111-AB35-3A5652BC1E17}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{65DC628F-A640-4111-AB35-3A5652BC1E17}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{65DC628F-A640-4111-AB35-3A5652BC1E17}.Release|Any CPU.Build.0 = Release|Any CPU
|
{65DC628F-A640-4111-AB35-3A5652BC1E17}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{69051C69-12AE-4E7D-A3E6-460D2E282312}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{69051C69-12AE-4E7D-A3E6-460D2E282312}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{69051C69-12AE-4E7D-A3E6-460D2E282312}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{69051C69-12AE-4E7D-A3E6-460D2E282312}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{69051C69-12AE-4E7D-A3E6-460D2E282312}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{69051C69-12AE-4E7D-A3E6-460D2E282312}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{69051C69-12AE-4E7D-A3E6-460D2E282312}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{69051C69-12AE-4E7D-A3E6-460D2E282312}.Release|Any CPU.Build.0 = Release|Any CPU
|
{69051C69-12AE-4E7D-A3E6-460D2E282312}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
@ -61,4 +68,33 @@ Global
|
|||||||
{65DC628F-A640-4111-AB35-3A5652BC1E17} = {7A75DFA2-DE65-4458-98AF-26AF96FFD6DC}
|
{65DC628F-A640-4111-AB35-3A5652BC1E17} = {7A75DFA2-DE65-4458-98AF-26AF96FFD6DC}
|
||||||
{69051C69-12AE-4E7D-A3E6-460D2E282312} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3}
|
{69051C69-12AE-4E7D-A3E6-460D2E282312} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(MonoDevelopProperties) = preSolution
|
||||||
|
Policies = $0
|
||||||
|
$0.TextStylePolicy = $1
|
||||||
|
$1.EolMarker = Windows
|
||||||
|
$1.inheritsSet = VisualStudio
|
||||||
|
$1.inheritsScope = text/plain
|
||||||
|
$1.scope = text/x-csharp
|
||||||
|
$0.CSharpFormattingPolicy = $2
|
||||||
|
$2.IndentSwitchSection = True
|
||||||
|
$2.NewLinesForBracesInProperties = True
|
||||||
|
$2.NewLinesForBracesInAccessors = True
|
||||||
|
$2.NewLinesForBracesInAnonymousMethods = True
|
||||||
|
$2.NewLinesForBracesInControlBlocks = True
|
||||||
|
$2.NewLinesForBracesInAnonymousTypes = True
|
||||||
|
$2.NewLinesForBracesInObjectCollectionArrayInitializers = True
|
||||||
|
$2.NewLinesForBracesInLambdaExpressionBody = True
|
||||||
|
$2.NewLineForElse = True
|
||||||
|
$2.NewLineForCatch = True
|
||||||
|
$2.NewLineForFinally = True
|
||||||
|
$2.NewLineForMembersInObjectInit = True
|
||||||
|
$2.NewLineForMembersInAnonymousTypes = True
|
||||||
|
$2.NewLineForClausesInQuery = True
|
||||||
|
$2.SpacingAfterMethodDeclarationName = False
|
||||||
|
$2.SpaceAfterMethodCallName = False
|
||||||
|
$2.SpaceBeforeOpenSquareBracket = False
|
||||||
|
$2.inheritsSet = Mono
|
||||||
|
$2.inheritsScope = text/x-csharp
|
||||||
|
$2.scope = text/x-csharp
|
||||||
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
Loading…
Reference in New Issue
Block a user