예제 #1
0
        private void Load(LargeTextureStore store)
        {
            cachedMap.Map = Songs.GetRandomMap();
            cachedMap.LoadTrackFile();

            InternalChildren = new Drawable[]
            {
                Background = new Sprite
                {
                    Depth            = 2,
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    Alpha            = 1f,
                    Texture          = store.Get("Skin/menu-background.png"),
                    RelativeSizeAxes = Axes.Both,
                    Size             = new Vector2(1.1f),
                },
                new Box
                {
                    Depth = Background.Depth - 0.1f,
                    RelativePositionAxes = Axes.Both,
                    Anchor           = Anchor.CentreLeft,
                    Origin           = Anchor.CentreLeft,
                    RelativeSizeAxes = Axes.Both,
                    Size             = new Vector2(0.15f, 1.1f),
                    Position         = new Vector2(0.05f, 0f),
                    Shear            = new Vector2(.15f, 0f),
                    EdgeSmoothness   = new Vector2(2f)
                },
                new MusicVisualizationLinear(3f, 120, 0f, cachedMap.BindableTrack)
                {
                    Depth  = Background.Depth - 0.2f,
                    Anchor = Anchor.Centre,
                    Origin = Anchor.CentreLeft,
                    RelativePositionAxes = Axes.Both,
                    RelativeSizeAxes     = Axes.Both,
                    Size = new Vector2(.25f, 0f),
                },
                GetMainMenuBox("Play", -0.2f, -0.25f, 0),
                GetMainMenuBox("Settings", -0.21f, -0.05f, 1),
                GetMainMenuBox("Editor", -0.25f, 0.15f, 2),
                GetMainMenuBox("Exit", -0.3f, 0.35f, 3),

                CurrentPlaying = new SpriteText
                {
                    Anchor = Anchor.TopCentre,
                    Origin = Anchor.Centre,
                    Alpha  = 1f,
                    RelativePositionAxes = Axes.Both,
                    Y = 0.1f,
                },
                volume = new Volume(cachedMap.BindableTrack)
                {
                    Anchor               = Anchor.Centre,
                    Origin               = Anchor.Centre,
                    RelativeSizeAxes     = Axes.Both,
                    RelativePositionAxes = Axes.Both,
                    Size  = new Vector2(1f, 0.3f),
                    X     = 0.4f,
                    Y     = 0.2f,
                    Alpha = 0f,
                },
            };

            AddInternal(box = new Box
            {
                Depth = float.MinValue + 1,
                RelativePositionAxes = Axes.Both,
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                Colour           = Color4.Black.Opacity(0.8f),
                RelativeSizeAxes = Axes.Both,
                Size             = new Vector2(1f),
                Alpha            = 0f,
            });

            var updater = new Update();

            AddInternal(_overlay = new NotificationOverlay
            {
                Depth = float.MinValue,
                RelativePositionAxes = Axes.Both,
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                RelativeSizeAxes = Axes.Both,
                Size             = new Vector2(0.3f),
                typeOfOverlay    = NotificationOverlay.TypeOfOverlay.YesNo,
                ActionYes        = () =>
                {
                    if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                    {
                        updater.DownloadUpdate();
                        updater.ApplyUpdate();
                    }
                    else
                    {
                        //TODO:
                    }
                }
            });

            bool newUpdate = false; //await updater.SearchAsyncForUpdates();

            if (newUpdate)
            {
                //TODO:
                _overlay._text.Text = "A new update is available!                                      " +
                                      "Do you want to install it now?";

                box.Size = new Vector2(3f);
                box.FadeIn(0d, Easing.OutCirc);
                _overlay.State.Value         = Visibility.Visible;
                _overlay.State.ValueChanged += (e) => box.FadeOut(250d);
            }
        }