Skip to content

sonolus.script.bucket

Bucket

Bases: Record

A bucket for entity judgment results.

Usage
Bucket(id: int)

id instance-attribute

Bucket ID.

window property writable

The judgment window of the bucket.

Judgment

Bases: IntEnum

The judgment of a hit.

JudgmentWindow

Bases: Record

The window for judging the accuracy of a hit.

Usage
JudgmentWindow(perfect: Interval, great: Interval, good: Interval)

end property

The end time of the good interval.

good instance-attribute

Interval for a good hit.

great instance-attribute

Interval for a great hit.

perfect instance-attribute

Interval for a perfect hit.

start property

The start time of the good interval.

__add__(other)

Add a scalar to the intervals.

__mul__(other)

Multiply the intervals by a scalar.

judge(actual, target)

Judge the accuracy of a hit.

Parameters:

Name Type Description Default
actual float

The actual time of the hit.

required
target float

The target time of the hit.

required

Returns:

Type Description
Judgment

The Judgment of the hit.

update(perfect=None, great=None, good=None)

Update the window with the given intervals.

Parameters:

Name Type Description Default
perfect Interval | None

The interval for a perfect hit.

None
great Interval | None

The interval for a great hit.

None
good Interval | None

The interval for a good hit.

None

bucket(*, sprites, unit=None)

Define a bucket with the given sprites and unit.

bucket_sprite(*, sprite, fallback_sprite=None, x, y, w, h, rotation=0)

Define a sprite for a bucket.

buckets(cls)

Decorator to define a buckets class.

Usage
@buckets
class Buckets:
    note: Bucket = bucket(
        sprites=[
            bucket_sprite(
                sprite=Skin.note,
                x=0,
                y=0,
                w=2,
                h=2,
            )
        ],
        unit=StandardText.MILLISECOND_UNIT,
    )