mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 20:53:04 +08:00
Merge branch 'multiplayer-rename-game-type' into multiplayer-match-rulesets
This commit is contained in:
commit
a42762e351
@ -2,10 +2,30 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
using osu.Game.Rulesets.Taiko.UI;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Mods
|
namespace osu.Game.Rulesets.Taiko.Mods
|
||||||
{
|
{
|
||||||
public class TaikoModClassic : ModClassic
|
public class TaikoModClassic : ModClassic, IApplicableToDrawableRuleset<TaikoHitObject>, IUpdatableByPlayfield
|
||||||
{
|
{
|
||||||
|
private DrawableTaikoRuleset drawableTaikoRuleset;
|
||||||
|
|
||||||
|
public void ApplyToDrawableRuleset(DrawableRuleset<TaikoHitObject> drawableRuleset)
|
||||||
|
{
|
||||||
|
drawableTaikoRuleset = (DrawableTaikoRuleset)drawableRuleset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(Playfield playfield)
|
||||||
|
{
|
||||||
|
// Classic taiko scrolls at a constant 100px per 1000ms. More notes become visible as the playfield is lengthened.
|
||||||
|
const float scroll_rate = 10;
|
||||||
|
|
||||||
|
// Since the time range will depend on a positional value, it is referenced to the x480 pixel space.
|
||||||
|
float ratio = drawableTaikoRuleset.DrawHeight / 480;
|
||||||
|
|
||||||
|
drawableTaikoRuleset.TimeRange.Value = (playfield.HitObjectContainer.DrawWidth / ratio) * scroll_rate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,23 +12,11 @@ using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Mods
|
namespace osu.Game.Rulesets.Taiko.Mods
|
||||||
{
|
{
|
||||||
public class TaikoModHidden : ModHidden, IApplicableToDifficulty
|
public class TaikoModHidden : ModHidden
|
||||||
{
|
{
|
||||||
public override string Description => @"Beats fade out before you hit them!";
|
public override string Description => @"Beats fade out before you hit them!";
|
||||||
public override double ScoreMultiplier => 1.06;
|
public override double ScoreMultiplier => 1.06;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// In osu-stable, the hit position is 160, so the active playfield is essentially 160 pixels shorter
|
|
||||||
/// than the actual screen width. The normalized playfield height is 480, so on a 4:3 screen the
|
|
||||||
/// playfield ratio of the active area up to the hit position will actually be (640 - 160) / 480 = 1.
|
|
||||||
/// For custom resolutions/aspect ratios (x:y), the screen width given the normalized height becomes 480 * x / y instead,
|
|
||||||
/// and the playfield ratio becomes (480 * x / y - 160) / 480 = x / y - 1/3.
|
|
||||||
/// This constant is equal to the playfield ratio on 4:3 screens divided by the playfield ratio on 16:9 screens.
|
|
||||||
/// </summary>
|
|
||||||
private const double hd_sv_scale = (4.0 / 3.0 - 1.0 / 3.0) / (16.0 / 9.0 - 1.0 / 3.0);
|
|
||||||
|
|
||||||
private double originalSliderMultiplier;
|
|
||||||
|
|
||||||
private ControlPointInfo controlPointInfo;
|
private ControlPointInfo controlPointInfo;
|
||||||
|
|
||||||
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||||
@ -41,7 +29,7 @@ namespace osu.Game.Rulesets.Taiko.Mods
|
|||||||
double beatLength = controlPointInfo.TimingPointAt(position).BeatLength;
|
double beatLength = controlPointInfo.TimingPointAt(position).BeatLength;
|
||||||
double speedMultiplier = controlPointInfo.DifficultyPointAt(position).SpeedMultiplier;
|
double speedMultiplier = controlPointInfo.DifficultyPointAt(position).SpeedMultiplier;
|
||||||
|
|
||||||
return originalSliderMultiplier * speedMultiplier * TimingControlPoint.DEFAULT_BEAT_LENGTH / beatLength;
|
return speedMultiplier * TimingControlPoint.DEFAULT_BEAT_LENGTH / beatLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||||
@ -69,22 +57,6 @@ namespace osu.Game.Rulesets.Taiko.Mods
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReadFromDifficulty(BeatmapDifficulty difficulty)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
|
|
||||||
{
|
|
||||||
// needs to be read after all processing has been run (TaikoBeatmapConverter applies an adjustment which would otherwise be omitted).
|
|
||||||
originalSliderMultiplier = difficulty.SliderMultiplier;
|
|
||||||
|
|
||||||
// osu-stable has an added playfield cover that essentially forces a 4:3 playfield ratio, by cutting off all objects past that size.
|
|
||||||
// This is not yet implemented; instead a playfield adjustment container is present which maintains a 16:9 ratio.
|
|
||||||
// For now, increase the slider multiplier proportionally so that the notes stay on the screen for the same amount of time as on stable.
|
|
||||||
// Note that this means that the notes will scroll faster as they have a longer distance to travel on the screen in that same amount of time.
|
|
||||||
difficulty.SliderMultiplier /= hd_sv_scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void ApplyToBeatmap(IBeatmap beatmap)
|
public override void ApplyToBeatmap(IBeatmap beatmap)
|
||||||
{
|
{
|
||||||
controlPointInfo = beatmap.ControlPointInfo;
|
controlPointInfo = beatmap.ControlPointInfo;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
@ -24,12 +25,14 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
{
|
{
|
||||||
public class DrawableTaikoRuleset : DrawableScrollingRuleset<TaikoHitObject>
|
public class DrawableTaikoRuleset : DrawableScrollingRuleset<TaikoHitObject>
|
||||||
{
|
{
|
||||||
private SkinnableDrawable scroller;
|
public new BindableDouble TimeRange => base.TimeRange;
|
||||||
|
|
||||||
protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Overlapping;
|
protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Overlapping;
|
||||||
|
|
||||||
protected override bool UserScrollSpeedAdjustment => false;
|
protected override bool UserScrollSpeedAdjustment => false;
|
||||||
|
|
||||||
|
private SkinnableDrawable scroller;
|
||||||
|
|
||||||
public DrawableTaikoRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
public DrawableTaikoRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
||||||
: base(ruleset, beatmap, mods)
|
: base(ruleset, beatmap, mods)
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default height of a <see cref="TaikoPlayfield"/> when inside a <see cref="DrawableTaikoRuleset"/>.
|
/// Default height of a <see cref="TaikoPlayfield"/> when inside a <see cref="DrawableTaikoRuleset"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const float DEFAULT_HEIGHT = 178;
|
public const float DEFAULT_HEIGHT = 212;
|
||||||
|
|
||||||
private Container<HitExplosion> hitExplosionContainer;
|
private Container<HitExplosion> hitExplosionContainer;
|
||||||
private Container<KiaiHitExplosion> kiaiExplosionContainer;
|
private Container<KiaiHitExplosion> kiaiExplosionContainer;
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.Rooms
|
|
||||||
{
|
|
||||||
public abstract class GameType
|
|
||||||
{
|
|
||||||
public abstract string Name { get; }
|
|
||||||
|
|
||||||
public abstract Drawable GetIcon(OsuColour colours, float size);
|
|
||||||
|
|
||||||
public override int GetHashCode() => GetType().GetHashCode();
|
|
||||||
public override bool Equals(object obj) => GetType() == obj?.GetType();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.Rooms.GameTypes
|
|
||||||
{
|
|
||||||
public class GameTypePlaylists : GameType
|
|
||||||
{
|
|
||||||
public override string Name => "Playlists";
|
|
||||||
|
|
||||||
public override Drawable GetIcon(OsuColour colours, float size) => new SpriteIcon
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Icon = FontAwesome.Regular.Clock,
|
|
||||||
Size = new Vector2(size),
|
|
||||||
Colour = colours.Blue,
|
|
||||||
Shadow = false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.Rooms.GameTypes
|
|
||||||
{
|
|
||||||
public class GameTypeTag : GameType
|
|
||||||
{
|
|
||||||
public override string Name => "Tag";
|
|
||||||
|
|
||||||
public override Drawable GetIcon(OsuColour colours, float size)
|
|
||||||
{
|
|
||||||
return new SpriteIcon
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Icon = FontAwesome.Solid.Sync,
|
|
||||||
Size = new Vector2(size),
|
|
||||||
Colour = colours.Blue,
|
|
||||||
Shadow = false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.Rooms.GameTypes
|
|
||||||
{
|
|
||||||
public class GameTypeTagTeam : GameType
|
|
||||||
{
|
|
||||||
public override string Name => "Tag Team";
|
|
||||||
|
|
||||||
public override Drawable GetIcon(OsuColour colours, float size)
|
|
||||||
{
|
|
||||||
return new FillFlowContainer
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Horizontal,
|
|
||||||
Spacing = new Vector2(2f),
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new SpriteIcon
|
|
||||||
{
|
|
||||||
Icon = FontAwesome.Solid.Sync,
|
|
||||||
Size = new Vector2(size * 0.75f),
|
|
||||||
Colour = colours.Blue,
|
|
||||||
Shadow = false,
|
|
||||||
},
|
|
||||||
new SpriteIcon
|
|
||||||
{
|
|
||||||
Icon = FontAwesome.Solid.Sync,
|
|
||||||
Size = new Vector2(size * 0.75f),
|
|
||||||
Colour = colours.Pink,
|
|
||||||
Shadow = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.Rooms.GameTypes
|
|
||||||
{
|
|
||||||
public class GameTypeTeamVersus : GameType
|
|
||||||
{
|
|
||||||
public override string Name => "Team Versus";
|
|
||||||
|
|
||||||
public override Drawable GetIcon(OsuColour colours, float size)
|
|
||||||
{
|
|
||||||
return new FillFlowContainer
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Spacing = new Vector2(2f),
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new VersusRow(colours.Blue, colours.Pink, size * 0.5f),
|
|
||||||
new VersusRow(colours.Blue, colours.Pink, size * 0.5f),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.Rooms.GameTypes
|
|
||||||
{
|
|
||||||
public class GameTypeVersus : GameType
|
|
||||||
{
|
|
||||||
public override string Name => "Versus";
|
|
||||||
|
|
||||||
public override Drawable GetIcon(OsuColour colours, float size)
|
|
||||||
{
|
|
||||||
return new VersusRow(colours.Blue, colours.Blue, size * 0.6f)
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osuTK;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.Rooms.GameTypes
|
|
||||||
{
|
|
||||||
public class VersusRow : FillFlowContainer
|
|
||||||
{
|
|
||||||
public VersusRow(Color4 first, Color4 second, float size)
|
|
||||||
{
|
|
||||||
var triangleSize = new Vector2(size);
|
|
||||||
AutoSizeAxes = Axes.Both;
|
|
||||||
Spacing = new Vector2(2f, 0f);
|
|
||||||
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
Size = triangleSize,
|
|
||||||
Colour = first,
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new EquilateralTriangle
|
|
||||||
{
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Rotation = 90,
|
|
||||||
EdgeSmoothness = new Vector2(1f),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
Size = triangleSize,
|
|
||||||
Colour = second,
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new EquilateralTriangle
|
|
||||||
{
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Rotation = -90,
|
|
||||||
EdgeSmoothness = new Vector2(1f),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
18
osu.Game/Online/Rooms/MatchType.cs
Normal file
18
osu.Game/Online/Rooms/MatchType.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Rooms
|
||||||
|
{
|
||||||
|
public enum MatchType
|
||||||
|
{
|
||||||
|
Playlists,
|
||||||
|
|
||||||
|
[Description("Head to head")]
|
||||||
|
HeadToHead,
|
||||||
|
|
||||||
|
[Description("Team VS")]
|
||||||
|
TeamVersus,
|
||||||
|
}
|
||||||
|
}
|
@ -7,7 +7,6 @@ using Newtonsoft.Json;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.IO.Serialization.Converters;
|
using osu.Game.IO.Serialization.Converters;
|
||||||
using osu.Game.Online.Rooms.GameTypes;
|
|
||||||
using osu.Game.Online.Rooms.RoomStatuses;
|
using osu.Game.Online.Rooms.RoomStatuses;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
@ -63,7 +62,7 @@ namespace osu.Game.Online.Rooms
|
|||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public readonly Bindable<GameType> Type = new Bindable<GameType>(new GameTypePlaylists());
|
public readonly Bindable<MatchType> Type = new Bindable<MatchType>();
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The maximum span of time that may be visible by the length of the scrolling axes.
|
/// The maximum span of time that may be visible by the length of the scrolling axes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const double time_span_max = 10000;
|
private const double time_span_max = 20000;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The step increase/decrease of the span of time visible by the length of the scrolling axes.
|
/// The step increase/decrease of the span of time visible by the length of the scrolling axes.
|
||||||
|
@ -2,24 +2,28 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
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;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay.Components
|
namespace osu.Game.Screens.OnlinePlay.Components
|
||||||
{
|
{
|
||||||
public class DrawableGameType : CircularContainer, IHasTooltip
|
public class DrawableGameType : CircularContainer, IHasTooltip
|
||||||
{
|
{
|
||||||
private readonly GameType type;
|
private readonly MatchType type;
|
||||||
|
|
||||||
public LocalisableString TooltipText => type.Name;
|
public LocalisableString TooltipText => type.GetLocalisableDescription();
|
||||||
|
|
||||||
public DrawableGameType(GameType type)
|
public DrawableGameType(MatchType type)
|
||||||
{
|
{
|
||||||
this.type = type;
|
this.type = type;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
@ -34,10 +38,138 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuColour colours { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load()
|
||||||
{
|
{
|
||||||
Add(type.GetIcon(colours, Height / 2));
|
Add(getIconFor(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Drawable getIconFor(MatchType matchType)
|
||||||
|
{
|
||||||
|
float size = Height / 2;
|
||||||
|
|
||||||
|
switch (matchType)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case MatchType.Playlists:
|
||||||
|
return new SpriteIcon
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(size),
|
||||||
|
Icon = FontAwesome.Regular.Clock,
|
||||||
|
Colour = colours.Blue,
|
||||||
|
Shadow = false
|
||||||
|
};
|
||||||
|
|
||||||
|
case MatchType.HeadToHead:
|
||||||
|
return new VersusRow(colours.Blue, colours.Blue, size * 0.6f)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
};
|
||||||
|
|
||||||
|
case MatchType.TeamVersus:
|
||||||
|
return new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(2f),
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new VersusRow(colours.Blue, colours.Pink, size * 0.5f),
|
||||||
|
new VersusRow(colours.Blue, colours.Pink, size * 0.5f),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// case MatchType.TagCoop:
|
||||||
|
// return new SpriteIcon
|
||||||
|
// {
|
||||||
|
// Anchor = Anchor.Centre,
|
||||||
|
// Origin = Anchor.Centre,
|
||||||
|
// Size = new Vector2(size),
|
||||||
|
// Icon = FontAwesome.Solid.Sync,
|
||||||
|
// Colour = colours.Blue,
|
||||||
|
//
|
||||||
|
// Shadow = false
|
||||||
|
// };
|
||||||
|
|
||||||
|
// case MatchType.TagTeamCoop:
|
||||||
|
// return new FillFlowContainer
|
||||||
|
// {
|
||||||
|
// Anchor = Anchor.Centre,
|
||||||
|
// Origin = Anchor.Centre,
|
||||||
|
// AutoSizeAxes = Axes.Both,
|
||||||
|
// Direction = FillDirection.Horizontal,
|
||||||
|
// Spacing = new Vector2(2f),
|
||||||
|
// Children = new[]
|
||||||
|
// {
|
||||||
|
// new SpriteIcon
|
||||||
|
// {
|
||||||
|
// Icon = FontAwesome.Solid.Sync,
|
||||||
|
// Size = new Vector2(size * 0.75f),
|
||||||
|
// Colour = colours.Blue,
|
||||||
|
// Shadow = false,
|
||||||
|
// },
|
||||||
|
// new SpriteIcon
|
||||||
|
// {
|
||||||
|
// Icon = FontAwesome.Solid.Sync,
|
||||||
|
// Size = new Vector2(size * 0.75f),
|
||||||
|
// Colour = colours.Pink,
|
||||||
|
// Shadow = false,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class VersusRow : FillFlowContainer
|
||||||
|
{
|
||||||
|
public VersusRow(Color4 first, Color4 second, float size)
|
||||||
|
{
|
||||||
|
var triangleSize = new Vector2(size);
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
Spacing = new Vector2(2f, 0f);
|
||||||
|
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Size = triangleSize,
|
||||||
|
Colour = first,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new EquilateralTriangle
|
||||||
|
{
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Rotation = 90,
|
||||||
|
EdgeSmoothness = new Vector2(1f),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Size = triangleSize,
|
||||||
|
Colour = second,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new EquilateralTriangle
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Rotation = -90,
|
||||||
|
EdgeSmoothness = new Vector2(1f),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,31 +9,27 @@ using osu.Framework.Graphics.UserInterface;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Online.Rooms.GameTypes;
|
|
||||||
using osu.Game.Screens.OnlinePlay.Components;
|
using osu.Game.Screens.OnlinePlay.Components;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay.Match.Components
|
namespace osu.Game.Screens.OnlinePlay.Match.Components
|
||||||
{
|
{
|
||||||
public class GameTypePicker : DisableableTabControl<GameType>
|
public class GameTypePicker : DisableableTabControl<MatchType>
|
||||||
{
|
{
|
||||||
private const float height = 40;
|
private const float height = 40;
|
||||||
private const float selection_width = 3;
|
private const float selection_width = 3;
|
||||||
|
|
||||||
protected override TabItem<GameType> CreateTabItem(GameType value) => new GameTypePickerItem(value);
|
protected override TabItem<MatchType> CreateTabItem(MatchType value) => new GameTypePickerItem(value);
|
||||||
|
|
||||||
protected override Dropdown<GameType> CreateDropdown() => null;
|
protected override Dropdown<MatchType> CreateDropdown() => null;
|
||||||
|
|
||||||
public GameTypePicker()
|
public GameTypePicker()
|
||||||
{
|
{
|
||||||
Height = height + selection_width * 2;
|
Height = height + selection_width * 2;
|
||||||
TabContainer.Spacing = new Vector2(10 - selection_width * 2);
|
TabContainer.Spacing = new Vector2(10 - selection_width * 2);
|
||||||
|
|
||||||
AddItem(new GameTypeTag());
|
AddItem(MatchType.HeadToHead);
|
||||||
AddItem(new GameTypeVersus());
|
AddItem(MatchType.TeamVersus);
|
||||||
AddItem(new GameTypeTagTeam());
|
|
||||||
AddItem(new GameTypeTeamVersus());
|
|
||||||
AddItem(new GameTypePlaylists());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class GameTypePickerItem : DisableableTabItem
|
private class GameTypePickerItem : DisableableTabItem
|
||||||
@ -42,7 +38,7 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
|
|||||||
|
|
||||||
private readonly CircularContainer hover, selection;
|
private readonly CircularContainer hover, selection;
|
||||||
|
|
||||||
public GameTypePickerItem(GameType value)
|
public GameTypePickerItem(MatchType value)
|
||||||
: base(value)
|
: base(value)
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
|
@ -6,6 +6,7 @@ using System.Diagnostics;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Extensions.ExceptionExtensions;
|
using osu.Framework.Extensions.ExceptionExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -265,7 +266,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
loadingLayer = new LoadingLayer(true)
|
loadingLayer = new LoadingLayer(true)
|
||||||
};
|
};
|
||||||
|
|
||||||
TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue?.Name ?? string.Empty, true);
|
TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue.GetLocalisableDescription(), true);
|
||||||
RoomName.BindValueChanged(name => NameField.Text = name.NewValue, true);
|
RoomName.BindValueChanged(name => NameField.Text = name.NewValue, true);
|
||||||
Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
|
Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
|
||||||
Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true);
|
Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true);
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
protected Bindable<RoomStatus> Status { get; private set; }
|
protected Bindable<RoomStatus> Status { get; private set; }
|
||||||
|
|
||||||
[Resolved(typeof(Room))]
|
[Resolved(typeof(Room))]
|
||||||
protected Bindable<GameType> Type { get; private set; }
|
protected Bindable<MatchType> Type { get; private set; }
|
||||||
|
|
||||||
[Resolved(typeof(Room))]
|
[Resolved(typeof(Room))]
|
||||||
protected BindableList<PlaylistItem> Playlist { get; private set; }
|
protected BindableList<PlaylistItem> Playlist { get; private set; }
|
||||||
|
Loading…
Reference in New Issue
Block a user