Skip to content

Commit

Permalink
使用targetWidth 而不是wider
Browse files Browse the repository at this point in the history
schedule使用240宽度
  • Loading branch information
cdwcgt committed Dec 28, 2024
1 parent d3f97d2 commit 2cb04a3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public partial class DrawableMatchTeam : DrawableTournamentTeam, IHasContextMenu
private Box background = null!;
private Box backgroundRight = null!;

private readonly bool wider;

private readonly Bindable<int?> score = new Bindable<int?>();
private readonly BindableBool completed = new BindableBool();

Expand All @@ -58,16 +56,12 @@ private void setCurrent()
[Resolved]
private LadderEditorInfo? editorInfo { get; set; }

public DrawableMatchTeam(TournamentTeam? team, TournamentMatch match, bool losers, bool wider = false)
public DrawableMatchTeam(TournamentTeam? team, TournamentMatch match, bool losers, float targetWidth = 150)
: base(team)
{
this.match = match;
this.losers = losers;
this.wider = wider;
Size = new Vector2(150, 40);

if (wider)
Width = 300;
Size = new Vector2(targetWidth, 40);

AcronymText.Anchor = AcronymText.Origin = Anchor.CentreLeft;
AcronymText.Padding = new MarginPadding { Left = 10 };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,20 @@ public partial class DrawableTournamentMatch : CompositeDrawable
private readonly Drawable currentMatchSelectionBox;
private Bindable<TournamentMatch>? globalSelection;

public bool IsVertical;
private float targetMatchWidth = 150;

public float TargetMatchWidth
{
get => targetMatchWidth;
set
{
if (targetMatchWidth == value)
return;

targetMatchWidth = value;
updateTeams();
}
}

[Resolved]
private LadderEditorInfo? editorInfo { get; set; }
Expand Down Expand Up @@ -281,8 +294,8 @@ private void updateTeams()

Flow.Children = new[]
{
new DrawableMatchTeam(Match.Team1.Value, Match, Match.Losers.Value, IsVertical),
new DrawableMatchTeam(Match.Team2.Value, Match, Match.Losers.Value, IsVertical)
new DrawableMatchTeam(Match.Team1.Value, Match, Match.Losers.Value, TargetMatchWidth),
new DrawableMatchTeam(Match.Team2.Value, Match, Match.Losers.Value, TargetMatchWidth)
};

SchedulerAfterChildren.Add(() => Scheduler.Add(updateProgression));
Expand Down
23 changes: 7 additions & 16 deletions osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,15 @@ public partial class ScheduleMatch : DrawableTournamentMatch
public ScheduleMatch(TournamentMatch match, bool showTimestamp = true, bool isVertical = false)
: base(match)
{
IsVertical = isVertical;
TargetMatchWidth = 240;

Scale = new Vector2(0.8f);

if (!isVertical)
{
Flow.Direction = FillDirection.Horizontal;
}

bool conditional = match is ConditionalTournamentMatch;

if (conditional)
Expand Down Expand Up @@ -276,21 +282,6 @@ public ScheduleMatch(TournamentMatch match, bool showTimestamp = true, bool isVe
});
}
}

protected override void LoadComplete()
{
base.LoadComplete();

if (IsVertical)
{
AutoSizeAxes = Axes.Y;
Width = 302;
}
else
{
Flow.Direction = FillDirection.Horizontal;
}
}
}

public partial class ScheduleMatchDate : DrawableDate
Expand Down

0 comments on commit 2cb04a3

Please sign in to comment.