コード例 #1
0
        public void TestShearedButton(bool bigButton)
        {
            ShearedButton button      = null;
            bool          actionFired = false;

            AddStep("create button", () =>
            {
                actionFired = false;

                if (bigButton)
                {
                    Child = button = new ShearedButton(400)
                    {
                        LighterColour = Colour4.FromHex("#FFFFFF"),
                        DarkerColour  = Colour4.FromHex("#FFCC22"),
                        TextColour    = Colour4.Black,
                        TextSize      = 36,
                        Anchor        = Anchor.Centre,
                        Origin        = Anchor.Centre,
                        Text          = "Let's GO!",
                        Height        = 80,
                        Action        = () => actionFired = true,
                    };
                }
                else
                {
                    Child = button = new ShearedButton(200)
                    {
                        LighterColour = Colour4.FromHex("#FF86DD"),
                        DarkerColour  = Colour4.FromHex("#DE31AE"),
                        TextColour    = Colour4.White,
                        Anchor        = Anchor.Centre,
                        Origin        = Anchor.Centre,
                        Text          = "Press me",
                        Height        = 80,
                        Action        = () => actionFired = true,
                    };
                }
            });

            AddStep("set disabled", () => button.Enabled.Value = false);
            AddStep("press button", () => button.TriggerClick());
            AddAssert("action not fired", () => !actionFired);

            AddStep("set enabled", () => button.Enabled.Value = true);
            AddStep("press button", () => button.TriggerClick());
            AddAssert("action fired", () => actionFired);
        }
コード例 #2
0
        private void load(OsuColour colours)
        {
            Header.Title       = FirstRunSetupOverlayStrings.FirstRunSetupTitle;
            Header.Description = FirstRunSetupOverlayStrings.FirstRunSetupDescription;

            MainAreaContent.AddRange(new Drawable[]
            {
                content = new Container
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding
                    {
                        Horizontal = 70 * 1.2f,
                        Bottom     = 20,
                    },
                    Child = new InputBlockingContainer
                    {
                        Masking          = true,
                        CornerRadius     = 14,
                        RelativeSizeAxes = Axes.Both,
                        Children         = new Drawable[]
                        {
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Colour           = ColourProvider.Background6,
                            },
                            stackContainer = new Container
                            {
                                Anchor           = Anchor.Centre,
                                Origin           = Anchor.Centre,
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding
                                {
                                    Vertical   = 20,
                                    Horizontal = 70,
                                },
                            }
                        },
                    },
                },
            });

            FooterContent.Add(new GridContainer
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Margin           = new MarginPadding {
                    Vertical = PADDING
                },
                Anchor           = Anchor.BottomLeft,
                Origin           = Anchor.BottomLeft,
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 10),
                    new Dimension(GridSizeMode.AutoSize),
                    new Dimension(),
                    new Dimension(GridSizeMode.Absolute, 10),
                },
                RowDimensions = new[]
                {
                    new Dimension(GridSizeMode.AutoSize),
                },
                Content = new[]
                {
                    new[]
                    {
                        Empty(),
                        BackButton = new ShearedButton(300)
                        {
                            Text          = CommonStrings.Back,
                            Action        = showPreviousStep,
                            Enabled       = { Value = false },
                            DarkerColour  = colours.Pink2,
                            LighterColour = colours.Pink1,
                        },
                        NextButton = new ShearedButton(0)
                        {
                            RelativeSizeAxes = Axes.X,
                            Width            = 1,
                            Text             = FirstRunSetupOverlayStrings.GetStarted,
                            DarkerColour     = ColourProvider.Colour2,
                            LighterColour    = ColourProvider.Colour1,
                            Action           = showNextStep
                        },
                        Empty(),
                    },
                }
            });
        }
コード例 #3
0
ファイル: FirstRunSetupOverlay.cs プロジェクト: Wieku/osu
        private void load(OsuColour colours, LegacyImportManager?legacyImportManager)
        {
            steps.Add(typeof(ScreenWelcome));
            steps.Add(typeof(ScreenUIScale));
            steps.Add(typeof(ScreenBeatmaps));
            if (legacyImportManager?.SupportsImportFromStable == true)
            {
                steps.Add(typeof(ScreenImportFromStable));
            }
            steps.Add(typeof(ScreenBehaviour));

            Header.Title       = FirstRunSetupOverlayStrings.FirstRunSetupTitle;
            Header.Description = FirstRunSetupOverlayStrings.FirstRunSetupDescription;

            MainAreaContent.AddRange(new Drawable[]
            {
                content = new PopoverContainer
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Bottom = 20,
                    },
                    Child = new GridContainer
                    {
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        RelativeSizeAxes = Axes.Both,
                        ColumnDimensions = new[]
                        {
                            new Dimension(),
                            new Dimension(minSize: 640, maxSize: 800),
                            new Dimension(),
                        },
                        Content = new[]
                        {
                            new[]
                            {
                                Empty(),
                                new InputBlockingContainer
                                {
                                    Masking          = true,
                                    CornerRadius     = 14,
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = ColourProvider.Background6,
                                        },
                                        loading = new LoadingSpinner(),
                                        new Container
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Padding          = new MarginPadding {
                                                Vertical = 20
                                            },
                                            Child = screenContent = new Container {
                                                RelativeSizeAxes = Axes.Both,
                                            },
                                        },
                                    },
                                },
                                Empty(),
                            },
                        }
                    }
                },
            });

            FooterContent.Add(new GridContainer
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Margin           = new MarginPadding {
                    Vertical = PADDING
                },
                Anchor           = Anchor.BottomLeft,
                Origin           = Anchor.BottomLeft,
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 10),
                    new Dimension(GridSizeMode.AutoSize),
                    new Dimension(),
                    new Dimension(GridSizeMode.Absolute, 10),
                },
                RowDimensions = new[]
                {
                    new Dimension(GridSizeMode.AutoSize),
                },
                Content = new[]
                {
                    new[]
                    {
                        Empty(),
                        BackButton = new ShearedButton(300)
                        {
                            Text          = CommonStrings.Back,
                            Action        = showPreviousStep,
                            Enabled       = { Value = false },
                            DarkerColour  = colours.Pink2,
                            LighterColour = colours.Pink1,
                        },
                        NextButton = new ShearedButton(0)
                        {
                            RelativeSizeAxes = Axes.X,
                            Width            = 1,
                            Text             = FirstRunSetupOverlayStrings.GetStarted,
                            DarkerColour     = ColourProvider.Colour2,
                            LighterColour    = ColourProvider.Colour1,
                            Action           = showNextStep
                        },
                        Empty(),
                    },
                }
            });
        }