mirror of
https://github.com/osukey/osukey.git
synced 2025-05-21 13:37:20 +09:00
Wrap main content of DrawableRoom
This commit is contained in:
parent
037b9cfb59
commit
bebb9d7e67
@ -43,6 +43,8 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
private PasswordProtectedIcon passwordIcon;
|
private PasswordProtectedIcon passwordIcon;
|
||||||
private EndDateInfo endDateInfo;
|
private EndDateInfo endDateInfo;
|
||||||
|
|
||||||
|
private DelayedLoadWrapper wrapper;
|
||||||
|
|
||||||
public DrawableRoom(Room room)
|
public DrawableRoom(Room room)
|
||||||
{
|
{
|
||||||
Room = room;
|
Room = room;
|
||||||
@ -75,155 +77,156 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
{
|
{
|
||||||
d.RelativeSizeAxes = Axes.Both;
|
d.RelativeSizeAxes = Axes.Both;
|
||||||
}),
|
}),
|
||||||
new Container
|
wrapper = new DelayedLoadWrapper(() =>
|
||||||
{
|
new Container
|
||||||
Name = @"Room content",
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
// This negative padding resolves 1px gaps between this background and the background above.
|
|
||||||
Padding = new MarginPadding { Left = 20, Vertical = -0.5f },
|
|
||||||
Child = new Container
|
|
||||||
{
|
{
|
||||||
|
Name = @"Room content",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true,
|
// This negative padding resolves 1px gaps between this background and the background above.
|
||||||
CornerRadius = CORNER_RADIUS,
|
Padding = new MarginPadding { Left = 20, Vertical = -0.5f },
|
||||||
Children = new Drawable[]
|
Child = new Container
|
||||||
{
|
{
|
||||||
new GridContainer
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Masking = true,
|
||||||
|
CornerRadius = CORNER_RADIUS,
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
new GridContainer
|
||||||
ColumnDimensions = new[]
|
|
||||||
{
|
{
|
||||||
new Dimension(GridSizeMode.Relative, 0.2f)
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
ColumnDimensions = new[]
|
||||||
Content = new[]
|
|
||||||
{
|
|
||||||
new Drawable[]
|
|
||||||
{
|
{
|
||||||
new Box
|
new Dimension(GridSizeMode.Relative, 0.2f)
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = colours.Background5,
|
|
||||||
},
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = ColourInfo.GradientHorizontal(colours.Background5, colours.Background5.Opacity(0.3f))
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
Name = @"Left details",
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Padding = new MarginPadding
|
|
||||||
{
|
|
||||||
Left = 20,
|
|
||||||
Vertical = 5
|
|
||||||
},
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Horizontal,
|
|
||||||
Spacing = new Vector2(5),
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new RoomStatusPill
|
|
||||||
{
|
|
||||||
Anchor = Anchor.CentreLeft,
|
|
||||||
Origin = Anchor.CentreLeft
|
|
||||||
},
|
|
||||||
specialCategoryPill = new RoomSpecialCategoryPill
|
|
||||||
{
|
|
||||||
Anchor = Anchor.CentreLeft,
|
|
||||||
Origin = Anchor.CentreLeft
|
|
||||||
},
|
|
||||||
endDateInfo = new EndDateInfo
|
|
||||||
{
|
|
||||||
Anchor = Anchor.CentreLeft,
|
|
||||||
Origin = Anchor.CentreLeft,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Padding = new MarginPadding { Top = 3 },
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new RoomNameText(),
|
|
||||||
new RoomHostText(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
Content = new[]
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
new Drawable[]
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Horizontal,
|
|
||||||
Spacing = new Vector2(5),
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
new PlaylistCountPill
|
new Box
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.CentreLeft,
|
Colour = colours.Background5,
|
||||||
},
|
},
|
||||||
new StarRatingRangeDisplay
|
new Box
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.CentreLeft,
|
Colour = ColourInfo.GradientHorizontal(colours.Background5, colours.Background5.Opacity(0.3f))
|
||||||
Scale = new Vector2(0.8f)
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Name = @"Left details",
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Padding = new MarginPadding
|
||||||
|
{
|
||||||
|
Left = 20,
|
||||||
|
Vertical = 5
|
||||||
|
},
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(5),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new RoomStatusPill
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft
|
||||||
|
},
|
||||||
|
specialCategoryPill = new RoomSpecialCategoryPill
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft
|
||||||
|
},
|
||||||
|
endDateInfo = new EndDateInfo
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Padding = new MarginPadding { Top = 3 },
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new RoomNameText(),
|
||||||
|
new RoomHostText(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(5),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new PlaylistCountPill
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
},
|
||||||
|
new StarRatingRangeDisplay
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Scale = new Vector2(0.8f)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
Name = "Right content",
|
|
||||||
Anchor = Anchor.CentreRight,
|
|
||||||
Origin = Anchor.CentreRight,
|
|
||||||
AutoSizeAxes = Axes.X,
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
Spacing = new Vector2(5),
|
|
||||||
Padding = new MarginPadding
|
|
||||||
{
|
|
||||||
Right = 10,
|
|
||||||
Vertical = 20,
|
|
||||||
},
|
},
|
||||||
Children = new Drawable[]
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
ButtonsContainer = new Container
|
Name = "Right content",
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
AutoSizeAxes = Axes.X,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Spacing = new Vector2(5),
|
||||||
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreRight,
|
Right = 10,
|
||||||
Origin = Anchor.CentreRight,
|
Vertical = 20,
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
AutoSizeAxes = Axes.X
|
|
||||||
},
|
},
|
||||||
recentParticipantsList = new RecentParticipantsList
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreRight,
|
ButtonsContainer = new Container
|
||||||
Origin = Anchor.CentreRight,
|
{
|
||||||
NumberOfCircles = NumberOfAvatars
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
AutoSizeAxes = Axes.X
|
||||||
|
},
|
||||||
|
recentParticipantsList = new RecentParticipantsList
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
NumberOfCircles = NumberOfAvatars
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
passwordIcon = new PasswordProtectedIcon { Alpha = 0 }
|
||||||
},
|
},
|
||||||
passwordIcon = new PasswordProtectedIcon { Alpha = 0 }
|
|
||||||
},
|
},
|
||||||
},
|
}, 0)
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,23 +234,26 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
roomCategory.BindTo(Room.Category);
|
wrapper.DelayedLoadComplete += _ =>
|
||||||
roomCategory.BindValueChanged(c =>
|
|
||||||
{
|
{
|
||||||
if (c.NewValue == RoomCategory.Spotlight)
|
roomCategory.BindTo(Room.Category);
|
||||||
specialCategoryPill.Show();
|
roomCategory.BindValueChanged(c =>
|
||||||
else
|
{
|
||||||
specialCategoryPill.Hide();
|
if (c.NewValue == RoomCategory.Spotlight)
|
||||||
}, true);
|
specialCategoryPill.Show();
|
||||||
|
else
|
||||||
|
specialCategoryPill.Hide();
|
||||||
|
}, true);
|
||||||
|
|
||||||
roomType.BindTo(Room.Type);
|
roomType.BindTo(Room.Type);
|
||||||
roomType.BindValueChanged(t =>
|
roomType.BindValueChanged(t =>
|
||||||
{
|
{
|
||||||
endDateInfo.Alpha = t.NewValue == MatchType.Playlists ? 1 : 0;
|
endDateInfo.Alpha = t.NewValue == MatchType.Playlists ? 1 : 0;
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
hasPassword.BindTo(Room.HasPassword);
|
hasPassword.BindTo(Room.HasPassword);
|
||||||
hasPassword.BindValueChanged(v => passwordIcon.Alpha = v.NewValue ? 1 : 0, true);
|
hasPassword.BindValueChanged(v => passwordIcon.Alpha = v.NewValue ? 1 : 0, true);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user