Beispiel #1
0
        private void load(LoginOverlay login)
        {
            apiState.BindTo(api.State);
            apiState.BindValueChanged(onlineStateChanged, true);

            StateContainer = login;
        }
Beispiel #2
0
        private void reload()
        {
            var fileBasedIpc = ipc as FileBasedIPC;

            fillFlow.Children = new Drawable[]
            {
                new ActionableInfo
                {
                    Label      = "Current IPC source",
                    ButtonText = "Refresh",
                    Action     = () =>
                    {
                        fileBasedIpc?.LocateStableStorage();
                        reload();
                    },
                    Value       = fileBasedIpc?.Storage?.GetFullPath(string.Empty) ?? "Not found",
                    Failing     = fileBasedIpc?.Storage == null,
                    Description = "The osu!stable installation which is currently being used as a data source. If a source is not found, make sure you have created an empty ipc.txt in your stable cutting-edge installation, and that it is registered as the default osu! install."
                },
                new ActionableInfo
                {
                    Label      = "Current User",
                    ButtonText = "Change Login",
                    Action     = () =>
                    {
                        api.Logout();

                        if (loginOverlay == null)
                        {
                            AddInternal(loginOverlay = new LoginOverlay
                            {
                                Anchor = Anchor.TopRight,
                                Origin = Anchor.TopRight,
                            });
                        }

                        loginOverlay.State.Value = Visibility.Visible;
                    },
                    Value       = api?.LocalUser.Value.Username,
                    Failing     = api?.IsLoggedIn != true,
                    Description = "In order to access the API and display metadata, a login is required."
                },
                new LabelledDropdown <RulesetInfo>
                {
                    Label       = "Ruleset",
                    Description = "Decides what stats are displayed and which ranks are retrieved for players",
                    Items       = rulesets.AvailableRulesets,
                    Current     = LadderInfo.Ruleset,
                },
                resolution = new ActionableInfo
                {
                    Label      = "Stream area resolution",
                    ButtonText = "Set to 1080p",
                    Action     = () =>
                    {
                        windowSize.Value = new Size((int)(1920 / TournamentSceneManager.STREAM_AREA_WIDTH * TournamentSceneManager.REQUIRED_WIDTH), 1080);
                    }
                }
            };
        }
Beispiel #3
0
        private void reload()
        {
            var fileBasedIpc = ipc as FileBasedIPC;

            fillFlow.Children = new Drawable[]
            {
                new ActionableInfo
                {
                    Label      = "目前IPC來源",
                    ButtonText = "刷新",
                    Action     = () =>
                    {
                        fileBasedIpc?.LocateStableStorage();
                        reload();
                    },
                    Value       = fileBasedIpc?.Storage?.GetFullPath(string.Empty) ?? "未找到",
                    Failing     = fileBasedIpc?.Storage == null,
                    Description = "The osu!stable installation which is currently being used as a data source. If a source is not found, make sure you have created an empty ipc.txt in your stable cutting-edge installation, and that it is registered as the default osu! install.",
                },
                new ActionableInfo
                {
                    Label      = "目前帳號",
                    ButtonText = "更換帳號",
                    Action     = () =>
                    {
                        api.Logout();

                        if (loginOverlay == null)
                        {
                            AddInternal(loginOverlay = new LoginOverlay
                            {
                                Anchor = Anchor.TopRight,
                                Origin = Anchor.TopRight,
                            });
                        }

                        loginOverlay.State.Value = Visibility.Visible;
                    },
                    Value       = api?.LocalUser.Value.Username,
                    Failing     = api?.IsLoggedIn != true,
                    Description = "為了訪問API並顯示數據,必須需要登錄帳號。",
                },
                new LabelledDropdown <RulesetInfo>
                {
                    Label       = "遊戲模式",
                    Description = "決定顯示哪些統計數據以及為玩家檢索哪些排名",
                    Items       = rulesets.AvailableRulesets,
                    Current     = LadderInfo.Ruleset,
                },
            };
        }
Beispiel #4
0
        public Messenger()
        {
            InitializeComponent();

            ChatsButton.BackColor     = AppColor;
            ChatButtonLabel.ForeColor = AppColor;
            ChatButtonLabel.BackColor = PeopleButtonLabel.BackColor = Color.White;

            ChatMessage.SelectionStart = ChatMessage.SelectionLength = 0;

            LoginOverlay.BringToFront();

            NotificationSound = new System.Media.SoundPlayer(@"Audio\Messenger_New_Message.wav");

            currentState = WindowState;
        }
        private void reload()
        {
            var fileBasedIpc = ipc as FileBasedIPC;

            fillFlow.Children = new Drawable[]
            {
                new ActionableInfo
                {
                    Label      = "Current IPC source",
                    ButtonText = "Refresh",
                    Action     = () =>
                    {
                        fileBasedIpc?.LocateStableStorage();
                        reload();
                    },
                    Value       = fileBasedIpc?.Storage?.GetFullPath(string.Empty) ?? "Not found",
                    Failing     = fileBasedIpc?.Storage == null,
                    Description = "The osu!stable installation which is currently being used as a data source. If a source is not found, make sure you have created an empty ipc.txt in your stable cutting-edge installation, and that it is registered as the default osu! install."
                },
                new ActionableInfo
                {
                    Label      = "Current User",
                    ButtonText = "Change Login",
                    Action     = () =>
                    {
                        api.Logout();

                        if (loginOverlay == null)
                        {
                            AddInternal(loginOverlay = new LoginOverlay
                            {
                                Anchor = Anchor.TopRight,
                                Origin = Anchor.TopRight,
                            });
                        }

                        loginOverlay.State.Value = Visibility.Visible;
                    },
                    Value       = api?.LocalUser.Value.Username,
                    Failing     = api?.IsLoggedIn != true,
                    Description = "In order to access the API and display metadata, a login is required."
                }
            };
        }
Beispiel #6
0
        private void load(IAPIProvider api, LoginOverlay login)
        {
            api.Register(this);

            StateContainer = login;
        }
Beispiel #7
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            // The next time this is updated is in UpdateAfterChildren, which occurs too late and results
            // in the cursor being shown for a few frames during the intro.
            // This prevents the cursor from showing until we have a screen with CursorVisible = true
            MenuCursorContainer.CanShowCursor = menuScreen?.CursorVisible ?? false;

            // todo: all archive managers should be able to be looped here.
            SkinManager.PostNotification = n => notifications?.Post(n);
            SkinManager.GetStableStorage = GetStorageForStableInstall;

            BeatmapManager.PostNotification = n => notifications?.Post(n);
            BeatmapManager.GetStableStorage = GetStorageForStableInstall;
            BeatmapManager.PresentImport    = items => PresentBeatmap(items.First());

            ScoreManager.PostNotification = n => notifications?.Post(n);
            ScoreManager.PresentImport    = items => PresentScore(items.First());

            Container logoContainer;

            AddRange(new Drawable[]
            {
                new VolumeControlReceptor
                {
                    RelativeSizeAxes      = Axes.Both,
                    ActionRequested       = action => volume.Adjust(action),
                    ScrollActionRequested = (action, amount, isPrecise) => volume.Adjust(action, amount, isPrecise),
                },
                screenContainer = new ScalingContainer(ScalingMode.ExcludeOverlays)
                {
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        screenStack = new OsuScreenStack {
                            RelativeSizeAxes = Axes.Both
                        },
                        logoContainer = new Container {
                            RelativeSizeAxes = Axes.Both
                        },
                    }
                },
                overlayContent = new Container {
                    RelativeSizeAxes = Axes.Both
                },
                rightFloatingOverlayContent = new Container {
                    RelativeSizeAxes = Axes.Both
                },
                leftFloatingOverlayContent = new Container {
                    RelativeSizeAxes = Axes.Both
                },
                topMostOverlayContent = new Container {
                    RelativeSizeAxes = Axes.Both
                },
                idleTracker = new GameIdleTracker(6000)
            });

            screenStack.ScreenPushed += screenPushed;
            screenStack.ScreenExited += screenExited;

            loadComponentSingleFile(osuLogo, logo =>
            {
                logoContainer.Add(logo);

                // Loader has to be created after the logo has finished loading as Loader performs logo transformations on entering.
                screenStack.Push(new Loader
                {
                    RelativeSizeAxes = Axes.Both
                });
            });

            loadComponentSingleFile(Toolbar = new Toolbar
            {
                OnHome = delegate
                {
                    CloseAllOverlays(false);
                    menuScreen?.MakeCurrent();
                },
            }, topMostOverlayContent.Add);

            loadComponentSingleFile(volume          = new VolumeOverlay(), leftFloatingOverlayContent.Add);
            loadComponentSingleFile(onscreenDisplay = new OnScreenDisplay(), Add);

            loadComponentSingleFile(loginOverlay = new LoginOverlay
            {
                GetToolbarHeight = () => ToolbarOffset,
                Anchor           = Anchor.TopRight,
                Origin           = Anchor.TopRight,
            }, rightFloatingOverlayContent.Add);

            loadComponentSingleFile(screenshotManager, Add);

            //overlay elements
            loadComponentSingleFile(direct         = new DirectOverlay(), overlayContent.Add);
            loadComponentSingleFile(social         = new SocialOverlay(), overlayContent.Add);
            loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal);
            loadComponentSingleFile(chatOverlay    = new ChatOverlay(), overlayContent.Add);
            loadComponentSingleFile(settings       = new MainSettings {
                GetToolbarHeight = () => ToolbarOffset
            }, leftFloatingOverlayContent.Add);
            loadComponentSingleFile(userProfile       = new UserProfileOverlay(), overlayContent.Add);
            loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay(), overlayContent.Add);

            loadComponentSingleFile(notifications = new NotificationOverlay
            {
                GetToolbarHeight = () => ToolbarOffset,
                Anchor           = Anchor.TopRight,
                Origin           = Anchor.TopRight,
            }, rightFloatingOverlayContent.Add);

            loadComponentSingleFile(musicController = new MusicController
            {
                GetToolbarHeight = () => ToolbarOffset,
                Anchor           = Anchor.TopRight,
                Origin           = Anchor.TopRight,
            }, rightFloatingOverlayContent.Add);

            loadComponentSingleFile(accountCreation    = new AccountCreationOverlay(), topMostOverlayContent.Add);
            loadComponentSingleFile(dialogOverlay      = new DialogOverlay(), topMostOverlayContent.Add);
            loadComponentSingleFile(externalLinkOpener = new ExternalLinkOpener(), topMostOverlayContent.Add);

            dependencies.CacheAs(idleTracker);
            dependencies.Cache(settings);
            dependencies.Cache(onscreenDisplay);
            dependencies.Cache(social);
            dependencies.Cache(direct);
            dependencies.Cache(chatOverlay);
            dependencies.Cache(channelManager);
            dependencies.Cache(userProfile);
            dependencies.Cache(musicController);
            dependencies.Cache(beatmapSetOverlay);
            dependencies.Cache(notifications);
            dependencies.Cache(loginOverlay);
            dependencies.Cache(dialogOverlay);
            dependencies.Cache(accountCreation);

            chatOverlay.StateChanged += state => channelManager.HighPollRate.Value = state == Visibility.Visible;

            Add(externalLinkOpener = new ExternalLinkOpener());

            var singleDisplaySideOverlays = new OverlayContainer[] { settings, notifications };

            overlays.AddRange(singleDisplaySideOverlays);

            foreach (var overlay in singleDisplaySideOverlays)
            {
                overlay.StateChanged += state =>
                {
                    if (state == Visibility.Hidden)
                    {
                        return;
                    }

                    singleDisplaySideOverlays.Where(o => o != overlay).ForEach(o => o.Hide());
                };
            }

            // eventually informational overlays should be displayed in a stack, but for now let's only allow one to stay open at a time.
            var informationalOverlays = new OverlayContainer[] { beatmapSetOverlay, userProfile };

            overlays.AddRange(informationalOverlays);

            foreach (var overlay in informationalOverlays)
            {
                overlay.StateChanged += state =>
                {
                    if (state == Visibility.Hidden)
                    {
                        return;
                    }

                    informationalOverlays.Where(o => o != overlay).ForEach(o => o.Hide());
                };
            }

            // ensure only one of these overlays are open at once.
            var singleDisplayOverlays = new OverlayContainer[] { chatOverlay, social, direct };

            overlays.AddRange(singleDisplayOverlays);

            foreach (var overlay in singleDisplayOverlays)
            {
                overlay.StateChanged += state =>
                {
                    // informational overlays should be dismissed on a show or hide of a full overlay.
                    informationalOverlays.ForEach(o => o.Hide());

                    if (state == Visibility.Hidden)
                    {
                        return;
                    }

                    singleDisplayOverlays.Where(o => o != overlay).ForEach(o => o.Hide());
                };
            }

            OverlayActivationMode.ValueChanged += mode =>
            {
                if (mode.NewValue != OverlayActivation.All)
                {
                    CloseAllOverlays();
                }
            };

            void updateScreenOffset()
            {
                float offset = 0;

                if (settings.State == Visibility.Visible)
                {
                    offset += ToolbarButton.WIDTH / 2;
                }
                if (notifications.State == Visibility.Visible)
                {
                    offset -= ToolbarButton.WIDTH / 2;
                }

                screenContainer.MoveToX(offset, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint);
            }

            settings.StateChanged      += _ => updateScreenOffset();
            notifications.StateChanged += _ => updateScreenOffset();
        }
Beispiel #8
0
        private void reload()
        {
            var fileBasedIpc = ipc as FileBasedIPC;

            fillFlow.Children = new Drawable[]
            {
                new ActionableInfo
                {
                    Label       = "Current IPC source",
                    ButtonText  = "Change source",
                    Action      = () => sceneManager?.SetScreen(new StablePathSelectScreen()),
                    Value       = fileBasedIpc?.IPCStorage?.GetFullPath(string.Empty) ?? "Not found",
                    Failing     = fileBasedIpc?.IPCStorage == null,
                    Description = "The osu!stable installation which is currently being used as a data source. If a source is not found, make sure you have created an empty ipc.txt in your stable cutting-edge installation."
                },
                new ActionableInfo
                {
                    Label      = "Current user",
                    ButtonText = "Change sign-in",
                    Action     = () =>
                    {
                        api.Logout();

                        if (loginOverlay == null)
                        {
                            AddInternal(loginOverlay = new LoginOverlay
                            {
                                Anchor = Anchor.TopRight,
                                Origin = Anchor.TopRight,
                            });
                        }

                        loginOverlay.State.Value = Visibility.Visible;
                    },
                    Value       = api?.LocalUser.Value.Username,
                    Failing     = api?.IsLoggedIn != true,
                    Description = "In order to access the API and display metadata, signing in is required."
                },
                new LabelledDropdown <RulesetInfo>
                {
                    Label       = "Ruleset",
                    Description = "Decides what stats are displayed and which ranks are retrieved for players.",
                    Items       = rulesets.AvailableRulesets,
                    Current     = LadderInfo.Ruleset,
                },
                new TournamentSwitcher
                {
                    Label       = "Current tournament",
                    Description = "Changes the background videos and bracket to match the selected tournament. This requires a restart to apply changes.",
                },
                resolution = new ResolutionSelector
                {
                    Label      = "Stream area resolution",
                    ButtonText = "Set height",
                    Action     = height =>
                    {
                        windowSize.Value = new Size((int)(height * aspect_ratio / TournamentSceneManager.STREAM_AREA_WIDTH * TournamentSceneManager.REQUIRED_WIDTH), height);
                    }
                },
            };
        }
Beispiel #9
0
        public override async Task HoldFocus()
        {
            // Request server configuration
            this.config = await this.Rpc.Event(LoginEvents.Configuration).Request <PublicConfiguration>();

            // Update local configuration on server configuration change
            this.Rpc.Event(LoginEvents.Configuration).On <PublicConfiguration>((e, c) => this.config = c);

            // Create overlay
            this.overlay = new LoginOverlay(this.OverlayManager);

            // Hide HUD
            Screen.Hud.IsVisible = false;

            // Disable the loading screen from automatically being dismissed
            API.SetManualShutdownLoadingScreenNui(true);

            // Position character, required for switching
            Game.Player.Character.Position = Vector3.Zero;

            // Freeze
            Game.Player.Freeze();

            // Switch out the player if it isn't already in a switch state
            if (!API.IsPlayerSwitchInProgress())
            {
                API.SwitchOutPlayer(API.PlayerPedId(), 0, 1);
            }

            // Remove most clouds
            API.SetCloudHatOpacity(0.01f);

            // Wait for switch
            while (API.GetPlayerSwitchState() != 5)
            {
                await Delay(10);
            }

            // Hide loading screen
            API.ShutdownLoadingScreen();

            // Fade out
            Screen.Fading.FadeOut(0);
            while (Screen.Fading.IsFadingOut)
            {
                await Delay(10);
            }

            // Show the overlay
            this.overlay.Configure(this.config);
            this.overlay.SwitchToForm(Forms.Login);

            this.overlay.Login    += OnLogin;
            this.overlay.Register += OnRegister;

            this.overlay.Show();

            // Let server know we started authentication process
            this.Rpc.Event(LoginEvents.AuthenticationStarted).Trigger();

            // Focus overlay
            API.SetNuiFocus(true, true);

            // Shut down the NUI loading screen
            API.ShutdownLoadingScreenNui();

            // Fade in
            Screen.Fading.FadeIn(500);
            while (Screen.Fading.IsFadingIn)
            {
                await Delay(10);
            }
        }
 public SessionStartScreen()
 {
     RelativePositionAxes = Axes.X;
     InternalChildren     = new Drawable[]
     {
         new Box
         {
             RelativeSizeAxes = Axes.Both,
             Colour           = new Colour4(106, 100, 104, 255),
         },
         new Container
         {
             Anchor   = Anchor.Centre,
             Origin   = Anchor.Centre,
             Height   = 300,
             Width    = 530,
             Children = new Drawable[]
             {
                 new Box
                 {
                     Anchor           = Anchor.Centre,
                     Origin           = Anchor.Centre,
                     RelativeSizeAxes = Axes.Both,
                     Colour           = new Colour4(80, 75, 74, 255),
                 },
                 new SpriteText
                 {
                     Text     = "Bienvenido a Games To Go",
                     Anchor   = Anchor.TopCentre,
                     Origin   = Anchor.TopCentre,
                     Position = new Vector2(0, 100),
                 },
                 new GamesToGoButton
                 {
                     Text             = @"Registrarse",
                     BackgroundColour = new Colour4(106, 100, 104, 255),  //Color Boton userInformation
                     BorderColour     = Colour4.Black,
                     BorderThickness  = 2f,
                     Masking          = true,
                     Height           = 40,
                     Width            = 100,
                     Anchor           = Anchor.TopLeft,
                     Origin           = Anchor.TopLeft,
                     Position         = new Vector2(100, 200),
                     Action           = showRegistration,
                 },
                 new GamesToGoButton
                 {
                     Text             = @"Iniciar Sesión",
                     BackgroundColour = new Colour4(106, 100, 104, 255),  //Color Boton userInformation
                     BorderColour     = Colour4.Black,
                     BorderThickness  = 2f,
                     Masking          = true,
                     Height           = 40,
                     Width            = 100,
                     Anchor           = Anchor.TopRight,
                     Origin           = Anchor.TopRight,
                     Position         = new Vector2(-100, 200),
                     Action           = showLogin,
                 },
             },
         },
         loginOverlay    = new LoginOverlay(loginIntoServer),
         registerOverlay = new RegisterOverlay(),
         new Box
         {
             RelativeSizeAxes     = Axes.Both,
             RelativePositionAxes = Axes.X,
             Anchor = Anchor.CentreLeft,
             Origin = Anchor.CentreRight,
             Colour = new Colour4(106, 100, 104, 255),
             Width  = 1,
         },
     };
 }
Beispiel #11
0
        private void load(TextureStore textures)
        {
            RelativeSizeAxes = Axes.Both;

            InternalChildren = 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, .5f),
                        new Dimension(GridSizeMode.Relative, .25f),
                        new Dimension()
                    },
                    ColumnDimensions = new[]
                    {
                        new Dimension()
                    },
                    Content = new []
                    {
                        new Drawable[]
                        {
                            new CircularContainer
                            {
                                Anchor          = Anchor.Centre,
                                Origin          = Anchor.Centre,
                                BorderColour    = Colour4.Black,
                                BorderThickness = 3.5f,
                                Masking         = true,
                                Size            = new Vector2(600, 600),
                                Child           = new Sprite
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Texture          = textures.Get("Images/gtg")
                                }
                            }
                        },
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Child            = loginButton = new GamesToGoButton
                                {
                                    Anchor = Anchor.BottomCentre,
                                    Origin = Anchor.BottomCentre,
                                    Height = 150,
                                    Width  = 800,
                                    Text   = "Iniciar Sesión",
                                    Action = () => loginOverlay.Show()
                                }
                            }
                        },
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Child            = registerButton = new GamesToGoButton
                                {
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.Centre,
                                    Height = 150,
                                    Width  = 800,
                                    Text   = "Registrarse",
                                    Action = () => registerOverlay.Show()
                                },
                            },
                        },
                    },
                },
                loginOverlay    = new LoginOverlay(loginIntoServer),
                registerOverlay = new RegisterOverlay(),
            };
            loginButton.SpriteText.Font    = new FontUsage(size: 60);
            registerButton.SpriteText.Font = new FontUsage(size: 60);
        }