Esempio n. 1
0
 protected override void LoadAsyncComplete()
 {
     BracketLoadTask.ContinueWith(_ => Schedule(() =>
     {
         // this has to be run here rather than LoadComplete because
         // TestScene.cs is checking the IsLoaded state (on another thread) and expects
         // the runner to be loaded at that point.
         Add(runner = new TestSceneTestRunner.TestRunner());
     }));
 }
Esempio n. 2
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            BracketLoadTask.ContinueWith(_ => Schedule(() =>
            {
                LoadComponentAsync(new Background("Menu/menu-background-0")
                {
                    Colour = OsuColour.Gray(0.5f),
                    Depth  = 10
                }, AddInternal);

                // Have to construct this here, rather than in the constructor, because
                // we depend on some dependencies to be loaded within OsuGameBase.load().
                Add(new TestBrowser());
            }));
        }
Esempio n. 3
0
        private void load(FrameworkConfigManager frameworkConfig, GameHost host)
        {
            windowSize = frameworkConfig.GetBindable <Size>(FrameworkSetting.WindowedSize);
            windowMode = frameworkConfig.GetBindable <WindowMode>(FrameworkSetting.WindowMode);

            Add(loadingSpinner = new LoadingSpinner(true, true)
            {
                Anchor = Anchor.BottomRight,
                Origin = Anchor.BottomRight,
                Margin = new MarginPadding(40),
            });

            // in order to have the OS mouse cursor visible, relative mode needs to be disabled.
            // can potentially be removed when https://github.com/ppy/osu-framework/issues/4309 is resolved.
            var mouseHandler = host.AvailableInputHandlers.OfType <MouseHandler>().FirstOrDefault();

            if (mouseHandler != null)
            {
                mouseHandler.UseRelativeMode.Value = false;
            }

            loadingSpinner.Show();

            BracketLoadTask.ContinueWith(t =>
            {
                if (t.IsFaulted)
                {
                    Schedule(() =>
                    {
                        loadingSpinner.Hide();
                        loadingSpinner.Expire();

                        Logger.Error(t.Exception, "Couldn't load bracket with error");
                        Add(new WarningBox("Your bracket.json file could not be parsed. Please check runtime.log for more details."));
                    });

                    return;
                }

                LoadComponentsAsync(new[]
                {
                    new Container
                    {
                        CornerRadius = 10,
                        Depth        = float.MinValue,
                        Position     = new Vector2(5),
                        Masking      = true,
                        AutoSizeAxes = Axes.Both,
                        Anchor       = Anchor.BottomRight,
                        Origin       = Anchor.BottomRight,
                        Children     = new Drawable[]
                        {
                            new Box
                            {
                                Colour           = OsuColour.Gray(0.2f),
                                RelativeSizeAxes = Axes.Both,
                            },
                            new TourneyButton
                            {
                                Text    = "Save Changes",
                                Width   = 140,
                                Height  = 50,
                                Padding = new MarginPadding
                                {
                                    Top  = 10,
                                    Left = 10,
                                },
                                Margin = new MarginPadding
                                {
                                    Right  = 10,
                                    Bottom = 10,
                                },
                                Action = SaveChanges,
                            },
                        }
                    },
                    heightWarning = new WarningBox("Please make the window wider")
                    {
                        Anchor = Anchor.BottomCentre,
                        Origin = Anchor.BottomCentre,
                        Margin = new MarginPadding(20),
                    },
                    new OsuContextMenuContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        Child            = new TournamentSceneManager()
                    }
                }, drawables =>
                {
                    loadingSpinner.Hide();
                    loadingSpinner.Expire();

                    AddRange(drawables);

                    windowSize.BindValueChanged(size => ScheduleAfterChildren(() =>
                    {
                        int minWidth        = (int)(size.NewValue.Height / 768f * TournamentSceneManager.REQUIRED_WIDTH) - 1;
                        heightWarning.Alpha = size.NewValue.Width < minWidth ? 1 : 0;
                    }), true);

                    windowMode.BindValueChanged(mode => ScheduleAfterChildren(() =>
                    {
                        windowMode.Value = WindowMode.Windowed;
                    }), true);
                });
            });
        }
Esempio n. 4
0
        private void load(FrameworkConfigManager frameworkConfig)
        {
            windowSize = frameworkConfig.GetBindable <Size>(FrameworkSetting.WindowedSize);
            windowMode = frameworkConfig.GetBindable <WindowMode>(FrameworkSetting.WindowMode);

            Add(loadingSpinner = new LoadingSpinner(true, true)
            {
                Anchor = Anchor.BottomRight,
                Origin = Anchor.BottomRight,
                Margin = new MarginPadding(40),
            });

            loadingSpinner.Show();

            BracketLoadTask.ContinueWith(_ => LoadComponentsAsync(new[]
            {
                new Container
                {
                    CornerRadius = 10,
                    Depth        = float.MinValue,
                    Position     = new Vector2(5),
                    Masking      = true,
                    AutoSizeAxes = Axes.Both,
                    Anchor       = Anchor.BottomRight,
                    Origin       = Anchor.BottomRight,
                    Children     = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = OsuColour.Gray(0.2f),
                            RelativeSizeAxes = Axes.Both,
                        },
                        new TourneyButton
                        {
                            Text    = "Save Changes",
                            Width   = 140,
                            Height  = 50,
                            Padding = new MarginPadding
                            {
                                Top  = 10,
                                Left = 10,
                            },
                            Margin = new MarginPadding
                            {
                                Right  = 10,
                                Bottom = 10,
                            },
                            Action = SaveChanges,
                        },
                    }
                },
                heightWarning = new WarningBox("Please make the window wider"),
                new OsuContextMenuContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Child            = new TournamentSceneManager()
                }
            }, drawables =>
            {
                loadingSpinner.Hide();
                loadingSpinner.Expire();

                AddRange(drawables);

                windowSize.BindValueChanged(size => ScheduleAfterChildren(() =>
                {
                    var minWidth        = (int)(size.NewValue.Height / 768f * TournamentSceneManager.REQUIRED_WIDTH) - 1;
                    heightWarning.Alpha = size.NewValue.Width < minWidth ? 1 : 0;
                }), true);

                windowMode.BindValueChanged(mode => ScheduleAfterChildren(() =>
                {
                    windowMode.Value = WindowMode.Windowed;
                }), true);
            }));
        }