Show() public static method

public static Show ( ) : void
return void
Ejemplo n.º 1
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            loading.Show();

            config.BindWith(OsuSetting.ChatDisplayHeight, chatHeight);

            chatHeight.BindValueChanged(height => { Height = height.NewValue; }, true);

            currentChannel.BindTo(channelManager.CurrentChannel);
            channelManager.CurrentChannel.BindValueChanged(currentChannelChanged, true);
            channelManager.JoinedChannels.BindCollectionChanged(joinedChannelsChanged, true);
            channelManager.AvailableChannels.BindCollectionChanged(availableChannelsChanged, true);

            channelList.OnRequestSelect += channel =>
            {
                // Manually selecting a channel should dismiss the selector
                selectorActive.Value = false;
                channelManager.CurrentChannel.Value = channel;
            };
            channelList.OnRequestLeave += channel => channelManager.LeaveChannel(channel);

            channelListing.OnRequestJoin  += channel => channelManager.JoinChannel(channel);
            channelListing.OnRequestLeave += channel => channelManager.LeaveChannel(channel);

            textBar.OnSearchTermsChanged   += searchTerms => channelListing.SearchTerm = searchTerms;
            textBar.OnChatMessageCommitted += handleChatMessage;

            selectorActive.BindValueChanged(v => channelListing.State.Value = v.NewValue ? Visibility.Visible : Visibility.Hidden, true);
        }
Ejemplo n.º 2
0
        protected override void LoadAsyncComplete()
        {
            base.LoadAsyncComplete();

            if (!LoadedBeatmapSuccessfully)
            {
                return;
            }

            if (!ValidForResume)
            {
                return; // token retrieval may have failed.
            }
            client.MatchStarted += onMatchStarted;
            client.ResultsReady += onResultsReady;

            ScoreProcessor.HasCompleted.BindValueChanged(completed =>
            {
                // wait for server to tell us that results are ready (see SubmitScore implementation)
                loadingDisplay.Show();
            });

            isConnected = client.IsConnected.GetBoundCopy();
            isConnected.BindValueChanged(connected => Schedule(() =>
            {
                if (!connected.NewValue)
                {
                    // messaging to the user about this disconnect will be provided by the MultiplayerMatchSubScreen.
                    failAndBail();
                }
            }), true);

            Debug.Assert(client.Room != null);
        }
Ejemplo n.º 3
0
        public void TestShowHide()
        {
            AddAssert("not visible", () => !overlay.IsPresent);

            AddStep("show", () => overlay.Show());

            AddUntilStep("wait for content dim", () => dimContent.Colour != Color4.White);

            AddStep("hide", () => overlay.Hide());

            AddUntilStep("wait for content restore", () => dimContent.Colour == Color4.White);
        }
        private void loadNewContent()
        {
            loading.Show();

            cancellationToken?.Cancel();
            lastRequest?.Cancel();

            if (Scope.Value == RankingsScope.Spotlights)
            {
                loadContent(new SpotlightsLayout
                {
                    Ruleset = { BindTarget = ruleset }
                });
                return;
            }

            var request = createScopedRequest();

            lastRequest = request;

            if (request == null)
            {
                loadContent(null);
                return;
            }

            request.Success += () => Schedule(() => loadContent(createTableFromResponse(request)));
            request.Failure += _ => Schedule(() => loadContent(null));

            api.Queue(request);
        }
Ejemplo n.º 5
0
        protected override void StartGameplay()
        {
            // block base call, but let the server know we are ready to start.
            loadingDisplay.Show();

            client.ChangeState(MultiplayerUserState.Loaded).ContinueWith(task => failAndBail(task.Exception?.Message ?? "Server error"), TaskContinuationOptions.NotOnRanToCompletion);
        }
Ejemplo n.º 6
0
        private void load()
        {
            // todo: this should be implemented via a custom HUD implementation, and correctly masked to the main content area.
            LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(ScoreProcessor, userIds), HUDOverlay.Add);

            HUDOverlay.Add(loadingDisplay = new LoadingLayer(true)
            {
                Depth = float.MaxValue
            });

            if (Token == null)
            {
                return; // Todo: Somehow handle token retrieval failure.
            }
            client.MatchStarted += onMatchStarted;
            client.ResultsReady += onResultsReady;

            ScoreProcessor.HasCompleted.BindValueChanged(completed =>
            {
                // wait for server to tell us that results are ready (see SubmitScore implementation)
                loadingDisplay.Show();
            });

            isConnected = client.IsConnected.GetBoundCopy();
            isConnected.BindValueChanged(connected =>
            {
                if (!connected.NewValue)
                {
                    // messaging to the user about this disconnect will be provided by the MultiplayerMatchSubScreen.
                    failAndBail();
                }
            }, true);

            Debug.Assert(client.Room != null);
        }
Ejemplo n.º 7
0
        protected override void SelectItem(PlaylistItem item)
        {
            // If the client is already in a room, update via the client.
            // Otherwise, update the playlist directly in preparation for it to be submitted to the API on match creation.
            if (client.Room != null)
            {
                loadingLayer.Show();

                var multiplayerItem = new MultiplayerPlaylistItem
                {
                    ID              = itemToEdit ?? 0,
                    BeatmapID       = item.Beatmap.OnlineID,
                    BeatmapChecksum = item.Beatmap.MD5Hash,
                    RulesetID       = item.RulesetID,
                    RequiredMods    = item.RequiredMods.ToArray(),
                    AllowedMods     = item.AllowedMods.ToArray()
                };

                Task task = itemToEdit != null?client.EditPlaylistItem(multiplayerItem) : client.AddPlaylistItem(multiplayerItem);

                task.ContinueWith(t =>
                {
                    Schedule(() =>
                    {
                        loadingLayer.Hide();

                        if (t.IsFaulted)
                        {
                            Exception exception = t.Exception;

                            if (exception is AggregateException ae)
                            {
                                exception = ae.InnerException;
                            }

                            Debug.Assert(exception != null);

                            string message = exception is HubException
                                             // HubExceptions arrive with additional message context added, but we want to display the human readable message:
                                             // "An unexpected error occurred invoking 'AddPlaylistItem' on the server.InvalidStateException: Can't enqueue more than 3 items at once."
                                             // We generally use the message field for a user-parseable error (eventually to be replaced), so drop the first part for now.
                                ? exception.Message.Substring(exception.Message.IndexOf(':') + 1).Trim()
                                : exception.Message;

                            Logger.Log(message, level: LogLevel.Important);
                            Carousel.AllowSelection = true;
                            return;
                        }

                        this.Exit();
                    });
                });
            }
            else
            {
                Playlist.Clear();
                Playlist.Add(item);
                this.Exit();
            }
        }
Ejemplo n.º 8
0
        protected override void SelectItem(PlaylistItem item)
        {
            // If the client is already in a room, update via the client.
            // Otherwise, update the playlist directly in preparation for it to be submitted to the API on match creation.
            if (client.Room != null)
            {
                loadingLayer.Show();

                client.ChangeSettings(item: item).ContinueWith(t =>
                {
                    Schedule(() =>
                    {
                        loadingLayer.Hide();

                        if (t.IsCompletedSuccessfully)
                        {
                            this.Exit();
                        }
                        else
                        {
                            Logger.Log($"Could not use current beatmap ({t.Exception?.Message})", level: LogLevel.Important);
                            Carousel.AllowSelection = true;
                        }
                    });
                });
            }
            else
            {
                Playlist.Clear();
                Playlist.Add(item);
                this.Exit();
            }
        }
Ejemplo n.º 9
0
        private void onTabChanged(ValueChangedEvent <DashboardOverlayTabs> tab)
        {
            cancellationToken?.Cancel();
            loading.Show();

            if (!API.IsLoggedIn)
            {
                loadDisplay(Empty());
                return;
            }

            switch (tab.NewValue)
            {
            case DashboardOverlayTabs.Friends:
                loadDisplay(new FriendDisplay());
                break;

            case DashboardOverlayTabs.CurrentlyPlaying:
                //todo: enable once caching logic is better
                //loadDisplay(new CurrentlyPlayingDisplay());
                break;

            default:
                throw new NotImplementedException($"Display for {tab.NewValue} tab is not implemented");
            }
        }
Ejemplo n.º 10
0
            private void apply()
            {
                if (!ApplyButton.Enabled.Value)
                {
                    return;
                }

                hideError();

                RoomName.Value     = NameField.Text;
                Availability.Value = AvailabilityPicker.Current.Value;
                Type.Value         = TypePicker.Current.Value;

                if (int.TryParse(MaxParticipantsField.Text, out int max))
                {
                    MaxParticipants.Value = max;
                }
                else
                {
                    MaxParticipants.Value = null;
                }

                Duration.Value = DurationField.Current.Value;

                manager?.CreateRoom(currentRoom.Value, onSuccess, onError);

                loadingLayer.Show();
            }
 private void onLoadStarted()
 {
     loading.Show();
     request?.Cancel();
     cancellationToken?.Cancel();
     cancellationToken = new CancellationTokenSource();
 }
Ejemplo n.º 12
0
        private void load(IAPIProvider api, NotificationOverlay notifications)
        {
            SpriteIcon icon;

            AddRange(new Drawable[]
            {
                icon = new SpriteIcon
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Icon   = FontAwesome.Regular.Heart,
                    Size   = new Vector2(18),
                    Shadow = false,
                },
                loading = new LoadingLayer(true, false),
            });

            Action = () =>
            {
                // guaranteed by disabled state above.
                Debug.Assert(BeatmapSet.Value.OnlineBeatmapSetID != null);

                loading.Show();

                request?.Cancel();

                request = new PostBeatmapFavouriteRequest(BeatmapSet.Value.OnlineBeatmapSetID.Value, favourited.Value ? BeatmapFavouriteAction.UnFavourite : BeatmapFavouriteAction.Favourite);

                request.Success += () =>
                {
                    favourited.Toggle();
                    loading.Hide();
                };

                request.Failure += e =>
                {
                    notifications?.Post(new SimpleNotification
                    {
                        Text = e.Message,
                        Icon = FontAwesome.Solid.Times,
                    });

                    loading.Hide();
                };

                api.Queue(request);
            };

            favourited.ValueChanged += favourited => icon.Icon = favourited.NewValue ? FontAwesome.Solid.Heart : FontAwesome.Regular.Heart;

            localUser.BindTo(api.LocalUser);
            localUser.BindValueChanged(_ => updateEnabled());

            // must be run after setting the Action to ensure correct enabled state (setting an Action forces a button to be enabled).
            BeatmapSet.BindValueChanged(setInfo =>
            {
                updateEnabled();
                favourited.Value = setInfo.NewValue?.OnlineInfo?.HasFavourited ?? false;
            }, true);
        }
 public void ResourceUpdateStart(System.Action func)
 {
     LoadingLayer.Show();
     if (func != null)
     {
         OnResourceUpdateComplete = func;
     }
     CheckExtractResource();
 }
Ejemplo n.º 14
0
 public static void Run(System.Action func)
 {
     LoadingLayer.Show();
     if (func != null)
     {
         OnAssetsUpdateComplete = func;
     }
     CheckUnpackAssets();
 }
Ejemplo n.º 15
0
 private void joinRequested(Room room)
 {
     loadingLayer.Show();
     RoomManager?.JoinRoom(room, r =>
     {
         Open(room);
         loadingLayer.Hide();
     }, _ => loadingLayer.Hide());
 }
Ejemplo n.º 16
0
    // Use this for initialization
    void Start()
    {
        Physics2D.autoSimulation = false;
        Reset();

        //Load minimium object. Will show loading screen until it has done.
        m_loadingLayer.Show();
        GameObjectPreloader.Fetch(() => {
            m_loadingLayer.Hide();
        });
    }
Ejemplo n.º 17
0
 private void updateLoadingLayer()
 {
     if (operationInProgress.Value || !ListingPollingComponent.InitialRoomsReceived.Value)
     {
         loadingLayer.Show();
     }
     else
     {
         loadingLayer.Hide();
     }
 }
Ejemplo n.º 18
0
        private void onSearchStarted()
        {
            cancellationToken?.Cancel();

            previewTrackManager.StopAnyPlaying(this);

            if (panelTarget.Any())
            {
                loadingLayer.Show();
            }
        }
Ejemplo n.º 19
0
        private void onSpotlightChanged(ValueChangedEvent <APISpotlight> spotlight)
        {
            loading.Show();

            cancellationToken?.Cancel();
            getRankingsRequest?.Cancel();

            getRankingsRequest          = new GetSpotlightRankingsRequest(Ruleset.Value, spotlight.NewValue.Id);
            getRankingsRequest.Success += onSuccess;
            api.Queue(getRankingsRequest);
        }
Ejemplo n.º 20
0
 private void updateLoadingLayer()
 {
     if (operationInProgress.Value)
     {
         loadingLayer.Show();
     }
     else
     {
         loadingLayer.Hide();
     }
 }
Ejemplo n.º 21
0
 private void updateLoadingLayer()
 {
     if (joiningRoom || !initialRoomsReceived.Value)
     {
         loadingLayer.Show();
     }
     else
     {
         loadingLayer.Hide();
     }
 }
Ejemplo n.º 22
0
        private void onSpotlightChanged()
        {
            loading.Show();

            cancellationToken?.Cancel();
            getRankingsRequest?.Cancel();

            getRankingsRequest          = new GetSpotlightRankingsRequest(Ruleset.Value, selectedSpotlight.Value.Id, sort.Value);
            getRankingsRequest.Success += onSuccess;
            api.Queue(getRankingsRequest);
        }
Ejemplo n.º 23
0
 private void updateLoadingLayer()
 {
     if (operationInProgress.Value || !initialRoomsReceived.Value)
     {
         loadingLayer.Show();
     }
     else
     {
         loadingLayer.Hide();
     }
 }
Ejemplo n.º 24
0
        private void performRegistration()
        {
            if (focusNextTextBox())
            {
                registerShake.Shake();
                return;
            }

            usernameDescription.ClearErrors();
            emailAddressDescription.ClearErrors();
            passwordDescription.ClearErrors();

            loadingLayer.Show();

            Task.Run(() =>
            {
                bool success;
                RegistrationRequest.RegistrationRequestErrors errors = null;

                try
                {
                    errors  = api.CreateAccount(emailTextBox.Text, usernameTextBox.Text, passwordTextBox.Text);
                    success = errors == null;
                }
                catch (Exception)
                {
                    success = false;
                }

                Schedule(() =>
                {
                    if (!success)
                    {
                        if (errors != null)
                        {
                            usernameDescription.AddErrors(errors.User.Username);
                            emailAddressDescription.AddErrors(errors.User.Email);
                            passwordDescription.AddErrors(errors.User.Password);
                        }
                        else
                        {
                            passwordDescription.AddErrors(new[] { "Something happened... but we're not sure what." });
                        }

                        registerShake.Shake();
                        loadingLayer.Hide();
                        return;
                    }

                    api.Login(usernameTextBox.Text, passwordTextBox.Text);
                });
            });
        }
Ejemplo n.º 25
0
    public void LoadScene(string sceneName, Action cb = null)
    {
        LoadingLayer loadingLayer = null;

        //if (sceneName == "MainMenu")
        {
            loadingLayer = UIHelper.Instance.New <LoadingLayer>(transform);
            loadingLayer.Show();
        }


        StartCoroutine(LoadAsyncScene(sceneName, loadingLayer, cb));
    }
        private void onArticleChanged(ValueChangedEvent <string> e)
        {
            cancellationToken?.Cancel();
            loading.Show();

            if (e.NewValue == null)
            {
                Header.SetFrontPage();
                LoadDisplay(new FrontPageDisplay());
                return;
            }

            Header.SetArticle(e.NewValue);
            LoadDisplay(Empty());
        }
Ejemplo n.º 27
0
    public void EnterScene(string rSceneName, UnityEngine.Events.UnityAction rOnInitSceneBegin = null, UnityEngine.Events.UnityAction rOnInitSceneEnd = null)
    {
        if (String.IsNullOrEmpty(rSceneName))
        {
            throw new NullReferenceException("loadSceneName is null");
        }
        else
        {
            loadSceneName = rSceneName;
        }

        OnInitializeScene         = rOnInitSceneBegin;
        OnInitializeSceneComplete = rOnInitSceneEnd;

        LoadingLayer.Show();

        LoadScene();
    }
            private void apply()
            {
                if (!ApplyButton.Enabled.Value)
                {
                    return;
                }

                hideError();
                loadingLayer.Show();

                // If the client is already in a room, update via the client.
                // Otherwise, update the room directly in preparation for it to be submitted to the API on match creation.
                if (client.Room != null)
                {
                    client.ChangeSettings(name: NameField.Text).ContinueWith(t => Schedule(() =>
                    {
                        if (t.IsCompletedSuccessfully)
                        {
                            onSuccess(currentRoom.Value);
                        }
                        else
                        {
                            onError(t.Exception?.AsSingular().Message ?? "Error changing settings.");
                        }
                    }));
                }
                else
                {
                    currentRoom.Value.Name.Value         = NameField.Text;
                    currentRoom.Value.Availability.Value = AvailabilityPicker.Current.Value;
                    currentRoom.Value.Type.Value         = TypePicker.Current.Value;

                    if (int.TryParse(MaxParticipantsField.Text, out int max))
                    {
                        currentRoom.Value.MaxParticipants.Value = max;
                    }
                    else
                    {
                        currentRoom.Value.MaxParticipants.Value = null;
                    }

                    manager?.CreateRoom(currentRoom.Value, onSuccess, onError);
                }
            }
        protected override bool OnStart()
        {
            itemSelected = true;
            var item = new PlaylistItem();

            item.Beatmap.Value = Beatmap.Value.BeatmapInfo;
            item.Ruleset.Value = Ruleset.Value;

            item.RequiredMods.Clear();
            item.RequiredMods.AddRange(Mods.Value.Select(m => m.CreateCopy()));

            // If the client is already in a room, update via the client.
            // Otherwise, update the playlist directly in preparation for it to be submitted to the API on match creation.
            if (client.Room != null)
            {
                loadingLayer.Show();

                client.ChangeSettings(item: item).ContinueWith(t =>
                {
                    Schedule(() =>
                    {
                        loadingLayer.Hide();

                        if (t.IsCompletedSuccessfully)
                        {
                            this.Exit();
                        }
                        else
                        {
                            Logger.Log($"Could not use current beatmap ({t.Exception?.Message})", level: LogLevel.Important);
                            Carousel.AllowSelection = true;
                        }
                    });
                });
            }
            else
            {
                playlist.Clear();
                playlist.Add(item);
                this.Exit();
            }

            return(true);
        }
Ejemplo n.º 30
0
        protected override void SelectItem(PlaylistItem item)
        {
            // If the client is already in a room, update via the client.
            // Otherwise, update the playlist directly in preparation for it to be submitted to the API on match creation.
            if (client.Room != null)
            {
                loadingLayer.Show();

                var multiplayerItem = new MultiplayerPlaylistItem
                {
                    ID              = itemToEdit ?? 0,
                    BeatmapID       = item.Beatmap.OnlineID,
                    BeatmapChecksum = item.Beatmap.MD5Hash,
                    RulesetID       = item.RulesetID,
                    RequiredMods    = item.RequiredMods.ToArray(),
                    AllowedMods     = item.AllowedMods.ToArray()
                };

                Task task = itemToEdit != null?client.EditPlaylistItem(multiplayerItem) : client.AddPlaylistItem(multiplayerItem);

                task.FireAndForget(onSuccess: () => Schedule(() =>
                {
                    loadingLayer.Hide();

                    // If an error or server side trigger occurred this screen may have already exited by external means.
                    if (this.IsCurrentScreen())
                    {
                        this.Exit();
                    }
                }), onError: _ => Schedule(() =>
                {
                    loadingLayer.Hide();
                    Carousel.AllowSelection = true;
                }));
            }
            else
            {
                Playlist.Clear();
                Playlist.Add(item);
                this.Exit();
            }
        }