コード例 #1
0
        public ToolbarModeSelector()
        {
            RelativeSizeAxes = Axes.Y;

            Children = new Drawable[]
            {
                new OpaqueBackground(),
                modeButtons = new FlowContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    AutoSizeAxes     = Axes.X,
                    Direction        = FlowDirection.HorizontalOnly,
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                    Padding          = new MarginPadding {
                        Left = 10, Right = 10
                    },
                },
                modeButtonLine = new Container
                {
                    RelativeSizeAxes = Axes.X,
                    Size             = new Vector2(0.3f, 3),
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.TopLeft,
                    Masking          = true,
                    EdgeEffect       = new EdgeEffect
                    {
                        Type      = EdgeEffectType.Glow,
                        Colour    = new Color4(255, 194, 224, 100),
                        Radius    = 15,
                        Roundness = 15,
                    },
                    Children = new []
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                        }
                    }
                }
            };

            int amountButtons = 0;

            foreach (PlayMode m in Enum.GetValues(typeof(PlayMode)))
            {
                ++amountButtons;

                var localMode = m;
                modeButtons.Add(new ToolbarModeButton
                {
                    Mode   = m,
                    Action = delegate
                    {
                        SetGameMode(localMode);
                        OnPlayModeChange?.Invoke(localMode);
                    }
                });
            }
        }
コード例 #2
0
ファイル: TextBox.cs プロジェクト: ddevault/osu-framework
        public override void Load()
        {
            base.Load();

            Masking = true;

            Add(background = new Box
            {
                Colour           = BackgroundUnfocused,
                RelativeSizeAxes = Axes.Both,
            });

            Add(textContainer = new Container
            {
                RelativeSizeAxes = Axes.Both
            });

            textFlow = new FlowContainer
            {
                Direction = FlowDirection.HorizontalOnly,
            };

            cursor = new Box
            {
                Size             = Vector2.One,
                Colour           = Color4.Transparent,
                RelativeSizeAxes = Axes.Y,
                Alpha            = 0
            };

            textContainer.Add(cursor);
            textContainer.Add(textFlow);
        }
コード例 #3
0
ファイル: OptionsSidebar.cs プロジェクト: yheno/osu
 public OptionsSidebar()
 {
     RelativeSizeAxes = Axes.Y;
     InternalChildren = new Drawable[]
     {
         new Box
         {
             Colour = Color4.Black,
             RelativeSizeAxes = Axes.Both,
         },
         new SidebarScrollContainer
         {
             Children = new []
             {
                 content = new FlowContainer
                 {
                     Origin = Anchor.CentreLeft,
                     Anchor = Anchor.CentreLeft,
                     AutoSizeAxes = Axes.Y,
                     RelativeSizeAxes = Axes.X,
                     Direction = FlowDirection.VerticalOnly
                 }
             }
         },
     };
 }
コード例 #4
0
        private void createArea(Direction scrollDir)
        {
            Axes scrollAxis = scrollDir == Direction.Horizontal ? Axes.X : Axes.Y;

            Children = new[]
            {
                scroll = new ScrollContainer(scrollDir)
                {
                    Padding = new MarginPadding {
                        Left = 150
                    },
                    Children = new []
                    {
                        flow = new FlowContainer
                        {
                            LayoutDuration   = 100,
                            LayoutEasing     = EasingTypes.Out,
                            Spacing          = new Vector2(1, 1),
                            RelativeSizeAxes = Axes.Both & ~scrollAxis,
                            AutoSizeAxes     = scrollAxis,
                            Padding          = new MarginPadding(5)
                        }
                    },
                },
            };
        }
コード例 #5
0
ファイル: TestCaseTextAwesome.cs プロジェクト: yheno/osu
        public override void Reset()
        {
            base.Reset();

            FlowContainer flow;

            Add(flow = new FlowContainer()
            {
                RelativeSizeAxes = Axes.Both,
                Size = new Vector2(0.5f),
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre
            });

            int i = 50;
            foreach (FontAwesome fa in Enum.GetValues(typeof(FontAwesome)))
            {
                flow.Add(new TextAwesome
                {
                    Icon = fa,
                    TextSize = 60,
                    Colour = new Color4(
                        Math.Max(0.5f, RNG.NextSingle()),
                        Math.Max(0.5f, RNG.NextSingle()),
                        Math.Max(0.5f, RNG.NextSingle()),
                        1)
                });

                if (i-- == 0) break;
            }
        }
コード例 #6
0
ファイル: Sidebar.cs プロジェクト: revam/osu
 public Sidebar()
 {
     RelativeSizeAxes = Axes.Y;
     InternalChildren = new Drawable[]
     {
         new Box
         {
             Colour           = Color4.Black,
             RelativeSizeAxes = Axes.Both,
         },
         new SidebarScrollContainer
         {
             Children = new []
             {
                 content = new FlowContainer
                 {
                     Origin           = Anchor.CentreLeft,
                     Anchor           = Anchor.CentreLeft,
                     AutoSizeAxes     = Axes.Y,
                     RelativeSizeAxes = Axes.X,
                     Direction        = FlowDirections.Vertical
                 }
             }
         },
     };
 }
コード例 #7
0
        public override void Reset()
        {
            base.Reset();

            FlowContainer flow;

            Children = new []
            {
                new ScrollContainer
                {
                    Children = new []
                    {
                        flow = new FlowContainer
                        {
                            LayoutDuration   = 100,
                            LayoutEasing     = EasingTypes.Out,
                            Spacing          = new Vector2(1, 1),
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Padding          = new MarginPadding(5)
                        }
                    },
                },
            };

            boxCreator?.Cancel();
            boxCreator = Scheduler.AddDelayed(delegate
            {
                if (Parent == null)
                {
                    return;
                }

                Box box;
                Container container = new Container
                {
                    Size     = new Vector2(80, 80),
                    Children = new[] {
                        box = new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.Centre,
                            Colour           = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1)
                        }
                    }
                };

                flow.Add(container);

                container.FadeInFromZero(1000);
                container.Delay(RNG.Next(0, 20000), true);
                container.FadeOutFromOne(4000);
                box.RotateTo((RNG.NextSingle() - 0.5f) * 90, 4000);
                box.ScaleTo(0.5f, 4000);
                container.Expire();
            }, 100, true);

            Scheduler.Add(boxCreator);
        }
コード例 #8
0
        public override void Load()
        {
            base.Load();

            Masking = true;

            Add(background = new Box()
            {
                Colour   = BackgroundUnfocused,
                SizeMode = InheritMode.XY,
            });

            Add(TextContainer = new Container()
            {
                SizeMode = InheritMode.XY
            });

            textFlow = new FlowContainer()
            {
                Direction = FlowDirection.HorizontalOnly,
            };

            cursor = new Box()
            {
                Size     = Vector2.One,
                Colour   = Color4.Transparent,
                SizeMode = InheritMode.Y,
                Alpha    = 0
            };

            TextContainer.Add(cursor);
            TextContainer.Add(textFlow);
        }
コード例 #9
0
        public override void Reset()
        {
            base.Reset();

            FlowContainer flow;

            Add(flow = new FlowContainer()
            {
                RelativeSizeAxes = Axes.Both,
                Size             = new Vector2(0.5f),
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre
            });

            int i = 50;

            foreach (FontAwesome fa in Enum.GetValues(typeof(FontAwesome)))
            {
                flow.Add(new TextAwesome
                {
                    Icon     = fa,
                    TextSize = 60,
                    Colour   = new Color4(
                        Math.Max(0.5f, RNG.NextSingle()),
                        Math.Max(0.5f, RNG.NextSingle()),
                        Math.Max(0.5f, RNG.NextSingle()),
                        1)
                });

                if (i-- == 0)
                {
                    break;
                }
            }
        }
コード例 #10
0
ファイル: TestCase.cs プロジェクト: NeoAdonis/osu-framework
 public virtual void Reset()
 {
     if (Contents == null)
     {
         InternalChildren = new Drawable[]
         {
             new ScrollContainer
             {
                 Children = new[]
                 {
                     buttonsContainer = new FlowContainer
                     {
                         Direction    = FlowDirection.VerticalOnly,
                         AutoSizeAxes = Axes.Both,
                         Spacing      = new Vector2(15, 5)
                     }
                 }
             },
             Contents = new Container()
             {
                 RelativeSizeAxes = Axes.Both,
             },
         };
     }
     else
     {
         Contents.Clear();
         buttonsContainer.Clear();
     }
 }
コード例 #11
0
        public VisualisedDrawable(Drawable d, TreeContainer tree)
        {
            this.tree = tree;
            Target    = d;

            attachEvents();

            var sprite = Target as Sprite;

            AutoSizeAxes = Axes.Both;
            Add(new[]
            {
                activityInvalidate = new Box
                {
                    Colour   = Color4.Yellow,
                    Size     = new Vector2(2, line_height),
                    Position = new Vector2(6, 0),
                    Alpha    = 0
                },
                activityLayout = new Box
                {
                    Colour   = Color4.Orange,
                    Size     = new Vector2(2, line_height),
                    Position = new Vector2(3, 0),
                    Alpha    = 0
                },
                activityAutosize = new Box
                {
                    Colour   = Color4.Red,
                    Size     = new Vector2(2, line_height),
                    Position = new Vector2(0, 0),
                    Alpha    = 0
                },
                previewBox = sprite?.Texture == null ? previewBox = new Box {
                    Colour = Color4.White
                } : new Sprite
                {
                    Texture = sprite.Texture,
                    Scale   = new Vector2(sprite.Texture.DisplayWidth / sprite.Texture.DisplayHeight, 1),
                },
                text = new SpriteText
                {
                    Position = new Vector2(24, -3),
                    Scale    = new Vector2(0.9f),
                },
                Flow = new FlowContainer
                {
                    Direction    = FlowDirections.Vertical,
                    AutoSizeAxes = Axes.Both,
                    Position     = new Vector2(10, 14)
                },
            });

            previewBox.Position = new Vector2(9, 0);
            previewBox.Size     = new Vector2(line_height, line_height);

            updateSpecifics();
        }
コード例 #12
0
ファイル: ToolbarModeSelector.cs プロジェクト: yheno/osu
        public ToolbarModeSelector()
        {
            RelativeSizeAxes = Axes.Y;

            Children = new Drawable[]
            {
                new OpaqueBackground(),
                modeButtons = new FlowContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    AutoSizeAxes = Axes.X,
                    Direction = FlowDirection.HorizontalOnly,
                    Anchor = Anchor.TopCentre,
                    Origin = Anchor.TopCentre,
                    Padding = new MarginPadding { Left = 10, Right = 10 },
                },
                modeButtonLine = new Container
                {
                    RelativeSizeAxes = Axes.X,
                    Size = new Vector2(0.3f, 3),
                    Anchor = Anchor.BottomLeft,
                    Origin = Anchor.TopLeft,
                    Masking = true,
                    EdgeEffect = new EdgeEffect
                    {
                        Type = EdgeEffectType.Glow,
                        Colour = new Color4(255, 194, 224, 100),
                        Radius = 15,
                        Roundness = 15,
                    },
                    Children = new []
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                        }
                    }
                }
            };

            int amountButtons = 0;
            foreach (PlayMode m in Enum.GetValues(typeof(PlayMode)))
            {
                ++amountButtons;

                var localMode = m;
                modeButtons.Add(new ToolbarModeButton
                {
                    Mode = m,
                    Action = delegate
                    {
                        SetGameMode(localMode);
                        OnPlayModeChange?.Invoke(localMode);
                    }
                });
            }
        }
コード例 #13
0
        private UIElement GetFilterElements()
        {
            var flow = new FlowContainer(new FieldElement {
                EditValue   = "{FilterParameters.Month}",
                CaptionHtml = "Spotkania w miesiącu",
                Width       = "20"
            });

            return(flow);
        }
コード例 #14
0
ファイル: TournamentSwitcher.cs プロジェクト: shadiwolf/e
        protected override Drawable CreateComponent()
        {
            var drawable = base.CreateComponent();

            FlowContainer.Insert(-1, dropdown = new OsuDropdown <string>
            {
                Width = 510
            });

            return(drawable);
        }
コード例 #15
0
        public override void Reset()
        {
            base.Reset();

            FlowContainer textBoxes = new FlowContainer
            {
                Direction = FlowDirections.Vertical,
                Padding   = new MarginPadding
                {
                    Top = 50,
                },
                Spacing          = new Vector2(0, 50),
                Anchor           = Anchor.TopCentre,
                Origin           = Anchor.TopCentre,
                RelativeSizeAxes = Axes.Both,
                Size             = new Vector2(0.8f, 1)
            };

            Add(textBoxes);

            textBoxes.Add(new TextBox
            {
                Size = new Vector2(100, 16),
            });

            textBoxes.Add(new TextBox
            {
                Text        = @"Limited length",
                Size        = new Vector2(200, 20),
                LengthLimit = 20
            });

            textBoxes.Add(new TextBox
            {
                Text = @"Box with some more text",
                Size = new Vector2(500, 30),
            });

            textBoxes.Add(new TextBox
            {
                PlaceholderText = @"Placeholder text",
                Size            = new Vector2(500, 30),
            });

            textBoxes.Add(new TextBox
            {
                Text            = @"prefilled placeholder",
                PlaceholderText = @"Placeholder text",
                Size            = new Vector2(500, 30),
            });


            //textBoxes.Add(tb = new PasswordTextBox(@"", 14, Vector2.Zero, 300));
        }
コード例 #16
0
        private UIElement GetGroupElements()
        {
            var flow  = new FlowContainer();
            var tasks = Tasks;

            for (var i = 0; i < tasks.Length; i++)
            {
                flow.Elements.Add(getUIElement(i));
            }
            return(flow);
        }
コード例 #17
0
        public RadioButtonCollection()
        {
            AutoSizeAxes = Axes.Y;

            InternalChild = buttonContainer = new FillFlowContainer <DrawableRadioButton>
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Direction        = FillDirection.Vertical,
                Spacing          = new Vector2(0, 5)
            };
        }
コード例 #18
0
ファイル: OptionsSection.cs プロジェクト: fystir/osu
        public OptionsSection()
        {
            Margin = new MarginPadding {
                Top = 20
            };

            const int headerSize = 26, headerMargin = 25;
            const int borderSize = 2;

            AutoSizeAxes     = Axes.Y;
            RelativeSizeAxes = Axes.X;
            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[]
                    {
                        new SpriteText
                        {
                            TextSize = headerSize,
                            Colour   = new Color4(247, 198, 35, 255),
                            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,
                        },
                    }
                },
            });
        }
コード例 #19
0
ファイル: ToolbarModeSelector.cs プロジェクト: Vexus178/osu
        public ToolbarModeSelector()
        {
            RelativeSizeAxes = Axes.Y;

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = new Color4(20, 20, 20, 255)
                },
                modeButtons = new FlowContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    AutoSizeAxes     = Axes.X,
                    Direction        = FlowDirection.HorizontalOnly,
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                },
                modeButtonLine = new Box
                {
                    RelativeSizeAxes = Axes.X,
                    Size             = new Vector2(0.3f, 3),
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.TopCentre,
                    Colour           = Color4.White
                }
            };

            int amountButtons = 0;

            foreach (PlayMode m in Enum.GetValues(typeof(PlayMode)))
            {
                ++amountButtons;

                var localMode = m;
                modeButtons.Add(new ToolbarModeButton
                {
                    Mode   = m,
                    Action = delegate
                    {
                        SetGameMode(localMode);
                        OnPlayModeChange?.Invoke(localMode);
                    }
                });
            }

            // We need to set the size within LoadComplete, because
            Size = new Vector2(amountButtons * ToolbarButton.WIDTH + padding * 2, 1);
        }
コード例 #20
0
        private void load()
        {
            Width            = width;
            RelativeSizeAxes = Axes.Y;

            AlwaysPresent = true;

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Black,
                    Alpha            = 0.6f,
                },
                scrollContainer = new OsuScrollContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Margin           = new MarginPadding {
                        Top = Toolbar.Toolbar.HEIGHT
                    },
                    Children = new[]
                    {
                        sections = new FillFlowContainer <NotificationSection>
                        {
                            Direction        = FillDirection.Vertical,
                            AutoSizeAxes     = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                            Children         = new[]
                            {
                                new NotificationSection
                                {
                                    Title       = @"Notifications",
                                    ClearText   = @"Clear All",
                                    AcceptTypes = new[] { typeof(SimpleNotification) },
                                },
                                new NotificationSection
                                {
                                    Title       = @"Running Tasks",
                                    ClearText   = @"Cancel All",
                                    AcceptTypes = new[] { typeof(ProgressNotification) },
                                },
                            }
                        }
                    }
                }
            };
        }
コード例 #21
0
        public BeatmapSetHeader(WorkingBeatmap beatmap)
        {
            this.beatmap = beatmap;

            Children = new Drawable[]
            {
                new PanelBackground(beatmap)
                {
                    RelativeSizeAxes = Axes.Both,
                },
                new FlowContainer
                {
                    Direction = FlowDirections.Vertical,
                    Padding   = new MarginPadding {
                        Top = 5, Left = 18, Right = 10, Bottom = 10
                    },
                    AutoSizeAxes = Axes.Both,
                    Children     = new[]
                    {
                        title = new OsuSpriteText
                        {
                            Font     = @"Exo2.0-BoldItalic",
                            Text     = beatmap.BeatmapSetInfo.Metadata.Title,
                            TextSize = 22,
                            Shadow   = true,
                        },
                        artist = new OsuSpriteText
                        {
                            Margin = new MarginPadding {
                                Top = -1
                            },
                            Font     = @"Exo2.0-SemiBoldItalic",
                            Text     = beatmap.BeatmapSetInfo.Metadata.Artist,
                            TextSize = 17,
                            Shadow   = true,
                        },
                        difficultyIcons = new FlowContainer
                        {
                            Margin = new MarginPadding {
                                Top = 5
                            },
                            AutoSizeAxes = Axes.Both,
                        }
                    }
                }
            };
        }
コード例 #22
0
        public override void Reset()
        {
            base.Reset();

            FlowContainer flow;

            Children = new Drawable[]
            {
                new ScrollContainer
                {
                    Children = new[]
                    {
                        flow = new FlowContainer
                        {
                            Anchor       = Anchor.TopLeft,
                            AutoSizeAxes = Axes.Both,
                            Direction    = FlowDirection.VerticalOnly,
                        }
                    }
                }
            };

            flow.Add(new SpriteText
            {
                Text = @"the quick red fox jumps over the lazy brown dog"
            });
            flow.Add(new SpriteText
            {
                Text = @"THE QUICK RED FOX JUMPS OVER THE LAZY BROWN DOG"
            });
            flow.Add(new SpriteText
            {
                Text = @"0123456789!@#$%^&*()_-+-[]{}.,<>;'\"
            });

            for (int i = 1; i <= 200; i++)
            {
                SpriteText text = new SpriteText
                {
                    Text     = $@"Font testy at size {i}",
                    TextSize = i
                };

                flow.Add(text);
            }
        }
コード例 #23
0
ファイル: TournamentSwitcher.cs プロジェクト: omkelderman/osu
        protected override Drawable CreateComponent()
        {
            var drawable = base.CreateComponent();

            FlowContainer.Insert(-1, folderButton = new TriangleButton
            {
                Text  = "Open folder",
                Width = 100
            });

            FlowContainer.Insert(-2, dropdown = new OsuDropdown <string>
            {
                Width = 510
            });

            return(drawable);
        }
コード例 #24
0
ファイル: ToolbarModeSelector.cs プロジェクト: UgiNyaa/osu
        public override void Load(BaseGame game)
        {
            base.Load(game);

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = new Color4(20, 20, 20, 255)
                },
                modeButtons = new FlowContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    AutoSizeAxes     = Axes.X,
                    Direction        = FlowDirection.HorizontalOnly,
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                },
                modeButtonLine = new Box
                {
                    RelativeSizeAxes = Axes.X,
                    Size             = new Vector2(0.3f, 3),
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.TopCentre,
                    Colour           = Color4.White
                }
            };

            foreach (PlayMode m in Enum.GetValues(typeof(PlayMode)))
            {
                var localMode = m;
                modeButtons.Add(new ToolbarModeButton
                {
                    Mode   = m,
                    Action = delegate
                    {
                        SetGameMode(localMode);
                        OnPlayModeChange?.Invoke(localMode);
                    }
                });
            }

            RelativeSizeAxes = Axes.Y;
            Size             = new Vector2(modeButtons.Children.Count() * ToolbarButton.WIDTH + padding * 2, 1);
        }
コード例 #25
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,
                        },
                    }
                },
            });
        }
コード例 #26
0
ファイル: Group.cs プロジェクト: guivieiras/osu
        public Group(string name)
        {
            GroupName = name;

            Size = new Vector2(176, 128);

            Masking      = true;
            CornerRadius = 4;

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = new Color4(54, 54, 54, 255)
                },
                // Group name
                new OsuSpriteText
                {
                    Anchor = Anchor.TopCentre,
                    Origin = Anchor.TopCentre,

                    Position = new Vector2(0, 7f),

                    Text     = $"GROUP {name.ToUpper()}",
                    TextSize = 8f,
                    Font     = @"Exo2.0-Bold",
                    Colour   = new Color4(255, 204, 34, 255),
                },
                teams = new FillFlowContainer <GroupTeam>
                {
                    RelativeSizeAxes = Axes.Both,

                    Spacing = new Vector2(6f, 22),

                    Margin = new MarginPadding
                    {
                        Top    = 21f,
                        Bottom = 7f,
                        Left   = 7f,
                        Right  = 7f
                    }
                }
            };
        }
コード例 #27
0
        private void load(FirstRunSetupOverlay?firstRunSetup)
        {
            X                = WIDTH;
            Width            = WIDTH;
            RelativeSizeAxes = Axes.Y;

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.Gray(0.05f),
                },
                new OsuScrollContainer
                {
                    Masking          = true,
                    RelativeSizeAxes = Axes.Both,
                    Children         = new[]
                    {
                        sections = new FillFlowContainer <NotificationSection>
                        {
                            Direction        = FillDirection.Vertical,
                            AutoSizeAxes     = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                            Children         = new[]
                            {
                                new NotificationSection(AccountsStrings.NotificationsTitle, "Clear All")
                                {
                                    AcceptTypes = new[] { typeof(SimpleNotification) }
                                },
                                new NotificationSection(@"Running Tasks", @"Cancel All")
                                {
                                    AcceptTypes = new[] { typeof(ProgressNotification) }
                                }
                            }
                        }
                    }
                }
            };

            if (firstRunSetup != null)
            {
                firstRunSetupVisibility.BindTo(firstRunSetup.State);
            }
        }
コード例 #28
0
        private void initializeChannels()
        {
            careChannels = new List <Channel>();

            if (api.State != APIState.Online)
            {
                return;
            }

            Add(flow = new FlowContainer
            {
                RelativeSizeAxes = Axes.Both,
                Direction        = FlowDirection.VerticalOnly
            });

            SpriteText loading;

            Add(loading = new SpriteText
            {
                Text     = @"Loading available channels...",
                Anchor   = Anchor.Centre,
                Origin   = Anchor.Centre,
                TextSize = 40,
            });

            messageRequest?.Cancel();

            ListChannelsRequest req = new ListChannelsRequest();

            req.Success += delegate(List <Channel> channels)
            {
                Scheduler.Add(delegate
                {
                    loading.FadeOut(100);
                });

                addChannel(channels.Find(c => c.Name == @"#osu"));
                addChannel(channels.Find(c => c.Name == @"#lobby"));
                addChannel(channels.Find(c => c.Name == @"#english"));

                messageRequest = scheduler.AddDelayed(() => FetchNewMessages(api), 1000, true);
            };
            api.Queue(req);
        }
コード例 #29
0
        public ManiaPlayfield(int columnCount)
        {
            this.columnCount = columnCount;

            if (columnCount <= 0)
            {
                throw new ArgumentException("Can't have zero or fewer columns.");
            }

            Children = new Drawable[]
            {
                new Container
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Y,
                    AutoSizeAxes     = Axes.X,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = Color4.Black
                        },
                        Columns = new FillFlowContainer <Column>
                        {
                            RelativeSizeAxes = Axes.Y,
                            AutoSizeAxes     = Axes.X,
                            Direction        = FillDirection.Horizontal,
                            Padding          = new MarginPadding {
                                Left = 1, Right = 1
                            },
                            Spacing = new Vector2(1, 0)
                        }
                    }
                }
            };

            for (int i = 0; i < columnCount; i++)
            {
                Columns.Add(new Column());
            }
        }
コード例 #30
0
        internal override void Reset()
        {
            base.Reset();

            FlowContainer flow = new FlowContainer()
            {
                LayoutDuration = 100,
                LayoutEasing   = EasingTypes.Out,
                Padding        = new Vector2(1, 1),
                SizeMode       = InheritMode.X
            };

            boxCreator?.Cancel();

            boxCreator = scheduler.AddDelayed(delegate
            {
                if (Parent == null)
                {
                    return;
                }

                Box box = new Box()
                {
                    Size   = new Vector2(80, 80),
                    Colour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1)
                };

                flow.Add(box);

                box.FadeInFromZero(1000);
                box.Delay(RNG.Next(0, 20000));
                box.FadeOutFromOne(4000);
                box.Expire();
            }, 100, true);

            scheduler.Add(boxCreator);

            ScrollContainer scrolling = new ScrollContainer();

            scrolling.Add(flow);
            Add(scrolling);
        }
コード例 #31
0
        public override void Reset()
        {
            base.Reset();

            iterationsBindable = new BindableInt(2000)
            {
                MinValue = 50,
                MaxValue = 20000,
            };

            SliderBar <int> iterations;

            Add(iterations = new BasicSliderBar <int>
            {
                Size           = new Vector2(200, 20),
                SelectionColor = Color4.Pink,
                KeyboardStep   = 100
            });

            Add(iterationsText = new SpriteText
            {
                X        = 210,
                TextSize = 16
            });

            iterations.Current.BindTo(iterationsBindable);
            iterations.Current.ValueChanged += v => Invalidate(Invalidation.DrawNode, shallPropagate: false);

            Add(scroll = new ScrollContainer
            {
                RelativeSizeAxes = Axes.Both,
                Y        = 25,
                Children = new[]
                {
                    flow = new FillFlowContainer <SpriteText>
                    {
                        AutoSizeAxes = Axes.Both,
                        Direction    = FillDirection.Vertical
                    }
                }
            });
        }
コード例 #32
0
        private void visualise(Drawable d, FlowContainer container)
        {
            if (d == this)
            {
                return;
            }

            var drawables = container.Children.Cast <VisualisedDrawable>();

            drawables.ForEach(dd => dd.CheckExpiry());

            VisualisedDrawable vd = drawables.FirstOrDefault(dd => dd.Target == d);

            if (vd == null)
            {
                vd = new VisualisedDrawable(d);
                container.Add(vd);
            }

            d.Children.ForEach(c => visualise(c, vd.Flow));
        }
コード例 #33
0
        private void load()
        {
            Width            = width;
            RelativeSizeAxes = Axes.Y;

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Black,
                    Alpha            = 0.6f
                },
                new OsuScrollContainer
                {
                    Masking          = true,
                    RelativeSizeAxes = Axes.Both,
                    Children         = new[]
                    {
                        sections = new FillFlowContainer <NotificationSection>
                        {
                            Direction        = FillDirection.Vertical,
                            AutoSizeAxes     = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                            Children         = new[]
                            {
                                new NotificationSection(@"Notifications", @"Clear All")
                                {
                                    AcceptTypes = new[] { typeof(SimpleNotification) }
                                },
                                new NotificationSection(@"Running Tasks", @"Cancel All")
                                {
                                    AcceptTypes = new[] { typeof(ProgressNotification) }
                                }
                            }
                        }
                    }
                }
            };
        }
コード例 #34
0
        private void load()
        {
            Width            = width;
            RelativeSizeAxes = Axes.Y;

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.Gray(0.05f),
                },
                new OsuScrollContainer
                {
                    Masking          = true,
                    RelativeSizeAxes = Axes.Both,
                    Children         = new[]
                    {
                        sections = new FillFlowContainer <NotificationSection>
                        {
                            Direction        = FillDirection.Vertical,
                            AutoSizeAxes     = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                            Children         = new[]
                            {
                                new NotificationSection(@"通知", @"清除所有")
                                {
                                    AcceptTypes = new[] { typeof(SimpleNotification) }
                                },
                                new NotificationSection(@"執行中", @"取消所有")
                                {
                                    AcceptTypes = new[] { typeof(ProgressNotification) }
                                }
                            }
                        }
                    }
                }
            };
        }
コード例 #35
0
ファイル: TestCaseChatDisplay.cs プロジェクト: yheno/osu
        private void initializeChannels()
        {
            careChannels = new List<Channel>();

            if (api.State != APIState.Online)
                return;

            Add(flow = new FlowContainer
            {
                RelativeSizeAxes = Axes.Both,
                Direction = FlowDirection.VerticalOnly
            });

            SpriteText loading;
            Add(loading = new SpriteText
            {
                Text = @"Loading available channels...",
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                TextSize = 40,
            });

            messageRequest?.Cancel();

            ListChannelsRequest req = new ListChannelsRequest();
            req.Success += delegate (List<Channel> channels)
            {
                Scheduler.Add(delegate
                {
                    loading.FadeOut(100);
                });

                addChannel(channels.Find(c => c.Name == @"#osu"));
                addChannel(channels.Find(c => c.Name == @"#lobby"));
                addChannel(channels.Find(c => c.Name == @"#english"));

                messageRequest = scheduler.AddDelayed(() => FetchNewMessages(api), 1000, true);
            };
            api.Queue(req);
        }