sonolus.script.runtime¶
RuntimeUi
¶
Bases: Record
Holds the layouts for different UI elements across all modes.
combo_config: UiConfig
property
¶
The configuration for the combo UI element.
Available in play and watch mode.
combo_text: UiLayout
property
¶
The configuration for the combo text UI element.
Available in play and watch mode.
combo_value: UiLayout
property
¶
The configuration for the combo value UI element.
Available in play and watch mode.
instruction: UiLayout
property
¶
The configuration for the instruction UI element.
Available in tutorial mode.
instruction_config: UiConfig
property
¶
The configuration for the instruction UI element.
Available in tutorial mode.
judgment: UiLayout
property
¶
The configuration for the judgment UI element.
Available in play and watch mode.
judgment_config: UiConfig
property
¶
The configuration for the judgment UI element.
Available in play and watch mode.
menu: UiLayout
property
¶
The configuration for the menu UI element.
Available in play, watch, preview, and tutorial mode.
menu_config: UiConfig
property
¶
The configuration for the menu UI element.
Available in play, watch, preview, and tutorial mode.
navigation_config: UiConfig
property
¶
The configuration for the navigation UI element.
Available in tutorial mode.
next: UiLayout
property
¶
The configuration for the next navigation UI element.
Available in tutorial mode.
previous: UiLayout
property
¶
The configuration for the previous navigation UI element.
Available in tutorial mode.
primary_metric_bar: UiLayout
property
¶
The configuration for the primary metric bar UI element.
Available in play and watch mode.
primary_metric_config: UiConfig
property
¶
The configuration for the primary metric UI element.
Available in play and watch mode.
primary_metric_value: UiLayout
property
¶
The configuration for the primary metric value UI element.
Available in play and watch mode.
progress: UiLayout
property
¶
The configuration for the progress UI element.
Available in watch and preview mode.
progress_config: UiConfig
property
¶
The configuration for the progress UI element.
Available in watch and preview mode.
secondary_metric_bar: UiLayout
property
¶
The configuration for the secondary metric bar UI element.
Available in play and watch mode.
secondary_metric_config: UiConfig
property
¶
The configuration for the secondary metric UI element.
Available in play and watch mode.
secondary_metric_value: UiLayout
property
¶
The configuration for the secondary metric value UI element.
Available in play and watch mode.
Touch
¶
Bases: Record
Data of a touch event.
angle: float
instance-attribute
¶
The angle of the touch's movement.
delta: Vec2
instance-attribute
¶
The change in position of the touch.
ended: bool
instance-attribute
¶
Whether the touch has ended this frame.
id: int
instance-attribute
¶
The unique identifier of the touch.
position: Vec2
instance-attribute
¶
The current position of the touch.
prev_position: Vec2
property
¶
The previous position of the touch.
speed: float
instance-attribute
¶
The speed of the touch's movement.
start_position: Vec2
instance-attribute
¶
The position the touch started.
start_time: float
instance-attribute
¶
The time the touch started.
started: bool
instance-attribute
¶
Whether the touch has started this frame.
time: float
instance-attribute
¶
The time of the touch event.
May remain constant while there is no movement.
total_angle: float
property
¶
The total angle of the touch's movement.
total_delta: Vec2
property
¶
The total change in position of the touch.
velocity: Vec2
instance-attribute
¶
The velocity of the touch.
UiConfig
¶
UiLayout
¶
Bases: Record
The layout of a UI element.
is_available: bool
property
¶
Check if the layout is available in the current mode.
update(anchor: Vec2 | None = None, pivot: Vec2 | None = None, dimensions: Vec2 | None = None, rotation: float | None = None, alpha: float | None = None, horizontal_align: HorizontalAlign | None = None, background: bool | None = None)
¶
Update the layout properties if it's available in the current mode and do nothing otherwise.
aspect_ratio() -> float
¶
Get the aspect ratio of the game.
audio_offset() -> float
¶
Get the audio offset of the game.
Returns 0 in preview mode.
background() -> Quad
¶
Get the background quad.
canvas() -> _PreviewRuntimeCanvas
¶
Get the preview canvas.
delta_time() -> float
¶
Get the time elapsed since the last frame.
Returns 0 in preview mode.
input_offset() -> float
¶
Get the input offset of the game.
Returns 0 in preview mode and tutorial mode.
is_debug() -> bool
¶
Check if the game is running in debug mode.
is_multiplayer() -> bool
¶
Check if the game is running in multiplayer mode.
Returns False if not in play mode.
is_play() -> bool
¶
Check if the game is running in play mode.
is_preprocessing() -> bool
¶
Check if the game is in the preprocessing stage.
Returns True if the current callback is one of preprocess, spawn_order, spawn_time, or despawn_time.
is_preview() -> bool
¶
Check if the game is running in preview mode.
is_replay() -> bool
¶
Check if the game is running in replay mode.
Returns False if not in watch mode.
is_skip() -> bool
¶
Check if there was a time skip this frame.
Returns False if not in watch mode.
is_tutorial() -> bool
¶
Check if the game is running in tutorial mode.
is_watch() -> bool
¶
Check if the game is running in watch mode.
level_life() -> _LevelLife
¶
Get the level life configuration.
level_score() -> _LevelScore
¶
Get the level score configuration.
navigation_direction() -> int
¶
Get the navigation direction of the tutorial.
Returns 0 if not in tutorial mode.
offset_adjusted_time() -> float
¶
Get the current time of the game adjusted by the input offset.
Returns 0 in preview mode and tutorial mode.
particle_transform() -> Transform2d
¶
Get the global particle transform.
prev_time() -> float
¶
Get the time of the previous frame.
Returns 0 in preview mode.
runtime_ui() -> RuntimeUi
¶
Get the runtime UI configuration.
scaled_time() -> float
¶
Get the current time of the game affected by the time scale.
Returns the unscaled time in tutorial mode and 0 in preview mode.
screen() -> Rect
¶
Get the screen boundaries as a rectangle.
set_background(value: Quad)
¶
Set the background quad.
set_particle_transform(value: Transform2d)
¶
Set the global particle transform.
set_skin_transform(value: Transform2d)
¶
Set the global skin transform.
skin_transform() -> Transform2d
¶
Get the global skin transform.
time() -> float
¶
Get the current time of the game.
Returns 0 in preview mode.
touches() -> ArrayLike[Touch]
¶
Get the current touches of the game.