private static GlobalAction getAction(ValueChangedEvent <double> change) => change.NewValue - change.OldValue > 0
     ? GlobalAction.EditorIncreaseDistanceSpacing
     : GlobalAction.EditorDecreaseDistanceSpacing;
 private void updateTime(ValueChangedEvent <User> user)
 {
     TooltipText  = (user.NewValue?.Statistics?.PlayTime ?? 0) / 3600 + " 個小時";
     info.Content = formatTime(user.NewValue?.Statistics?.PlayTime);
 }
Beispiel #3
0
        protected override void OnDirectionChanged(ValueChangedEvent <ScrollingDirection> e)
        {
            base.OnDirectionChanged(e);

            headPiece.Anchor = headPiece.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
        }
Beispiel #4
0
 private void bindable_ValueChanged(ValueChangedEvent <PanelDisplayStyle> e)
 {
     icon.FadeTo(e.NewValue == style ? 1.0f : 0.5f, 100);
 }
Beispiel #5
0
 private void modsChanged(ValueChangedEvent <LegacyMods> mods)
 {
     SongBar.Mods = mods.NewValue;
 }
        protected override void OnDirectionChanged(ValueChangedEvent <ScrollingDirection> e)
        {
            base.OnDirectionChanged(e);

            Origin = Anchor = e.NewValue == ScrollingDirection.Left ? Anchor.CentreRight : Anchor.CentreLeft;
        }
Beispiel #7
0
 private void onBreakTimeChanged(ValueChangedEvent <bool> isBreakTime)
 {
     updateGameplayState();
     updatePauseOnFocusLostState();
     HUDOverlay.KeyCounter.IsCounting = !isBreakTime.NewValue;
 }
Beispiel #8
0
        private void updateCompletionState(ValueChangedEvent <bool> completionState)
        {
            // screen may be in the exiting transition phase.
            if (!this.IsCurrentScreen())
            {
                return;
            }

            if (!completionState.NewValue)
            {
                completionProgressDelegate?.Cancel();
                completionProgressDelegate = null;
                ValidForResume             = true;
                return;
            }

            if (completionProgressDelegate != null)
            {
                throw new InvalidOperationException($"{nameof(updateCompletionState)} was fired more than once");
            }

            // Only show the completion screen if the player hasn't failed
            if (HealthProcessor.HasFailed)
            {
                return;
            }

            ValidForResume = false;

            if (!Configuration.ShowResults)
            {
                return;
            }

            scoreSubmissionTask ??= Task.Run(async() =>
            {
                var score = CreateScore();

                try
                {
                    await SubmitScore(score).ConfigureAwait(false);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex, "Score submission failed!");
                }

                try
                {
                    await ImportScore(score).ConfigureAwait(false);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex, "Score import failed!");
                }

                return(score.ScoreInfo);
            });

            using (BeginDelayedSequence(RESULTS_DISPLAY_DELAY))
                scheduleCompletion();
        }
Beispiel #9
0
 private void updateDrawable(ValueChangedEvent <string> flag)
 {
     drawableContainer.Child = new DrawableTeamFlag(Model);
 }
Beispiel #10
0
 protected override void OnComboChange(ValueChangedEvent <int> e)
 {
     this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(e.NewValue)), FLASHLIGHT_FADE_DURATION);
 }
Beispiel #11
0
 private void updateMajor(ValueChangedEvent <bool> major)
 {
     line.Alpha = major.NewValue ? 1f : 0.75f;
     triangleContainer.Alpha = major.NewValue ? 1 : 0;
 }
Beispiel #12
0
 public void OnSliderTrackingChange(ValueChangedEvent <bool> e)
 {
     // If a slider is in a tracking state, a further dim should be applied to the (remaining) visible portion of the playfield over a brief duration.
     this.TransformTo(nameof(FlashlightDim), e.NewValue ? 0.8f : 0.0f, 50);
 }
Beispiel #13
0
 private void fileChanged(ValueChangedEvent <FileInfo> selectedFile)
 {
     importButton.Enabled.Value = selectedFile.NewValue != null;
     currentFileText.Text       = selectedFile.NewValue?.Name ?? "選擇一個檔案...";
 }
Beispiel #14
0
 private void directoryChanged(ValueChangedEvent <DirectoryInfo> _)
 {
     // this should probably be done by the selector itself, but let's do it here for now.
     fileSelector.CurrentFile.Value = null;
 }
Beispiel #15
0
        protected override void OnDirectionChanged(ValueChangedEvent <ScrollingDirection> e)
        {
            base.OnDirectionChanged(e);

            bodyPiece.Anchor = bodyPiece.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft;
        }
Beispiel #16
0
        private void currentChannelChanged(ValueChangedEvent <Channel> e)
        {
            if (e.NewValue == null)
            {
                textBox.Current.Disabled = true;
                currentChannelContainer.Clear(false);
                ChannelSelectionOverlay.Show();
                return;
            }

            if (e.NewValue is ChannelSelectorTabItem.ChannelSelectorTabChannel)
            {
                return;
            }

            textBox.Current.Disabled = e.NewValue.ReadOnly;

            if (ChannelTabControl.Current.Value != e.NewValue)
            {
                Scheduler.Add(() => ChannelTabControl.Current.Value = e.NewValue);
            }

            var loaded = loadedChannels.Find(d => d.Channel == e.NewValue);

            if (loaded == null)
            {
                currentChannelContainer.FadeOut(500, Easing.OutQuint);
                loading.Show();

                loaded = new DrawableChannel(e.NewValue);
                loadedChannels.Add(loaded);
                LoadComponentAsync(loaded, l =>
                {
                    if (currentChannel.Value != e.NewValue)
                    {
                        return;
                    }

                    // check once more to ensure the channel hasn't since been removed from the loaded channels list (may have been left by some automated means).
                    if (!loadedChannels.Contains(loaded))
                    {
                        return;
                    }

                    loading.Hide();

                    currentChannelContainer.Clear(false);
                    currentChannelContainer.Add(loaded);
                    currentChannelContainer.FadeIn(500, Easing.OutQuint);
                });
            }
            else
            {
                currentChannelContainer.Clear(false);
                currentChannelContainer.Add(loaded);
            }

            // mark channel as read when channel switched
            if (e.NewValue.Messages.Any())
            {
                channelManager.MarkChannelAsRead(e.NewValue);
            }
        }
Beispiel #17
0
 private void onAccentChanged(ValueChangedEvent <Colour4> accent) => Background.Colour = accent.NewValue.Opacity(0.7f);
Beispiel #18
0
        private void matchChanged(ValueChangedEvent <TournamentMatch> match)
        {
            var upcoming     = ladder.Matches.Where(p => !p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4);
            var conditionals = ladder
                               .Matches.Where(p => !p.Completed.Value && (p.Team1.Value == null || p.Team2.Value == null) && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4)
                               .SelectMany(m => m.ConditionalMatches.Where(cp => m.Acronyms.TrueForAll(a => cp.Acronyms.Contains(a))));

            upcoming = upcoming.Concat(conditionals);
            upcoming = upcoming.OrderBy(p => p.Date.Value).Take(8);

            ScheduleContainer comingUpNext;

            mainContainer.Child = new FillFlowContainer
            {
                RelativeSizeAxes = Axes.Both,
                Direction        = FillDirection.Vertical,
                Children         = new Drawable[]
                {
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Height           = 0.74f,
                        Child            = new FillFlowContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            Direction        = FillDirection.Horizontal,
                            Children         = new Drawable[]
                            {
                                new ScheduleContainer("recent matches")
                                {
                                    RelativeSizeAxes   = Axes.Both,
                                    Width              = 0.4f,
                                    ChildrenEnumerable = ladder.Matches
                                                         .Where(p => p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null &&
                                                                Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4)
                                                         .OrderByDescending(p => p.Date.Value)
                                                         .Take(8)
                                                         .Select(p => new ScheduleMatch(p))
                                },
                                new ScheduleContainer("upcoming matches")
                                {
                                    RelativeSizeAxes   = Axes.Both,
                                    Width              = 0.6f,
                                    ChildrenEnumerable = upcoming.Select(p => new ScheduleMatch(p))
                                },
                            }
                        }
                    },
                    comingUpNext = new ScheduleContainer("coming up next")
                    {
                        RelativeSizeAxes = Axes.Both,
                        Height           = 0.25f,
                    }
                }
            };

            if (match.NewValue != null)
            {
                comingUpNext.Child = new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Horizontal,
                    Spacing      = new Vector2(30),
                    Children     = new Drawable[]
                    {
                        new ScheduleMatch(match.NewValue, false)
                        {
                            Anchor = Anchor.CentreLeft,
                            Origin = Anchor.CentreLeft,
                        },
                        new TournamentSpriteTextWithBackground(match.NewValue.Round.Value?.Name.Value)
                        {
                            Anchor = Anchor.CentreLeft,
                            Origin = Anchor.CentreLeft,
                            Scale  = new Vector2(0.5f)
                        },
                        new TournamentSpriteText
                        {
                            Anchor = Anchor.CentreLeft,
                            Origin = Anchor.CentreLeft,
                            Text   = match.NewValue.Team1.Value?.FullName + " vs " + match.NewValue.Team2.Value?.FullName,
                            Font   = OsuFont.Torus.With(size: 24, weight: FontWeight.SemiBold)
                        },
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Horizontal,
                            Anchor       = Anchor.CentreLeft,
                            Origin       = Anchor.CentreLeft,
                            Children     = new Drawable[]
                            {
                                new ScheduleMatchDate(match.NewValue.Date.Value)
                                {
                                    Font = OsuFont.Torus.With(size: 24, weight: FontWeight.Regular)
                                }
                            }
                        },
                    }
                };
            }
        }
Beispiel #19
0
 private void matchChanged(ValueChangedEvent <TournamentMatch> match) =>
 currentTeam.Value = currentMatch.Value.Team1.Value;
Beispiel #20
0
 private void userChanged(ValueChangedEvent <APIUser> e) => button.Enabled.Value = !(e.NewValue is GuestUser);
Beispiel #21
0
 private void onTokenChanged(ValueChangedEvent <OAuthToken> e) => config.Set(OsuSetting.Token, config.Get <bool>(OsuSetting.SavePassword) ? authentication.TokenString : string.Empty);
Beispiel #22
0
 private void enabledChanged(ValueChangedEvent <bool> e) => this.FadeColour(e.NewValue ? Color4.White : Color4.Gray, 200, Easing.OutQuint);
Beispiel #23
0
 private void onDisplayModeChanged(ValueChangedEvent <MultiplayerPlaylistDisplayMode> mode)
 {
     historyList.FadeTo(mode.NewValue == MultiplayerPlaylistDisplayMode.History ? 1 : 0, 100);
     queueList.FadeTo(mode.NewValue == MultiplayerPlaylistDisplayMode.Queue ? 1 : 0, 100);
 }
Beispiel #24
0
 add => AddHandler(ValueChangedEvent, value);
Beispiel #25
0
 private void beatmapChanged(ValueChangedEvent <TournamentBeatmap> beatmap)
 {
     SongBar.FadeInFromZero(300, Easing.OutQuint);
     SongBar.Beatmap = beatmap.NewValue;
 }
Beispiel #26
0
 remove => RemoveHandler(ValueChangedEvent, value);
Beispiel #27
0
 private void onStartTimeChanged(ValueChangedEvent <double> startTime) => updateState(State.Value, true);
Beispiel #28
0
 private void onDirectionChanged(ValueChangedEvent <ScrollingDirection> direction)
 {
     updateHitPosition();
 }
Beispiel #29
0
 private void beatmapChanged(ValueChangedEvent <WorkingBeatmap> beatmap) => changeBeatmap(beatmap.NewValue);
 public DistanceSpacingToast(LocalisableString value, ValueChangedEvent <double> change)
     : base(getAction(change).GetLocalisableDescription(), value, string.Empty)
 {
     this.change = change;
 }