Beispiel #1
0
        protected override void OnRoomUpdated()
        {
            base.OnRoomUpdated();

            if (Room == null || Client.LocalUser == null)
            {
                return;
            }

            const double fade_time = 50;

            var currentItem = Playlist.GetCurrentItem();

            Debug.Assert(currentItem != null);

            var ruleset = rulesets.GetRuleset(currentItem.RulesetID)?.CreateInstance();

            int?currentModeRank = ruleset != null?User.User?.RulesetsStatistics?.GetValueOrDefault(ruleset.ShortName)?.GlobalRank : null;

            userRankText.Text = currentModeRank != null ? $"#{currentModeRank.Value:N0}" : string.Empty;

            userStateDisplay.UpdateStatus(User.State, User.BeatmapAvailability);

            if ((User.BeatmapAvailability.State == DownloadState.LocallyAvailable) && (User.State != MultiplayerUserState.Spectating))
            {
                userModsDisplay.FadeIn(fade_time);
            }
            else
            {
                userModsDisplay.FadeOut(fade_time);
            }

            if (Client.IsHost && !User.Equals(Client.LocalUser))
            {
                kickButton.FadeIn(fade_time);
            }
            else
            {
                kickButton.FadeOut(fade_time);
            }

            if (Room.Host?.Equals(User) == true)
            {
                crown.FadeIn(fade_time);
            }
            else
            {
                crown.FadeOut(fade_time);
            }

            // If the mods are updated at the end of the frame, the flow container will skip a reflow cycle: https://github.com/ppy/osu-framework/issues/4187
            // This looks particularly jarring here, so re-schedule the update to that start of our frame as a fix.
            Schedule(() => userModsDisplay.Current.Value = User.Mods.Select(m => m.ToMod(ruleset)).ToList());
        }
Beispiel #2
0
 protected override Ruleset GetRuleset(int rulesetId) => rulesets.GetRuleset(rulesetId)?.CreateInstance();