mirror of
https://github.com/ppy/osu.git
synced 2025-03-23 16:27:20 +08:00
More documentation
This commit is contained in:
parent
024adb699c
commit
5dc939c2f3
@ -1,16 +1,25 @@
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
{
|
||||
/// <summary>
|
||||
/// A grid of players playing the multiplayer match.
|
||||
/// </summary>
|
||||
public partial class PlayerGrid : CompositeDrawable
|
||||
{
|
||||
private const float player_spacing = 5;
|
||||
|
||||
/// <summary>
|
||||
/// The currently-maximised facade.
|
||||
/// </summary>
|
||||
public Drawable MaximisedFacade => maximisedFacade;
|
||||
|
||||
private readonly Facade maximisedFacade;
|
||||
@ -52,6 +61,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
/// <exception cref="InvalidOperationException">If more than 16 cells are added.</exception>
|
||||
public void Add(Drawable content)
|
||||
{
|
||||
if (cellContainer.Count == 16)
|
||||
throw new InvalidOperationException("Only 16 cells are supported.");
|
||||
|
||||
int index = cellContainer.Count;
|
||||
|
||||
var facade = new Facade();
|
||||
@ -99,6 +111,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
{
|
||||
base.Update();
|
||||
|
||||
// Different layouts are used for varying cell counts in order to maximise dimensions.
|
||||
Vector2 cellsPerDimension;
|
||||
|
||||
switch (facadeContainer.Count)
|
||||
@ -141,7 +154,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
break;
|
||||
}
|
||||
|
||||
// Total spacing between cells
|
||||
// Total inter-cell spacing.
|
||||
Vector2 totalCellSpacing = player_spacing * (cellsPerDimension - Vector2.One);
|
||||
|
||||
Vector2 fullSize = paddingContainer.ChildSize - totalCellSpacing;
|
||||
|
@ -12,6 +12,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
{
|
||||
public partial class PlayerGrid
|
||||
{
|
||||
/// <summary>
|
||||
/// A cell of the grid. Contains the content and tracks to the linked facade.
|
||||
/// </summary>
|
||||
private class Cell : CompositeDrawable
|
||||
{
|
||||
/// <summary>
|
||||
@ -24,7 +27,14 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
/// </summary>
|
||||
public readonly Drawable Content;
|
||||
|
||||
/// <summary>
|
||||
/// An action that toggles the maximisation state of this cell.
|
||||
/// </summary>
|
||||
public Action<Cell> ToggleMaximisationState;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this cell is currently maximised.
|
||||
/// </summary>
|
||||
public bool IsMaximised;
|
||||
|
||||
private Facade facade;
|
||||
|
Loading…
x
Reference in New Issue
Block a user