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); }
protected override void OnDirectionChanged(ValueChangedEvent <ScrollingDirection> e) { base.OnDirectionChanged(e); headPiece.Anchor = headPiece.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; }
private void bindable_ValueChanged(ValueChangedEvent <PanelDisplayStyle> e) { icon.FadeTo(e.NewValue == style ? 1.0f : 0.5f, 100); }
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; }
private void onBreakTimeChanged(ValueChangedEvent <bool> isBreakTime) { updateGameplayState(); updatePauseOnFocusLostState(); HUDOverlay.KeyCounter.IsCounting = !isBreakTime.NewValue; }
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(); }
private void updateDrawable(ValueChangedEvent <string> flag) { drawableContainer.Child = new DrawableTeamFlag(Model); }
protected override void OnComboChange(ValueChangedEvent <int> e) { this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); }
private void updateMajor(ValueChangedEvent <bool> major) { line.Alpha = major.NewValue ? 1f : 0.75f; triangleContainer.Alpha = major.NewValue ? 1 : 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); }
private void fileChanged(ValueChangedEvent <FileInfo> selectedFile) { importButton.Enabled.Value = selectedFile.NewValue != null; currentFileText.Text = selectedFile.NewValue?.Name ?? "選擇一個檔案..."; }
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; }
protected override void OnDirectionChanged(ValueChangedEvent <ScrollingDirection> e) { base.OnDirectionChanged(e); bodyPiece.Anchor = bodyPiece.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; }
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); } }
private void onAccentChanged(ValueChangedEvent <Colour4> accent) => Background.Colour = accent.NewValue.Opacity(0.7f);
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) } } }, } }; } }
private void matchChanged(ValueChangedEvent <TournamentMatch> match) => currentTeam.Value = currentMatch.Value.Team1.Value;
private void userChanged(ValueChangedEvent <APIUser> e) => button.Enabled.Value = !(e.NewValue is GuestUser);
private void onTokenChanged(ValueChangedEvent <OAuthToken> e) => config.Set(OsuSetting.Token, config.Get <bool>(OsuSetting.SavePassword) ? authentication.TokenString : string.Empty);
private void enabledChanged(ValueChangedEvent <bool> e) => this.FadeColour(e.NewValue ? Color4.White : Color4.Gray, 200, Easing.OutQuint);
private void onDisplayModeChanged(ValueChangedEvent <MultiplayerPlaylistDisplayMode> mode) { historyList.FadeTo(mode.NewValue == MultiplayerPlaylistDisplayMode.History ? 1 : 0, 100); queueList.FadeTo(mode.NewValue == MultiplayerPlaylistDisplayMode.Queue ? 1 : 0, 100); }
add => AddHandler(ValueChangedEvent, value);
private void beatmapChanged(ValueChangedEvent <TournamentBeatmap> beatmap) { SongBar.FadeInFromZero(300, Easing.OutQuint); SongBar.Beatmap = beatmap.NewValue; }
remove => RemoveHandler(ValueChangedEvent, value);
private void onStartTimeChanged(ValueChangedEvent <double> startTime) => updateState(State.Value, true);
private void onDirectionChanged(ValueChangedEvent <ScrollingDirection> direction) { updateHitPosition(); }
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; }