コード例 #1
0
        private SkinnableSound addSound(SampleInfo sampleInfo)
        {
            var drawable = new SkinnableSound(sampleInfo);

            Sounds.Add(drawable);
            return(drawable);
        }
コード例 #2
0
        private void load()
        {
            var judgement = HitObject.CreateJudgement();

            if (judgement != null)
            {
                Result = CreateResult(judgement);
                if (Result == null)
                {
                    throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateResult)}.");
                }
            }

            var samples = GetSamples().ToArray();

            if (samples.Length > 0)
            {
                if (HitObject.SampleControlPoint == null)
                {
                    throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)}s must always have an attached {nameof(HitObject.SampleControlPoint)}."
                                                    + $" This is an indication that {nameof(HitObject.ApplyDefaults)} has not been invoked on {this}.");
                }

                samples = samples.Select(s => HitObject.SampleControlPoint.ApplyTo(s)).ToArray();
                foreach (var s in samples)
                {
                    s.Namespace = SampleNamespace;
                }

                AddInternal(Samples = new SkinnableSound(samples));
            }
        }
コード例 #3
0
        private void loadSamples()
        {
            if (Samples != null)
            {
                RemoveInternal(Samples);
                Samples = null;
            }

            var samples = GetSamples().ToArray();

            if (samples.Length <= 0)
            {
                return;
            }

            if (HitObject.SampleControlPoint == null)
            {
                throw new InvalidOperationException($"{nameof(HitObject)}s must always have an attached {nameof(HitObject.SampleControlPoint)}."
                                                    + $" This is an indication that {nameof(HitObject.ApplyDefaults)} has not been invoked on {this}.");
            }

            samples = samples.Select(s => HitObject.SampleControlPoint.ApplyTo(s)).ToArray();
            foreach (var s in samples)
            {
                s.Namespace = SampleNamespace;
            }

            AddInternal(Samples = new SkinnableSound(samples));
        }
コード例 #4
0
        private void loadSamples()
        {
            if (Samples != null)
            {
                RemoveInternal(Samples);
                Samples = null;
            }

            var samples = GetSamples().ToArray();

            if (samples.Length <= 0)
            {
                return;
            }

            if (HitObject.SampleControlPoint == null)
            {
                throw new InvalidOperationException($"{nameof(HitObject)}s must always have an attached {nameof(HitObject.SampleControlPoint)}."
                                                    + $" This is an indication that {nameof(HitObject.ApplyDefaults)} has not been invoked on {this}.");
            }

            Samples = new SkinnableSound(samples.Select(s => HitObject.SampleControlPoint.ApplyTo(s)));
            Samples.AddAdjustment(AdjustableProperty.Balance, balanceAdjust);
            AddInternal(Samples);
        }
コード例 #5
0
ファイル: DivaPlayfield.cs プロジェクト: 4zjata/osu-DIVA
 private void load()
 {
     AddRangeInternal(new Drawable[]
     {
         HitObjectContainer,
         hitSample = new SkinnableSound(new SampleInfo("normal-hitnormal")),
     });
 }
コード例 #6
0
        private SkinnableSound getNextSample()
        {
            SkinnableSound hitSound = hitSounds[nextHitSoundIndex];

            // round robin over available samples to allow for concurrent playback.
            nextHitSoundIndex = (nextHitSoundIndex + 1) % max_concurrent_hitsounds;

            return(hitSound);
        }
コード例 #7
0
        private SkinnableSound addSound(HitSampleInfo hitSampleInfo, double lifetimeStart, double lifetimeEnd)
        {
            var drawable = new SkinnableSound(hitSampleInfo)
            {
                LifetimeStart = lifetimeStart,
                LifetimeEnd   = lifetimeEnd
            };

            AddInternal(drawable);
            return(drawable);
        }
コード例 #8
0
        private void load(OsuColour colours)
        {
            AddButton("Continue", colours.Green, () => OnResume?.Invoke());
            AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke());
            AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());

            AddInternal(pauseLoop = new SkinnableSound(new SampleInfo("pause-loop"))
            {
                Looping = true,
                Volume  = { Value = 0 }
            });
        }
コード例 #9
0
ファイル: PauseOverlay.cs プロジェクト: claike/osu
        private void load(OsuColour colours)
        {
            AddButton("Continue", colours.Green, () => OnResume?.Invoke());
            AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke());
            AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());

            AddInternal(pauseLoop = new SkinnableSound(new SampleInfo("pause-loop"))
            {
                Looping = true,
            });

            // SkinnableSound only plays a sound if its aggregate volume is > 0, so the volume must be turned up before playing it
            pauseLoop.VolumeTo(minimum_volume);
        }
コード例 #10
0
        public void SetUp() => Schedule(() =>
        {
            gameplayClock.IsPaused.Value = false;

            Children = new Drawable[]
            {
                new Container
                {
                    Clock            = gameplayClock,
                    RelativeSizeAxes = Axes.Both,
                    Child            = skinnableSound = new SkinnableSound(new SampleInfo("normal-sliderslide"))
                },
            };
        });
コード例 #11
0
        private void load(AudioManager audio, IAPIProvider api)
        {
            if (MenuVoice.Value)
            {
                if (api.LocalUser.Value.IsSupporter)
                {
                    AddInternal(skinnableWelcome = new SkinnableSound(new SampleInfo(@"Intro/Welcome/welcome")));
                }
                else
                {
                    welcome = audio.Samples.Get(@"Intro/Welcome/welcome");
                }
            }

            pianoReverb = audio.Samples.Get(@"Intro/Welcome/welcome_piano");
        }
コード例 #12
0
        private void load()
        {
            var samples = GetSamples().ToArray();

            if (samples.Any())
            {
                if (HitObject.SampleControlPoint == null)
                {
                    throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)}s must always have an attached {nameof(HitObject.SampleControlPoint)}."
                                                    + $" This is an indication that {nameof(HitObject.ApplyDefaults)} has not been invoked on {this}.");
                }
                AddInternal(Samples = new SkinnableSound(samples.Select(s => new SampleInfo
                {
                    Bank      = s.Bank ?? HitObject.SampleControlPoint.SampleBank,
                    Name      = s.Name,
                    Volume    = s.Volume > 0 ? s.Volume : HitObject.SampleControlPoint.SampleVolume,
                    Namespace = SampleNamespace
                }).ToArray()));
            }
        }
コード例 #13
0
        protected override void LoadSamples()
        {
            base.LoadSamples();

            slidingSample?.Expire();
            slidingSample = null;

            var firstSample = HitObject.Samples.FirstOrDefault();

            if (firstSample != null)
            {
                var clone = HitObject.SampleControlPoint.ApplyTo(firstSample);
                clone.Name = "sliderslide";

                AddInternal(slidingSample = new SkinnableSound(clone)
                {
                    Looping = true
                });
            }
        }
コード例 #14
0
        protected override void LoadSamples()
        {
            base.LoadSamples();

            spinningSample?.Expire();
            spinningSample = null;

            var firstSample = HitObject.Samples.FirstOrDefault();

            if (firstSample != null)
            {
                var clone = HitObject.SampleControlPoint.ApplyTo(firstSample);
                clone.Name = "spinnerspin";

                AddInternal(spinningSample = new SkinnableSound(clone)
                {
                    Volume  = { Value = minimum_volume },
                    Looping = true,
                });
            }
        }
コード例 #15
0
        private void load()
        {
            var samples = GetSamples().ToArray();

            if (samples.Any())
            {
                if (HitObject.SampleControlPoint == null)
                {
                    throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)}s must always have an attached {nameof(HitObject.SampleControlPoint)}."
                                                    + $" This is an indication that {nameof(HitObject.ApplyDefaults)} has not been invoked on {this}.");
                }

                samples = samples.Select(s => HitObject.SampleControlPoint.ApplyTo(s)).ToArray();
                foreach (var s in samples)
                {
                    s.Namespace = SampleNamespace;
                }

                AddInternal(Samples = new SkinnableSound(samples));
            }
        }
コード例 #16
0
 public SentakkiResumeOverlay()
 {
     Origin           = Anchor.Centre;
     Anchor           = Anchor.Centre;
     RelativeSizeAxes = Axes.Both;
     Children         = new Drawable[] {
         counterText = new OsuSpriteText
         {
             Anchor       = Anchor.Centre,
             Origin       = Anchor.Centre,
             Text         = "",
             Font         = OsuFont.Torus.With(size: 50),
             Colour       = Color4.White,
             Shadow       = true,
             ShadowColour = new Color4(0f, 0f, 0f, 0.25f)
         },
         new FillFlowContainer {
             Direction            = FillDirection.Horizontal,
             RelativePositionAxes = Axes.Both,
             Y        = -0.4f,
             Anchor   = Anchor.BottomCentre,
             Origin   = Anchor.BottomCentre,
             Children = new Drawable[] {
                 new OsuSpriteText
                 {
                     Text         = "Sentakki is made with the support of ",
                     Font         = OsuFont.Torus.With(size: 20),
                     Colour       = Color4.White,
                     Anchor       = Anchor.Centre,
                     Origin       = Anchor.Centre,
                     Shadow       = true,
                     ShadowColour = new Color4(0f, 0f, 0f, 0.25f)
                 },
                 supporterText = new OsuSpriteText
                 {
                     Text         = "Marisa Kirisame",
                     Font         = OsuFont.Torus.With(size: 20, weight: FontWeight.SemiBold),
                     Colour       = Color4Extensions.FromHex("ff0064"),
                     Anchor       = Anchor.Centre,
                     Origin       = Anchor.Centre,
                     Shadow       = true,
                     ShadowColour = new Color4(0f, 0f, 0f, 0.25f)
                 }
             }
         },
         countSound = new SkinnableSound(new SampleInfo("Gameplay/Taka"))
     };
     tickCount.BindValueChanged(
         ticks =>
     {
         counterText.Text = (ticks.NewValue == 4) ? "" : ticks.NewValue.ToString();
         if (ticks.NewValue % 4 != 0)
         {
             countSound?.Play();
         }
         if (ticks.NewValue <= 0)
         {
             Resume();
         }
     }
         );
 }
コード例 #17
0
 private void load()
 {
     InternalChild = comboBreakSample = new SkinnableSound(new SampleInfo("combobreak"));
 }
コード例 #18
0
ファイル: ResultsScreen.cs プロジェクト: timiimit/osu
        private void load()
        {
            FillFlowContainer buttons;

            InternalChild = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                Content          = new[]
                {
                    new Drawable[]
                    {
                        new VerticalScrollContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            ScrollbarVisible = false,
                            Child            = new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Children         = new Drawable[]
                                {
                                    statisticsPanel = new StatisticsPanel
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Score            = { BindTarget = SelectedScore }
                                    },
                                    ScorePanelList = new ScorePanelList
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        SelectedScore    = { BindTarget = SelectedScore },
                                        PostExpandAction = () => statisticsPanel.ToggleVisibility()
                                    },
                                    detachedPanelContainer = new Container <ScorePanel>
                                    {
                                        RelativeSizeAxes = Axes.Both
                                    },
                                }
                            }
                        },
                    },
                    new[]
                    {
                        bottomPanel = new Container
                        {
                            Anchor           = Anchor.BottomLeft,
                            Origin           = Anchor.BottomLeft,
                            RelativeSizeAxes = Axes.X,
                            Height           = TwoLayerButton.SIZE_EXTENDED.Y,
                            Alpha            = 0,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = Color4Extensions.FromHex("#333")
                                },
                                buttons = new FillFlowContainer
                                {
                                    Anchor       = Anchor.Centre,
                                    Origin       = Anchor.Centre,
                                    AutoSizeAxes = Axes.Both,
                                    Spacing      = new Vector2(5),
                                    Direction    = FillDirection.Horizontal
                                }
                            }
                        }
                    }
                },
                RowDimensions = new[]
                {
                    new Dimension(),
                    new Dimension(GridSizeMode.AutoSize)
                }
            };

            if (Score != null)
            {
                // only show flair / animation when arriving after watching a play that isn't autoplay.
                bool shouldFlair = player != null && !Score.Mods.Any(m => m is ModAutoplay);

                ScorePanelList.AddScore(Score, shouldFlair);

                if (shouldFlair)
                {
                    AddInternal(applauseSound = Score.Rank >= ScoreRank.A
                        ? new SkinnableSound(new SampleInfo("Results/rankpass", "applause"))
                        : new SkinnableSound(new SampleInfo("Results/rankfail")));
                }
            }

            if (allowWatchingReplay)
            {
                buttons.Add(new ReplayDownloadButton(null)
                {
                    Score = { BindTarget = SelectedScore },
                    Width = 300
                });
            }

            if (player != null && allowRetry)
            {
                buttons.Add(new RetryButton {
                    Width = 300
                });

                AddInternal(new HotkeyRetryOverlay
                {
                    Action = () =>
                    {
                        if (!this.IsCurrentScreen())
                        {
                            return;
                        }

                        player?.Restart();
                    },
                });
            }
        }
コード例 #19
0
        private void load(AudioManager audio)
        {
            InternalChildren = new Drawable[]
            {
                new SmoothCircularProgress
                {
                    Name             = "Background circle",
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.Gray(47),
                    Alpha            = 0.5f,
                    InnerRadius      = accuracy_circle_radius + 0.01f, // Extends a little bit into the circle
                    Current          = { Value = 1 },
                },
                accuracyCircle = new SmoothCircularProgress
                {
                    Name             = "Accuracy circle",
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    Colour           = ColourInfo.GradientVertical(Color4Extensions.FromHex("#7CF6FF"), Color4Extensions.FromHex("#BAFFA9")),
                    InnerRadius      = accuracy_circle_radius,
                },
                new BufferedContainer
                {
                    Name             = "Graded circles",
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    Size             = new Vector2(0.8f),
                    Padding          = new MarginPadding(2),
                    Children         = new Drawable[]
                    {
                        new SmoothCircularProgress
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = OsuColour.ForRank(ScoreRank.X),
                            InnerRadius      = RANK_CIRCLE_RADIUS,
                            Current          = { Value = 1 }
                        },
                        new SmoothCircularProgress
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = OsuColour.ForRank(ScoreRank.S),
                            InnerRadius      = RANK_CIRCLE_RADIUS,
                            Current          = { Value = 1 - virtual_ss_percentage }
                        },
                        new SmoothCircularProgress
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = OsuColour.ForRank(ScoreRank.A),
                            InnerRadius      = RANK_CIRCLE_RADIUS,
                            Current          = { Value = 0.95f }
                        },
                        new SmoothCircularProgress
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = OsuColour.ForRank(ScoreRank.B),
                            InnerRadius      = RANK_CIRCLE_RADIUS,
                            Current          = { Value = 0.9f }
                        },
                        new SmoothCircularProgress
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = OsuColour.ForRank(ScoreRank.C),
                            InnerRadius      = RANK_CIRCLE_RADIUS,
                            Current          = { Value = 0.8f }
                        },
                        new SmoothCircularProgress
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = OsuColour.ForRank(ScoreRank.D),
                            InnerRadius      = RANK_CIRCLE_RADIUS,
                            Current          = { Value = 0.7f }
                        },
                        new RankNotch(0),
                        new RankNotch((float)(1 - virtual_ss_percentage)),
                        new RankNotch(0.95f),
                        new RankNotch(0.9f),
                        new RankNotch(0.8f),
                        new RankNotch(0.7f),
                        new BufferedContainer
                        {
                            Name             = "Graded circle mask",
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding(1),
                            Blending         = new BlendingParameters
                            {
                                Source           = BlendingType.DstColor,
                                Destination      = BlendingType.OneMinusSrcAlpha,
                                SourceAlpha      = BlendingType.One,
                                DestinationAlpha = BlendingType.SrcAlpha
                            },
                            Child = innerMask = new SmoothCircularProgress
                            {
                                RelativeSizeAxes = Axes.Both,
                                InnerRadius      = RANK_CIRCLE_RADIUS - 0.01f,
                            }
                        }
                    }
                },
                badges = new Container <RankBadge>
                {
                    Name             = "Rank badges",
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Vertical = -15, Horizontal = -20
                    },
                    Children = new[]
                    {
                        new RankBadge(1f, getRank(ScoreRank.X)),
                        new RankBadge(0.95f, getRank(ScoreRank.S)),
                        new RankBadge(0.9f, getRank(ScoreRank.A)),
                        new RankBadge(0.8f, getRank(ScoreRank.B)),
                        new RankBadge(0.7f, getRank(ScoreRank.C)),
                        new RankBadge(0.35f, getRank(ScoreRank.D)),
                    }
                },
                rankText = new RankText(score.Rank)
            };

            if (withFlair)
            {
                AddInternal(applauseSound = score.Rank >= ScoreRank.A
                    ? new SkinnableSound(new SampleInfo("Results/rankpass", "applause"))
                    : new SkinnableSound(new SampleInfo("Results/rankfail")));
            }
        }
コード例 #20
0
        private void load(OsuConfigManager config, Framework.Game game, RealmAccess realm, IAPIProvider api)
        {
            // prevent user from changing beatmap while the intro is still running.
            beatmap = Beatmap.BeginLease(false);

            MenuVoice = config.GetBindable <bool>(OsuSetting.MenuVoice);
            MenuMusic = config.GetBindable <bool>(OsuSetting.MenuMusic);

            if (api.LocalUser.Value.IsSupporter)
            {
                AddInternal(skinnableSeeya = new SkinnableSound(new SampleInfo(SeeyaSampleName)));
            }
            else
            {
                seeya = audio.Samples.Get(SeeyaSampleName);
            }

            // if the user has requested not to play theme music, we should attempt to find a random beatmap from their collection.
            if (!MenuMusic.Value)
            {
                realm.Run(r =>
                {
                    var usableBeatmapSets = r.All <BeatmapSetInfo>().Where(s => !s.DeletePending && !s.Protected).AsRealmCollection();

                    int setCount = usableBeatmapSets.Count;

                    if (setCount > 0)
                    {
                        var found = usableBeatmapSets[RNG.Next(0, setCount - 1)].Beatmaps.FirstOrDefault();

                        if (found != null)
                        {
                            initialBeatmap = beatmaps.GetWorkingBeatmap(found);
                        }
                    }
                });
            }

            // we generally want a song to be playing on startup, so use the intro music even if a user has specified not to if no other track is available.
            if (initialBeatmap == null)
            {
                // Intro beatmaps are generally made using the osu! ruleset.
                // It might not be present in test projects for other rulesets.
                bool osuRulesetPresent = rulesets.GetRuleset(0) != null;

                if (!loadThemedIntro() && osuRulesetPresent)
                {
                    // if we detect that the theme track or beatmap is unavailable this is either first startup or things are in a bad state.
                    // this could happen if a user has nuked their files store. for now, reimport to repair this.
                    var import = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream($"Tracks/{BeatmapFile}"), BeatmapFile)).GetResultSafely();

                    import?.PerformWrite(b => b.Protected = true);

                    loadThemedIntro();
                }
            }

            bool loadThemedIntro()
            {
                var setInfo = beatmaps.QueryBeatmapSet(b => b.Protected && b.Hash == BeatmapHash);

                if (setInfo == null)
                {
                    return(false);
                }

                setInfo.PerformRead(s =>
                {
                    if (s.Beatmaps.Count == 0)
                    {
                        return;
                    }

                    initialBeatmap = beatmaps.GetWorkingBeatmap(s.Beatmaps.First());
                });

                return(UsingThemedIntro = initialBeatmap != null);
            }
        }
コード例 #21
0
ファイル: ComboEffects.cs プロジェクト: miniriley2012/osu
 private void load(OsuConfigManager config)
 {
     InternalChild = comboBreakSample = new SkinnableSound(new SampleInfo("Gameplay/combobreak"));
     alwaysPlay    = config.GetBindable <bool>(OsuSetting.AlwaysPlayFirstComboBreak);
 }