コード例 #1
0
            private void load(OverlayColourProvider colourProvider, OsuColour colours)
            {
                InternalChildren = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = colourProvider.Background4
                    },
                    new GridContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        RowDimensions    = new[]
                        {
                            new Dimension(),
                            new Dimension(GridSizeMode.AutoSize),
                        },
                        Content = new[]
                        {
                            new Drawable[]
                            {
                                new OsuScrollContainer
                                {
                                    Padding = new MarginPadding
                                    {
                                        Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
                                        Vertical   = 10
                                    },
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new[]
                                    {
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 10),
                                            Children         = new[]
                                            {
                                                new Container
                                                {
                                                    Anchor  = Anchor.TopCentre,
                                                    Origin  = Anchor.TopCentre,
                                                    Padding = new MarginPadding {
                                                        Horizontal = WaveOverlayContainer.WIDTH_PADDING
                                                    },
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Children         = new Drawable[]
                                                    {
                                                        new SectionContainer
                                                        {
                                                            Padding = new MarginPadding {
                                                                Right = FIELD_PADDING / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Room name")
                                                                {
                                                                    Child = NameField = new OsuTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        LengthLimit = 100,
                                                                    },
                                                                },
                                                                new Section("Room visibility")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = AvailabilityPicker = new RoomAvailabilityPicker
                                                                    {
                                                                        Enabled = { Value = false }
                                                                    },
                                                                },
                                                                new Section("Game type")
                                                                {
                                                                    Child = new FillFlowContainer
                                                                    {
                                                                        AutoSizeAxes     = Axes.Y,
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Direction        = FillDirection.Vertical,
                                                                        Spacing          = new Vector2(7),
                                                                        Children         = new Drawable[]
                                                                        {
                                                                            TypePicker = new MatchTypePicker
                                                                            {
                                                                                RelativeSizeAxes = Axes.X,
                                                                            },
                                                                            typeLabel = new OsuSpriteText
                                                                            {
                                                                                Font   = OsuFont.GetFont(size: 14),
                                                                                Colour = colours.Yellow
                                                                            },
                                                                        },
                                                                    },
                                                                },
                                                                new Section("Queue mode")
                                                                {
                                                                    Child = new Container
                                                                    {
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Height           = 40,
                                                                        Child            = QueueModeDropdown = new OsuEnumDropdown <QueueMode>
                                                                        {
                                                                            RelativeSizeAxes = Axes.X
                                                                        }
                                                                    }
                                                                }
                                                            },
                                                        },
                                                        new SectionContainer
                                                        {
                                                            Anchor  = Anchor.TopRight,
                                                            Origin  = Anchor.TopRight,
                                                            Padding = new MarginPadding {
                                                                Left = FIELD_PADDING / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Max participants")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = MaxParticipantsField = new OsuNumberBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        ReadOnly = true,
                                                                    },
                                                                },
                                                                new Section("Password (optional)")
                                                                {
                                                                    Child = PasswordTextBox = new OsuPasswordTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        LengthLimit = 255,
                                                                    },
                                                                },
                                                            }
                                                        }
                                                    },
                                                },
                                                playlistContainer = new FillFlowContainer
                                                {
                                                    Anchor           = Anchor.TopCentre,
                                                    Origin           = Anchor.TopCentre,
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Width            = 0.5f,
                                                    Depth            = float.MaxValue,
                                                    Spacing          = new Vector2(5),
                                                    Children         = new Drawable[]
                                                    {
                                                        drawablePlaylist = new DrawableRoomPlaylist(false, false)
                                                        {
                                                            RelativeSizeAxes = Axes.X,
                                                            Height           = DrawableRoomPlaylistItem.HEIGHT
                                                        },
                                                        new PurpleTriangleButton
                                                        {
                                                            RelativeSizeAxes = Axes.X,
                                                            Height           = 40,
                                                            Text             = "Select beatmap",
                                                            Action           = SelectBeatmap
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    },
                                },
                            },
                            new Drawable[]
                            {
                                new Container
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    Y                = 2,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = colourProvider.Background5
                                        },
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 20),
                                            Margin           = new MarginPadding {
                                                Vertical = 20
                                            },
                                            Padding = new MarginPadding {
                                                Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                            },
                                            Children = new Drawable[]
                                            {
                                                ApplyButton = new CreateOrUpdateButton
                                                {
                                                    Anchor  = Anchor.BottomCentre,
                                                    Origin  = Anchor.BottomCentre,
                                                    Size    = new Vector2(230, 55),
                                                    Enabled = { Value = false },
                                                    Action  = apply,
                                                },
                                                ErrorText = new OsuSpriteText
                                                {
                                                    Anchor = Anchor.BottomCentre,
                                                    Origin = Anchor.BottomCentre,
                                                    Alpha  = 0,
                                                    Depth  = 1,
                                                    Colour = colours.RedDark
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    loadingLayer = new LoadingLayer(true)
                };

                TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue.GetLocalisableDescription(), true);
                RoomName.BindValueChanged(name => NameField.Text           = name.NewValue, true);
                Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
                Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true);
                MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text = count.NewValue?.ToString(), true);
                RoomID.BindValueChanged(roomId => playlistContainer.Alpha           = roomId.NewValue == null ? 1 : 0, true);
                Password.BindValueChanged(password => PasswordTextBox.Text          = password.NewValue ?? string.Empty, true);
                QueueMode.BindValueChanged(mode => QueueModeDropdown.Current.Value  = mode.NewValue, true);

                operationInProgress.BindTo(ongoingOperationTracker.InProgress);
                operationInProgress.BindValueChanged(v =>
                {
                    if (v.NewValue)
                    {
                        loadingLayer.Show();
                    }
                    else
                    {
                        loadingLayer.Hide();
                    }
                });
            }
コード例 #2
0
ファイル: HomesteadRoom.cs プロジェクト: troseberry/Woodlands
 public void SetRoomName(RoomName name)
 {
     roomName = name;
 }
コード例 #3
0
            private void load(OsuColour colours)
            {
                Container dimContent;

                InternalChildren = new Drawable[]
                {
                    dimContent = new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Children         = new Drawable[]
                        {
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Colour           = Color4Extensions.FromHex(@"28242d"),
                            },
                            new GridContainer
                            {
                                RelativeSizeAxes = Axes.Both,
                                RowDimensions    = new[]
                                {
                                    new Dimension(GridSizeMode.Distributed),
                                    new Dimension(GridSizeMode.AutoSize),
                                },
                                Content = new[]
                                {
                                    new Drawable[]
                                    {
                                        new OsuScrollContainer
                                        {
                                            Padding = new MarginPadding
                                            {
                                                Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
                                                Vertical   = 10
                                            },
                                            RelativeSizeAxes = Axes.Both,
                                            Children         = new[]
                                            {
                                                new Container
                                                {
                                                    Padding = new MarginPadding {
                                                        Horizontal = WaveOverlayContainer.WIDTH_PADDING
                                                    },
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Children         = new Drawable[]
                                                    {
                                                        new SectionContainer
                                                        {
                                                            Padding = new MarginPadding {
                                                                Right = field_padding / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Room name")
                                                                {
                                                                    Child = NameField = new SettingsTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                    },
                                                                },
                                                                new Section("Duration")
                                                                {
                                                                    Child = DurationField = new DurationDropdown
                                                                    {
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Items            = new[]
                                                                        {
                                                                            TimeSpan.FromMinutes(30),
                                                                            TimeSpan.FromHours(1),
                                                                            TimeSpan.FromHours(2),
                                                                            TimeSpan.FromHours(4),
                                                                            TimeSpan.FromHours(8),
                                                                            TimeSpan.FromHours(12),
                                                                            //TimeSpan.FromHours(16),
                                                                            TimeSpan.FromHours(24),
                                                                            TimeSpan.FromDays(3),
                                                                            TimeSpan.FromDays(7)
                                                                        }
                                                                    }
                                                                },
                                                                new Section("Room visibility")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = AvailabilityPicker = new RoomAvailabilityPicker
                                                                    {
                                                                        Enabled = { Value = false }
                                                                    },
                                                                },
                                                                new Section("Game type")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = new FillFlowContainer
                                                                    {
                                                                        AutoSizeAxes     = Axes.Y,
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Direction        = FillDirection.Vertical,
                                                                        Spacing          = new Vector2(7),
                                                                        Children         = new Drawable[]
                                                                        {
                                                                            TypePicker = new GameTypePicker
                                                                            {
                                                                                RelativeSizeAxes = Axes.X,
                                                                                Enabled          = { Value = false }
                                                                            },
                                                                            typeLabel = new OsuSpriteText
                                                                            {
                                                                                Font   = OsuFont.GetFont(size: 14),
                                                                                Colour = colours.Yellow
                                                                            },
                                                                        },
                                                                    },
                                                                },
                                                                new Section("Max participants")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = MaxParticipantsField = new SettingsNumberTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        ReadOnly = true,
                                                                    },
                                                                },
                                                                new Section("Password (optional)")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = new SettingsPasswordTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        ReadOnly = true,
                                                                    },
                                                                },
                                                            },
                                                        },
                                                        new SectionContainer
                                                        {
                                                            Anchor  = Anchor.TopRight,
                                                            Origin  = Anchor.TopRight,
                                                            Padding = new MarginPadding {
                                                                Left = field_padding / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Playlist")
                                                                {
                                                                    Child = new GridContainer
                                                                    {
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Height           = 300,
                                                                        Content          = new[]
                                                                        {
                                                                            new Drawable[]
                                                                            {
                                                                                playlist = new DrawableRoomPlaylist(true, true)
                                                                                {
                                                                                    RelativeSizeAxes = Axes.Both
                                                                                }
                                                                            },
                                                                            new Drawable[]
                                                                            {
                                                                                playlistLength = new OsuSpriteText
                                                                                {
                                                                                    Margin = new MarginPadding {
                                                                                        Vertical = 5
                                                                                    },
                                                                                    Colour = colours.Yellow,
                                                                                    Font   = OsuFont.GetFont(size: 12),
                                                                                }
                                                                            },
                                                                            new Drawable[]
                                                                            {
                                                                                new PurpleTriangleButton
                                                                                {
                                                                                    RelativeSizeAxes = Axes.X,
                                                                                    Height           = 40,
                                                                                    Text             = "Edit playlist",
                                                                                    Action           = () => EditPlaylist?.Invoke()
                                                                                }
                                                                            }
                                                                        },
                                                                        RowDimensions = new[]
                                                                        {
                                                                            new Dimension(),
                                                                            new Dimension(GridSizeMode.AutoSize),
                                                                            new Dimension(GridSizeMode.AutoSize),
                                                                        }
                                                                    }
                                                                },
                                                            },
                                                        },
                                                    },
                                                }
                                            },
                                        },
                                    },
                                    new Drawable[]
                                    {
                                        new Container
                                        {
                                            Anchor           = Anchor.BottomLeft,
                                            Origin           = Anchor.BottomLeft,
                                            Y                = 2,
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Children         = new Drawable[]
                                            {
                                                new Box
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Colour           = Color4Extensions.FromHex(@"28242d").Darken(0.5f).Opacity(1f),
                                                },
                                                new FillFlowContainer
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Direction        = FillDirection.Vertical,
                                                    Spacing          = new Vector2(0, 20),
                                                    Margin           = new MarginPadding {
                                                        Vertical = 20
                                                    },
                                                    Padding = new MarginPadding {
                                                        Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                                    },
                                                    Children = new Drawable[]
                                                    {
                                                        ApplyButton = new CreateRoomButton
                                                        {
                                                            Anchor  = Anchor.BottomCentre,
                                                            Origin  = Anchor.BottomCentre,
                                                            Size    = new Vector2(230, 55),
                                                            Enabled = { Value = false },
                                                            Action  = apply,
                                                        },
                                                        ErrorText = new OsuSpriteText
                                                        {
                                                            Anchor = Anchor.BottomCentre,
                                                            Origin = Anchor.BottomCentre,
                                                            Alpha  = 0,
                                                            Depth  = 1,
                                                            Colour = colours.RedDark
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            },
                        }
                    },
                    loadingLayer = new LoadingLayer(dimContent)
                };

                TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue?.Name ?? string.Empty, true);
                RoomName.BindValueChanged(name => NameField.Text           = name.NewValue, true);
                Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
                Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true);
                MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text = count.NewValue?.ToString(), true);
                Duration.BindValueChanged(duration => DurationField.Current.Value   = duration.NewValue, true);

                playlist.Items.BindTo(Playlist);
                Playlist.BindCollectionChanged(onPlaylistChanged, true);
            }
コード例 #4
0
 public bool IsRoomOccuppied(RoomName name)
 {
     return(shipData.systemDatas.Exists(sys => sys.room == name));
 }
コード例 #5
0
 public bool IsRoomAvailable(RoomName name)
 {
     return(areRoomsReassignable || !IsRoomOccuppied(name));
 }
コード例 #6
0
            private void load(OsuColour colours)
            {
                InternalChildren = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = Color4Extensions.FromHex(@"28242d"),
                    },
                    new GridContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        RowDimensions    = new[]
                        {
                            new Dimension(),
                            new Dimension(GridSizeMode.AutoSize),
                        },
                        Content = new[]
                        {
                            new Drawable[]
                            {
                                new OsuScrollContainer
                                {
                                    Padding = new MarginPadding
                                    {
                                        Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
                                        Vertical   = 10
                                    },
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new[]
                                    {
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 10),
                                            Children         = new Drawable[]
                                            {
                                                new Container
                                                {
                                                    Anchor  = Anchor.TopCentre,
                                                    Origin  = Anchor.TopCentre,
                                                    Padding = new MarginPadding {
                                                        Horizontal = WaveOverlayContainer.WIDTH_PADDING
                                                    },
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Children         = new Drawable[]
                                                    {
                                                        new SectionContainer
                                                        {
                                                            Padding = new MarginPadding {
                                                                Right = FIELD_PADDING / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Room name")
                                                                {
                                                                    Child = NameField = new SettingsTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                    },
                                                                },
                                                                new Section("Room visibility")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = AvailabilityPicker = new RoomAvailabilityPicker
                                                                    {
                                                                        Enabled = { Value = false }
                                                                    },
                                                                },
                                                                new Section("Game type")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = new FillFlowContainer
                                                                    {
                                                                        AutoSizeAxes     = Axes.Y,
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Direction        = FillDirection.Vertical,
                                                                        Spacing          = new Vector2(7),
                                                                        Children         = new Drawable[]
                                                                        {
                                                                            TypePicker = new GameTypePicker
                                                                            {
                                                                                RelativeSizeAxes = Axes.X,
                                                                                Enabled          = { Value = false }
                                                                            },
                                                                            typeLabel = new OsuSpriteText
                                                                            {
                                                                                Font   = OsuFont.GetFont(size: 14),
                                                                                Colour = colours.Yellow
                                                                            },
                                                                        },
                                                                    },
                                                                },
                                                            },
                                                        },
                                                        new SectionContainer
                                                        {
                                                            Anchor  = Anchor.TopRight,
                                                            Origin  = Anchor.TopRight,
                                                            Padding = new MarginPadding {
                                                                Left = FIELD_PADDING / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Max participants")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = MaxParticipantsField = new SettingsNumberTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        ReadOnly = true,
                                                                    },
                                                                },
                                                                new Section("Password (optional)")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = new SettingsPasswordTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        ReadOnly = true,
                                                                    },
                                                                },
                                                            }
                                                        }
                                                    },
                                                },
                                                initialBeatmapControl = new BeatmapSelectionControl
                                                {
                                                    Anchor           = Anchor.TopCentre,
                                                    Origin           = Anchor.TopCentre,
                                                    RelativeSizeAxes = Axes.X,
                                                    Width            = 0.5f
                                                }
                                            }
                                        }
                                    },
                                },
                            },
                            new Drawable[]
                            {
                                new Container
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    Y                = 2,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = Color4Extensions.FromHex(@"28242d").Darken(0.5f).Opacity(1f),
                                        },
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 20),
                                            Margin           = new MarginPadding {
                                                Vertical = 20
                                            },
                                            Padding = new MarginPadding {
                                                Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                            },
                                            Children = new Drawable[]
                                            {
                                                ApplyButton = new CreateOrUpdateButton
                                                {
                                                    Anchor  = Anchor.BottomCentre,
                                                    Origin  = Anchor.BottomCentre,
                                                    Size    = new Vector2(230, 55),
                                                    Enabled = { Value = false },
                                                    Action  = apply,
                                                },
                                                ErrorText = new OsuSpriteText
                                                {
                                                    Anchor = Anchor.BottomCentre,
                                                    Origin = Anchor.BottomCentre,
                                                    Alpha  = 0,
                                                    Depth  = 1,
                                                    Colour = colours.RedDark
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    loadingLayer = new LoadingLayer(true)
                };

                TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue?.Name ?? string.Empty, true);
                RoomName.BindValueChanged(name => NameField.Text           = name.NewValue, true);
                Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
                Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true);
                MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text = count.NewValue?.ToString(), true);
                RoomID.BindValueChanged(roomId => initialBeatmapControl.Alpha       = roomId.NewValue == null ? 1 : 0, true);

                operationInProgress.BindTo(ongoingOperationTracker.InProgress);
                operationInProgress.BindValueChanged(v =>
                {
                    if (v.NewValue)
                    {
                        loadingLayer.Show();
                    }
                    else
                    {
                        loadingLayer.Hide();
                    }
                });
            }
コード例 #7
0
 public string GetCleanName()
 {
     return(!RoomName.StartsWith("${") ? RoomName : RoomName[2..^ 1]);
コード例 #8
0
            private void load(OverlayColourProvider colourProvider, OsuColour colours)
            {
                InternalChildren = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = colourProvider.Background4
                    },
                    new GridContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        RowDimensions    = new[]
                        {
                            new Dimension(),
                            new Dimension(GridSizeMode.AutoSize),
                        },
                        Content = new[]
                        {
                            new Drawable[]
                            {
                                new OsuScrollContainer
                                {
                                    Padding = new MarginPadding
                                    {
                                        Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
                                        Vertical   = 10
                                    },
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new[]
                                    {
                                        new Container
                                        {
                                            Padding = new MarginPadding {
                                                Horizontal = WaveOverlayContainer.WIDTH_PADDING
                                            },
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Children         = new Drawable[]
                                            {
                                                new SectionContainer
                                                {
                                                    Padding = new MarginPadding {
                                                        Right = FIELD_PADDING / 2
                                                    },
                                                    Children = new[]
                                                    {
                                                        new Section("Room name")
                                                        {
                                                            Child = NameField = new OsuTextBox
                                                            {
                                                                RelativeSizeAxes         = Axes.X,
                                                                TabbableContentContainer = this,
                                                                LengthLimit = 100
                                                            },
                                                        },
                                                        new Section("Duration")
                                                        {
                                                            Child = DurationField = new DurationDropdown
                                                            {
                                                                RelativeSizeAxes = Axes.X,
                                                                Items            = new[]
                                                                {
                                                                    TimeSpan.FromMinutes(30),
                                                                    TimeSpan.FromHours(1),
                                                                    TimeSpan.FromHours(2),
                                                                    TimeSpan.FromHours(4),
                                                                    TimeSpan.FromHours(8),
                                                                    TimeSpan.FromHours(12),
                                                                    //TimeSpan.FromHours(16),
                                                                    TimeSpan.FromHours(24),
                                                                    TimeSpan.FromDays(3),
                                                                    TimeSpan.FromDays(7)
                                                                }
                                                            }
                                                        },
                                                        new Section("Allowed attempts (across all playlist items)")
                                                        {
                                                            Child = MaxAttemptsField = new OsuNumberBox
                                                            {
                                                                RelativeSizeAxes         = Axes.X,
                                                                TabbableContentContainer = this,
                                                                PlaceholderText          = "Unlimited",
                                                            },
                                                        },
                                                        new Section("Room visibility")
                                                        {
                                                            Alpha = disabled_alpha,
                                                            Child = AvailabilityPicker = new RoomAvailabilityPicker
                                                            {
                                                                Enabled = { Value = false }
                                                            },
                                                        },
                                                        new Section("Max participants")
                                                        {
                                                            Alpha = disabled_alpha,
                                                            Child = MaxParticipantsField = new OsuNumberBox
                                                            {
                                                                RelativeSizeAxes         = Axes.X,
                                                                TabbableContentContainer = this,
                                                                ReadOnly = true,
                                                            },
                                                        },
                                                        new Section("Password (optional)")
                                                        {
                                                            Alpha = disabled_alpha,
                                                            Child = new OsuPasswordTextBox
                                                            {
                                                                RelativeSizeAxes         = Axes.X,
                                                                TabbableContentContainer = this,
                                                                ReadOnly = true,
                                                            },
                                                        },
                                                    },
                                                },
                                                new SectionContainer
                                                {
                                                    Anchor  = Anchor.TopRight,
                                                    Origin  = Anchor.TopRight,
                                                    Padding = new MarginPadding {
                                                        Left = FIELD_PADDING / 2
                                                    },
                                                    Children = new[]
                                                    {
                                                        new Section("Playlist")
                                                        {
                                                            Child = new GridContainer
                                                            {
                                                                RelativeSizeAxes = Axes.X,
                                                                Height           = 448,
                                                                Content          = new[]
                                                                {
                                                                    new Drawable[]
                                                                    {
                                                                        playlist = new DrawableRoomPlaylist(true, false)
                                                                        {
                                                                            RelativeSizeAxes = Axes.Both
                                                                        }
                                                                    },
                                                                    new Drawable[]
                                                                    {
                                                                        playlistLength = new OsuSpriteText
                                                                        {
                                                                            Margin = new MarginPadding {
                                                                                Vertical = 5
                                                                            },
                                                                            Colour = colours.Yellow,
                                                                            Font   = OsuFont.GetFont(size: 12),
                                                                        }
                                                                    },
                                                                    new Drawable[]
                                                                    {
                                                                        editPlaylistButton = new PurpleTriangleButton
                                                                        {
                                                                            RelativeSizeAxes = Axes.X,
                                                                            Height           = 40,
                                                                            Text             = "Edit playlist",
                                                                            Action           = () => EditPlaylist?.Invoke()
                                                                        }
                                                                    }
                                                                },
                                                                RowDimensions = new[]
                                                                {
                                                                    new Dimension(),
                                                                    new Dimension(GridSizeMode.AutoSize),
                                                                    new Dimension(GridSizeMode.AutoSize),
                                                                }
                                                            }
                                                        },
                                                    },
                                                },
                                            },
                                        }
                                    },
                                },
                            },
                            new Drawable[]
                            {
                                new Container
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    Y                = 2,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = colourProvider.Background5
                                        },
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 20),
                                            Margin           = new MarginPadding {
                                                Vertical = 20
                                            },
                                            Padding = new MarginPadding {
                                                Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                            },
                                            Children = new Drawable[]
                                            {
                                                ApplyButton = new CreateRoomButton
                                                {
                                                    Anchor  = Anchor.BottomCentre,
                                                    Origin  = Anchor.BottomCentre,
                                                    Size    = new Vector2(230, 55),
                                                    Enabled = { Value = false },
                                                    Action  = apply,
                                                },
                                                ErrorText = new OsuSpriteText
                                                {
                                                    Anchor = Anchor.BottomCentre,
                                                    Origin = Anchor.BottomCentre,
                                                    Alpha  = 0,
                                                    Depth  = 1,
                                                    Colour = colours.RedDark
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    loadingLayer = new LoadingLayer(true)
                };

                RoomName.BindValueChanged(name => NameField.Text = name.NewValue, true);
                Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
                MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text            = count.NewValue?.ToString(), true);
                MaxAttempts.BindValueChanged(count => MaxAttemptsField.Text       = count.NewValue?.ToString(), true);
                Duration.BindValueChanged(duration => DurationField.Current.Value = duration.NewValue ?? TimeSpan.FromMinutes(30), true);

                playlist.Items.BindTo(Playlist);
                Playlist.BindCollectionChanged(onPlaylistChanged, true);
            }