Exemple #1
0
        private void load(OsuGameBase osuGame, IFrameBasedClock framedClock)
        {
            beatmap.BindTo(osuGame.Beatmap);

            try
            {
                rulesetContainer       = CreateRulesetContainer(ruleset, beatmap.Value);
                rulesetContainer.Clock = framedClock;
            }
            catch (Exception e)
            {
                Logger.Error(e, "Could not load beatmap sucessfully!");
                return;
            }

            var layerBelowRuleset = new BorderLayer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = CreateLayerContainer()
            };

            var layerAboveRuleset = CreateLayerContainer();

            layerAboveRuleset.Child = new HitObjectMaskLayer(rulesetContainer.Playfield, this);

            layerContainers.Add(layerBelowRuleset);
            layerContainers.Add(layerAboveRuleset);

            RadioButtonCollection toolboxCollection;

            InternalChild = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                Content          = new[]
                {
                    new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            Name             = "Sidebar",
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Right = 10
                            },
                            Children = new Drawable[]
                            {
                                new ToolboxGroup {
                                    Child = toolboxCollection = new RadioButtonCollection {
                                        RelativeSizeAxes = Axes.X
                                    }
                                }
                            }
                        },
                        new Container
                        {
                            Name             = "Content",
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                layerBelowRuleset,
                                rulesetContainer,
                                layerAboveRuleset
                            }
                        }
                    },
                },
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 200),
                }
            };

            toolboxCollection.Items =
                CompositionTools.Select(t => new RadioButton(t.Name, () => setCompositionTool(t)))
                .Prepend(new RadioButton("Select", () => setCompositionTool(null)))
                .ToList();

            toolboxCollection.Items[0].Select();
        }
Exemple #2
0
        private void load(OsuGameBase game, BeatmapManager beatmaps, OsuColour colours, UserInputManager inputManager)
        {
            this.inputManager = inputManager;
            this.beatmaps     = beatmaps;

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    CornerRadius     = 5,
                    Masking          = true,
                    EdgeEffect       = new EdgeEffectParameters
                    {
                        Type   = EdgeEffectType.Shadow,
                        Colour = Color4.Black.Opacity(40),
                        Radius = 5,
                    },
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = colours.Gray3,
                            RelativeSizeAxes = Axes.Both,
                        },
                        list = new PlaylistList
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = 95, Bottom = 10, Right = 10
                            },
                            OnSelect = itemSelected,
                        },
                        filter = new FilterControl
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            ExitRequested    = () => State = Visibility.Hidden,
                            FilterChanged    = search => list.Filter(search),
                            Padding          = new MarginPadding(10),
                        },
                    },
                },
            };

            list.BeatmapSets = BeatmapSets = beatmaps.GetAllUsableBeatmapSets();

            // todo: these should probably be above the query.
            beatmaps.BeatmapSetAdded   += s => list.AddBeatmapSet(s);
            beatmaps.BeatmapSetRemoved += s => list.RemoveBeatmapSet(s);

            beatmapBacking.BindTo(game.Beatmap);

            filter.Search.OnCommit = (sender, newText) =>
            {
                var beatmap = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault();
                if (beatmap != null)
                {
                    playSpecified(beatmap);
                }
            };
        }
Exemple #3
0
        private void load()
        {
            var drawableOsuObject = (DrawableOsuHitObject)drawableObject;

            bool allowFallback = false;

            // attempt lookup using priority specification
            Texture baseTexture = getTextureWithFallback(string.Empty);

            // if the base texture was not found without a fallback, switch on fallback mode and re-perform the lookup.
            if (baseTexture == null)
            {
                allowFallback = true;
                baseTexture   = getTextureWithFallback(string.Empty);
            }

            // at this point, any further texture fetches should be correctly using the priority source if the base texture was retrieved using it.
            // the flow above handles the case where a sliderendcircle.png is retrieved from the skin, but sliderendcircleoverlay.png doesn't exist.
            // expected behaviour in this scenario is not showing the overlay, rather than using hitcircleoverlay.png (potentially from the default/fall-through skin).
            Texture overlayTexture = getTextureWithFallback("overlay");

            InternalChildren = new Drawable[]
            {
                circleSprites = new Container <Sprite>
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    Children         = new[]
                    {
                        hitCircleSprite = new Sprite
                        {
                            Texture = baseTexture,
                            Anchor  = Anchor.Centre,
                            Origin  = Anchor.Centre,
                        },
                        hitCircleOverlay = new Sprite
                        {
                            Texture = overlayTexture,
                            Anchor  = Anchor.Centre,
                            Origin  = Anchor.Centre,
                        }
                    }
                },
            };

            if (hasNumber)
            {
                AddInternal(hitCircleText = new SkinnableSpriteText(new OsuSkinComponent(OsuSkinComponents.HitCircleText), _ => new OsuSpriteText
                {
                    Font = OsuFont.Numeric.With(size: 40),
                    UseFullGlyphHeight = false,
                }, confineMode: ConfineMode.NoScaling)
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                });
            }

            bool overlayAboveNumber = skin.GetConfig <OsuSkinConfiguration, bool>(OsuSkinConfiguration.HitCircleOverlayAboveNumber)?.Value ?? true;

            if (overlayAboveNumber)
            {
                AddInternal(hitCircleOverlay.CreateProxy());
            }

            accentColour.BindTo(drawableObject.AccentColour);
            indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable);

            Texture getTextureWithFallback(string name)
            {
                Texture tex = null;

                if (!string.IsNullOrEmpty(priorityLookup))
                {
                    tex = skin.GetTexture($"{priorityLookup}{name}");

                    if (!allowFallback)
                    {
                        return(tex);
                    }
                }

                return(tex ?? skin.GetTexture($"hitcircle{name}"));
            }
        }
Exemple #4
0
 private void load(OsuGameBase game)
 {
     beatmapBacking.BindTo(game.Beatmap);
     beatmapBacking.ValueChanged += beatmapChanged;
 }
Exemple #5
0
        private void load(OsuColour colours)
        {
            background.Colour = colours.Gray2;

            user.BindTo(api.LocalUser);
        }
Exemple #6
0
        protected sealed override void OnApply(HitObjectLifetimeEntry entry)
        {
            // LifetimeStart is already computed using HitObjectLifetimeEntry's InitialLifetimeOffset.
            // We override this with DHO's InitialLifetimeOffset for a non-pooled DHO.
            if (entry is SyntheticHitObjectEntry)
            {
                LifetimeStart = HitObject.StartTime - InitialLifetimeOffset;
            }

            ensureEntryHasResult();

            foreach (var h in HitObject.NestedHitObjects)
            {
                var pooledDrawableNested = pooledObjectProvider?.GetPooledDrawableRepresentation(h, this);
                var drawableNested       = pooledDrawableNested
                                           ?? CreateNestedHitObject(h)
                                           ?? throw new InvalidOperationException($"{nameof(CreateNestedHitObject)} returned null for {h.GetType().ReadableName()}.");

                // Only invoke the event for non-pooled DHOs, otherwise the event will be fired by the playfield.
                if (pooledDrawableNested == null)
                {
                    OnNestedDrawableCreated?.Invoke(drawableNested);
                }

                drawableNested.OnNewResult            += onNewResult;
                drawableNested.OnRevertResult         += onRevertResult;
                drawableNested.ApplyCustomUpdateState += onApplyCustomUpdateState;

                // This is only necessary for non-pooled DHOs. For pooled DHOs, this is handled inside GetPooledDrawableRepresentation().
                // Must be done before the nested DHO is added to occur before the nested Apply()!
                drawableNested.ParentHitObject = this;

                nestedHitObjects.Add(drawableNested);
                AddNestedHitObject(drawableNested);
            }

            StartTimeBindable.BindTo(HitObject.StartTimeBindable);
            StartTimeBindable.BindValueChanged(onStartTimeChanged);

            if (HitObject is IHasComboInformation combo)
            {
                comboIndexBindable.BindTo(combo.ComboIndexBindable);
                comboIndexWithOffsetsBindable.BindTo(combo.ComboIndexWithOffsetsBindable);
            }

            samplesBindable.BindTo(HitObject.SamplesBindable);
            samplesBindable.BindCollectionChanged(onSamplesChanged, true);

            HitObject.DefaultsApplied += onDefaultsApplied;

            OnApply();
            HitObjectApplied?.Invoke(this);

            // If not loaded, the state update happens in LoadComplete().
            if (IsLoaded)
            {
                if (Result.IsHit)
                {
                    updateState(ArmedState.Hit, true);
                }
                else if (Result.HasResult)
                {
                    updateState(ArmedState.Miss, true);
                }
                else
                {
                    updateState(ArmedState.Idle, true);
                }
            }
        }
 private void load(OsuGameBase game)
 {
     Beatmap.BindTo(game.Beatmap);
 }
Exemple #8
0
        private void load(OsuGame osuGame, Bindable <RulesetInfo> parentRuleset)
        {
            Children = new Drawable[]
            {
                new ToolbarBackground(),
                new FillFlowContainer
                {
                    Direction        = FillDirection.Horizontal,
                    RelativeSizeAxes = Axes.Y,
                    AutoSizeAxes     = Axes.X,
                    Children         = new Drawable[]
                    {
                        new ToolbarSettingsButton(),
                        new ToolbarHomeButton
                        {
                            Action = () => OnHome?.Invoke()
                        },
                        rulesetSelector = new ToolbarRulesetSelector()
                    }
                },
                new FillFlowContainer
                {
                    Anchor           = Anchor.TopRight,
                    Origin           = Anchor.TopRight,
                    Direction        = FillDirection.Horizontal,
                    RelativeSizeAxes = Axes.Y,
                    AutoSizeAxes     = Axes.X,
                    Children         = new Drawable[]
                    {
                        new ToolbarNewsButton(),
                        new ToolbarChangelogButton(),
                        new ToolbarRankingsButton(),
                        new ToolbarBeatmapListingButton(),
                        new ToolbarChatButton(),
                        new ToolbarSocialButton(),
                        new ToolbarMusicButton(),
                        //new ToolbarButton
                        //{
                        //    Icon = FontAwesome.Solid.search
                        //},
                        userButton = new ToolbarUserButton(),
                        new ToolbarNotificationButton(),
                    }
                }
            };

            // Bound after the selector is added to the hierarchy to give it a chance to load the available rulesets
            rulesetSelector.Current.BindTo(parentRuleset);

            State.ValueChanged += visibility =>
            {
                if (overlayActivationMode.Value == OverlayActivation.Disabled)
                {
                    Hide();
                }
            };

            if (osuGame != null)
            {
                overlayActivationMode.BindTo(osuGame.OverlayActivationMode);
            }
        }
Exemple #9
0
        protected override void OnApply()
        {
            base.OnApply();

            XBindable.BindTo(HitObject.XBindable);
        }
Exemple #10
0
        private void load()
        {
            RelativePositionAxes = Axes.X;
            RelativeSizeAxes     = Axes.Both;
            X = -1;

            InternalChildren = new Drawable[]
            {
                new InvitationsUpdater(),
                hideButton = new SurfaceButton
                {
                    Anchor           = Anchor.TopRight,
                    Origin           = Anchor.TopRight,
                    BackgroundColour = ColourInfo.GradientHorizontal(Colour4.Black.Opacity(0.6f).ToLinear(), Colour4.Black.Opacity(0f).ToLinear()),
                    Width            = 0.2f,
                    Action           = Hide,
                },
                new Box
                {
                    Anchor           = Anchor.TopLeft,
                    Origin           = Anchor.TopRight,
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Colour4.Black.Opacity(0.6f).ToLinear(),
                },
                new Container
                {
                    RelativePositionAxes = Axes.Both,
                    RelativeSizeAxes     = Axes.Both,
                    Width           = .8f,
                    BorderColour    = Colour4.Black,
                    BorderThickness = 3.5f,
                    Masking         = true,
                    Children        = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = new Colour4(106, 100, 104, 255)
                        },
                        new GridContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            RowDimensions    = new[]
                            {
                                new Dimension(GridSizeMode.Relative, .9f),
                                new Dimension()
                            },
                            ColumnDimensions = new[]
                            {
                                new Dimension()
                            },
                            Content = new[]
                            {
                                new Drawable[]
                                {
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Child            = new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Direction        = FillDirection.Vertical,
                                            Children         = new Drawable[]
                                            {
                                                new Container
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Height           = .3f,
                                                    BorderColour     = Colour4.Black,
                                                    BorderThickness  = 3.5f,
                                                    Masking          = true,
                                                    Padding          = new MarginPadding {
                                                        Top = 80, Left = 20, Right = 20
                                                    },
                                                    Child = new SurfaceButton
                                                    {
                                                        Action   = profileScreen,
                                                        Children = new Drawable[]
                                                        {
                                                            new FillFlowContainer
                                                            {
                                                                RelativeSizeAxes = Axes.Both,
                                                                Direction        = FillDirection.Vertical,
                                                                Padding          = new MarginPadding()
                                                                {
                                                                    Bottom = 40
                                                                },
                                                                Children = new Drawable[]
                                                                {
                                                                    new CircularContainer
                                                                    {
                                                                        Anchor          = Anchor.Centre,
                                                                        Origin          = Anchor.Centre,
                                                                        BorderColour    = Colour4.Black,
                                                                        BorderThickness = 3.5f,
                                                                        Masking         = true,
                                                                        Size            = new Vector2(300, 300),
                                                                        Child           = userImage = new Sprite
                                                                        {
                                                                            Anchor           = Anchor.Centre,
                                                                            Origin           = Anchor.Centre,
                                                                            RelativeSizeAxes = Axes.Both,
                                                                            Texture          = textures.Get("Images/gtg"),
                                                                        },
                                                                    },
                                                                    username = new SpriteText
                                                                    {
                                                                        Anchor = Anchor.Centre,
                                                                        Origin = Anchor.Centre,
                                                                        Text   = "Guest",
                                                                        Font   = new FontUsage(size: 80)
                                                                    },
                                                                },
                                                            },
                                                        },
                                                    },
                                                },
                                                new Container
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Height           = .15f,
                                                    BorderColour     = Colour4.Black,
                                                    BorderThickness  = 3.5f,
                                                    Masking          = true,
                                                    Padding          = new MarginPadding(20),
                                                    Child            = new SurfaceButton
                                                    {
                                                        Action   = () => invitesScreen(),
                                                        Children = new Drawable[]
                                                        {
                                                            new FillFlowContainer
                                                            {
                                                                RelativeSizeAxes = Axes.Both,
                                                                Spacing          = new Vector2(30),
                                                                Children         = new Drawable[]
                                                                {
                                                                    numberContainer = new Container
                                                                    {
                                                                        Anchor = Anchor.CentreRight,
                                                                        Origin = Anchor.CentreRight,

                                                                        Children = new Drawable[]
                                                                        {
                                                                            new Box
                                                                            {
                                                                                RelativeSizeAxes = Axes.Both,
                                                                                Colour           = Colour4.LightBlue,
                                                                            },
                                                                            invitationsNumber = new SpriteText
                                                                            {
                                                                                Anchor = Anchor.Centre,
                                                                                Origin = Anchor.Centre,
                                                                                Font   = new FontUsage(size: 70)
                                                                            },
                                                                        }
                                                                    },
                                                                    new SpriteText
                                                                    {
                                                                        Anchor = Anchor.CentreRight,
                                                                        Origin = Anchor.CentreRight,
                                                                        Text   = "Invitaciones",
                                                                        Font   = new FontUsage(size: 80)
                                                                    },
                                                                }
                                                            }
                                                        },
                                                    }
                                                },
                                                new Container
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Height           = .15f,
                                                    BorderColour     = Colour4.Black,
                                                    BorderThickness  = 3.5f,
                                                    Masking          = true,
                                                    Padding          = new MarginPadding(20),
                                                    Child            = new SurfaceButton
                                                    {
                                                        Action   = logout,
                                                        Children = new Drawable[]
                                                        {
                                                            new SpriteText
                                                            {
                                                                Anchor = Anchor.CentreRight,
                                                                Origin = Anchor.CentreRight,
                                                                Text   = "Cerrar Sesión",
                                                                Font   = new FontUsage(size: 80)
                                                            },
                                                        },
                                                    }
                                                },
                                            },
                                        },
                                    },
                                },
                                new Drawable[]
                                {
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        BorderColour     = Colour4.Black,
                                        BorderThickness  = 3.5f,
                                        Masking          = true,
                                        Padding          = new MarginPadding(20),
                                        Children         = new Drawable[]
                                        {
                                            new SpriteText
                                            {
                                                Anchor = Anchor.CentreRight,
                                                Origin = Anchor.CentreRight,
                                                Text   = "GamesToGo",
                                                Font   = new FontUsage(size: 80)
                                            },
                                        },
                                    },
                                },
                            },
                        },
                    },
                },
                profileOverlay,
                invitationsOverlay
            };
            invitations.BindTo(game.Invitations);
            invitations.BindCollectionChanged((_, __) => changeInvitationsNumber());
            localUser.BindTo(api.LocalUser);
            localUser.BindValueChanged(_ => changeUserData(), true);
        }
Exemple #11
0
 private void load(OsuGameBase game)
 {
     beatmapBacking.BindTo(game.Beatmap);
 }
Exemple #12
0
        private void load()
        {
            RelativeSizeAxes = Axes.Both;
            Children         = new Drawable[]
            {
                shadowBox = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Colour4.Black,
                    Alpha            = 0,
                },
                content = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        new GridContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            RowDimensions    = new[]
                            {
                                new Dimension(GridSizeMode.Relative, .2f),
                                new Dimension(GridSizeMode.Relative, .5f),
                                new Dimension()
                            },
                            ColumnDimensions = new[]
                            {
                                new Dimension()
                            },
                            Content = new[]
                            {
                                new Drawable[]
                                {
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Padding          = new MarginPadding(10),
                                        Child            = new SimpleIconButton(FontAwesome.Solid.Times)
                                        {
                                            Anchor = Anchor.TopRight,
                                            Origin = Anchor.TopRight,
                                            Action = Hide,
                                        },
                                    },
                                },
                                new Drawable[]
                                {
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Children         = new Drawable[]
                                        {
                                            new FillFlowContainer
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Direction        = FillDirection.Vertical,
                                                Padding          = new MarginPadding(30),
                                                Children         = new Drawable[]
                                                {
                                                    new FillFlowContainer
                                                    {
                                                        RelativeSizeAxes = Axes.X,
                                                        AutoSizeAxes     = Axes.Y,
                                                        Direction        = FillDirection.Vertical,
                                                        Children         = new Drawable[]
                                                        {
                                                            new SpriteText
                                                            {
                                                                Origin = Anchor.TopLeft,
                                                                Anchor = Anchor.TopLeft,
                                                                Text   = @"Usuario:",
                                                                Font   = new FontUsage(size: 60)
                                                            },
                                                            usernameBox = new BasicTextBox
                                                            {
                                                                Origin           = Anchor.TopLeft,
                                                                Anchor           = Anchor.TopLeft,
                                                                Height           = 150,
                                                                RelativeSizeAxes = Axes.X,
                                                            },
                                                        }
                                                    },
                                                    new FillFlowContainer
                                                    {
                                                        RelativeSizeAxes = Axes.X,
                                                        AutoSizeAxes     = Axes.Y,
                                                        Direction        = FillDirection.Vertical,
                                                        Children         = new Drawable[]
                                                        {
                                                            new SpriteText
                                                            {
                                                                Origin = Anchor.TopLeft,
                                                                Anchor = Anchor.TopLeft,
                                                                Text   = @"Contraseña:",
                                                                Font   = new FontUsage(size: 60),
                                                            },
                                                            passwordBox = new BasicPasswordTextBox
                                                            {
                                                                Origin           = Anchor.TopLeft,
                                                                Anchor           = Anchor.TopLeft,
                                                                Height           = 150,
                                                                RelativeSizeAxes = Axes.X,
                                                            },
                                                        },
                                                    },
                                                },
                                            },
                                        },
                                    },
                                },
                                new Drawable[]
                                {
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Padding          = new MarginPadding(30),
                                        Child            = login = new GamesToGoButton
                                        {
                                            Anchor           = Anchor.TopCentre,
                                            Origin           = Anchor.TopCentre,
                                            Height           = 225,
                                            RelativeSizeAxes = Axes.X,
                                            Text             = @"Iniciar Sesión",
                                            Action           = () => api.Login(usernameBox.Text, passwordBox.Text),
                                        },
                                    },
                                },
                            },
                        },
                    },
                },
            };
            login.SpriteText.Font = new FontUsage(size: 60);
            login.Enabled.Value   = false;

            passwordBox.Current.BindValueChanged(checkUserPass);
            usernameBox.Current.BindValueChanged(checkUserPass);

            localUser.BindTo(api.LocalUser);
            localUser.BindValueChanged(_ =>
            {
                usernameBox.Text = "";
                passwordBox.Text = "";
                Hide();
                if (localUser.Value != null)
                {
                    nextScreenAction?.Invoke();
                }
            });
            api.Login(@"daro31", @"1234");
        }
Exemple #13
0
 protected ProfileSubsection(Bindable <APIUser> user, LocalisableString?headerText = null, CounterVisibilityState counterVisibilityState = CounterVisibilityState.AlwaysHidden)
 {
     this.headerText             = headerText ?? string.Empty;
     this.counterVisibilityState = counterVisibilityState;
     User.BindTo(user);
 }
Exemple #14
0
 private void load(OsuColour colours, ILyricEditorState state)
 {
     dragAlert.Colour = colours.YellowDarker;
     bindableMode.BindTo(state.BindableMode);
 }
Exemple #15
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            enabled.BindTo(tabletHandler.Enabled);
            enabled.BindValueChanged(_ => Scheduler.AddOnce(updateVisibility));

            rotation.BindTo(tabletHandler.Rotation);

            areaOffset.BindTo(tabletHandler.AreaOffset);
            areaOffset.BindValueChanged(val =>
            {
                offsetX.Value = val.NewValue.X;
                offsetY.Value = val.NewValue.Y;
            }, true);

            offsetX.BindValueChanged(val => areaOffset.Value = new Vector2(val.NewValue, areaOffset.Value.Y));
            offsetY.BindValueChanged(val => areaOffset.Value = new Vector2(areaOffset.Value.X, val.NewValue));

            areaSize.BindTo(tabletHandler.AreaSize);
            areaSize.BindValueChanged(val =>
            {
                sizeX.Value = val.NewValue.X;
                sizeY.Value = val.NewValue.Y;
            }, true);

            sizeX.BindValueChanged(val =>
            {
                areaSize.Value = new Vector2(val.NewValue, areaSize.Value.Y);

                aspectRatioApplication?.Cancel();
                aspectRatioApplication = Schedule(() => applyAspectRatio(sizeX));
            });

            sizeY.BindValueChanged(val =>
            {
                areaSize.Value = new Vector2(areaSize.Value.X, val.NewValue);

                aspectRatioApplication?.Cancel();
                aspectRatioApplication = Schedule(() => applyAspectRatio(sizeY));
            });

            updateAspectRatio();
            aspectRatio.BindValueChanged(aspect =>
            {
                aspectRatioApplication?.Cancel();
                aspectRatioApplication = Schedule(() => forceAspectRatio(aspect.NewValue));
            });

            tablet.BindTo(tabletHandler.Tablet);
            tablet.BindValueChanged(val =>
            {
                Scheduler.AddOnce(updateVisibility);

                var tab = val.NewValue;

                bool tabletFound = tab != null;
                if (!tabletFound)
                {
                    return;
                }

                offsetX.MaxValue = tab.Size.X;
                offsetX.Default  = tab.Size.X / 2;
                sizeX.Default    = sizeX.MaxValue = tab.Size.X;

                offsetY.MaxValue = tab.Size.Y;
                offsetY.Default  = tab.Size.Y / 2;
                sizeY.Default    = sizeY.MaxValue = tab.Size.Y;

                areaSize.Default = new Vector2(sizeX.Default, sizeY.Default);
            }, true);
        }
Exemple #16
0
        private void load(LadderInfo ladder, MatchIPCInfo ipc, Storage storage)
        {
            this.ipc = ipc;

            AddRangeInternal(new Drawable[]
            {
                new TourneyVideo("gameplay")
                {
                    Loop             = true,
                    RelativeSizeAxes = Axes.Both,
                },
                header = new MatchHeader
                {
                    ShowLogo = false
                },
                new Container
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Y        = 110,
                    Anchor   = Anchor.TopCentre,
                    Origin   = Anchor.TopCentre,
                    Children = new Drawable[]
                    {
                        chroma = new Box
                        {
                            // chroma key area for stable gameplay
                            Name   = "chroma",
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.TopCentre,
                            Height = 512,
                            Colour = new Color4(0, 255, 0, 255),
                        },
                    }
                },
                scoreDisplay = new MatchScoreDisplay
                {
                    Y      = -147,
                    Anchor = Anchor.BottomCentre,
                    Origin = Anchor.TopCentre,
                },
                new ControlPanel
                {
                    Children = new Drawable[]
                    {
                        warmupButton = new TourneyButton
                        {
                            RelativeSizeAxes = Axes.X,
                            Text             = "Toggle warmup",
                            Action           = () => warmup.Toggle()
                        },
                        new TourneyButton
                        {
                            RelativeSizeAxes = Axes.X,
                            Text             = "Toggle chat",
                            Action           = () => { State.Value = State.Value == TourneyState.Idle ? TourneyState.Playing : TourneyState.Idle; }
                        },
                        new SettingsSlider <int>
                        {
                            LabelText    = "Chroma Width",
                            Bindable     = LadderInfo.ChromaKeyWidth,
                            KeyboardStep = 1,
                        }
                    }
                }
            });

            State.BindTo(ipc.State);
            State.BindValueChanged(stateChanged, true);

            ladder.ChromaKeyWidth.BindValueChanged(width => chroma.Width = width.NewValue, true);

            currentMatch.BindValueChanged(m =>
            {
                warmup.Value = m.NewValue.Team1Score.Value + m.NewValue.Team2Score.Value == 0;
                scheduledOperation?.Cancel();
            });

            currentMatch.BindTo(ladder.CurrentMatch);

            warmup.BindValueChanged(w =>
            {
                warmupButton.Alpha = !w.NewValue ? 0.5f : 1;
                header.ShowScores  = !w.NewValue;
            }, true);
        }
Exemple #17
0
 private void load(OsuGameBase osuGame) => beatmapBacking.BindTo(osuGame.Beatmap);
Exemple #18
0
 protected override void OnApply()
 {
     base.OnApply();
     major.BindTo(HitObject.MajorBindable);
 }
Exemple #19
0
 public void BindDrawableRuleset(DrawableRuleset drawableRuleset)
 {
     AllowSeeking.BindTo(drawableRuleset.HasReplayLoaded);
 }
Exemple #20
0
 protected override void LoadComplete()
 {
     base.LoadComplete();
     path.BindValueChanged(onPathChanged);
     wikiData.BindTo(Header.WikiPageData);
 }
Exemple #21
0
        private void load(OverlayColourProvider colourProvider)
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;
            AddRangeInternal(new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = colourProvider.Background5
                },
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Children         = new Drawable[]
                    {
                        commentCounter = new TotalCommentsCounter(),
                        new CommentsHeader
                        {
                            Sort        = { BindTarget = Sort },
                            ShowDeleted = { BindTarget = ShowDeleted }
                        },
                        content = new FillFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FillDirection.Vertical,
                        },
                        new Container
                        {
                            Name             = @"Footer",
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = colourProvider.Background4
                                },
                                new FillFlowContainer
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Vertical,
                                    Children         = new Drawable[]
                                    {
                                        deletedCommentsCounter = new DeletedCommentsCounter
                                        {
                                            ShowDeleted = { BindTarget = ShowDeleted }
                                        },
                                        new Container
                                        {
                                            AutoSizeAxes     = Axes.Y,
                                            RelativeSizeAxes = Axes.X,
                                            Child            = moreButton = new CommentsShowMoreButton
                                            {
                                                Anchor    = Anchor.Centre,
                                                Origin    = Anchor.Centre,
                                                Margin    = new MarginPadding(5),
                                                Action    = getComments,
                                                IsLoading = true,
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            });

            User.BindTo(api.LocalUser);
        }
 private void load(OsuGameBase osuGameBase)
 {
     availableMods.BindTo(osuGameBase.AvailableMods);
 }
Exemple #23
0
        public DrawableRoom(Room room)
        {
            Room = room;

            RelativeSizeAxes = Axes.X;
            Height           = height;
            CornerRadius     = 5;
            Masking          = true;
            EdgeEffect       = new EdgeEffectParameters
            {
                Type   = EdgeEffectType.Shadow,
                Colour = Color4.Black.Opacity(40),
                Radius = 5,
            };

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.FromHex(@"212121"),
                },
                sideStrip = new Box
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = side_strip_width,
                },
                new Container
                {
                    Width            = cover_width,
                    RelativeSizeAxes = Axes.Y,
                    Masking          = true,
                    Margin           = new MarginPadding {
                        Left = side_strip_width
                    },
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = Color4.Black,
                        },
                        coverContainer = new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                        },
                    },
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding
                    {
                        Vertical = content_padding,
                        Left     = side_strip_width + cover_width + content_padding,
                        Right    = content_padding,
                    },
                    Children = new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FillDirection.Vertical,
                            Spacing          = new Vector2(5f),
                            Children         = new Drawable[]
                            {
                                name = new OsuSpriteText
                                {
                                    TextSize = 18,
                                },
                                participantInfo = new ParticipantInfo(),
                            },
                        },
                        new FillFlowContainer
                        {
                            Anchor           = Anchor.BottomLeft,
                            Origin           = Anchor.BottomLeft,
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FillDirection.Vertical,
                            Children         = new Drawable[]
                            {
                                status = new OsuSpriteText
                                {
                                    TextSize = 14,
                                    Font     = @"Exo2.0-Bold",
                                },
                                beatmapInfoFlow = new FillFlowContainer <OsuSpriteText>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Horizontal,
                                    Children         = new[]
                                    {
                                        beatmapTitle = new OsuSpriteText
                                        {
                                            TextSize = 14,
                                            Font     = @"Exo2.0-BoldItalic",
                                        },
                                        beatmapDash = new OsuSpriteText
                                        {
                                            TextSize = 14,
                                            Font     = @"Exo2.0-BoldItalic",
                                        },
                                        beatmapArtist = new OsuSpriteText
                                        {
                                            TextSize = 14,
                                            Font     = @"Exo2.0-RegularItalic",
                                        },
                                    },
                                },
                            },
                        },
                        modeTypeInfo = new ModeTypeInfo
                        {
                            Anchor = Anchor.BottomRight,
                            Origin = Anchor.BottomRight,
                        },
                    },
                },
            };

            nameBind.ValueChanged         += displayName;
            hostBind.ValueChanged         += displayUser;
            typeBind.ValueChanged         += displayGameType;
            participantsBind.ValueChanged += displayParticipants;

            nameBind.BindTo(Room.Name);
            hostBind.BindTo(Room.Host);
            statusBind.BindTo(Room.Status);
            typeBind.BindTo(Room.Type);
            beatmapBind.BindTo(Room.Beatmap);
            participantsBind.BindTo(Room.Participants);
        }
Exemple #24
0
 private void load(OsuGameBase game, BeatmapManager beatmaps)
 {
     this.beatmaps = beatmaps;
     beatmap.BindTo(game.Beatmap);
 }
Exemple #25
0
        private void load(AudioManager audio, OsuConfigManager config, OsuGame game)
        {
            Mods.Value = base.Mods.Value.Select(m => m.CreateCopy()).ToArray();

            if (Beatmap.Value is DummyWorkingBeatmap)
            {
                return;
            }

            IBeatmap playableBeatmap = loadPlayableBeatmap();

            if (playableBeatmap == null)
            {
                return;
            }

            sampleRestart = audio.Samples.Get(@"Gameplay/restart");

            mouseWheelDisabled = config.GetBindable <bool>(OsuSetting.MouseDisableWheel);

            if (game != null)
            {
                LocalUserPlaying.BindTo(game.LocalUserPlaying);
            }

            DrawableRuleset = ruleset.CreateDrawableRulesetWith(playableBeatmap, Mods.Value);

            ScoreProcessor = ruleset.CreateScoreProcessor();
            ScoreProcessor.ApplyBeatmap(playableBeatmap);
            ScoreProcessor.Mods.BindTo(Mods);

            HealthProcessor = ruleset.CreateHealthProcessor(playableBeatmap.HitObjects[0].StartTime);
            HealthProcessor.ApplyBeatmap(playableBeatmap);

            if (!ScoreProcessor.Mode.Disabled)
            {
                config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode);
            }

            InternalChild = GameplayClockContainer = CreateGameplayClockContainer(Beatmap.Value, DrawableRuleset.GameplayStartTime);

            AddInternal(gameplayBeatmap  = new GameplayBeatmap(playableBeatmap));
            AddInternal(screenSuspension = new ScreenSuspensionHandler(GameplayClockContainer));

            dependencies.CacheAs(gameplayBeatmap);

            var beatmapSkinProvider = new BeatmapSkinProvidingContainer(Beatmap.Value.Skin);

            // the beatmapSkinProvider is used as the fallback source here to allow the ruleset-specific skin implementation
            // full access to all skin sources.
            var rulesetSkinProvider = new SkinProvidingContainer(ruleset.CreateLegacySkinProvider(beatmapSkinProvider, playableBeatmap));

            // load the skinning hierarchy first.
            // this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources.
            GameplayClockContainer.Add(beatmapSkinProvider.WithChild(rulesetSkinProvider));

            rulesetSkinProvider.AddRange(new[]
            {
                // underlay and gameplay should have access the to skinning sources.
                createUnderlayComponents(),
                createGameplayComponents(Beatmap.Value, playableBeatmap)
            });

            // also give the HUD a ruleset container to allow rulesets to potentially override HUD elements (used to disable combo counters etc.)
            // we may want to limit this in the future to disallow rulesets from outright replacing elements the user expects to be there.
            var hudRulesetContainer = new SkinProvidingContainer(ruleset.CreateLegacySkinProvider(beatmapSkinProvider, playableBeatmap));

            // add the overlay components as a separate step as they proxy some elements from the above underlay/gameplay components.
            GameplayClockContainer.Add(hudRulesetContainer.WithChild(createOverlayComponents(Beatmap.Value)));

            if (!DrawableRuleset.AllowGameplayOverlays)
            {
                HUDOverlay.ShowHud.Value    = false;
                HUDOverlay.ShowHud.Disabled = true;
                BreakOverlay.Hide();
                skipOverlay.Hide();
            }

            DrawableRuleset.FrameStableClock.WaitingOnFrames.BindValueChanged(waiting =>
            {
                if (waiting.NewValue)
                {
                    GameplayClockContainer.Stop();
                }
                else
                {
                    GameplayClockContainer.Start();
                }
            });

            DrawableRuleset.IsPaused.BindValueChanged(paused =>
            {
                updateGameplayState();
                updateSampleDisabledState();
            });

            DrawableRuleset.FrameStableClock.IsCatchingUp.BindValueChanged(_ => updateSampleDisabledState());

            DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updateGameplayState());

            DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updatePauseOnFocusLostState(), true);

            // bind clock into components that require it
            DrawableRuleset.IsPaused.BindTo(GameplayClockContainer.IsPaused);

            DrawableRuleset.NewResult += r =>
            {
                HealthProcessor.ApplyResult(r);
                ScoreProcessor.ApplyResult(r);
                gameplayBeatmap.ApplyResult(r);
            };

            DrawableRuleset.RevertResult += r =>
            {
                HealthProcessor.RevertResult(r);
                ScoreProcessor.RevertResult(r);
            };

            // Bind the judgement processors to ourselves
            ScoreProcessor.HasCompleted.ValueChanged += updateCompletionState;
            HealthProcessor.Failed += onFail;

            foreach (var mod in Mods.Value.OfType <IApplicableToScoreProcessor>())
            {
                mod.ApplyToScoreProcessor(ScoreProcessor);
            }

            foreach (var mod in Mods.Value.OfType <IApplicableToHealthProcessor>())
            {
                mod.ApplyToHealthProcessor(HealthProcessor);
            }

            IsBreakTime.BindTo(breakTracker.IsBreakTime);
            IsBreakTime.BindValueChanged(onBreakTimeChanged, true);
        }
Exemple #26
0
 private void load(OsuColour colours, OsuConfigManager config)
 {
     AccentColour = colours.BlueLighter;
     overlayDim.BindTo(config.GetBindable <double>(OsuSetting.OverlayDim));
     DisplayedCountSpriteText.Alpha = 1 - (float)overlayDim.Value;
 }
Exemple #27
0
        private void load(LadderInfo ladder, TextureStore textures)
        {
            currentMatch.BindValueChanged(matchChanged);
            currentMatch.BindTo(ladder.CurrentMatch);

            Masking = true;

            AddRangeInternal(new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Black,
                },
                new UpdateableOnlineBeatmapSetCover
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.Gray(0.5f),
                    OnlineInfo       = Beatmap.BeatmapSet,
                },
                new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Anchor       = Anchor.CentreLeft,
                    Origin       = Anchor.CentreLeft,
                    Padding      = new MarginPadding(15),
                    Direction    = FillDirection.Vertical,
                    Children     = new Drawable[]
                    {
                        new TournamentSpriteText
                        {
                            Text = Beatmap.GetDisplayTitleRomanisable(false, false),
                            Font = OsuFont.Torus.With(weight: FontWeight.Bold),
                        },
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Horizontal,
                            Children     = new Drawable[]
                            {
                                new TournamentSpriteText
                                {
                                    Text    = "mapper",
                                    Padding = new MarginPadding {
                                        Right = 5
                                    },
                                    Font = OsuFont.Torus.With(weight: FontWeight.Regular, size: 14)
                                },
                                new TournamentSpriteText
                                {
                                    Text    = Beatmap.Metadata.Author.Username,
                                    Padding = new MarginPadding {
                                        Right = 20
                                    },
                                    Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 14)
                                },
                                new TournamentSpriteText
                                {
                                    Text    = "difficulty",
                                    Padding = new MarginPadding {
                                        Right = 5
                                    },
                                    Font = OsuFont.Torus.With(weight: FontWeight.Regular, size: 14)
                                },
                                new TournamentSpriteText
                                {
                                    Text = Beatmap.DifficultyName,
                                    Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 14)
                                },
                            }
                        }
                    },
                },
                flash = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Gray,
                    Blending         = BlendingParameters.Additive,
                    Alpha            = 0,
                },
            });

            if (!string.IsNullOrEmpty(mod))
            {
                AddInternal(new TournamentModIcon(mod)
                {
                    Anchor           = Anchor.CentreRight,
                    Origin           = Anchor.CentreRight,
                    Margin           = new MarginPadding(10),
                    Width            = 60,
                    RelativeSizeAxes = Axes.Y,
                });
            }
        }
Exemple #28
0
        /// <summary>
        /// Applies a new <see cref="HitObject"/> to be represented by this <see cref="DrawableHitObject"/>.
        /// </summary>
        /// <param name="hitObject">The <see cref="HitObject"/> to apply.</param>
        /// <param name="lifetimeEntry">The <see cref="HitObjectLifetimeEntry"/> controlling the lifetime of <paramref name="hitObject"/>.</param>
        public void Apply([NotNull] HitObject hitObject, [CanBeNull] HitObjectLifetimeEntry lifetimeEntry)
        {
            free();

            HitObject = hitObject ?? throw new InvalidOperationException($"Cannot apply a null {nameof(HitObject)}.");

            this.lifetimeEntry = lifetimeEntry;

            if (lifetimeEntry != null)
            {
                // Transfer lifetime from the entry.
                LifetimeStart = lifetimeEntry.LifetimeStart;
                LifetimeEnd   = lifetimeEntry.LifetimeEnd;

                // Copy any existing result from the entry (required for rewind / judgement revert).
                Result = lifetimeEntry.Result;
            }

            // Ensure this DHO has a result.
            Result ??= CreateResult(HitObject.CreateJudgement())
            ?? throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateResult)}.");

            // Copy back the result to the entry for potential future retrieval.
            if (lifetimeEntry != null)
            {
                lifetimeEntry.Result = Result;
            }

            foreach (var h in HitObject.NestedHitObjects)
            {
                var drawableNested = pooledObjectProvider?.GetPooledDrawableRepresentation(h)
                                     ?? CreateNestedHitObject(h)
                                     ?? throw new InvalidOperationException($"{nameof(CreateNestedHitObject)} returned null for {h.GetType().ReadableName()}.");

                drawableNested.OnNewResult            += onNewResult;
                drawableNested.OnRevertResult         += onRevertResult;
                drawableNested.ApplyCustomUpdateState += onApplyCustomUpdateState;

                nestedHitObjects.Value.Add(drawableNested);
                AddNestedHitObject(drawableNested);

                drawableNested.OnParentReceived(this);
            }

            StartTimeBindable.BindTo(HitObject.StartTimeBindable);
            StartTimeBindable.BindValueChanged(onStartTimeChanged);

            if (HitObject is IHasComboInformation combo)
            {
                comboIndexBindable.BindTo(combo.ComboIndexBindable);
            }

            samplesBindable.BindTo(HitObject.SamplesBindable);
            samplesBindable.BindCollectionChanged(onSamplesChanged, true);

            HitObject.DefaultsApplied += onDefaultsApplied;

            OnApply(hitObject);
            HitObjectApplied?.Invoke(this);

            // If not loaded, the state update happens in LoadComplete(). Otherwise, the update is scheduled to allow for lifetime updates.
            if (IsLoaded)
            {
                Schedule(() => updateState(ArmedState.Idle, true));
            }

            hasHitObjectApplied = true;
        }
Exemple #29
0
 private void load(LadderInfo ladder)
 {
     currentMatch.BindValueChanged(matchChanged);
     currentMatch.BindTo(ladder.CurrentMatch);
 }
Exemple #30
0
        public FileDialog(string defaultDirectory = null)
        {
            CornerRadius = 10;
            Masking      = true;

            LockDrag = true;

            AddRangeInternal(new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = TCCColours.FromHex("1a1a1a")
                },
                new DrawSizePreservingFillContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding(10),
                    Strategy         = DrawSizePreservationStrategy.Minimum,
                    Children         = new Drawable[]
                    {
                        new SpriteText
                        {
                            Text = $"{FileDialogActionName} File"
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Y      = 35,
                            Height = 30,
                            Child  = filePathBreadcrumbs = new TCCBreadcrumbNavigationTextBox
                            {
                                Origin           = Anchor.CentreLeft,
                                Anchor           = Anchor.CentreLeft,
                                RelativeSizeAxes = Axes.X,
                                Height           = 30
                            }
                        },
                        new FileDialogActionContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding
                            {
                                Top    = 70,
                                Bottom = 40
                            },
                            Child = itemContainer = new DirectoryItemContainer
                            {
                                RelativeSizeAxes = Axes.Both
                            }
                        },
                        new Container
                        {
                            Anchor           = Anchor.BottomRight,
                            Origin           = Anchor.BottomRight,
                            RelativeSizeAxes = Axes.X,
                            Height           = 30,
                            Children         = new Drawable[]
                            {
                                new Container
                                {
                                    Anchor           = Anchor.CentreLeft,
                                    Origin           = Anchor.CentreLeft,
                                    RelativeSizeAxes = Axes.Both,
                                    Padding          = new MarginPadding {
                                        Right = 110
                                    },
                                    Children = new Drawable[]
                                    {
                                        search = new BasicTextBox
                                        {
                                            Anchor           = Anchor.CentreLeft,
                                            Origin           = Anchor.CentreLeft,
                                            RelativeSizeAxes = Axes.Both,
                                            PlaceholderText  = "Selected Path",
                                            OnCommit         = (sender, newText) => SelectedItem = sender.Text
                                        },
                                        new SpriteIcon
                                        {
                                            Anchor = Anchor.CentreRight,
                                            Origin = Anchor.CentreRight,
                                            Size   = new Vector2(15),
                                            Margin = new MarginPadding {
                                                Right = 10
                                            },
                                            Icon = FontAwesome.Solid.Search
                                        }
                                    }
                                },
                                ActionButton = new FadeButton
                                {
                                    Anchor       = Anchor.CentreRight,
                                    Origin       = Anchor.CentreRight,
                                    Width        = 100,
                                    EnabledColor = TCCColours.FromHex("303030"),
                                    Action       = ActionButtonAction,
                                    Text         = FileDialogActionName
                                }
                            }
                        }
                    }
                }
            });

            ActionButton.Enabled.Value = false;

            CurrentSelection.BindTo(itemContainer.CurrentSelection);
            CurrentDirectoryBindable.BindTo(itemContainer.CurrentDirectoryBindable);
            SelectedItemBindable.BindTo(itemContainer.SelectedItemBindable);

            CurrentSelection.ValueChanged         += HandleCurrentSelectionChanged;
            CurrentDirectoryBindable.ValueChanged += HandleDirectoryChanged;
            SelectedItemBindable.ValueChanged     += HandleItemChanged;

            itemContainer.PerformActionRequested += HandlePerformActionRequested;

            filePathBreadcrumbs.OnTextChanged += HandleBreadcrumbsUpdated;
            filePathBreadcrumbs.BreadcrumbNavigation.BreadcrumbClicked += HandleBreadcrumbsUpdated;

            CurrentDirectory = defaultDirectory
                               ?? GetFolderPath(MyDocuments);
        }