1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-19 16:52:56 +08:00
osu-lazer/osu.Desktop.Tests/Visual/TestCaseDrawableRoom.cs

133 lines
5.8 KiB
C#
Raw Normal View History

2017-05-22 11:07:15 +08:00
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2017-06-24 16:05:48 +08:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
2017-07-26 12:22:46 +08:00
using osu.Game.Beatmaps;
using osu.Game.Online.Multiplayer;
2017-07-26 12:22:46 +08:00
using osu.Game.Rulesets;
using osu.Game.Screens.Multiplayer;
using osu.Game.Users;
2017-05-22 11:07:15 +08:00
namespace osu.Desktop.Tests.Visual
2017-05-22 11:07:15 +08:00
{
internal class TestCaseDrawableRoom : OsuTestCase
2017-05-22 11:07:15 +08:00
{
public override string Description => @"Select your favourite room";
private RulesetStore rulesets;
2017-06-24 16:05:48 +08:00
protected override void LoadComplete()
2017-05-22 11:07:15 +08:00
{
base.LoadComplete();
2017-05-22 11:07:15 +08:00
2017-05-23 00:05:18 +08:00
DrawableRoom first;
2017-05-22 11:07:15 +08:00
Add(new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Y,
2017-06-24 16:05:48 +08:00
Width = 580f,
2017-05-22 11:07:15 +08:00
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
2017-06-24 16:05:48 +08:00
first = new DrawableRoom(new Room
{
Name = { Value = @"Great Room Right Here" },
Host = { Value = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" } } },
Status = { Value = new RoomStatusOpen() },
Type = { Value = new GameTypeTeamVersus() },
Beatmap =
{
Value = new BeatmapInfo
{
StarDifficulty = 4.65,
Ruleset = rulesets.GetRuleset(3),
Metadata = new BeatmapMetadata
{
Title = @"Critical Crystal",
Artist = @"Seiryu",
},
2017-07-13 12:06:46 +08:00
BeatmapSet = new BeatmapSetInfo
2017-06-24 16:05:48 +08:00
{
2017-07-13 12:06:46 +08:00
OnlineInfo = new BeatmapSetOnlineInfo
{
Covers = new BeatmapSetOnlineCovers
{
Cover = @"https://assets.ppy.sh//beatmaps/376340/covers/cover.jpg?1456478455",
},
},
2017-06-24 16:05:48 +08:00
},
},
},
Participants =
{
Value = new[]
{
new User { GlobalRank = 1355 },
new User { GlobalRank = 8756 },
},
},
}),
new DrawableRoom(new Room
{
Name = { Value = @"Relax It's The Weekend" },
Host = { Value = new User { Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" } } },
Status = { Value = new RoomStatusPlaying() },
Type = { Value = new GameTypeTagTeam() },
Beatmap =
{
Value = new BeatmapInfo
{
StarDifficulty = 1.96,
Ruleset = rulesets.GetRuleset(0),
Metadata = new BeatmapMetadata
{
Title = @"Serendipity",
Artist = @"ZAQ",
},
2017-07-13 12:06:46 +08:00
BeatmapSet = new BeatmapSetInfo
2017-06-24 16:05:48 +08:00
{
2017-07-13 12:06:46 +08:00
OnlineInfo = new BeatmapSetOnlineInfo
{
Covers = new BeatmapSetOnlineCovers
{
Cover = @"https://assets.ppy.sh//beatmaps/526839/covers/cover.jpg?1493815706",
},
},
2017-06-24 16:05:48 +08:00
},
},
},
Participants =
{
Value = new[]
{
new User { GlobalRank = 578975 },
new User { GlobalRank = 24554 },
},
},
}),
2017-05-22 11:07:15 +08:00
}
});
2017-06-24 16:05:48 +08:00
AddStep(@"change title", () => first.Room.Name.Value = @"I Changed Name");
AddStep(@"change host", () => first.Room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } });
AddStep(@"change status", () => first.Room.Status.Value = new RoomStatusPlaying());
AddStep(@"change type", () => first.Room.Type.Value = new GameTypeVersus());
AddStep(@"change beatmap", () => first.Room.Beatmap.Value = null);
AddStep(@"change participants", () => first.Room.Participants.Value = new[]
2017-05-22 12:01:55 +08:00
{
2017-06-24 16:05:48 +08:00
new User { GlobalRank = 1254 },
new User { GlobalRank = 123189 },
2017-05-22 12:01:55 +08:00
});
2017-06-24 16:05:48 +08:00
}
2017-05-22 12:01:55 +08:00
2017-06-24 16:05:48 +08:00
[BackgroundDependencyLoader]
private void load(RulesetStore rulesets)
2017-06-24 16:05:48 +08:00
{
this.rulesets = rulesets;
2017-05-22 11:07:15 +08:00
}
}
}