コード例 #1
0
ファイル: OptionsSection.cs プロジェクト: yheno/osu
        public OptionsSection()
        {
            Margin = new MarginPadding { Top = 20 };
            AutoSizeAxes = Axes.Y;
            RelativeSizeAxes = Axes.X;

            const int headerSize = 26, headerMargin = 25;
            const int borderSize = 2;
            AddInternal(new Drawable[]
            {
                new Box
                {
                    Colour = new Color4(0, 0, 0, 255),
                    RelativeSizeAxes = Axes.X,
                    Height = borderSize,
                },
                new Container
                {
                    Padding = new MarginPadding
                    {
                        Top = 20 + borderSize,
                        Left = OptionsOverlay.CONTENT_MARGINS,
                        Right = OptionsOverlay.CONTENT_MARGINS,
                        Bottom = 10,
                    },
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes = Axes.Y,
                    Children = new[]
                    {
                        headerLabel = new SpriteText
                        {
                            TextSize = headerSize,
                            Text = Header,
                        },
                        content = new FlowContainer
                        {
                            Margin = new MarginPadding { Top = headerSize + headerMargin },
                            Direction = FlowDirection.VerticalOnly,
                            Spacing = new Vector2(0, 50),
                            AutoSizeAxes = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                        },
                    }
                },
            });
        }
コード例 #2
0
ファイル: MusicController.cs プロジェクト: yheno/osu
        public MusicController()
        {
            Width = 400;
            Height = 130;
            CornerRadius = 5;
            EdgeEffect = new EdgeEffect
            {
                Type = EdgeEffectType.Shadow,
                Colour = Color4.Black.Opacity(40),
                Radius = 5,
            };

            Masking = true;
            Anchor = Anchor.TopRight;//placeholder
            Origin = Anchor.TopRight;
            Position = start_position;
            Margin = new MarginPadding(10);
        }
コード例 #3
0
ファイル: LogOverlay.cs プロジェクト: jorolf/osu-framework
        public DrawableLogEntry(LogEntry entry)
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;

            Margin = new MarginPadding(1);

            Color4 col = getColourForEntry(entry);

            CornerRadius = 5;
            Masking      = true;

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Black,
                    Alpha            = 0.6f,
                },
                new Container
                {
                    //log target coloured box
                    Margin       = new MarginPadding(3),
                    Size         = new Vector2(target_box_width, 20),
                    CornerRadius = 5,
                    Masking      = true,

                    Children = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = col,
                        },
                        new SpriteText
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Margin = new MarginPadding {
                                Left = 5, Right = 5
                            },
                            Text = entry.Target.ToString(),
                        }
                    }
                },
                new Container
                {
                    AutoSizeAxes     = Axes.Y,
                    RelativeSizeAxes = Axes.X,
                    Padding          = new MarginPadding {
                        Left = target_box_width + 10
                    },

                    Children = new Drawable[]
                    {
                        new SpriteText
                        {
                            AutoSizeAxes     = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                            Text             = entry.Message
                        }
                    }
                }
            };
        }
コード例 #4
0
 public NowPlayingOverlay()
 {
     Width  = 400;
     Margin = new MarginPadding(10);
 }
コード例 #5
0
 public MetadataLineInfo(string text)
 {
     Margin = new MarginPadding { Left = 5 };
     Text = string.IsNullOrEmpty(text) ? @"-" : text;
 }
コード例 #6
0
                    public RoundBeatmapRow(TournamentRound team, RoundBeatmap beatmap)
                    {
                        Model = beatmap;

                        Margin = new MarginPadding(10);

                        RelativeSizeAxes = Axes.X;
                        AutoSizeAxes     = Axes.Y;

                        Masking      = true;
                        CornerRadius = 5;

                        InternalChildren = new Drawable[]
                        {
                            new Box
                            {
                                Colour           = OsuColour.Gray(0.2f),
                                RelativeSizeAxes = Axes.Both,
                            },
                            new FillFlowContainer
                            {
                                Margin  = new MarginPadding(5),
                                Padding = new MarginPadding {
                                    Right = 160
                                },
                                Spacing      = new Vector2(5),
                                Direction    = FillDirection.Horizontal,
                                AutoSizeAxes = Axes.Both,
                                Children     = new Drawable[]
                                {
                                    new SettingsNumberBox
                                    {
                                        LabelText        = "Beatmap ID",
                                        RelativeSizeAxes = Axes.None,
                                        Width            = 200,
                                        Current          = beatmapId,
                                    },
                                    new SettingsTextBox
                                    {
                                        LabelText        = "Mods",
                                        RelativeSizeAxes = Axes.None,
                                        Width            = 200,
                                        Current          = mods,
                                    },
                                    drawableContainer = new Container
                                    {
                                        Size = new Vector2(100, 70),
                                    },
                                }
                            },
                            new DangerousSettingsButton
                            {
                                Anchor           = Anchor.CentreRight,
                                Origin           = Anchor.CentreRight,
                                RelativeSizeAxes = Axes.None,
                                Width            = 150,
                                Text             = "Delete Beatmap",
                                Action           = () =>
                                {
                                    Expire();
                                    team.Beatmaps.Remove(beatmap);
                                },
                            }
                        };
                    }
コード例 #7
0
ファイル: StyleScreen.cs プロジェクト: littlebees/karaoke
        private void load()
        {
            Padding = new MarginPadding(50);
            Child   = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Relative, 0.3f),
                    new Dimension(GridSizeMode.Distributed)
                },
                Content = new[]
                {
                    new Drawable[]
                    {
                        new Container
                        {
                            Name             = "Layout adjustment area",
                            RelativeSizeAxes = Axes.Both,
                            Masking          = true,
                            CornerRadius     = 10,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    Colour           = ColourProvider.Background2,
                                    RelativeSizeAxes = Axes.Both,
                                },
                                styleSections = new StyleSectionsContainer
                                {
                                    RelativeSizeAxes = Axes.Both,
                                }
                            }
                        },
                        previewContainer = new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                        }
                    }
                },
            };

            styleSections.BindableStyle.BindValueChanged(e =>
            {
                switch (e.NewValue)
                {
                case Style.Lyric:
                    previewContainer.Child = new LyricStylePreview
                    {
                        Name             = "Lyric style preview area",
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        Size             = new Vector2(0.95f),
                        RelativeSizeAxes = Axes.Both
                    };
                    break;

                case Style.Note:
                    previewContainer.Child = new NoteStylePreview
                    {
                        Name             = "Note style preview area",
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        Size             = new Vector2(0.95f),
                        RelativeSizeAxes = Axes.Both
                    };
                    break;
                }
            }, true);
        }
コード例 #8
0
        protected OnlinePlayScreen()
        {
            Anchor           = Anchor.Centre;
            Origin           = Anchor.Centre;
            RelativeSizeAxes = Axes.Both;
            Padding          = new MarginPadding {
                Horizontal = -HORIZONTAL_OVERFLOW_PADDING
            };

            var backgroundColour = Color4Extensions.FromHex(@"3e3a44");

            InternalChild = waves = new MultiplayerWaveContainer
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = backgroundColour,
                    },
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Padding          = new MarginPadding {
                            Top = Header.HEIGHT
                        },
                        Children = new[]
                        {
                            header = new Container
                            {
                                RelativeSizeAxes = Axes.X,
                                Height           = 400,
                                Children         = new[]
                                {
                                    headerBackground = new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Width            = 1.25f,
                                        Masking          = true,
                                        Children         = new Drawable[]
                                        {
                                            new HeaderBackgroundSprite
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                Height           = 400 // Keep a static height so the header doesn't change as it's resized between subscreens
                                            },
                                        }
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Padding          = new MarginPadding {
                                            Bottom = -1
                                        },                                           // 1px padding to avoid a 1px gap due to masking
                                        Child = new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = ColourInfo.GradientVertical(backgroundColour.Opacity(0.5f), backgroundColour)
                                        },
                                    }
                                }
                            },
                            screenStack = new OnlinePlaySubScreenStack {
                                RelativeSizeAxes = Axes.Both
                            }
                        }
                    },
                    new Header(ScreenTitle, screenStack),
                    createButton = CreateNewMultiplayerGameButton().With(button =>
                    {
                        button.Anchor = Anchor.TopRight;
                        button.Origin = Anchor.TopRight;
                        button.Size   = new Vector2(150, Header.HEIGHT - 20);
                        button.Margin = new MarginPadding
                        {
                            Top   = 10,
                            Right = 10 + HORIZONTAL_OVERFLOW_PADDING,
                        };
                        button.Action = () => OpenNewRoom();
                    }),
                    RoomManager = CreateRoomManager()
                }
            };

            screenStack.ScreenPushed += screenPushed;
            screenStack.ScreenExited += screenExited;

            screenStack.Push(loungeSubScreen = CreateLounge());
        }
コード例 #9
0
ファイル: HoldForMenuButton.cs プロジェクト: omkelderman/osu
 public HoldForMenuButton()
 {
     Direction = FillDirection.Horizontal;
     Spacing   = new Vector2(20, 0);
     Margin    = new MarginPadding(10);
 }
コード例 #10
0
ファイル: GroupSection.cs プロジェクト: ms2mml/osu
        private void load()
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;

            Padding = new MarginPadding(10);

            InternalChildren = new Drawable[]
            {
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Spacing          = new Vector2(10),
                    Direction        = FillDirection.Vertical,
                    Children         = new Drawable[]
                    {
                        textBox = new LabelledTextBox
                        {
                            Label = "Time"
                        },
                        button = new TriangleButton
                        {
                            Text             = "Use current time",
                            RelativeSizeAxes = Axes.X,
                            Action           = () => changeSelectedGroupTime(clock.CurrentTime)
                        }
                    }
                },
            };

            textBox.OnCommit += (sender, isNew) =>
            {
                if (!isNew)
                {
                    return;
                }

                if (double.TryParse(sender.Text, out var newTime))
                {
                    changeSelectedGroupTime(newTime);
                }
                else
                {
                    SelectedGroup.TriggerChange();
                }
            };

            SelectedGroup.BindValueChanged(group =>
            {
                if (group.NewValue == null)
                {
                    textBox.Text = string.Empty;

                    textBox.Current.Disabled = true;
                    button.Enabled.Value     = false;
                    return;
                }

                textBox.Current.Disabled = false;
                button.Enabled.Value     = true;

                textBox.Text = $"{group.NewValue.Time:n0}";
            }, true);
        }
コード例 #11
0
 private void load()
 {
     Padding = new MarginPadding {
         Vertical = 3.5f
     };
     AutoSizeAxes     = Axes.Y;
     RelativeSizeAxes = Axes.X;
     Children         = new Drawable[]
     {
         sizedContainer = new Container
         {
             Masking          = true,
             CornerRadius     = MARGIN_SIZE,
             BorderColour     = Colour4.DarkGray,
             BorderThickness  = 3,
             RelativeSizeAxes = Axes.X,
             Children         = new Drawable[]
             {
                 new Box
                 {
                     RelativeSizeAxes = Axes.Both,
                     Colour           = new Colour4(55, 55, 55, 255),
                     Alpha            = 0.8f,
                 },
                 expandedContainer = new Container
                 {
                     RelativeSizeAxes = Axes.X,
                     AutoSizeAxes     = Axes.Y,
                     Padding          = new MarginPadding(MARGIN_SIZE),
                     Children         = new Drawable[]
                     {
                         new FillFlowContainer
                         {
                             Direction    = FillDirection.Vertical,
                             Spacing      = new Vector2(MARGIN_SIZE),
                             AutoSizeAxes = Axes.Both,
                             Children     = new Drawable[]
                             {
                                 smallContainer = new FillFlowContainer
                                 {
                                     Direction    = FillDirection.Horizontal,
                                     Spacing      = new Vector2(MARGIN_SIZE),
                                     AutoSizeAxes = Axes.Both,
                                     Children     = new Drawable[]
                                     {
                                         ImageContainer = new Container
                                         {
                                             Size         = new Vector2(main_text_size + SMALL_TEXT_SIZE + MARGIN_SIZE),
                                             Masking      = true,
                                             CornerRadius = 20 * (main_text_size + SMALL_TEXT_SIZE + MARGIN_SIZE) / 150,
                                             Child        = ProjectImage = new Sprite
                                             {
                                                 RelativeSizeAxes = Axes.Both,
                                                 FillMode         = FillMode.Fit,
                                                 Anchor           = Anchor.Centre,
                                                 Origin           = Anchor.Centre,
                                             },
                                         },
                                         new FillFlowContainer
                                         {
                                             Direction    = FillDirection.Vertical,
                                             Spacing      = new Vector2(MARGIN_SIZE),
                                             AutoSizeAxes = Axes.Both,
                                             Children     = new[]
                                             {
                                                 ProjectName = new SpriteText
                                                 {
                                                     Font = new FontUsage(size: main_text_size),
                                                 },
                                                 ProjectDescription = new SpriteText
                                                 {
                                                     Font = new FontUsage(size: SMALL_TEXT_SIZE),
                                                 },
                                             },
                                         },
                                     },
                                 },
                                 UsernameBox = new SpriteText
                                 {
                                     Font = new FontUsage(size: SMALL_TEXT_SIZE),
                                 },
                                 BottomContainer = new Container
                                 {
                                     Height       = SMALL_TEXT_SIZE,
                                     AutoSizeAxes = Axes.X,
                                 },
                             },
                         },
                     },
                 },
                 buttonsContainer = new Container
                 {
                     Padding      = new MarginPadding(MARGIN_SIZE),
                     Anchor       = Anchor.CentreRight,
                     Origin       = Anchor.CentreRight,
                     AutoSizeAxes = Axes.Both,
                     Alpha        = 0,
                     Children     = new Drawable[]
                     {
                         ButtonFlowContainer = new FillFlowContainer <IconButton>
                         {
                             AutoSizeAxes = Axes.Both,
                             Anchor       = Anchor.CentreRight,
                             Origin       = Anchor.CentreRight,
                             Spacing      = new Vector2(MARGIN_SIZE),
                             Direction    = FillDirection.Horizontal,
                         },
                     },
                 },
             },
         },
     };
 }
コード例 #12
0
ファイル: OsuFileSelector.cs プロジェクト: zi-jing/osu
 private void load()
 {
     Padding = new MarginPadding(10);
 }
コード例 #13
0
        private void load(TextureStore texStore, LovewingColours colours, UserData user)
        {
            Padding = new MarginPadding {
                Right = 75, Top = 5
            };
            Spacing = new Vector2(75, 0);

            Children = new Drawable[]
            {
                new IconButton
                {
                    Icon   = FontAwesome.fa_ellipsis_v,
                    Action = ButtonAction,
                    Margin = new MarginPadding {
                        Top = 17.5f
                    },
                    Size   = new Vector2(15, 55),
                    Origin = Anchor.TopRight,
                    Anchor = Anchor.TopRight,
                    Colour = Color4.White
                },
                new CircularContainer
                {
                    Anchor           = Anchor.TopRight,
                    Origin           = Anchor.TopRight,
                    RelativeSizeAxes = Axes.Both,
                    FillMode         = FillMode.Fit,
                    Colour           = Color4.White,
                    Masking          = true,
                    BorderColour     = new Color4(85, 85, 85, 255),
                    BorderThickness  = 10,
                    Children         = new Drawable[]
                    {
                        new Sprite
                        {
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.Centre,
                            RelativeSizeAxes = Axes.Both,
                            FillMode         = FillMode.Fit,
                            Texture          = texStore.Get(user.Avatar)
                        }
                    }
                },
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    AutoSizeAxes     = Axes.X,
                    Height           = 0.4f,
                    Anchor           = Anchor.CentreRight,
                    Origin           = Anchor.CentreRight,
                    Direction        = FillDirection.Horizontal,
                    Spacing          = new Vector2(10, 0),
                    Children         = new Drawable[]
                    {
                        new IconButton
                        {
                            Anchor = Anchor.CentreRight,
                            Origin = Anchor.BottomRight,
                            Size   = new Vector2(20),
                            Colour = Color4.LightGreen,
                            Icon   = FontAwesome.fa_plus
                        },
                        new SpriteText
                        {
                            Anchor   = Anchor.TopRight,
                            Origin   = Anchor.TopRight,
                            Text     = user.Loveca.ToString(),
                            TextSize = 40
                        },
                        new CircularContainer
                        {
                            Anchor           = Anchor.BottomRight,
                            Origin           = Anchor.BottomRight,
                            RelativeSizeAxes = Axes.Both,
                            FillMode         = FillMode.Fit,
                            BorderColour     = colours.Magenta,
                            BorderThickness  = 6,
                            Masking          = true,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = Color4.Transparent
                                },
                                new SpriteIcon
                                {
                                    Anchor           = Anchor.Centre,
                                    Origin           = Anchor.Centre,
                                    Colour           = colours.Magenta,
                                    RelativeSizeAxes = Axes.Both,
                                    Size             = new Vector2(0.5f),
                                    Icon             = FontAwesome.fa_heart
                                }
                            }
                        }
                    }
                },
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    AutoSizeAxes     = Axes.X,
                    Height           = 0.4f,
                    Anchor           = Anchor.CentreRight,
                    Origin           = Anchor.CentreRight,
                    Direction        = FillDirection.Horizontal,
                    Spacing          = new Vector2(10, 0),
                    Children         = new Drawable[]
                    {
                        new IconButton
                        {
                            Anchor = Anchor.CentreRight,
                            Origin = Anchor.BottomRight,
                            Size   = new Vector2(20),
                            Colour = Color4.LightGreen,
                            Icon   = FontAwesome.fa_plus
                        },
                        new SpriteText
                        {
                            Anchor   = Anchor.TopRight,
                            Origin   = Anchor.TopRight,
                            Text     = user.Coins.ToString(),
                            TextSize = 40
                        },
                        new CircularContainer
                        {
                            Anchor           = Anchor.BottomRight,
                            Origin           = Anchor.BottomRight,
                            RelativeSizeAxes = Axes.Both,
                            FillMode         = FillMode.Fit,
                            BorderColour     = colours.Yellow,
                            BorderThickness  = 6,
                            Masking          = true,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = Color4.Transparent
                                },
                                new SpriteIcon
                                {
                                    Anchor           = Anchor.Centre,
                                    Origin           = Anchor.Centre,
                                    Colour           = colours.Yellow,
                                    RelativeSizeAxes = Axes.Both,
                                    Size             = new Vector2(0.5f),
                                    Icon             = FontAwesome.fa_star
                                }
                            }
                        }
                    }
                }
            };
        }
コード例 #14
0
ファイル: ListingHeader.cs プロジェクト: Game4all/gamebosu
        public ListingHeader()
        {
            RelativeSizeAxes = Axes.X;
            Height           = HEIGHT;
            Padding          = new MarginPadding {
                Left = -WaveOverlayContainer.WIDTH_PADDING
            };

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4Extensions.FromHex(@"#1f1921"),
                },
                new Container
                {
                    Anchor           = Anchor.CentreLeft,
                    Origin           = Anchor.CentreLeft,
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Left = WaveOverlayContainer.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                    },
                    Children = new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Spacing      = new Vector2(spacing, 0),
                            Anchor       = Anchor.CentreLeft,
                            Origin       = Anchor.CentreLeft,
                            Direction    = FillDirection.Horizontal,
                            Children     = new Drawable[]
                            {
                                new GamebosuRuleset().CreateIcon().With(t =>
                                {
                                    t.Anchor = Anchor.CentreLeft;
                                    t.Origin = Anchor.CentreLeft;
                                    t.Scale  = new Vector2(0.75f);
                                    t.Margin = new MarginPadding {
                                        Right = 10
                                    };
                                }),
                                new OsuSpriteText
                                {
                                    Anchor = Anchor.CentreLeft,
                                    Origin = Anchor.CentreLeft,
                                    Font   = OsuFont.GetFont(size: 24),
                                    Text   = "gamebosu"
                                },
                                dot = new OsuSpriteText
                                {
                                    Anchor = Anchor.CentreLeft,
                                    Origin = Anchor.CentreLeft,
                                    Font   = OsuFont.GetFont(size: 48),
                                    Text   = "·"
                                },
                                romListing = new OsuSpriteText
                                {
                                    Anchor = Anchor.CentreLeft,
                                    Origin = Anchor.CentreLeft,
                                    Font   = OsuFont.GetFont(size: 24),
                                    Text   = "rom listing"
                                }
                            }
                        },
                    },
                },
            };
        }
コード例 #15
0
        private void computeLayout()
        {
            var childrenByLine = new List <List <Drawable> >();
            var curLine        = new List <Drawable>();

            foreach (var c in Children)
            {
                NewLineContainer nlc = c as NewLineContainer;
                if (nlc != null)
                {
                    curLine.Add(nlc);
                    childrenByLine.Add(curLine);
                    curLine = new List <Drawable>();
                }
                else
                {
                    if (c.X == 0)
                    {
                        if (curLine.Count > 0)
                        {
                            childrenByLine.Add(curLine);
                        }
                        curLine = new List <Drawable>();
                    }
                    curLine.Add(c);
                }
            }

            if (curLine.Count > 0)
            {
                childrenByLine.Add(curLine);
            }

            bool  isFirstLine    = true;
            float lastLineHeight = 0f;

            foreach (var line in childrenByLine)
            {
                bool isFirstChild = true;
                IEnumerable <float> lineBaseHeightValues = line.OfType <IHasLineBaseHeight>().Select(l => l.LineBaseHeight);
                float lineBaseHeight    = lineBaseHeightValues.Any() ? lineBaseHeightValues.Max() : 0f;
                float currentLineHeight = 0f;
                float lineSpacingValue  = lastLineHeight * LineSpacing;

                foreach (Drawable c in line)
                {
                    NewLineContainer nlc = c as NewLineContainer;
                    if (nlc != null)
                    {
                        nlc.Height = nlc.IndicatesNewParagraph ? (currentLineHeight == 0 ? lastLineHeight : currentLineHeight) * ParagraphSpacing : 0;
                        continue;
                    }

                    float         childLineBaseHeight = (c as IHasLineBaseHeight)?.LineBaseHeight ?? 0f;
                    MarginPadding margin = new MarginPadding {
                        Top = (childLineBaseHeight != 0f ? lineBaseHeight - childLineBaseHeight : 0f) + lineSpacingValue
                    };
                    if (isFirstLine)
                    {
                        margin.Left = FirstLineIndent;
                    }
                    else if (isFirstChild)
                    {
                        margin.Left = ContentIndent;
                    }

                    c.Margin = margin;

                    if (c.Height > currentLineHeight)
                    {
                        currentLineHeight = c.Height;
                    }

                    isFirstChild = false;
                }

                if (currentLineHeight != 0f)
                {
                    lastLineHeight = currentLineHeight;
                }

                isFirstLine = false;
            }
        }
コード例 #16
0
        public ModSelectOverlay()
        {
            Waves.FirstWaveColour  = OsuColour.FromHex(@"19b0e2");
            Waves.SecondWaveColour = OsuColour.FromHex(@"2280a2");
            Waves.ThirdWaveColour  = OsuColour.FromHex(@"005774");
            Waves.FourthWaveColour = OsuColour.FromHex(@"003a4e");

            Height  = 510;
            Padding = new MarginPadding {
                Horizontal = -OsuScreen.HORIZONTAL_OVERFLOW_PADDING
            };

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = new Color4(36, 50, 68, 255)
                        },
                        new Triangles
                        {
                            TriangleScale    = 5,
                            RelativeSizeAxes = Axes.X,
                            Height           = Height, //set the height from the start to ensure correct triangle density.
                            ColourLight      = new Color4(53, 66, 82, 255),
                            ColourDark       = new Color4(41, 54, 70, 255),
                        },
                    },
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.BottomCentre,
                    Origin           = Anchor.BottomCentre,
                    RowDimensions    = new[]
                    {
                        new Dimension(GridSizeMode.Absolute, 90),
                        new Dimension(GridSizeMode.Distributed),
                        new Dimension(GridSizeMode.Absolute, 70),
                    },
                    Content = new[]
                    {
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = OsuColour.Gray(10).Opacity(100),
                                    },
                                    new FillFlowContainer
                                    {
                                        Origin           = Anchor.Centre,
                                        Anchor           = Anchor.Centre,
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Direction        = FillDirection.Vertical,
                                        Width            = content_width,
                                        Padding          = new MarginPadding {
                                            Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                        },
                                        Children = new Drawable[]
                                        {
                                            new OsuSpriteText
                                            {
                                                Text   = @"Gameplay Mods",
                                                Font   = OsuFont.GetFont(size: 22, weight: FontWeight.Bold),
                                                Shadow = true,
                                                Margin = new MarginPadding
                                                {
                                                    Bottom = 4,
                                                },
                                            },
                                            new OsuTextFlowContainer(text =>
                                            {
                                                text.Font   = text.Font.With(size: 18);
                                                text.Shadow = true;
                                            })
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                AutoSizeAxes     = Axes.Y,
                                                Text             = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.\nOthers are just for fun.",
                                            },
                                        },
                                    },
                                },
                            },
                        },
                        new Drawable[]
                        {
                            // Body
                            new OsuScrollContainer
                            {
                                ScrollbarVisible = false,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding
                                {
                                    Vertical   = 10,
                                    Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                },
                                Child = ModSectionsContainer = new FillFlowContainer <ModSection>
                                {
                                    Origin           = Anchor.TopCentre,
                                    Anchor           = Anchor.TopCentre,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Spacing          = new Vector2(0f, 10f),
                                    Width            = content_width,
                                    Children         = new ModSection[]
                                    {
                                        new DifficultyReductionSection {
                                            Action = modButtonPressed
                                        },
                                        new DifficultyIncreaseSection {
                                            Action = modButtonPressed
                                        },
                                        new AutomationSection {
                                            Action = modButtonPressed
                                        },
                                        new ConversionSection {
                                            Action = modButtonPressed
                                        },
                                        new FunSection {
                                            Action = modButtonPressed
                                        },
                                    }
                                },
                            },
                        },
                        new Drawable[]
                        {
                            // Footer
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = new Color4(172, 20, 116, 255),
                                        Alpha            = 0.5f,
                                    },
                                    footerContainer = new FillFlowContainer
                                    {
                                        Origin           = Anchor.BottomCentre,
                                        Anchor           = Anchor.BottomCentre,
                                        AutoSizeAxes     = Axes.Y,
                                        RelativeSizeAxes = Axes.X,
                                        Width            = content_width,
                                        Direction        = FillDirection.Horizontal,
                                        Padding          = new MarginPadding
                                        {
                                            Vertical   = 15,
                                            Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                        },
                                        Children = new Drawable[]
                                        {
                                            DeselectAllButton = new TriangleButton
                                            {
                                                Width  = 180,
                                                Text   = "Deselect All",
                                                Action = DeselectAll,
                                                Margin = new MarginPadding
                                                {
                                                    Right = 20
                                                }
                                            },
                                            CloseButton = new TriangleButton
                                            {
                                                Width  = 180,
                                                Text   = "Close",
                                                Action = Hide,
                                                Margin = new MarginPadding
                                                {
                                                    Right = 20
                                                }
                                            },
                                            new OsuSpriteText
                                            {
                                                Text   = @"Score Multiplier:",
                                                Font   = OsuFont.GetFont(size: 30),
                                                Margin = new MarginPadding
                                                {
                                                    Top   = 5,
                                                    Right = 10
                                                }
                                            },
                                            MultiplierLabel = new OsuSpriteText
                                            {
                                                Font   = OsuFont.GetFont(size: 30, weight: FontWeight.Bold),
                                                Margin = new MarginPadding
                                                {
                                                    Top = 5
                                                }
                                            },
                                            UnrankedLabel = new OsuSpriteText
                                            {
                                                Text   = @"(Unranked)",
                                                Font   = OsuFont.GetFont(size: 30, weight: FontWeight.Bold),
                                                Margin = new MarginPadding
                                                {
                                                    Top  = 5,
                                                    Left = 10
                                                }
                                            }
                                        }
                                    }
                                },
                            }
                        },
                    },
                },
            };
        }
コード例 #17
0
 protected KaraokeSettingsSection()
 {
     Margin = new MarginPadding {
         Bottom = margin
     };
 }
コード例 #18
0
        public RubyRomajiEditor()
        {
            Padding = new MarginPadding(10);

            Child = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Relative, 0.4f)
                },
                Content = new[]
                {
                    new Drawable[]
                    {
                        lyricList = new LyricList
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding(area_margin)
                        },
                        new GridContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            Content          = new[]
                            {
                                new Drawable[]
                                {
                                    lyricPreviewArea = new LyricPreviewArea
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Margin           = new MarginPadding(area_margin)
                                    }
                                },
                                new Drawable[]
                                {
                                    new GridContainer
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Content          = new[]
                                        {
                                            new Drawable[]
                                            {
                                                rubyListPreview = new RubyListPreview
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Padding          = new MarginPadding(area_margin)
                                                },
                                                romajiListPreview = new RomajiListPreview
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Padding          = new MarginPadding(area_margin)
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };
        }
コード例 #19
0
 public MatchScoreCounter()
 {
     Margin = new MarginPadding {
         Top = bar_height, Horizontal = 10
     };
 }
コード例 #20
0
 private void load(OverlayColourProvider colourProvider)
 {
     Colour = colourProvider.Light1;
     Margin = new MarginPadding(10);
 }
コード例 #21
0
        public Multiplayer()
        {
            Anchor           = Anchor.Centre;
            Origin           = Anchor.Centre;
            RelativeSizeAxes = Axes.Both;
            Padding          = new MarginPadding {
                Horizontal = -HORIZONTAL_OVERFLOW_PADDING
            };

            var backgroundColour = Color4Extensions.FromHex(@"3e3a44");

            InternalChild = waves = new MultiplayerWaveContainer
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = backgroundColour,
                    },
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Padding          = new MarginPadding {
                            Top = Header.HEIGHT
                        },
                        Children = new[]
                        {
                            header = new Container
                            {
                                RelativeSizeAxes = Axes.X,
                                Height           = 400,
                                Children         = new[]
                                {
                                    headerBackground = new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Width            = 1.25f,
                                        Masking          = true,
                                        Children         = new Drawable[]
                                        {
                                            new HeaderBackgroundSprite
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                Height           = 400 // Keep a static height so the header doesn't change as it's resized between subscreens
                                            },
                                        }
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Padding          = new MarginPadding {
                                            Bottom = -1
                                        },                                           // 1px padding to avoid a 1px gap due to masking
                                        Child = new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = ColourInfo.GradientVertical(backgroundColour.Opacity(0.5f), backgroundColour)
                                        },
                                    }
                                }
                            },
                            screenStack = new MultiplayerSubScreenStack {
                                RelativeSizeAxes = Axes.Both
                            }
                        }
                    },
                    new Header(screenStack),
                    createButton = new CreateRoomButton
                    {
                        Anchor = Anchor.TopRight,
                        Origin = Anchor.TopRight,
                        Action = () => CreateRoom()
                    },
                    roomManager = new RoomManager()
                }
            };

            screenStack.Push(loungeSubScreen = new LoungeSubScreen());

            screenStack.ScreenPushed += screenPushed;
            screenStack.ScreenExited += screenExited;
        }
コード例 #22
0
 protected override void ApplyLayout(KaraokeLayout layout)
 {
     base.ApplyLayout(layout);
     Padding = new MarginPadding(0);
 }
コード例 #23
0
ファイル: NotificationSection.cs プロジェクト: nbayt/osu
        private void load(OsuColour colours)
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;
            Direction        = FillDirection.Vertical;

            Padding = new MarginPadding
            {
                Top    = 10,
                Bottom = 5,
                Right  = 20,
                Left   = 20,
            };

            AddRangeInternal(new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Children         = new Drawable[]
                    {
                        clearButton = new ClearAllButton
                        {
                            Text   = clearText,
                            Anchor = Anchor.TopRight,
                            Origin = Anchor.TopRight,
                            Action = clearAll
                        },
                        new FillFlowContainer
                        {
                            Margin = new MarginPadding
                            {
                                Bottom = 5
                            },
                            Spacing      = new Vector2(5, 0),
                            AutoSizeAxes = Axes.Both,
                            Children     = new Drawable[]
                            {
                                titleText = new OsuSpriteText
                                {
                                    Text = title.ToUpperInvariant(),
                                    Font = @"Exo2.0-Black",
                                },
                                countText = new OsuSpriteText
                                {
                                    Text   = "3",
                                    Colour = colours.Yellow,
                                    Font   = @"Exo2.0-Black",
                                },
                            }
                        },
                    },
                },
                notifications = new AlwaysUpdateFillFlowContainer <Notification>
                {
                    AutoSizeAxes     = Axes.Y,
                    RelativeSizeAxes = Axes.X,
                    LayoutDuration   = 150,
                    LayoutEasing     = Easing.OutQuart,
                    Spacing          = new Vector2(3),
                }
            });
        }
コード例 #24
0
                    public SeedingBeatmapRow(SeedingResult result, SeedingBeatmap beatmap)
                    {
                        this.result = result;
                        Model       = beatmap;

                        Margin = new MarginPadding(10);

                        RelativeSizeAxes = Axes.X;
                        AutoSizeAxes     = Axes.Y;

                        Masking      = true;
                        CornerRadius = 5;

                        InternalChildren = new Drawable[]
                        {
                            new Box
                            {
                                Colour           = OsuColour.Gray(0.2f),
                                RelativeSizeAxes = Axes.Both,
                            },
                            new FillFlowContainer
                            {
                                Margin  = new MarginPadding(5),
                                Padding = new MarginPadding {
                                    Right = 160
                                },
                                Spacing      = new Vector2(5),
                                Direction    = FillDirection.Horizontal,
                                AutoSizeAxes = Axes.Both,
                                Children     = new Drawable[]
                                {
                                    new SettingsNumberBox
                                    {
                                        LabelText        = "Beatmap ID",
                                        RelativeSizeAxes = Axes.None,
                                        Width            = 200,
                                        Bindable         = beatmapId,
                                    },
                                    new SettingsSlider <int>
                                    {
                                        LabelText        = "Seed",
                                        RelativeSizeAxes = Axes.None,
                                        Width            = 200,
                                        Bindable         = beatmap.Seed
                                    },
                                    new SettingsTextBox
                                    {
                                        LabelText        = "Score",
                                        RelativeSizeAxes = Axes.None,
                                        Width            = 200,
                                        Bindable         = score,
                                    },
                                    drawableContainer = new Container
                                    {
                                        Size = new Vector2(100, 70),
                                    },
                                }
                            },
                            new DangerousSettingsButton
                            {
                                Anchor           = Anchor.CentreRight,
                                Origin           = Anchor.CentreRight,
                                RelativeSizeAxes = Axes.None,
                                Width            = 150,
                                Text             = "Delete Beatmap",
                                Action           = () =>
                                {
                                    Expire();
                                    result.Beatmaps.Remove(beatmap);
                                },
                            }
                        };
                    }
コード例 #25
0
 public MatchSongSelect()
 {
     Padding = new MarginPadding {
         Horizontal = HORIZONTAL_OVERFLOW_PADDING
     };
 }
コード例 #26
0
        public TranslateEditSection()
        {
            Padding = new MarginPadding(10);

            var columnDimensions = new[]
            {
                new Dimension(GridSizeMode.Absolute, 200),
                new Dimension(GridSizeMode.Absolute, column_spacing),
                new Dimension(GridSizeMode.Absolute, 400),
                new Dimension(GridSizeMode.Absolute, column_spacing),
                new Dimension()
            };

            Child = new FillFlowContainer
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Children         = new Drawable[]
                {
                    new GridContainer
                    {
                        Name          = "LanguageSelection",
                        RowDimensions = new[]
                        {
                            new Dimension(GridSizeMode.AutoSize)
                        },
                        ColumnDimensions = columnDimensions,
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Content          = new Drawable[][]
                        {
                            new[]
                            {
                                null,
                                null,
                                null,
                                null,
                                new GridContainer
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    ColumnDimensions = new[]
                                    {
                                        new Dimension(GridSizeMode.Distributed),
                                        new Dimension(GridSizeMode.Absolute, column_spacing),
                                        new Dimension(GridSizeMode.Absolute, 50),
                                        new Dimension(GridSizeMode.Absolute, column_spacing),
                                        new Dimension(GridSizeMode.Absolute, 50),
                                    },
                                    RowDimensions = new[]
                                    {
                                        new Dimension(GridSizeMode.AutoSize),
                                    },
                                    Content = new[]
                                    {
                                        new Drawable[]
                                        {
                                            languageDropdown = new LanguageDropdown
                                            {
                                                RelativeSizeAxes = Axes.X,
                                            },
                                            null,
                                            new IconButton
                                            {
                                                Y      = 5,
                                                Icon   = FontAwesome.Solid.Plus,
                                                Action = () =>
                                                {
                                                    LanguageSelectionDialog.Show();
                                                }
                                            },
                                            null,
                                            new IconButton
                                            {
                                                Y      = 5,
                                                Icon   = FontAwesome.Solid.Trash,
                                                Action = () =>
                                                {
                                                    var currentLanguage = languageDropdown.Current.Value;

                                                    if (translateManager.LanguageContainsTranslateAmount(currentLanguage) > 0)
                                                    {
                                                        DialogOverlay.Push(new DeleteLanguagePopupDialog(currentLanguage, isOk =>
                                                        {
                                                            if (isOk)
                                                            {
                                                                translateManager.RemoveLanguage(currentLanguage);
                                                            }
                                                        }));
                                                    }
                                                    else
                                                    {
                                                        translateManager.RemoveLanguage(currentLanguage);
                                                    }
                                                }
                                            },
                                        }
                                    }
                                }
                            },
                        }
                    },
                    new Container
                    {
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Children         = new[]
                        {
                            new GridContainer
                            {
                                Name          = "Background",
                                RowDimensions = new[]
                                {
                                    new Dimension(GridSizeMode.AutoSize)
                                },
                                ColumnDimensions = columnDimensions,
                                RelativeSizeAxes = Axes.Both,
                                Content          = new[]
                                {
                                    new[]
                                    {
                                        new CornerBackground
                                        {
                                            Alpha = 0,
                                        },
                                        null,
                                        null,
                                        null,
                                        null,
                                    },
                                    new[]
                                    {
                                        timeSectionBackground = new CornerBackground
                                        {
                                            RelativeSizeAxes = Axes.Both
                                        },
                                        null,
                                        lyricSectionBackground = new CornerBackground
                                        {
                                            RelativeSizeAxes = Axes.Both
                                        },
                                        null,
                                        null,
                                    },
                                }
                            },
                            translateGrid = new GridContainer
                            {
                                Name             = "Translates",
                                ColumnDimensions = columnDimensions,
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                            }
                        }
                    }
                },
            };

            NewLanguage.BindValueChanged(e =>
            {
                translateManager.AddLanguage(e.NewValue);
            });
        }
コード例 #27
0
ファイル: DrawableProfileScore.cs プロジェクト: Wieku/osu
        private void load(RulesetStore rulesets)
        {
            AddInternal(new ProfileItemContainer
            {
                Children = new Drawable[]
                {
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Padding          = new MarginPadding {
                            Left = 20, Right = performance_width
                        },
                        Children = new Drawable[]
                        {
                            new FillFlowContainer
                            {
                                Anchor       = Anchor.CentreLeft,
                                Origin       = Anchor.CentreLeft,
                                AutoSizeAxes = Axes.Both,
                                Direction    = FillDirection.Horizontal,
                                Spacing      = new Vector2(10, 0),
                                Children     = new Drawable[]
                                {
                                    new UpdateableRank(Score.Rank)
                                    {
                                        Anchor = Anchor.CentreLeft,
                                        Origin = Anchor.CentreLeft,
                                        Size   = new Vector2(50, 20),
                                    },
                                    new FillFlowContainer
                                    {
                                        Anchor       = Anchor.CentreLeft,
                                        Origin       = Anchor.CentreLeft,
                                        AutoSizeAxes = Axes.Both,
                                        Direction    = FillDirection.Vertical,
                                        Spacing      = new Vector2(0, 2),
                                        Children     = new Drawable[]
                                        {
                                            new ScoreBeatmapMetadataContainer(Score.Beatmap),
                                            new FillFlowContainer
                                            {
                                                AutoSizeAxes = Axes.Both,
                                                Direction    = FillDirection.Horizontal,
                                                Spacing      = new Vector2(15, 0),
                                                Children     = new Drawable[]
                                                {
                                                    new OsuSpriteText
                                                    {
                                                        Text   = $"{Score.Beatmap?.DifficultyName}",
                                                        Font   = OsuFont.GetFont(size: 12, weight: FontWeight.Regular),
                                                        Colour = colours.Yellow
                                                    },
                                                    new DrawableDate(Score.Date, 12)
                                                    {
                                                        Colour = colourProvider.Foreground1
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            },
                            new FillFlowContainer
                            {
                                Anchor           = Anchor.CentreRight,
                                Origin           = Anchor.CentreRight,
                                AutoSizeAxes     = Axes.X,
                                RelativeSizeAxes = Axes.Y,
                                Direction        = FillDirection.Horizontal,
                                Spacing          = new Vector2(15),
                                Children         = new Drawable[]
                                {
                                    new Container
                                    {
                                        AutoSizeAxes     = Axes.X,
                                        RelativeSizeAxes = Axes.Y,
                                        Padding          = new MarginPadding {
                                            Horizontal = 10, Vertical = 5
                                        },
                                        Anchor = Anchor.CentreRight,
                                        Origin = Anchor.CentreRight,
                                        Child  = CreateRightContent()
                                    },
                                    new FillFlowContainer
                                    {
                                        AutoSizeAxes = Axes.Both,
                                        Anchor       = Anchor.CentreRight,
                                        Origin       = Anchor.CentreRight,
                                        Direction    = FillDirection.Horizontal,
                                        Spacing      = new Vector2(2),
                                        Children     = Score.Mods.Select(mod =>
                                        {
                                            var ruleset = rulesets.GetRuleset(Score.RulesetID) ?? throw new InvalidOperationException();

                                            return(new ModIcon(ruleset.CreateInstance().CreateModFromAcronym(mod.Acronym))
                                            {
                                                Scale = new Vector2(0.35f)
                                            });
                                        }).ToList(),
                                    }
                                }
                            }
                        }
                    },
コード例 #28
0
        private void load()
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;

            Padding = new MarginPadding(10)
            {
                Bottom = 0
            };

            InternalChildren = new Drawable[]
            {
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Spacing          = new Vector2(10),
                    Direction        = FillDirection.Vertical,
                    Children         = new Drawable[]
                    {
                        textBox = new LabelledTextBox
                        {
                            Label = "Time"
                        },
                        button = new RoundedButton
                        {
                            Text             = "Use current time",
                            RelativeSizeAxes = Axes.X,
                            Action           = () => changeSelectedGroupTime(clock.CurrentTime)
                        }
                    }
                },
            };

            textBox.OnCommit += (sender, isNew) =>
            {
                if (!isNew)
                {
                    return;
                }

                if (double.TryParse(sender.Text, out double newTime))
                {
                    changeSelectedGroupTime(newTime);
                }
                else
                {
                    SelectedGroup.TriggerChange();
                }
            };

            SelectedGroup.BindValueChanged(group =>
            {
                if (group.NewValue == null)
                {
                    textBox.Text = string.Empty;

                    // cannot use textBox.Current.Disabled due to https://github.com/ppy/osu-framework/issues/3919
                    textBox.ReadOnly     = true;
                    button.Enabled.Value = false;
                    return;
                }

                textBox.ReadOnly     = false;
                button.Enabled.Value = true;

                textBox.Text = $"{group.NewValue.Time:n0}";
            }, true);
        }
コード例 #29
0
        public ModSelectOverlay()
        {
            Waves.FirstWaveColour  = Color4Extensions.FromHex(@"19b0e2");
            Waves.SecondWaveColour = Color4Extensions.FromHex(@"2280a2");
            Waves.ThirdWaveColour  = Color4Extensions.FromHex(@"005774");
            Waves.FourthWaveColour = Color4Extensions.FromHex(@"003a4e");

            RelativeSizeAxes = Axes.Both;

            Padding = new MarginPadding {
                Horizontal = -OsuScreen.HORIZONTAL_OVERFLOW_PADDING
            };

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = new Color4(36, 50, 68, 255)
                        },
                        new Triangles
                        {
                            TriangleScale    = 5,
                            RelativeSizeAxes = Axes.Both,
                            ColourLight      = new Color4(53, 66, 82, 255),
                            ColourDark       = new Color4(41, 54, 70, 255),
                        },
                    },
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.BottomCentre,
                    Origin           = Anchor.BottomCentre,
                    RowDimensions    = new[]
                    {
                        new Dimension(GridSizeMode.Absolute, 90),
                        new Dimension(GridSizeMode.Distributed),
                        new Dimension(GridSizeMode.AutoSize),
                    },
                    Content = new[]
                    {
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = OsuColour.Gray(10).Opacity(100),
                                    },
                                    new FillFlowContainer
                                    {
                                        Origin           = Anchor.Centre,
                                        Anchor           = Anchor.Centre,
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Direction        = FillDirection.Vertical,
                                        Width            = content_width,
                                        Padding          = new MarginPadding {
                                            Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                        },
                                        Children = new Drawable[]
                                        {
                                            new OsuSpriteText
                                            {
                                                Text   = @"Gameplay Mods",
                                                Font   = OsuFont.GetFont(size: 22, weight: FontWeight.Bold),
                                                Shadow = true,
                                                Margin = new MarginPadding
                                                {
                                                    Bottom = 4,
                                                },
                                            },
                                            new OsuTextFlowContainer(text =>
                                            {
                                                text.Font   = text.Font.With(size: 18);
                                                text.Shadow = true;
                                            })
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                AutoSizeAxes     = Axes.Y,
                                                Text             = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.\nOthers are just for fun.",
                                            },
                                        },
                                    },
                                },
                            },
                        },
                        new Drawable[]
                        {
                            // Body
                            new OsuScrollContainer
                            {
                                ScrollbarVisible = false,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding
                                {
                                    Vertical   = 10,
                                    Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                },
                                Child = ModSectionsContainer = new FillFlowContainer <ModSection>
                                {
                                    Origin           = Anchor.TopCentre,
                                    Anchor           = Anchor.TopCentre,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Spacing          = new Vector2(0f, 10f),
                                    Width            = content_width,
                                    LayoutDuration   = 200,
                                    LayoutEasing     = Easing.OutQuint,
                                    Children         = new ModSection[]
                                    {
                                        new DifficultyReductionSection {
                                            Action = modButtonPressed
                                        },
                                        new DifficultyIncreaseSection {
                                            Action = modButtonPressed
                                        },
                                        new AutomationSection {
                                            Action = modButtonPressed
                                        },
                                        new ConversionSection {
                                            Action = modButtonPressed
                                        },
                                        new FunSection {
                                            Action = modButtonPressed
                                        },
                                    }
                                },
                            },
                        },
                        new Drawable[]
                        {
                            // Footer
                            new Container
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = new Color4(172, 20, 116, 255),
                                        Alpha            = 0.5f,
                                    },
                                    footerContainer = new FillFlowContainer
                                    {
                                        Origin           = Anchor.BottomCentre,
                                        Anchor           = Anchor.BottomCentre,
                                        AutoSizeAxes     = Axes.Y,
                                        RelativeSizeAxes = Axes.X,
                                        Width            = content_width,
                                        Spacing          = new Vector2(footer_button_spacing, footer_button_spacing / 2),
                                        LayoutDuration   = 100,
                                        LayoutEasing     = Easing.OutQuint,
                                        Padding          = new MarginPadding
                                        {
                                            Vertical   = 15,
                                            Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                        },
                                        Children = new Drawable[]
                                        {
                                            DeselectAllButton = new TriangleButton
                                            {
                                                Width  = 180,
                                                Text   = "Deselect All",
                                                Action = DeselectAll,
                                                Origin = Anchor.CentreLeft,
                                                Anchor = Anchor.CentreLeft,
                                            },
                                            CustomiseButton = new TriangleButton
                                            {
                                                Width   = 180,
                                                Text    = "Customisation",
                                                Action  = () => ModSettingsContainer.Alpha = ModSettingsContainer.Alpha == 1 ? 0 : 1,
                                                Enabled = { Value = false },
                                                Origin  = Anchor.CentreLeft,
                                                Anchor  = Anchor.CentreLeft,
                                            },
                                            CloseButton = new TriangleButton
                                            {
                                                Width  = 180,
                                                Text   = "Close",
                                                Action = Hide,
                                                Origin = Anchor.CentreLeft,
                                                Anchor = Anchor.CentreLeft,
                                            },
                                            new FillFlowContainer
                                            {
                                                AutoSizeAxes = Axes.Both,
                                                Spacing      = new Vector2(footer_button_spacing / 2, 0),
                                                Origin       = Anchor.CentreLeft,
                                                Anchor       = Anchor.CentreLeft,
                                                Children     = new Drawable[]
                                                {
                                                    new OsuSpriteText
                                                    {
                                                        Text   = @"Score Multiplier:",
                                                        Font   = OsuFont.GetFont(size: 30),
                                                        Origin = Anchor.CentreLeft,
                                                        Anchor = Anchor.CentreLeft,
                                                    },
                                                    MultiplierLabel = new OsuSpriteText
                                                    {
                                                        Font   = OsuFont.GetFont(size: 30, weight: FontWeight.Bold),
                                                        Origin = Anchor.CentreLeft,
                                                        Anchor = Anchor.CentreLeft,
                                                        Width  = 70, // make width fixed so reflow doesn't occur when multiplier number changes.
                                                    },
                                                },
                                            },
                                        }
                                    }
                                },
                            }
                        },
                    },
                },
                ModSettingsContainer = new ModSettingsContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.BottomRight,
                    Origin           = Anchor.BottomRight,
                    Width            = 0.25f,
                    Alpha            = 0,
                    X            = -100,
                    SelectedMods = { BindTarget = SelectedMods },
                }
            };

            ((IBindable <bool>)CustomiseButton.Enabled).BindTo(ModSettingsContainer.HasSettingsForSelection);
        }
コード例 #30
0
ファイル: Multiplayer.cs プロジェクト: nwabear/osu
        public Multiplayer()
        {
            Anchor           = Anchor.Centre;
            Origin           = Anchor.Centre;
            RelativeSizeAxes = Axes.Both;
            Padding          = new MarginPadding {
                Horizontal = -HORIZONTAL_OVERFLOW_PADDING
            };

            InternalChild = waves = new MultiplayerWaveContainer
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new Drawable[]
                {
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Masking          = true,
                        Children         = new Drawable[]
                        {
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Colour           = OsuColour.FromHex(@"3e3a44"),
                            },
                            new Triangles
                            {
                                RelativeSizeAxes = Axes.Both,
                                ColourLight      = OsuColour.FromHex(@"3c3842"),
                                ColourDark       = OsuColour.FromHex(@"393540"),
                                TriangleScale    = 5,
                            },
                        },
                    },
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Padding          = new MarginPadding {
                            Top = Header.HEIGHT
                        },
                        Child = screenStack = new OsuScreenStack(loungeSubScreen = new LoungeSubScreen())
                        {
                            RelativeSizeAxes = Axes.Both
                        }
                    },
                    new Header(screenStack),
                    createButton = new HeaderButton
                    {
                        Anchor           = Anchor.TopRight,
                        Origin           = Anchor.TopRight,
                        RelativeSizeAxes = Axes.None,
                        Size             = new Vector2(150, Header.HEIGHT - 20),
                        Margin           = new MarginPadding
                        {
                            Top   = 10,
                            Right = 10 + HORIZONTAL_OVERFLOW_PADDING,
                        },
                        Text   = "Create room",
                        Action = () => loungeSubScreen.Open(new Room
                        {
                            Name = { Value = $"{api.LocalUser}'s awesome room" }
                        }),
                    },
                    roomManager = new RoomManager()
                }
            };

            screenStack.ScreenPushed += screenPushed;
            screenStack.ScreenExited += screenExited;
        }
コード例 #31
0
        public DrawableTournamentMatch(TournamentMatch match, bool editor = false)
        {
            Match       = match;
            this.editor = editor;

            AutoSizeAxes = Axes.Both;

            Margin = new MarginPadding(5);

            InternalChildren = new[]
            {
                selectionBox = new Container
                {
                    CornerRadius     = 5,
                    Masking          = true,
                    Scale            = new Vector2(1.05f),
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    Alpha            = 0,
                    Colour           = Color4.YellowGreen,
                    Child            = new Box {
                        RelativeSizeAxes = Axes.Both
                    }
                },
                currentMatchSelectionBox = new Container
                {
                    CornerRadius     = 5,
                    Masking          = true,
                    Scale            = new Vector2(1.05f),
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    Alpha            = 0,
                    Colour           = Color4.OrangeRed,
                    Child            = new Box {
                        RelativeSizeAxes = Axes.Both
                    }
                },
                Flow = new FillFlowContainer <DrawableMatchTeam>
                {
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Vertical,
                    Spacing      = new Vector2(2)
                }
            };

            boundReference(match.Team1).BindValueChanged(_ => updateTeams());
            boundReference(match.Team2).BindValueChanged(_ => updateTeams());
            boundReference(match.Team1Score).BindValueChanged(_ => updateWinConditions());
            boundReference(match.Team2Score).BindValueChanged(_ => updateWinConditions());
            boundReference(match.Round).BindValueChanged(_ =>
            {
                updateWinConditions();
                Changed?.Invoke();
            });
            boundReference(match.Completed).BindValueChanged(_ => updateProgression());
            boundReference(match.Progression).BindValueChanged(_ => updateProgression());
            boundReference(match.LosersProgression).BindValueChanged(_ => updateProgression());
            boundReference(match.Losers).BindValueChanged(_ =>
            {
                updateTeams();
                Changed?.Invoke();
            });
            boundReference(match.Current).BindValueChanged(_ => updateCurrentMatch(), true);
            boundReference(match.Position).BindValueChanged(pos =>
            {
                if (!IsDragged)
                {
                    Position = new Vector2(pos.NewValue.X, pos.NewValue.Y);
                }
                Changed?.Invoke();
            }, true);

            updateTeams();
        }
コード例 #32
0
ファイル: Validation.cs プロジェクト: ms2mml/osu-framework
 /// <summary>
 /// Returns whether the components of a <see cref="MarginPadding"/> are not infinite or NaN.
 /// <para>For further information, see <seealso cref="float.IsFinite(float)"/>.</para>
 /// </summary>
 /// <param name="toCheck">The <see cref="MarginPadding"/> to check.</param>
 /// <returns>False if either component of <paramref name="toCheck"/> are Infinity or NaN, true otherwise. </returns>
 public static bool IsFinite(MarginPadding toCheck) => float.IsFinite(toCheck.Top) && float.IsFinite(toCheck.Bottom) && float.IsFinite(toCheck.Left) && float.IsFinite(toCheck.Right);