2019-01-24 16:43:03 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-06-12 03:43:01 +08:00
|
|
|
|
|
2020-12-01 14:44:16 +08:00
|
|
|
|
using System;
|
2020-07-30 16:58:49 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using osu.Game.Audio;
|
2018-08-02 14:28:48 +08:00
|
|
|
|
using osu.Game.Rulesets.Catch.Judgements;
|
2018-08-02 19:37:07 +08:00
|
|
|
|
using osu.Game.Rulesets.Judgements;
|
2020-11-26 17:14:25 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
2021-05-05 12:17:27 +08:00
|
|
|
|
using osu.Game.Skinning;
|
2020-12-02 14:22:45 +08:00
|
|
|
|
using osu.Game.Utils;
|
2020-11-26 17:14:25 +08:00
|
|
|
|
using osuTK.Graphics;
|
2018-08-02 14:28:48 +08:00
|
|
|
|
|
2018-06-12 03:43:01 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Catch.Objects
|
|
|
|
|
{
|
2020-12-07 13:10:17 +08:00
|
|
|
|
public class Banana : PalpableCatchHitObject, IHasComboInformation
|
2018-06-12 03:43:01 +08:00
|
|
|
|
{
|
2020-07-30 16:58:49 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Index of banana in current shower.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int BananaIndex;
|
|
|
|
|
|
2018-08-06 10:50:18 +08:00
|
|
|
|
public override Judgement CreateJudgement() => new CatchBananaJudgement();
|
2020-07-30 16:58:49 +08:00
|
|
|
|
|
2023-05-03 12:02:05 +08:00
|
|
|
|
private static readonly IList<HitSampleInfo> default_banana_samples = new List<HitSampleInfo> { new BananaHitSampleInfo() }.AsReadOnly();
|
2023-05-02 18:41:39 +08:00
|
|
|
|
|
|
|
|
|
public Banana()
|
2020-07-30 16:58:49 +08:00
|
|
|
|
{
|
2023-05-03 12:02:05 +08:00
|
|
|
|
Samples = default_banana_samples;
|
2020-07-30 16:58:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-12-02 16:12:30 +08:00
|
|
|
|
// override any external colour changes with banananana
|
2021-05-05 12:17:27 +08:00
|
|
|
|
Color4 IHasComboInformation.GetComboColour(ISkin skin) => getBananaColour();
|
2020-11-26 17:14:25 +08:00
|
|
|
|
|
|
|
|
|
private Color4 getBananaColour()
|
|
|
|
|
{
|
2020-12-02 19:53:47 +08:00
|
|
|
|
switch (StatelessRNG.NextInt(3, RandomSeed))
|
2020-11-26 17:14:25 +08:00
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
return new Color4(255, 240, 0, 255);
|
|
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
return new Color4(255, 192, 0, 255);
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
return new Color4(214, 221, 28, 255);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-02 18:41:39 +08:00
|
|
|
|
public class BananaHitSampleInfo : HitSampleInfo, IEquatable<BananaHitSampleInfo>
|
2020-07-30 16:58:49 +08:00
|
|
|
|
{
|
2020-12-02 14:22:45 +08:00
|
|
|
|
private static readonly string[] lookup_names = { "Gameplay/metronomelow", "Gameplay/catch-banana" };
|
2020-07-30 16:58:49 +08:00
|
|
|
|
|
2020-12-01 14:44:16 +08:00
|
|
|
|
public override IEnumerable<string> LookupNames => lookup_names;
|
2020-12-01 14:37:51 +08:00
|
|
|
|
|
2023-05-01 20:14:57 +08:00
|
|
|
|
public BananaHitSampleInfo(int volume = 100)
|
2020-12-02 14:22:45 +08:00
|
|
|
|
: base(string.Empty, volume: volume)
|
2020-12-01 14:37:51 +08:00
|
|
|
|
{
|
|
|
|
|
}
|
2020-12-01 14:44:16 +08:00
|
|
|
|
|
2023-05-17 13:11:14 +08:00
|
|
|
|
public sealed override HitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<string?> newSuffix = default, Optional<int> newVolume = default)
|
2020-12-02 14:22:45 +08:00
|
|
|
|
=> new BananaHitSampleInfo(newVolume.GetOr(Volume));
|
|
|
|
|
|
|
|
|
|
public bool Equals(BananaHitSampleInfo? other)
|
2020-12-01 14:44:16 +08:00
|
|
|
|
=> other != null;
|
|
|
|
|
|
2020-12-02 14:22:45 +08:00
|
|
|
|
public override bool Equals(object? obj)
|
2020-12-01 17:09:21 +08:00
|
|
|
|
=> obj is BananaHitSampleInfo other && Equals(other);
|
2020-12-01 14:44:16 +08:00
|
|
|
|
|
|
|
|
|
public override int GetHashCode() => lookup_names.GetHashCode();
|
2020-07-30 16:58:49 +08:00
|
|
|
|
}
|
2018-06-12 03:43:01 +08:00
|
|
|
|
}
|
|
|
|
|
}
|