Esempio n. 1
0
        public RoomInfo()
        {
            AutoSizeAxes = Axes.Y;

            RoomStatusInfo  statusInfo;
            ModeTypeInfo    typeInfo;
            ParticipantInfo participantInfo;

            InternalChild = new FillFlowContainer
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Direction        = FillDirection.Vertical,
                Spacing          = new Vector2(0, 4),
                Children         = new Drawable[]
                {
                    new Container
                    {
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Children         = new Drawable[]
                        {
                            new FillFlowContainer
                            {
                                Anchor           = Anchor.CentreLeft,
                                Origin           = Anchor.CentreLeft,
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Direction        = FillDirection.Vertical,
                                Children         = new Drawable[]
                                {
                                    roomName = new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(size: 30))
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                    },
                                    statusInfo = new RoomStatusInfo(),
                                }
                            },
                            typeInfo = new ModeTypeInfo
                            {
                                Anchor = Anchor.BottomRight,
                                Origin = Anchor.BottomRight
                            }
                        }
                    },
                    participantInfo = new ParticipantInfo(),
                }
            };

            statusElements.AddRange(new Drawable[] { statusInfo, typeInfo, participantInfo });
        }
Esempio n. 2
0
        private void load(OsuColour colours)
        {
            Box             sideStrip;
            ParticipantInfo participantInfo;
            OsuSpriteText   name;

            Children = new Drawable[]
            {
                selectionBox,
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding(SELECTION_BORDER_WIDTH),
                    Child            = new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Masking          = true,
                        CornerRadius     = corner_radius,
                        EdgeEffect       = new EdgeEffectParameters
                        {
                            Type   = EdgeEffectType.Shadow,
                            Colour = Color4.Black.Opacity(40),
                            Radius = 5,
                        },
                        Children = new Drawable[]
                        {
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Colour           = OsuColour.FromHex(@"212121"),
                            },
                            sideStrip = new Box
                            {
                                RelativeSizeAxes = Axes.Y,
                                Width            = side_strip_width,
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Y,
                                Width            = cover_width,
                                Masking          = true,
                                Margin           = new MarginPadding {
                                    Left = side_strip_width
                                },
                                Child = background = new UpdateableBeatmapBackgroundSprite {
                                    RelativeSizeAxes = Axes.Both
                                }
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding
                                {
                                    Vertical = content_padding,
                                    Left     = side_strip_width + cover_width + content_padding,
                                    Right    = content_padding,
                                },
                                Children = new Drawable[]
                                {
                                    new FillFlowContainer
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Direction        = FillDirection.Vertical,
                                        Spacing          = new Vector2(5f),
                                        Children         = new Drawable[]
                                        {
                                            name = new OsuSpriteText {
                                                TextSize = 18
                                            },
                                            participantInfo = new ParticipantInfo(),
                                        },
                                    },
                                    new FillFlowContainer
                                    {
                                        Anchor           = Anchor.BottomLeft,
                                        Origin           = Anchor.BottomLeft,
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Direction        = FillDirection.Vertical,
                                        Spacing          = new Vector2(0, 5),
                                        Children         = new Drawable[]
                                        {
                                            new RoomStatusInfo(Room),
                                            beatmapTitle = new BeatmapTitle {
                                                TextSize = 14
                                            },
                                        },
                                    },
                                    modeTypeInfo = new ModeTypeInfo
                                    {
                                        Anchor = Anchor.BottomRight,
                                        Origin = Anchor.BottomRight,
                                    },
                                },
                            },
                        },
                    },
                },
            };

            background.Beatmap.BindTo(bindings.CurrentBeatmap);
            modeTypeInfo.Beatmap.BindTo(bindings.CurrentBeatmap);
            modeTypeInfo.Ruleset.BindTo(bindings.CurrentRuleset);
            modeTypeInfo.Type.BindTo(bindings.Type);
            beatmapTitle.Beatmap.BindTo(bindings.CurrentBeatmap);
            participantInfo.Host.BindTo(bindings.Host);
            participantInfo.Participants.BindTo(bindings.Participants);
            participantInfo.ParticipantCount.BindTo(bindings.ParticipantCount);

            bindings.Name.BindValueChanged(n => name.Text = n, true);
            bindings.Status.BindValueChanged(s =>
            {
                foreach (Drawable d in new Drawable[] { selectionBox, sideStrip })
                {
                    d.FadeColour(s.GetAppropriateColour(colours), transition_duration);
                }
            }, true);
        }