private void load(OsuGame game, ScoreManager scores) { InternalChild = shakeContainer = new ShakeContainer { RelativeSizeAxes = Axes.Both, Child = button = new DownloadButton { RelativeSizeAxes = Axes.Both, } }; button.Action = () => { switch (State.Value) { case DownloadState.LocallyAvailable: game?.PresentScore(Model.Value); break; case DownloadState.NotDownloaded: scores.Download(Model.Value); break; case DownloadState.Downloaded: case DownloadState.Downloading: shakeContainer.Shake(); break; } }; State.BindValueChanged(state => { button.State.Value = state.NewValue; switch (replayAvailability) { case ReplayAvailability.Local: button.TooltipText = @"Watch replay"; break; case ReplayAvailability.Online: button.TooltipText = @"Download replay"; break; default: button.TooltipText = @"Replay unavailable"; break; } }, true); if (replayAvailability == ReplayAvailability.NotAvailable) { button.Enabled.Value = false; button.Alpha = 0.6f; } }
private void load(OsuGame game, ScoreManager scores) { InternalChild = shakeContainer = new ShakeContainer { RelativeSizeAxes = Axes.Both, Child = button = new DownloadButton { RelativeSizeAxes = Axes.Both, } }; button.Action = () => { switch (State.Value) { case DownloadState.LocallyAvailable: game?.PresentScore(Score.Value, ScorePresentType.Gameplay); break; case DownloadState.NotDownloaded: scores.Download(Score.Value, false); break; case DownloadState.Importing: case DownloadState.Downloading: shakeContainer.Shake(); break; } }; Score.BindValueChanged(score => { downloadTracker?.RemoveAndDisposeImmediately(); if (score.NewValue != null) { AddInternal(downloadTracker = new ScoreDownloadTracker(score.NewValue) { State = { BindTarget = State } }); } button.Enabled.Value = replayAvailability != ReplayAvailability.NotAvailable; updateTooltip(); }, true); State.BindValueChanged(state => { button.State.Value = state.NewValue; updateTooltip(); }, true); }
private void load(OsuGame game, ScoreManager scores) { InternalChild = shakeContainer = new ShakeContainer { RelativeSizeAxes = Axes.Both, Child = button = new DownloadButton { RelativeSizeAxes = Axes.Both, } }; button.Action = () => { switch (State.Value) { case DownloadState.LocallyAvailable: game?.PresentScore(Model.Value, ScorePresentType.Gameplay); break; case DownloadState.NotDownloaded: scores.Download(Model.Value); break; case DownloadState.Importing: case DownloadState.Downloading: shakeContainer.Shake(); break; } }; State.BindValueChanged(state => { button.State.Value = state.NewValue; updateTooltip(); }, true); Model.BindValueChanged(_ => { button.Enabled.Value = replayAvailability != ReplayAvailability.NotAvailable; updateTooltip(); }, true); }