1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 11:27:24 +08:00

Change ready button to "Start" and make it enter player

This commit is contained in:
smoogipoo 2018-12-11 17:32:01 +09:00
parent 1ac615b490
commit bf3f5ab685
6 changed files with 100 additions and 66 deletions

View File

@ -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();
}

View File

@ -1,17 +1,16 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Multiplayer;
using osu.Game.Overlays.SearchableList;
using osu.Game.Screens.Multi.Components;
@ -23,13 +22,12 @@ namespace osu.Game.Screens.Multi.Match.Components
{
public const float HEIGHT = 128;
public Action OnStart;
private readonly OsuSpriteText availabilityStatus;
private readonly ReadyButton readyButton;
private OsuColour colours;
public Bindable<bool> Ready => readyButton.Ready;
public readonly Bindable<string> Name = new Bindable<string>();
public readonly Bindable<RoomAvailability> Availability = new Bindable<RoomAvailability>();
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,
Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Y,
Size = new Vector2(200, 1),
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}";
}
}
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);
}
}
}
}

View 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,
};
}
}

View File

@ -10,6 +10,8 @@ using osu.Game.Beatmaps;
using osu.Game.Online.API;
using osu.Game.Online.Multiplayer;
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.Users;
@ -36,6 +38,9 @@ namespace osu.Game.Screens.Multi.Match
[Cached]
private readonly Room room;
[Resolved]
private Multiplayer multiplayer { get; set; }
[Resolved]
private BeatmapManager beatmapManager { get; set; }
@ -67,6 +72,7 @@ namespace osu.Game.Screens.Multi.Match
info = new Info
{
Margin = new MarginPadding { Top = Components.Header.HEIGHT },
OnStart = onStart
},
participants = new Participants
{
@ -113,5 +119,16 @@ namespace osu.Game.Screens.Multi.Match
beatmapBind.BindValueChanged(b => Beatmap.Value = beatmapManager.GetWorkingBeatmap(room.Beatmap.Value), true);
Beatmap.BindValueChanged(b => beatmapBind.Value = b.BeatmapInfo);
}
private void onStart()
{
switch (typeBind.Value)
{
default:
case GameTypeTimeshift _:
multiplayer.Push(new PlayerLoader(new TimeshiftPlayer()));
break;
}
}
}
}

View File

@ -1,6 +1,7 @@
// 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;
@ -13,21 +14,20 @@ using osu.Game.Screens.Multi.Lounge;
namespace osu.Game.Screens.Multi
{
[Cached]
public class Multiplayer : OsuScreen
{
private readonly MultiplayerWaveContainer waves;
protected override Container<Drawable> Content => waves;
public Multiplayer()
{
InternalChild = waves = new MultiplayerWaveContainer
Child = waves = new MultiplayerWaveContainer
{
RelativeSizeAxes = Axes.Both,
};
LoungeScreen loungeScreen;
Children = new Drawable[]
waves.AddRange(new Drawable[]
{
new Container
{
@ -56,7 +56,7 @@ namespace osu.Game.Screens.Multi
Child = loungeScreen = new LoungeScreen(),
},
new Header(loungeScreen),
};
});
loungeScreen.Exited += s => Exit();
}
@ -76,13 +76,17 @@ namespace osu.Game.Screens.Multi
protected override void OnResuming(Screen last)
{
base.OnResuming(last);
waves.Show();
Content.FadeIn(250);
Content.ScaleTo(1, 250, Easing.OutSine);
}
protected override void OnSuspending(Screen next)
{
Content.ScaleTo(1.1f, 250, Easing.InSine);
Content.FadeOut(250);
base.OnSuspending(next);
waves.Hide();
}
protected override void LogoExiting(OsuLogo logo)

View 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
{
}
}