1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 12:53:11 +08:00

Merge branch 'master' into update-button

This commit is contained in:
Craftplacer 2020-05-08 01:42:32 +02:00 committed by GitHub
commit c412afe35b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 102 additions and 19 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;
}
}
}
}
}

View File

@ -139,7 +139,7 @@ namespace osu.Game.Graphics
return false;
dateText.Text = $"{date:d MMMM yyyy} ";
timeText.Text = $"{date:hh:mm:ss \"UTC\"z}";
timeText.Text = $"{date:HH:mm:ss \"UTC\"z}";
return true;
}

View File

@ -12,7 +12,7 @@ namespace osu.Game.Scoring.Legacy
switch (scoreInfo.Ruleset?.ID ?? scoreInfo.RulesetID)
{
case 3:
return scoreInfo.Statistics[HitResult.Perfect];
return getCount(scoreInfo, HitResult.Perfect);
}
return null;
@ -35,10 +35,10 @@ namespace osu.Game.Scoring.Legacy
case 0:
case 1:
case 3:
return scoreInfo.Statistics[HitResult.Great];
return getCount(scoreInfo, HitResult.Great);
case 2:
return scoreInfo.Statistics[HitResult.Perfect];
return getCount(scoreInfo, HitResult.Perfect);
}
return null;
@ -65,10 +65,10 @@ namespace osu.Game.Scoring.Legacy
switch (scoreInfo.Ruleset?.ID ?? scoreInfo.RulesetID)
{
case 3:
return scoreInfo.Statistics[HitResult.Good];
return getCount(scoreInfo, HitResult.Good);
case 2:
return scoreInfo.Statistics[HitResult.SmallTickMiss];
return getCount(scoreInfo, HitResult.SmallTickMiss);
}
return null;
@ -94,13 +94,13 @@ namespace osu.Game.Scoring.Legacy
{
case 0:
case 1:
return scoreInfo.Statistics[HitResult.Good];
return getCount(scoreInfo, HitResult.Good);
case 3:
return scoreInfo.Statistics[HitResult.Ok];
return getCount(scoreInfo, HitResult.Ok);
case 2:
return scoreInfo.Statistics[HitResult.LargeTickHit];
return getCount(scoreInfo, HitResult.LargeTickHit);
}
return null;
@ -131,10 +131,10 @@ namespace osu.Game.Scoring.Legacy
{
case 0:
case 3:
return scoreInfo.Statistics[HitResult.Meh];
return getCount(scoreInfo, HitResult.Meh);
case 2:
return scoreInfo.Statistics[HitResult.SmallTickHit];
return getCount(scoreInfo, HitResult.SmallTickHit);
}
return null;
@ -156,9 +156,17 @@ namespace osu.Game.Scoring.Legacy
}
public static int? GetCountMiss(this ScoreInfo scoreInfo) =>
scoreInfo.Statistics[HitResult.Miss];
getCount(scoreInfo, HitResult.Miss);
public static void SetCountMiss(this ScoreInfo scoreInfo, int value) =>
scoreInfo.Statistics[HitResult.Miss] = value;
private static int? getCount(ScoreInfo scoreInfo, HitResult result)
{
if (scoreInfo.Statistics.TryGetValue(result, out var existing))
return existing;
return null;
}
}
}