Beispiel #1
0
        protected TestScene()
        {
            Name = RemovePrefix(GetType().ReadableName());

            RelativeSizeAxes = Axes.Both;
            Masking          = true;

            base.AddInternal(new Container
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new Drawable[]
                {
                    new Box
                    {
                        Colour           = new Color4(25, 25, 25, 255),
                        RelativeSizeAxes = Axes.Y,
                        Width            = steps_width,
                    },
                    scroll = new BasicScrollContainer
                    {
                        Width            = steps_width,
                        Depth            = float.MinValue,
                        RelativeSizeAxes = Axes.Y,
                        Child            = StepsContainer = new FillFlowContainer <Drawable>
                        {
                            Direction        = FillDirection.Vertical,
                            Spacing          = new Vector2(3),
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Padding          = new MarginPadding(10),
                            Child            = new SpriteText
                            {
                                Font   = FrameworkFont.Condensed.With(size: 16),
                                Text   = Name,
                                Margin = new MarginPadding {
                                    Bottom = 5
                                },
                            }
                        },
                    },
                    new Container
                    {
                        Masking = true,
                        Padding = new MarginPadding
                        {
                            Left   = steps_width + padding,
                            Right  = padding,
                            Top    = padding,
                            Bottom = padding,
                        },
                        RelativeSizeAxes = Axes.Both,
                        Child            = content = new DrawFrameRecordingContainer
                        {
                            Masking          = true,
                            RelativeSizeAxes = Axes.Both
                        }
                    },
                }
            });
        }
        private void load()
        {
            var ruleset = new OsuRuleset().RulesetInfo;

            var normal = CreateWorkingBeatmap(ruleset).BeatmapSetInfo;

            normal.OnlineInfo.HasVideo      = true;
            normal.OnlineInfo.HasStoryboard = true;

            var undownloadable = getUndownloadableBeatmapSet(ruleset);

            Child = new BasicScrollContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Padding          = new MarginPadding(20),
                    Spacing          = new Vector2(0, 20),
                    Children         = new Drawable[]
                    {
                        new DirectGridPanel(normal),
                        new DirectListPanel(normal),
                        new DirectGridPanel(undownloadable),
                        new DirectListPanel(undownloadable),
                    },
                },
            };
        }
Beispiel #3
0
        private void load()
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;
            Masking          = true;
            CornerRadius     = 4;

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Coral,
                },
                scrollContainer = new BasicScrollContainer(Direction.Horizontal)
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    ScrollbarVisible = false,
                    Child            = descriptionContainer = new FillFlowContainer
                    {
                        Anchor       = Anchor.CentreLeft,
                        Origin       = Anchor.CentreLeft,
                        AutoSizeAxes = Axes.Both,
                        Direction    = FillDirection.Horizontal,
                    },
                },
            };

            scrollContainer.ScrollContent.RelativeSizeAxes = Axes.None;
            scrollContainer.ScrollContent.AutoSizeAxes     = Axes.Both;

            for (int i = 0; i < model.ExpectedArguments.Length; i++)
            {
                descriptionContainer.AddRange(new Drawable[]
                {
                    new SpriteText
                    {
                        Padding = new MarginPadding(4),
                        Text    = model.Text[i],
                        Font    = new FontUsage(size: 25),
                        Anchor  = Anchor.CentreLeft,
                        Origin  = Anchor.CentreLeft,
                    },
                    new ArgumentChanger(model.ExpectedArguments[i], model.Arguments[i]),
                });
            }

            if (model.ExpectedArguments.Length < model.Text.Length)
            {
                descriptionContainer.Add(new SpriteText
                {
                    Padding = new MarginPadding(4),
                    Text    = model.Text.Last(),
                    Font    = new FontUsage(size: 25),
                    Anchor  = Anchor.CentreLeft,
                    Origin  = Anchor.CentreLeft,
                });
            }
        }
Beispiel #4
0
        private void load(RulesetStore rulesets)
        {
            var normal = CreateWorkingBeatmap(Ruleset.Value).BeatmapSetInfo;

            normal.OnlineInfo.HasVideo      = true;
            normal.OnlineInfo.HasStoryboard = true;

            var undownloadable   = getUndownloadableBeatmapSet();
            var manyDifficulties = getManyDifficultiesBeatmapSet(rulesets);

            Child = new BasicScrollContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Full,
                    Padding          = new MarginPadding(20),
                    Spacing          = new Vector2(5, 20),
                    Children         = new Drawable[]
                    {
                        new GridBeatmapPanel(normal),
                        new GridBeatmapPanel(undownloadable),
                        new GridBeatmapPanel(manyDifficulties),
                        new ListBeatmapPanel(normal),
                        new ListBeatmapPanel(undownloadable),
                        new ListBeatmapPanel(manyDifficulties),
                    },
                },
            };
        }
Beispiel #5
0
        public TestSceneCommentsContainer()
        {
            BasicScrollContainer scrollFlow;

            Add(scrollFlow = new BasicScrollContainer
            {
                RelativeSizeAxes = Axes.Both,
            });

            AddStep("Big Black comments", () =>
            {
                scrollFlow.Clear();
                scrollFlow.Add(new CommentsContainer(CommentableType.Beatmapset, 41823));
            });

            AddStep("Airman comments", () =>
            {
                scrollFlow.Clear();
                scrollFlow.Add(new CommentsContainer(CommentableType.Beatmapset, 24313));
            });

            AddStep("lazer build comments", () =>
            {
                scrollFlow.Clear();
                scrollFlow.Add(new CommentsContainer(CommentableType.Build, 4772));
            });
        }
Beispiel #6
0
        public TestSceneEasingCurves()
        {
            FillFlowContainer easingsContainer = null;

            var easingTypes = Enum.GetValues(typeof(Easing))
                              .OfType <Easing>()
                              .ToList();

            AddStep("set up easings", () => Child = new BasicScrollContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = easingsContainer = new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Children         = easingTypes.Select(type => new Visualiser(type))
                                       .ToArray()
                }
            });

            AddSliderStep("resize easings", default_size, 3 * default_size, default_size, size =>
            {
                easingsContainer?.Children?.OfType <Visualiser>().ForEach(easing => easing.ResizeTo(new Vector2(size)));
            });

            foreach (var type in easingTypes)
            {
                AddToggleStep($"toggle {type}", enabled =>
                {
                    var easingContainer           = easingsContainer.Children.OfType <Visualiser>().Single(easing => easing.Easing == type);
                    easingContainer.Visible.Value = enabled;
                });
            }
        }
Beispiel #7
0
 public void Setup() => Schedule(() =>
 {
     Child = new BasicScrollContainer
     {
         RelativeSizeAxes = Axes.Both,
         Child            = display = new FriendDisplay()
     };
 });
 private void load()
 {
     RelativeSizeAxes = Axes.Both;
     Children         = new Drawable[]
     {
         new Box
         {
             RelativeSizeAxes = Axes.Both,
             Colour           = Colour4.Black.Opacity(0.6f)
         },
         new FillFlowContainer
         {
             RelativeSizeAxes = Axes.Both,
             Children         = new Drawable[]
             {
                 scroll = new BasicScrollContainer(Direction.Horizontal)
                 {
                     RelativeSizeAxes         = Axes.Both,
                     Width                    = .7f,
                     ScrollbarOverlapsContent = false,
                     Child                    = playerCards = new FillFlowContainer <CardContainer>
                     {
                         Anchor           = Anchor.Centre,
                         Origin           = Anchor.Centre,
                         RelativeSizeAxes = Axes.Y,
                         AutoSizeAxes     = Axes.X,
                         Direction        = FillDirection.Horizontal,
                     },
                 },
                 new BasicScrollContainer(Direction.Vertical)
                 {
                     RelativeSizeAxes         = Axes.Both,
                     Width                    = .3f,
                     ScrollbarOverlapsContent = false,
                     Child                    = playerTokens = new FillFlowContainer <TokenContainer>
                     {
                         Anchor           = Anchor.Centre,
                         Origin           = Anchor.Centre,
                         RelativeSizeAxes = Axes.X,
                         AutoSizeAxes     = Axes.Y,
                         Direction        = FillDirection.Vertical,
                     },
                 }
             }
         },
         description = new HelpContainer(80)
         {
         }
     };
     description.Hide();
     scroll.ScrollContent.Anchor = Anchor.Centre;
     scroll.ScrollContent.Origin = Anchor.Centre;
     room.BindValueChanged(updatedRoom => checkPlayerHand(updatedRoom.NewValue), true);
 }
Beispiel #9
0
        private void load(RulesetStore rulesets)
        {
            var normal = getBeatmapSet();

            normal.OnlineInfo.HasVideo      = true;
            normal.OnlineInfo.HasStoryboard = true;

            var undownloadable   = getUndownloadableBeatmapSet();
            var manyDifficulties = getManyDifficultiesBeatmapSet(rulesets);

            var explicitMap = getBeatmapSet();

            explicitMap.OnlineInfo.HasExplicitContent = true;

            var featuredMap = getBeatmapSet();

            featuredMap.OnlineInfo.TrackId = 1;

            var explicitFeaturedMap = getBeatmapSet();

            explicitFeaturedMap.OnlineInfo.HasExplicitContent = true;
            explicitFeaturedMap.OnlineInfo.TrackId            = 2;

            Child = new BasicScrollContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Full,
                    Padding          = new MarginPadding(20),
                    Spacing          = new Vector2(5, 20),
                    Children         = new Drawable[]
                    {
                        new GridBeatmapPanel(normal),
                        new GridBeatmapPanel(undownloadable),
                        new GridBeatmapPanel(manyDifficulties),
                        new GridBeatmapPanel(explicitMap),
                        new GridBeatmapPanel(featuredMap),
                        new GridBeatmapPanel(explicitFeaturedMap),
                        new ListBeatmapPanel(normal),
                        new ListBeatmapPanel(undownloadable),
                        new ListBeatmapPanel(manyDifficulties),
                        new ListBeatmapPanel(explicitMap),
                        new ListBeatmapPanel(featuredMap),
                        new ListBeatmapPanel(explicitFeaturedMap)
                    },
                },
            };

            BeatmapSetInfo getBeatmapSet() => CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet;
        }
Beispiel #10
0
 public RankingsOverlay()
     : base(OverlayColourScheme.Green)
 {
     Children = new Drawable[]
     {
         new Box
         {
             RelativeSizeAxes = Axes.Both,
             Colour           = OsuColour.Gray(0.1f),
         },
         scrollFlow = new BasicScrollContainer
         {
             RelativeSizeAxes = Axes.Both,
             ScrollbarVisible = false,
             Child            = new FillFlowContainer
             {
                 AutoSizeAxes     = Axes.Y,
                 RelativeSizeAxes = Axes.X,
                 Direction        = FillDirection.Vertical,
                 Children         = new Drawable[]
                 {
                     new RankingsHeader
                     {
                         Anchor  = Anchor.TopCentre,
                         Origin  = Anchor.TopCentre,
                         Country = { BindTarget = Country },
                         Scope   = { BindTarget = Scope },
                         Ruleset = { BindTarget = ruleset }
                     },
                     new Container
                     {
                         RelativeSizeAxes = Axes.X,
                         AutoSizeAxes     = Axes.Y,
                         Children         = new Drawable[]
                         {
                             tableContainer = new Container
                             {
                                 Anchor           = Anchor.TopCentre,
                                 Origin           = Anchor.TopCentre,
                                 AutoSizeAxes     = Axes.Y,
                                 RelativeSizeAxes = Axes.X,
                                 Margin           = new MarginPadding {
                                     Vertical = 10
                                 }
                             },
                             loading = new DimmedLoadingLayer(),
                         }
                     }
                 }
             }
         }
     };
 }
 public void Setup() => Schedule(() =>
 {
     Child = new BasicScrollContainer
     {
         RelativeSizeAxes = Axes.Both,
         Child            = markdownContainer = new TestMarkdownContainer
         {
             RelativeSizeAxes = Axes.X,
             AutoSizeAxes     = Axes.Y
         }
     };
 });
Beispiel #12
0
 public TestSceneDisplayMode()
 {
     Child = new BasicScrollContainer
     {
         RelativeSizeAxes = Axes.Both,
         Child            = new FillFlowContainer
         {
             RelativeSizeAxes = Axes.X,
             AutoSizeAxes     = Axes.Y,
             Direction        = FillDirection.Vertical,
             Padding          = new MarginPadding(10),
             Spacing          = new Vector2(10),
             Children         = new Drawable[]
             {
                 new SpriteText
                 {
                     Text = "FrameworkConfigManager settings: ",
                     Font = FrameworkFont.Regular.With(size: 24),
                 },
                 new SpriteText {
                     Current = textConfigSizeFullscreen, Font = FrameworkFont.Condensed
                 },
                 new SpriteText {
                     Current = textConfigWindowMode, Font = FrameworkFont.Condensed
                 },
                 new SpriteText
                 {
                     Text   = "IWindow properties: ",
                     Font   = FrameworkFont.Regular.With(size: 24),
                     Margin = new MarginPadding {
                         Top = 7
                     },
                 },
                 new SpriteText {
                     Current = textCurrentDisplay, Font = FrameworkFont.Condensed
                 },
                 new SpriteText {
                     Current = textCurrentDisplayMode, Font = FrameworkFont.Condensed.With(size: 16)
                 },
                 new SpriteText {
                     Text = "Available display modes for current display:", Font = FrameworkFont.Condensed
                 },
                 textWindowDisplayModes = new TextFlowContainer(text => text.Font = FrameworkFont.Condensed.With(size: 16))
                 {
                     Width        = 1000,
                     AutoSizeAxes = Axes.Y,
                 }
             },
         },
     };
 }
        public void TestUnloadedWhenAsyncLoadCompletedAndMaskedAway()
        {
            BasicScrollContainer    scrollContainer = null;
            DelayedLoadTestDrawable child           = null;

            AddStep("add panel", () =>
            {
                Child = scrollContainer = new BasicScrollContainer
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Size   = new Vector2(128),
                    Child  = new Container
                    {
                        RelativeSizeAxes = Axes.X,
                        Height           = 1000,
                        Child            = new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 128,
                            Child            = new DelayedLoadUnloadWrapper(() => child = new DelayedLoadTestDrawable {
                                RelativeSizeAxes = Axes.Both
                            }, 0, 1000)
                            {
                                RelativeSizeAxes = Axes.X,
                                Height           = 128
                            }
                        }
                    }
                };
            });

            // Check that the child is disposed when its async-load completes while the wrapper is masked away.
            AddUntilStep("wait for load to begin", () => child?.LoadState == LoadState.Loading);
            AddStep("scroll to end", () => scrollContainer.ScrollToEnd(false));
            AddStep("allow load", () => child.AllowLoad.Set());
            AddUntilStep("drawable disposed", () => child.IsDisposed);

            Drawable lastChild = null;

            AddStep("store child", () => lastChild = child);

            // Check that reuse of the child is not attempted.
            AddStep("scroll to start", () => scrollContainer.ScrollToStart(false));
            AddStep("allow load of new child", () => child.AllowLoad.Set());
            AddUntilStep("new child loaded", () => child.IsLoaded);
            AddAssert("last child not loaded", () => !lastChild.IsLoaded);
        }
        public void SetUp() => Schedule(() =>
        {
            var easingTypes = Enum.GetValues(typeof(Easing))
                              .OfType <Easing>()
                              .ToList();

            Child = new BasicScrollContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = easingsContainer = new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Children         = easingTypes.Select(type => new Visualiser(type)).ToArray()
                }
            };
        });
Beispiel #15
0
        private void load(FontStore fontStore, Storage storage, TextureStore textureStore)
        {
            Child = new BasicScrollContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = flow = new FillFlowContainer <ResourceDisplay>
                {
                    Margin           = new MarginPadding(10),
                    Spacing          = new Vector2(3),
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                },
            };

            this.fontStore    = fontStore;
            this.textureStore = textureStore;
            this.storage      = storage;
        }
Beispiel #16
0
        public TestSceneCommentsContainer()
        {
            BasicScrollContainer scroll;
            CommentsContainer    comments;

            Add(scroll = new BasicScrollContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = comments = new CommentsContainer()
            });

            AddStep("Big Black comments", () => comments.ShowComments(CommentableType.Beatmapset, 41823));
            AddStep("Airman comments", () => comments.ShowComments(CommentableType.Beatmapset, 24313));
            AddStep("Lazer build comments", () => comments.ShowComments(CommentableType.Build, 4772));
            AddStep("News comments", () => comments.ShowComments(CommentableType.NewsPost, 715));
            AddStep("Idle state", () =>
            {
                scroll.Clear();
                scroll.Add(comments = new CommentsContainer());
            });
        }
 public TestSceneProxyDrawables()
 {
     Child = new BasicScrollContainer
     {
         RelativeSizeAxes = Axes.Both,
         Child            = new FillFlowContainer
         {
             RelativeSizeAxes = Axes.X,
             AutoSizeAxes     = Axes.Y,
             Children         = new[]
             {
                 generateProxyAboveAllPresentTest(1),
                 generateProxyBelowAllPresentTest(1),
                 generateProxyAboveAllPresentTest(6),
                 generateProxyBelowAllPresentTest(6),
                 generateProxyAboveOriginalMaskedAway(1),
                 generateProxyBelowOriginalMaskedAway(1),
                 generateProxyAboveOriginalMaskedAway(6),
                 generateProxyBelowOriginalMaskedAway(6),
                 generateProxyAboveBoxParentNotPresent(1),
                 generateProxyBelowBoxParentNotPresent(1),
                 generateProxyAboveBoxParentNotPresent(6),
                 generateProxyBelowBoxParentNotPresent(6),
                 generateProxyAboveBoxParentNotAlive(1),
                 generateProxyBelowBoxParentNotAlive(1),
                 generateProxyAboveBoxParentNotAlive(6),
                 generateProxyBelowBoxParentNotAlive(6),
                 generateProxyAboveParentOriginalIndirectlyMaskedAway(1),
                 generateProxyBelowParentOriginalIndirectlyMaskedAway(1),
                 generateProxyAboveParentOriginalIndirectlyMaskedAway(6),
                 generateProxyBelowParentOriginalIndirectlyMaskedAway(6),
                 generateOpaqueProxyAboveOpaqueBox(),
             }
         }
     };
 }
Beispiel #18
0
        private void load()
        {
            filesPath = store.GetFullPath("files/", true);

            RelativeSizeAxes = Axes.Both;
            Children         = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = new Colour4(100, 112, 206, 255),
                },
                itemsScrollContainer = new BasicScrollContainer
                {
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                    RelativeSizeAxes = Axes.Both,
                    ClampExtension   = 30,
                    Padding          = new MarginPadding {
                        Top = 70
                    },
                    Children = new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FillDirection.Vertical,
                            Spacing          = new Vector2(0, entry_padding / 3 * 2),
                            Padding          = new MarginPadding {
                                Top = entry_padding / 3 * 2
                            },
                            Children = new Drawable[]
                            {
                                directoriesContainer = new FillFlowContainer <DirectoryButton>
                                {
                                    Padding = new MarginPadding {
                                        Horizontal = entry_padding
                                    },
                                    Direction        = FillDirection.Full,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Anchor           = Anchor.TopLeft,
                                    Origin           = Anchor.TopLeft,
                                    Spacing          = new Vector2(entry_spacing),
                                },
                                filesContainer = new FillFlowContainer <ImageButton>
                                {
                                    Padding = new MarginPadding {
                                        Horizontal = entry_padding
                                    },
                                    Direction        = FillDirection.Full,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Anchor           = Anchor.TopLeft,
                                    Origin           = Anchor.TopLeft,
                                    Spacing          = new Vector2(entry_spacing),
                                },
                            },
                        },
                    },
                },
                new Container
                {
                    AutoSizeAxes     = Axes.Y,
                    RelativeSizeAxes = Axes.X,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = new Colour4(130, 138, 230, 255),
                        },
                        currentDirectoryText = new SpriteText
                        {
                            Font   = new FontUsage(size: 40),
                            Margin = new MarginPadding(15),
                        },
                        new IconButton(FontAwesome.Solid.Times, new Colour4(145, 151, 243, 255), backgroundColour: new Colour4(100, 112, 206, 255))
                        {
                            Action = Hide,
                            X      = -10,
                        },
                    },
                },
            };
        }
 static bool checkScrollCurrent(BasicScrollContainer scrolled, BasicScrollContainer notScrolled) => notScrolled.Current == 0 && Precision.DefinitelyBigger(scrolled.Current, 0f);
Beispiel #20
0
        private void load(ProjectEditor editor)
        {
            InternalChildren = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = new Colour4(106, 100, 104, 255),
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Content          = new[]
                    {
                        new Drawable[]
                        {
                            //Listas de elementos
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = Colour4.Gray,
                                    },
                                    new ProjectObjectManagerContainer <Card>(true)
                                    {
                                        Anchor = Anchor.TopLeft,
                                        Origin = Anchor.TopLeft,
                                        Height = 1 / 3f,
                                    },
                                    new ProjectObjectManagerContainer <Token>(true)
                                    {
                                        Anchor = Anchor.CentreLeft,
                                        Origin = Anchor.CentreLeft,
                                        Height = 1 / 3f,
                                    },
                                    new ProjectObjectManagerContainer <Board>(true)
                                    {
                                        Anchor = Anchor.BottomLeft,
                                        Origin = Anchor.BottomLeft,
                                        Height = 1 / 3f,
                                    },
                                },
                            },
                            //Area de edición
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Children         = new Drawable[]
                                {
                                    activeEditContainer = new BasicScrollContainer
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Child            = new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Children         = new Drawable[]
                                            {
                                                new Container
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Padding          = new MarginPadding {
                                                        Horizontal = 60, Vertical = 50
                                                    },
                                                    Children = new Drawable[]
                                                    {
                                                        visualEditor = new ElementVisualEditorContainer(),
                                                        new SpriteText
                                                        {
                                                            Anchor   = Anchor.TopRight,
                                                            Origin   = Anchor.TopRight,
                                                            Position = new Vector2(-675, 10),
                                                            Text     = @"Nombre:",
                                                        },
                                                        nameTextBox = new BasicTextBox
                                                        {
                                                            CommitOnFocusLost = true,
                                                            Anchor            = Anchor.TopRight,
                                                            Origin            = Anchor.TopRight,
                                                            Position          = new Vector2(-250, 0),
                                                            Height            = 35,
                                                            Width             = 400,
                                                        },
                                                        new SpriteText
                                                        {
                                                            Anchor   = Anchor.TopRight,
                                                            Origin   = Anchor.TopRight,
                                                            Position = new Vector2(-675, 80),
                                                            Text     = @"Descripción:",
                                                        },
                                                        descriptionTextBox = new BasicTextBox
                                                        {
                                                            CommitOnFocusLost = true,
                                                            Anchor            = Anchor.TopRight,
                                                            Origin            = Anchor.TopRight,
                                                            Position          = new Vector2(-250, 70),
                                                            Height            = 35,
                                                            Width             = 400,
                                                        },
                                                        new GamesToGoButton
                                                        {
                                                            Anchor = Anchor.TopRight,
                                                            Origin = Anchor.TopRight,
                                                            Height = 35,
                                                            Width  = 200,
                                                            Text   = @"Borrar Elemento",
                                                            Action = () => editor.DeleteElement(currentEditing.Value),
                                                        },
                                                    },
                                                },
                                                new Container
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    Height           = 600,
                                                    Children         = new Drawable[]
                                                    {
                                                        new FillFlowContainer
                                                        {
                                                            RelativeSizeAxes = Axes.Both,
                                                            Direction        = FillDirection.Full,
                                                            Spacing          = new Vector2(10),
                                                            Padding          = new MarginPadding {
                                                                Horizontal = 50
                                                            },
                                                            Children = new Drawable[]
                                                            {
                                                                elementSize = new VectorTextBoxContainer(4, false)
                                                                {
                                                                    TextX = @"Tamaño X:",
                                                                    TextY = @"Tamaño Y:",
                                                                },
                                                                elementOrientation = new LabeledDropdown <ElementOrientation>
                                                                {
                                                                    Text    = @"Orientación:",
                                                                    Element = new GamesToGoDropdown <ElementOrientation>
                                                                    {
                                                                        Width = 200,
                                                                    },
                                                                },
                                                                elementSideVisible = new LabeledDropdown <ElementSideVisible>
                                                                {
                                                                    Text    = @"Lado visible:",
                                                                    Element = new GamesToGoDropdown <ElementSideVisible>
                                                                    {
                                                                        Width = 200,
                                                                    },
                                                                },
                                                                elementPrivacy = new LabeledDropdown <ElementPrivacy>
                                                                {
                                                                    Text    = @"Privacidad:",
                                                                    Element = new GamesToGoDropdown <ElementPrivacy>
                                                                    {
                                                                        Width = 200,
                                                                    },
                                                                },
                                                                elementPosition = new VectorTextBoxContainer(4, true)
                                                                {
                                                                    TextX = @"Posición en X:",
                                                                    TextY = @"Posición en Y:",
                                                                },
                                                            },
                                                        },
                                                        elementSubElements = new Container
                                                        {
                                                            RelativeSizeAxes = Axes.Both,
                                                            Width            = 1 / 3f,
                                                            Anchor           = Anchor.TopRight,
                                                            Origin           = Anchor.TopRight,
                                                            Child            = tilesManagerContainer = new BoardObjectManagerContainer(),
                                                        },
                                                    },
                                                },
                                            },
                                        },
                                    },
                                    tileOverlay,
                                    noSelectionContainer = new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Anchor           = Anchor.Centre,
                                        Origin           = Anchor.Centre,
                                        Child            = new SpriteText
                                        {
                                            Anchor = Anchor.Centre,
                                            Origin = Anchor.Centre,
                                            Text   = @"Selecciona un objeto para editarlo",
                                        },
                                    },
                                },
                            },
                        },
                    },
                    ColumnDimensions = new[]
                    {
                        new Dimension(GridSizeMode.Relative, 0.25f),
                        new Dimension(),
                    },
                },
            };
            currentEditing.BindTo(editor.CurrentEditingElement);
            currentEditing.BindValueChanged(checkData, true);

            nameTextBox.OnCommit += delegate
            {
                if (currentEditing.Value != null)
                {
                    currentEditing.Value.Name.Value = nameTextBox.Text;
                }
            };

            descriptionTextBox.OnCommit += delegate
            {
                if (currentEditing.Value != null)
                {
                    currentEditing.Value.Description.Value = descriptionTextBox.Text;
                }
            };

            elementPosition.Current.BindValueChanged(_ => visualEditor.UpdatePreview());
            elementOrientation.Current.BindValueChanged(_ => visualEditor.UpdatePreview());
            elementSideVisible.Current.BindValueChanged(_ => visualEditor.UpdatePreview());
            elementSize.Current.BindValueChanged(_ => visualEditor.UpdatePreview());
            tilesManagerContainer.ElementsAdded   = _ => visualEditor.UpdatePreview();
            tilesManagerContainer.ElementsRemoved = _ => visualEditor.UpdatePreview();
        }
 private void load(ProjectEditor editor)
 {
     InternalChildren = new Drawable[]
     {
         new Box
         {
             RelativeSizeAxes = Axes.Both,
             Colour           = new Colour4(106, 100, 104, 255),
         },
         new GridContainer
         {
             RelativeSizeAxes = Axes.Both,
             Content          = new[]
             {
                 new Drawable[]
                 {
                     //Listas de elementos
                     new Container
                     {
                         RelativeSizeAxes = Axes.Both,
                         Children         = new Drawable []
                         {
                             new Box
                             {
                                 RelativeSizeAxes = Axes.Both,
                                 Colour           = Colour4.Gray,
                             },
                             new ProjectObjectManagerContainer <Card>(true)
                             {
                                 Anchor = Anchor.TopLeft,
                                 Origin = Anchor.TopLeft,
                                 Height = 1 / 3f,
                             },
                             new ProjectObjectManagerContainer <Token>(true)
                             {
                                 Anchor = Anchor.CentreLeft,
                                 Origin = Anchor.CentreLeft,
                                 Height = 1 / 3f,
                             },
                             new ProjectObjectManagerContainer <Board>(true)
                             {
                                 Anchor = Anchor.BottomLeft,
                                 Origin = Anchor.BottomLeft,
                                 Height = 1 / 3f,
                             },
                         },
                     },
                     //Area de edición
                     new Container
                     {
                         RelativeSizeAxes = Axes.Both,
                         Children         = new Drawable[]
                         {
                             activeEditContainer = new BasicScrollContainer
                             {
                                 RelativeSizeAxes = Axes.Both,
                                 Child            = new FillFlowContainer
                                 {
                                     RelativeSizeAxes = Axes.X,
                                     AutoSizeAxes     = Axes.Y,
                                     Direction        = FillDirection.Vertical,
                                     Children         = new Drawable[]
                                     {
                                         new Container
                                         {
                                             RelativeSizeAxes = Axes.X,
                                             AutoSizeAxes     = Axes.Y,
                                             Children         = new Drawable[]
                                             {
                                                 new Box
                                                 {
                                                     RelativeSizeAxes = Axes.Both,
                                                     Colour           = Colour4.Cyan,
                                                 },
                                                 new Container
                                                 {
                                                     RelativeSizeAxes = Axes.X,
                                                     AutoSizeAxes     = Axes.Y,
                                                     Padding          = new MarginPadding {
                                                         Horizontal = 60, Vertical = 50
                                                     },
                                                     Children = new Drawable[]
                                                     {
                                                         new ImagePreviewContainer(),
                                                         new SpriteText
                                                         {
                                                             Anchor   = Anchor.TopRight,
                                                             Origin   = Anchor.TopRight,
                                                             Position = new Vector2(-675, 10),
                                                             Text     = @"Nombre:",
                                                             Colour   = Colour4.Black,
                                                         },
                                                         nameTextBox = new BasicTextBox
                                                         {
                                                             Anchor   = Anchor.TopRight,
                                                             Origin   = Anchor.TopRight,
                                                             Position = new Vector2(-250, 0),
                                                             Height   = 35,
                                                             Width    = 400,
                                                         },
                                                         new SpriteText
                                                         {
                                                             Anchor   = Anchor.TopRight,
                                                             Origin   = Anchor.TopRight,
                                                             Position = new Vector2(-675, 80),
                                                             Text     = @"Descripción:",
                                                             Colour   = Colour4.Black,
                                                         },
                                                         descriptionTextBox = new BasicTextBox
                                                         {
                                                             Anchor   = Anchor.TopRight,
                                                             Origin   = Anchor.TopRight,
                                                             Position = new Vector2(-250, 70),
                                                             Height   = 35,
                                                             Width    = 400,
                                                         },
                                                     },
                                                 },
                                             },
                                         },
                                         new Container
                                         {
                                             RelativeSizeAxes = Axes.X,
                                             Height           = 600,
                                             Children         = new Drawable[]
                                             {
                                                 new Box
                                                 {
                                                     RelativeSizeAxes = Axes.Both,
                                                     Colour           = Colour4.Fuchsia,
                                                 },
                                                 elementSize = new Container
                                                 {
                                                     RelativeSizeAxes = Axes.Both,
                                                     Children         = new Drawable[]
                                                     {
                                                         new SpriteText
                                                         {
                                                             Text     = @"Tamaño X:",
                                                             Position = new Vector2(50, 50),
                                                         },
                                                         sizeTextBoxX = new NumericTextBox(4)
                                                         {
                                                             Height   = 35,
                                                             Width    = 75,
                                                             Position = new Vector2(125, 45),
                                                         },
                                                         new SpriteText
                                                         {
                                                             Text     = @"Tamaño Y:",
                                                             Position = new Vector2(50, 100),
                                                         },
                                                         sizeTextBoxY = new NumericTextBox(4)
                                                         {
                                                             Height   = 35,
                                                             Width    = 75,
                                                             Position = new Vector2(125, 95),
                                                         },
                                                     },
                                                 },
                                                 elementSubElements = new Container
                                                 {
                                                     RelativeSizeAxes = Axes.Both,
                                                     Width            = 1 / 3f,
                                                     Anchor           = Anchor.TopRight,
                                                     Origin           = Anchor.TopRight,
                                                     Child            = tilesManagerContainer = new BoardObjectManagerContainer(),
                                                 },
                                             },
                                         },
                                     },
                                 },
                             },
                             tileOverlay,
                             noSelectionContainer = new Container
                             {
                                 RelativeSizeAxes = Axes.Both,
                                 Anchor           = Anchor.Centre,
                                 Origin           = Anchor.Centre,
                                 Child            = new SpriteText
                                 {
                                     Anchor = Anchor.Centre,
                                     Origin = Anchor.Centre,
                                     Text   = @"Selecciona un objeto para editarlo",
                                 },
                             },
                         },
                     },
                 },
             },
             ColumnDimensions = new[]
             {
                 new Dimension(GridSizeMode.Relative, 0.25f),
                 new Dimension(),
             },
         },
     };
     currentEditing.BindTo(editor.CurrentEditingElement);
     currentEditing.BindValueChanged(checkData, true);
 }
        public void TestNestedScrolling(Direction outer, Direction inner)
        {
            BasicScrollContainer horizontalScroll = null;
            BasicScrollContainer verticalScroll   = null;

            AddStep("create scroll containers", () =>
            {
                BasicScrollContainer outerScroll;
                BasicScrollContainer innerScroll;

                Child = outerScroll = new BasicScrollContainer(outer)
                {
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.Centre,
                    Size     = new Vector2(500),
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            Size   = new Vector2(500f),
                            Colour = FrameworkColour.Yellow,
                        },
                        innerScroll = new BasicScrollContainer(inner)
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Size   = new Vector2(250, 250),
                            Child  = new Box
                            {
                                Size   = new Vector2(250, 250),
                                Colour = FrameworkColour.Green,
                            },
                        }
                    }
                };

                horizontalScroll = outer == Direction.Horizontal ? outerScroll : innerScroll;
                verticalScroll   = outer == Direction.Vertical ? outerScroll : innerScroll;
            });

            AddStep("drag vertically", () =>
            {
                InputManager.MoveMouseTo(verticalScroll);
                InputManager.PressButton(MouseButton.Left);
                InputManager.MoveMouseTo(verticalScroll, new Vector2(0, -50));
            });
            AddAssert("vertical container scrolled only", () => checkScrollCurrent(verticalScroll, horizontalScroll));
            AddStep("reset vertical scroll", () =>
            {
                InputManager.ReleaseButton(MouseButton.Left);
                verticalScroll.ScrollToStart(false, true);
            });

            AddStep("drag horizontally", () =>
            {
                InputManager.MoveMouseTo(horizontalScroll);
                InputManager.PressButton(MouseButton.Left);
                InputManager.MoveMouseTo(horizontalScroll, new Vector2(-50, 0));
            });
            AddAssert("horizontal container scrolled only", () => checkScrollCurrent(horizontalScroll, verticalScroll));
            AddStep("reset horizontal scroll", () =>
            {
                InputManager.ReleaseButton(MouseButton.Left);
                horizontalScroll.ScrollToStart(false, true);
            });

            // if the inner is a horizontal scroll container, it'll absorb input either way,
            // as vertical scrolls translate to horizontal in a horizontal scroll container.
            if (inner != Direction.Horizontal)
            {
                AddStep("scroll vertically", () => InputManager.ScrollVerticalBy(-50));
                AddAssert("vertical container scrolled only", () => checkScrollCurrent(verticalScroll, horizontalScroll));
                AddStep("reset vertical scroll", () => verticalScroll.ScrollToStart(false));
            }

            AddStep("scroll horizontally", () => InputManager.ScrollHorizontalBy(-50));
            AddAssert("horizontal container scrolled only", () => checkScrollCurrent(horizontalScroll, verticalScroll));
            AddStep("reset horizontal scroll", () => horizontalScroll.ScrollToStart(false));
 public void SetUp() => Schedule(() =>
                                 Child = new BasicScrollContainer
 {
     RelativeSizeAxes = Axes.Both,
     Child            = commentsContainer = new CommentsContainer()
 });
Beispiel #24
0
        private void load()
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;
            Children         = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Red,
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    RowDimensions    = new []
                    {
                        new Dimension(GridSizeMode.AutoSize),
                    },
                    ColumnDimensions = new []
                    {
                        new Dimension(),
                        new Dimension(GridSizeMode.AutoSize),
                    },
                    Content = new []
                    {
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Child            = scrollContainer = new BasicScrollContainer(Direction.Horizontal)
                                {
                                    RelativeSizeAxes         = Axes.X,
                                    AutoSizeAxes             = Axes.Y,
                                    ScrollbarOverlapsContent = false,
                                    Child = descriptionContainer = new FillFlowContainer
                                    {
                                        Anchor       = Anchor.CentreLeft,
                                        Origin       = Anchor.CentreLeft,
                                        AutoSizeAxes = Axes.Both,
                                        Direction    = FillDirection.Horizontal,
                                    },
                                },
                            },
                            new Container
                            {
                                AutoSizeAxes = Axes.Both,
                                Anchor       = Anchor.Centre,
                                Origin       = Anchor.Centre,
                                Padding      = new MarginPadding(5),
                                Child        = new IconButton(FontAwesome.Solid.TrashAlt, Colour4.DarkRed)
                                {
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.Centre,
                                    Action = () => RemoveAction?.Invoke(Model),
                                },
                            },
                        },
                    },
                },
            };

            scrollContainer.ScrollContent.RelativeSizeAxes = Axes.None;
            scrollContainer.ScrollContent.AutoSizeAxes     = Axes.Both;

            for (int i = 0; i < Model.ExpectedArguments.Length; i++)
            {
                descriptionContainer.AddRange(new Drawable[]
                {
                    new SpriteText
                    {
                        Anchor  = Anchor.CentreLeft,
                        Origin  = Anchor.CentreLeft,
                        Padding = new MarginPadding(4),
                        Text    = Model.Text[i],
                        Font    = new FontUsage(size: 25),
                    },
                    new ArgumentChanger(Model.ExpectedArguments[i], Model.Arguments[i]),
                });
            }

            if (Model.ExpectedArguments.Length < Model.Text.Length)
            {
                descriptionContainer.Add(new SpriteText
                {
                    Anchor  = Anchor.CentreLeft,
                    Origin  = Anchor.CentreLeft,
                    Padding = new MarginPadding(4),
                    Text    = Model.Text.Last(),
                    Font    = new FontUsage(size: 25),
                });
            }
        }
Beispiel #25
0
        private void load(RulesetStore rulesets)
        {
            var normal = getBeatmapSet();

            normal.HasVideo      = true;
            normal.HasStoryboard = true;

            var undownloadable   = getUndownloadableBeatmapSet();
            var manyDifficulties = getManyDifficultiesBeatmapSet();

            var explicitMap = getBeatmapSet();

            explicitMap.HasExplicitContent = true;

            var featuredMap = getBeatmapSet();

            featuredMap.TrackId = 1;

            var explicitFeaturedMap = getBeatmapSet();

            explicitFeaturedMap.HasExplicitContent = true;
            explicitFeaturedMap.TrackId            = 2;

            Child = new BasicScrollContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Full,
                    Padding          = new MarginPadding(20),
                    Spacing          = new Vector2(5, 20),
                    Children         = new Drawable[]
                    {
                        new GridBeatmapPanel(normal),
                        new GridBeatmapPanel(undownloadable),
                        new GridBeatmapPanel(manyDifficulties),
                        new GridBeatmapPanel(explicitMap),
                        new GridBeatmapPanel(featuredMap),
                        new GridBeatmapPanel(explicitFeaturedMap),
                        new ListBeatmapPanel(normal),
                        new ListBeatmapPanel(undownloadable),
                        new ListBeatmapPanel(manyDifficulties),
                        new ListBeatmapPanel(explicitMap),
                        new ListBeatmapPanel(featuredMap),
                        new ListBeatmapPanel(explicitFeaturedMap)
                    },
                },
            };

            APIBeatmapSet getBeatmapSet() => CreateAPIBeatmapSet(Ruleset.Value);

            APIBeatmapSet getUndownloadableBeatmapSet() => new APIBeatmapSet
            {
                OnlineID = 123,
                Title    = "undownloadable beatmap",
                Artist   = "test",
                Source   = "more tests",
                Author   = new APIUser
                {
                    Username = "******",
                    Id       = 3,
                },
                Availability = new BeatmapSetOnlineAvailability
                {
                    DownloadDisabled = true,
                },
                Preview        = @"https://b.ppy.sh/preview/12345.mp3",
                PlayCount      = 123,
                FavouriteCount = 456,
                BPM            = 111,
                HasVideo       = true,
                HasStoryboard  = true,
                Covers         = new BeatmapSetOnlineCovers(),
                Beatmaps       = new[]
                {
                    new APIBeatmap
                    {
                        RulesetID      = Ruleset.Value.ID ?? 0,
                        DifficultyName = "Test",
                        StarRating     = 6.42,
                    }
                }
            };

            APIBeatmapSet getManyDifficultiesBeatmapSet()
            {
                var beatmaps = new List <APIBeatmap>();

                for (int i = 0; i < 100; i++)
                {
                    beatmaps.Add(new APIBeatmap
                    {
                        RulesetID         = i % 4,
                        StarRating        = 2 + i % 4 * 2,
                        OverallDifficulty = 3.5f,
                    });
                }

                return(new APIBeatmapSet
                {
                    OnlineID = 1,
                    Title = "undownloadable beatmap",
                    Artist = "test",
                    Source = "more tests",
                    Author = new APIUser
                    {
                        Username = "******",
                        Id = 3,
                    },
                    HasVideo = true,
                    HasStoryboard = true,
                    Covers = new BeatmapSetOnlineCovers(),
                    Beatmaps = beatmaps.ToArray(),
                });
            }
        }