1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:20:04 +08:00

Merge pull request #8961 from peppy/tourney-3v3

Add support for 3v3 tournament chroma key layout
This commit is contained in:
Dean Herbert 2020-05-07 18:09:41 +09:00 committed by GitHub
commit e8a8c800e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 82 additions and 7 deletions

View File

@ -32,5 +32,11 @@ namespace osu.Game.Tournament.Models
MinValue = 640,
MaxValue = 1366,
};
public Bindable<int> PlayersPerTeam = new BindableInt(4)
{
MinValue = 3,
MaxValue = 4,
};
}
}

View File

@ -36,7 +36,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
[Resolved]
private TournamentMatchChatDisplay chat { get; set; }
private Box chroma;
private Drawable chroma;
[BackgroundDependencyLoader]
private void load(LadderInfo ladder, MatchIPCInfo ipc, Storage storage)
@ -61,16 +61,30 @@ namespace osu.Game.Tournament.Screens.Gameplay
Y = 110,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Children = new Drawable[]
Children = new[]
{
chroma = new Box
chroma = new Container
{
// chroma key area for stable gameplay
Name = "chroma",
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Height = 512,
Colour = new Color4(0, 255, 0, 255),
Children = new Drawable[]
{
new ChromaArea
{
Name = "Left chroma",
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
},
new ChromaArea
{
Name = "Right chroma",
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Width = 0.5f,
}
}
},
}
},
@ -98,9 +112,15 @@ namespace osu.Game.Tournament.Screens.Gameplay
},
new SettingsSlider<int>
{
LabelText = "Chroma Width",
LabelText = "Chroma width",
Bindable = LadderInfo.ChromaKeyWidth,
KeyboardStep = 1,
},
new SettingsSlider<int>
{
LabelText = "Players per team",
Bindable = LadderInfo.PlayersPerTeam,
KeyboardStep = 1,
}
}
}
@ -201,5 +221,54 @@ namespace osu.Game.Tournament.Screens.Gameplay
lastState = state.NewValue;
}
}
private class ChromaArea : CompositeDrawable
{
[Resolved]
private LadderInfo ladder { get; set; }
[BackgroundDependencyLoader]
private void load()
{
// chroma key area for stable gameplay
Colour = new Color4(0, 255, 0, 255);
ladder.PlayersPerTeam.BindValueChanged(performLayout, true);
}
private void performLayout(ValueChangedEvent<int> playerCount)
{
switch (playerCount.NewValue)
{
case 3:
InternalChildren = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
Height = 0.5f,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
new Box
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Height = 0.5f,
},
};
break;
default:
InternalChild = new Box
{
RelativeSizeAxes = Axes.Both,
};
break;
}
}
}
}
}