mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 03:22:54 +08:00
Change ready button to "Start" and make it enter player
This commit is contained in:
parent
1ac615b490
commit
bf3f5ab685
@ -85,7 +85,12 @@ namespace osu.Game.Screens.Multi
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
breadcrumbs.Current.ValueChanged += s => screenType.Text = ((IMultiplayerScreen)s).ShortTitle.ToLowerInvariant();
|
breadcrumbs.Current.ValueChanged += s =>
|
||||||
|
{
|
||||||
|
if (s is IMultiplayerScreen mpScreen)
|
||||||
|
screenType.Text = mpScreen.ShortTitle.ToLowerInvariant();
|
||||||
|
};
|
||||||
|
|
||||||
breadcrumbs.Current.TriggerChange();
|
breadcrumbs.Current.TriggerChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Overlays.SearchableList;
|
using osu.Game.Overlays.SearchableList;
|
||||||
using osu.Game.Screens.Multi.Components;
|
using osu.Game.Screens.Multi.Components;
|
||||||
@ -23,13 +22,12 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
{
|
{
|
||||||
public const float HEIGHT = 128;
|
public const float HEIGHT = 128;
|
||||||
|
|
||||||
|
public Action OnStart;
|
||||||
|
|
||||||
private readonly OsuSpriteText availabilityStatus;
|
private readonly OsuSpriteText availabilityStatus;
|
||||||
private readonly ReadyButton readyButton;
|
|
||||||
|
|
||||||
private OsuColour colours;
|
private OsuColour colours;
|
||||||
|
|
||||||
public Bindable<bool> Ready => readyButton.Ready;
|
|
||||||
|
|
||||||
public readonly Bindable<string> Name = new Bindable<string>();
|
public readonly Bindable<string> Name = new Bindable<string>();
|
||||||
public readonly Bindable<RoomAvailability> Availability = new Bindable<RoomAvailability>();
|
public readonly Bindable<RoomAvailability> Availability = new Bindable<RoomAvailability>();
|
||||||
public readonly Bindable<RoomStatus> Status = new Bindable<RoomStatus>();
|
public readonly Bindable<RoomStatus> Status = new Bindable<RoomStatus>();
|
||||||
@ -81,13 +79,14 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
readyButton = new ReadyButton
|
new ReadyButton
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Size = new Vector2(200, 1),
|
Size = new Vector2(200, 1),
|
||||||
Padding = new MarginPadding { Vertical = 10 },
|
Padding = new MarginPadding { Vertical = 10 },
|
||||||
|
Action = () => OnStart?.Invoke()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -125,57 +124,5 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
availabilityStatus.Text = $"{Availability.Value.GetDescription()}, {Status.Value.Message}";
|
availabilityStatus.Text = $"{Availability.Value.GetDescription()}, {Status.Value.Message}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ReadyButton : TriangleButton
|
|
||||||
{
|
|
||||||
public readonly Bindable<bool> Ready = new Bindable<bool>();
|
|
||||||
|
|
||||||
protected override SpriteText CreateText() => new OsuSpriteText
|
|
||||||
{
|
|
||||||
Depth = -1,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Font = @"Exo2.0-Light",
|
|
||||||
TextSize = 30,
|
|
||||||
};
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
BackgroundColour = OsuColour.FromHex(@"1187aa");
|
|
||||||
Triangles.ColourLight = OsuColour.FromHex(@"277b9c");
|
|
||||||
Triangles.ColourDark = OsuColour.FromHex(@"1f6682");
|
|
||||||
Triangles.TriangleScale = 1.5f;
|
|
||||||
|
|
||||||
Container active;
|
|
||||||
Add(active = new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Alpha = 0f,
|
|
||||||
Child = new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Alpha = 0.15f,
|
|
||||||
Blending = BlendingMode.Additive,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
Action = () => Ready.Value = !Ready.Value;
|
|
||||||
|
|
||||||
Ready.BindValueChanged(value =>
|
|
||||||
{
|
|
||||||
if (value)
|
|
||||||
{
|
|
||||||
Text = "Not Ready";
|
|
||||||
active.FadeIn(200);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Text = "Ready";
|
|
||||||
active.FadeOut(200);
|
|
||||||
}
|
|
||||||
}, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
50
osu.Game/Screens/Multi/Match/Components/ReadyButton.cs
Normal file
50
osu.Game/Screens/Multi/Match/Components/ReadyButton.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Multi.Match.Components
|
||||||
|
{
|
||||||
|
public class ReadyButton : TriangleButton
|
||||||
|
{
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
BackgroundColour = OsuColour.FromHex(@"1187aa");
|
||||||
|
|
||||||
|
Triangles.ColourLight = OsuColour.FromHex(@"277b9c");
|
||||||
|
Triangles.ColourDark = OsuColour.FromHex(@"1f6682");
|
||||||
|
Triangles.TriangleScale = 1.5f;
|
||||||
|
|
||||||
|
Text = "Start";
|
||||||
|
|
||||||
|
Add(new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Alpha = 1f,
|
||||||
|
Child = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Alpha = 0.15f,
|
||||||
|
Blending = BlendingMode.Additive,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override SpriteText CreateText() => new OsuSpriteText
|
||||||
|
{
|
||||||
|
Depth = -1,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Font = @"Exo2.0-Light",
|
||||||
|
TextSize = 30,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,8 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Screens.Multi.Match.Components;
|
using osu.Game.Screens.Multi.Match.Components;
|
||||||
|
using osu.Game.Screens.Multi.Play;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
|
|
||||||
@ -36,6 +38,9 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
[Cached]
|
[Cached]
|
||||||
private readonly Room room;
|
private readonly Room room;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Multiplayer multiplayer { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmapManager { get; set; }
|
private BeatmapManager beatmapManager { get; set; }
|
||||||
|
|
||||||
@ -67,6 +72,7 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
info = new Info
|
info = new Info
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Top = Components.Header.HEIGHT },
|
Margin = new MarginPadding { Top = Components.Header.HEIGHT },
|
||||||
|
OnStart = onStart
|
||||||
},
|
},
|
||||||
participants = new Participants
|
participants = new Participants
|
||||||
{
|
{
|
||||||
@ -113,5 +119,16 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
beatmapBind.BindValueChanged(b => Beatmap.Value = beatmapManager.GetWorkingBeatmap(room.Beatmap.Value), true);
|
beatmapBind.BindValueChanged(b => Beatmap.Value = beatmapManager.GetWorkingBeatmap(room.Beatmap.Value), true);
|
||||||
Beatmap.BindValueChanged(b => beatmapBind.Value = b.BeatmapInfo);
|
Beatmap.BindValueChanged(b => beatmapBind.Value = b.BeatmapInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onStart()
|
||||||
|
{
|
||||||
|
switch (typeBind.Value)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case GameTypeTimeshift _:
|
||||||
|
multiplayer.Push(new PlayerLoader(new TimeshiftPlayer()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 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.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -13,21 +14,20 @@ using osu.Game.Screens.Multi.Lounge;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Multi
|
namespace osu.Game.Screens.Multi
|
||||||
{
|
{
|
||||||
|
[Cached]
|
||||||
public class Multiplayer : OsuScreen
|
public class Multiplayer : OsuScreen
|
||||||
{
|
{
|
||||||
private readonly MultiplayerWaveContainer waves;
|
private readonly MultiplayerWaveContainer waves;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => waves;
|
|
||||||
|
|
||||||
public Multiplayer()
|
public Multiplayer()
|
||||||
{
|
{
|
||||||
InternalChild = waves = new MultiplayerWaveContainer
|
Child = waves = new MultiplayerWaveContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
};
|
};
|
||||||
|
|
||||||
LoungeScreen loungeScreen;
|
LoungeScreen loungeScreen;
|
||||||
Children = new Drawable[]
|
waves.AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
@ -56,7 +56,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
Child = loungeScreen = new LoungeScreen(),
|
Child = loungeScreen = new LoungeScreen(),
|
||||||
},
|
},
|
||||||
new Header(loungeScreen),
|
new Header(loungeScreen),
|
||||||
};
|
});
|
||||||
|
|
||||||
loungeScreen.Exited += s => Exit();
|
loungeScreen.Exited += s => Exit();
|
||||||
}
|
}
|
||||||
@ -76,13 +76,17 @@ namespace osu.Game.Screens.Multi
|
|||||||
protected override void OnResuming(Screen last)
|
protected override void OnResuming(Screen last)
|
||||||
{
|
{
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
waves.Show();
|
|
||||||
|
Content.FadeIn(250);
|
||||||
|
Content.ScaleTo(1, 250, Easing.OutSine);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSuspending(Screen next)
|
protected override void OnSuspending(Screen next)
|
||||||
{
|
{
|
||||||
|
Content.ScaleTo(1.1f, 250, Easing.InSine);
|
||||||
|
Content.FadeOut(250);
|
||||||
|
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
waves.Hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LogoExiting(OsuLogo logo)
|
protected override void LogoExiting(OsuLogo logo)
|
||||||
|
11
osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs
Normal file
11
osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Multi.Play
|
||||||
|
{
|
||||||
|
public class TimeshiftPlayer : Player
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user