sonolus.py 0.1.1__py3-none-any.whl → 0.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sonolus.py might be problematic. Click here for more details.
- sonolus/backend/mode.py +4 -4
- sonolus/backend/visitor.py +4 -2
- sonolus/build/compile.py +3 -3
- sonolus/build/engine.py +72 -6
- sonolus/script/archetype.py +42 -11
- sonolus/script/bucket.py +2 -2
- sonolus/script/callbacks.py +22 -0
- sonolus/script/comptime.py +14 -0
- sonolus/script/debug.py +1 -1
- sonolus/script/effect.py +11 -11
- sonolus/script/engine.py +63 -7
- sonolus/script/globals.py +79 -44
- sonolus/script/graphics.py +37 -28
- sonolus/script/instruction.py +151 -0
- sonolus/script/internal/builtin_impls.py +3 -3
- sonolus/script/internal/native.py +2 -2
- sonolus/script/interval.py +14 -0
- sonolus/script/iterator.py +3 -0
- sonolus/script/level.py +7 -7
- sonolus/script/num.py +30 -4
- sonolus/script/options.py +4 -4
- sonolus/script/particle.py +48 -48
- sonolus/script/pointer.py +3 -3
- sonolus/script/print.py +81 -0
- sonolus/script/runtime.py +150 -35
- sonolus/script/sprite.py +106 -104
- sonolus/script/text.py +407 -404
- sonolus/script/transform.py +13 -17
- sonolus/script/vec.py +31 -1
- {sonolus_py-0.1.1.dist-info → sonolus_py-0.1.3.dist-info}/METADATA +1 -2
- {sonolus_py-0.1.1.dist-info → sonolus_py-0.1.3.dist-info}/RECORD +34 -34
- {sonolus_py-0.1.1.dist-info → sonolus_py-0.1.3.dist-info}/WHEEL +1 -1
- sonolus/build/defaults.py +0 -32
- sonolus/script/icon.py +0 -73
- {sonolus_py-0.1.1.dist-info → sonolus_py-0.1.3.dist-info}/entry_points.txt +0 -0
- {sonolus_py-0.1.1.dist-info → sonolus_py-0.1.3.dist-info}/licenses/LICENSE +0 -0
sonolus/script/particle.py
CHANGED
|
@@ -102,54 +102,54 @@ def particles[T](cls: type[T]) -> T | Particles:
|
|
|
102
102
|
|
|
103
103
|
|
|
104
104
|
class StandardParticle:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
105
|
+
NOTE_CIRCULAR_TAP_NEUTRAL = Annotated[Particle, particle("#NOTE_CIRCULAR_TAP_NEUTRAL")]
|
|
106
|
+
NOTE_CIRCULAR_TAP_RED = Annotated[Particle, particle("#NOTE_CIRCULAR_TAP_RED")]
|
|
107
|
+
NOTE_CIRCULAR_TAP_GREEN = Annotated[Particle, particle("#NOTE_CIRCULAR_TAP_GREEN")]
|
|
108
|
+
NOTE_CIRCULAR_TAP_BLUE = Annotated[Particle, particle("#NOTE_CIRCULAR_TAP_BLUE")]
|
|
109
|
+
NOTE_CIRCULAR_TAP_YELLOW = Annotated[Particle, particle("#NOTE_CIRCULAR_TAP_YELLOW")]
|
|
110
|
+
NOTE_CIRCULAR_TAP_PURPLE = Annotated[Particle, particle("#NOTE_CIRCULAR_TAP_PURPLE")]
|
|
111
|
+
NOTE_CIRCULAR_TAP_CYAN = Annotated[Particle, particle("#NOTE_CIRCULAR_TAP_CYAN")]
|
|
112
|
+
NOTE_CIRCULAR_ALTERNATIVE_NEUTRAL = Annotated[Particle, particle("#NOTE_CIRCULAR_ALTERNATIVE_NEUTRAL")]
|
|
113
|
+
NOTE_CIRCULAR_ALTERNATIVE_RED = Annotated[Particle, particle("#NOTE_CIRCULAR_ALTERNATIVE_RED")]
|
|
114
|
+
NOTE_CIRCULAR_ALTERNATIVE_GREEN = Annotated[Particle, particle("#NOTE_CIRCULAR_ALTERNATIVE_GREEN")]
|
|
115
|
+
NOTE_CIRCULAR_ALTERNATIVE_BLUE = Annotated[Particle, particle("#NOTE_CIRCULAR_ALTERNATIVE_BLUE")]
|
|
116
|
+
NOTE_CIRCULAR_ALTERNATIVE_YELLOW = Annotated[Particle, particle("#NOTE_CIRCULAR_ALTERNATIVE_YELLOW")]
|
|
117
|
+
NOTE_CIRCULAR_ALTERNATIVE_PURPLE = Annotated[Particle, particle("#NOTE_CIRCULAR_ALTERNATIVE_PURPLE")]
|
|
118
|
+
NOTE_CIRCULAR_ALTERNATIVE_CYAN = Annotated[Particle, particle("#NOTE_CIRCULAR_ALTERNATIVE_CYAN")]
|
|
119
|
+
NOTE_CIRCULAR_HOLD_NEUTRAL = Annotated[Particle, particle("#NOTE_CIRCULAR_HOLD_NEUTRAL")]
|
|
120
|
+
NOTE_CIRCULAR_HOLD_RED = Annotated[Particle, particle("#NOTE_CIRCULAR_HOLD_RED")]
|
|
121
|
+
NOTE_CIRCULAR_HOLD_GREEN = Annotated[Particle, particle("#NOTE_CIRCULAR_HOLD_GREEN")]
|
|
122
|
+
NOTE_CIRCULAR_HOLD_BLUE = Annotated[Particle, particle("#NOTE_CIRCULAR_HOLD_BLUE")]
|
|
123
|
+
NOTE_CIRCULAR_HOLD_YELLOW = Annotated[Particle, particle("#NOTE_CIRCULAR_HOLD_YELLOW")]
|
|
124
|
+
NOTE_CIRCULAR_HOLD_PURPLE = Annotated[Particle, particle("#NOTE_CIRCULAR_HOLD_PURPLE")]
|
|
125
|
+
NOTE_CIRCULAR_HOLD_CYAN = Annotated[Particle, particle("#NOTE_CIRCULAR_HOLD_CYAN")]
|
|
126
|
+
NOTE_LINEAR_TAP_NEUTRAL = Annotated[Particle, particle("#NOTE_LINEAR_TAP_NEUTRAL")]
|
|
127
|
+
NOTE_LINEAR_TAP_RED = Annotated[Particle, particle("#NOTE_LINEAR_TAP_RED")]
|
|
128
|
+
NOTE_LINEAR_TAP_GREEN = Annotated[Particle, particle("#NOTE_LINEAR_TAP_GREEN")]
|
|
129
|
+
NOTE_LINEAR_TAP_BLUE = Annotated[Particle, particle("#NOTE_LINEAR_TAP_BLUE")]
|
|
130
|
+
NOTE_LINEAR_TAP_YELLOW = Annotated[Particle, particle("#NOTE_LINEAR_TAP_YELLOW")]
|
|
131
|
+
NOTE_LINEAR_TAP_PURPLE = Annotated[Particle, particle("#NOTE_LINEAR_TAP_PURPLE")]
|
|
132
|
+
NOTE_LINEAR_TAP_CYAN = Annotated[Particle, particle("#NOTE_LINEAR_TAP_CYAN")]
|
|
133
|
+
NOTE_LINEAR_ALTERNATIVE_NEUTRAL = Annotated[Particle, particle("#NOTE_LINEAR_ALTERNATIVE_NEUTRAL")]
|
|
134
|
+
NOTE_LINEAR_ALTERNATIVE_RED = Annotated[Particle, particle("#NOTE_LINEAR_ALTERNATIVE_RED")]
|
|
135
|
+
NOTE_LINEAR_ALTERNATIVE_GREEN = Annotated[Particle, particle("#NOTE_LINEAR_ALTERNATIVE_GREEN")]
|
|
136
|
+
NOTE_LINEAR_ALTERNATIVE_BLUE = Annotated[Particle, particle("#NOTE_LINEAR_ALTERNATIVE_BLUE")]
|
|
137
|
+
NOTE_LINEAR_ALTERNATIVE_YELLOW = Annotated[Particle, particle("#NOTE_LINEAR_ALTERNATIVE_YELLOW")]
|
|
138
|
+
NOTE_LINEAR_ALTERNATIVE_PURPLE = Annotated[Particle, particle("#NOTE_LINEAR_ALTERNATIVE_PURPLE")]
|
|
139
|
+
NOTE_LINEAR_ALTERNATIVE_CYAN = Annotated[Particle, particle("#NOTE_LINEAR_ALTERNATIVE_CYAN")]
|
|
140
|
+
NOTE_LINEAR_HOLD_NEUTRAL = Annotated[Particle, particle("#NOTE_LINEAR_HOLD_NEUTRAL")]
|
|
141
|
+
NOTE_LINEAR_HOLD_RED = Annotated[Particle, particle("#NOTE_LINEAR_HOLD_RED")]
|
|
142
|
+
NOTE_LINEAR_HOLD_GREEN = Annotated[Particle, particle("#NOTE_LINEAR_HOLD_GREEN")]
|
|
143
|
+
NOTE_LINEAR_HOLD_BLUE = Annotated[Particle, particle("#NOTE_LINEAR_HOLD_BLUE")]
|
|
144
|
+
NOTE_LINEAR_HOLD_YELLOW = Annotated[Particle, particle("#NOTE_LINEAR_HOLD_YELLOW")]
|
|
145
|
+
NOTE_LINEAR_HOLD_PURPLE = Annotated[Particle, particle("#NOTE_LINEAR_HOLD_PURPLE")]
|
|
146
|
+
NOTE_LINEAR_HOLD_CYAN = Annotated[Particle, particle("#NOTE_LINEAR_HOLD_CYAN")]
|
|
147
|
+
LANE_CIRCULAR = Annotated[Particle, particle("#LANE_CIRCULAR")]
|
|
148
|
+
LANE_LINEAR = Annotated[Particle, particle("#LANE_LINEAR")]
|
|
149
|
+
SLOT_CIRCULAR = Annotated[Particle, particle("#SLOT_CIRCULAR")]
|
|
150
|
+
SLOT_LINEAR = Annotated[Particle, particle("#SLOT_LINEAR")]
|
|
151
|
+
JUDGE_LINE_CIRCULAR = Annotated[Particle, particle("#JUDGE_LINE_CIRCULAR")]
|
|
152
|
+
JUDGE_LINE_LINEAR = Annotated[Particle, particle("#JUDGE_LINE_LINEAR")]
|
|
153
153
|
|
|
154
154
|
|
|
155
155
|
@particles
|
sonolus/script/pointer.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from sonolus.backend.place import BlockPlace
|
|
2
2
|
from sonolus.script.internal.impl import meta_fn, validate_value
|
|
3
3
|
from sonolus.script.internal.value import Value
|
|
4
|
-
from sonolus.script.num import Num
|
|
4
|
+
from sonolus.script.num import Num, is_num
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
@meta_fn
|
|
@@ -14,7 +14,7 @@ def deref[T: Value](block: Num, offset: Num, type_: type[T]) -> T:
|
|
|
14
14
|
if not isinstance(block, int):
|
|
15
15
|
raise TypeError("block must be an integer")
|
|
16
16
|
else:
|
|
17
|
-
if not
|
|
17
|
+
if not is_num(block):
|
|
18
18
|
raise TypeError("block must be a Num")
|
|
19
19
|
block = block.index()
|
|
20
20
|
if offset._is_py_():
|
|
@@ -22,7 +22,7 @@ def deref[T: Value](block: Num, offset: Num, type_: type[T]) -> T:
|
|
|
22
22
|
if not isinstance(offset, int):
|
|
23
23
|
raise TypeError("offset must be an integer")
|
|
24
24
|
else:
|
|
25
|
-
if not
|
|
25
|
+
if not is_num(offset):
|
|
26
26
|
raise TypeError("offset must be a Num")
|
|
27
27
|
offset = offset.index()
|
|
28
28
|
if not (isinstance(type_, type) and issubclass(type_, Value)):
|
sonolus/script/print.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
from enum import IntEnum
|
|
2
|
+
|
|
3
|
+
from sonolus.backend.ops import Op
|
|
4
|
+
from sonolus.script.internal.native import native_function
|
|
5
|
+
from sonolus.script.runtime import HorizontalAlign
|
|
6
|
+
from sonolus.script.vec import Vec2
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class PrintFormat(IntEnum):
|
|
10
|
+
NUMBER = 0
|
|
11
|
+
PERCENTAGE = 1
|
|
12
|
+
TIME = 10
|
|
13
|
+
SCORE = 11
|
|
14
|
+
BPM = 20
|
|
15
|
+
TIMESCALE = 21
|
|
16
|
+
BEAT_COUNT = 30
|
|
17
|
+
MEASURE_COUNT = 31
|
|
18
|
+
ENTITY_COUNT = 32
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class PrintColor(IntEnum):
|
|
22
|
+
THEME = -1
|
|
23
|
+
NEUTRAL = 0
|
|
24
|
+
RED = 1
|
|
25
|
+
GREEN = 2
|
|
26
|
+
BLUE = 3
|
|
27
|
+
YELLOW = 4
|
|
28
|
+
PURPLE = 5
|
|
29
|
+
CYAN = 6
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@native_function(Op.Print)
|
|
33
|
+
def _print(
|
|
34
|
+
value: int | float,
|
|
35
|
+
format: PrintFormat, # noqa: A002
|
|
36
|
+
decimal_places: int,
|
|
37
|
+
anchor_x: float,
|
|
38
|
+
anchor_y: float,
|
|
39
|
+
pivot_x: float,
|
|
40
|
+
pivot_y: float,
|
|
41
|
+
width: float,
|
|
42
|
+
height: float,
|
|
43
|
+
rotation: float,
|
|
44
|
+
color: PrintColor,
|
|
45
|
+
alpha: float,
|
|
46
|
+
horizontal_align: HorizontalAlign,
|
|
47
|
+
background: bool,
|
|
48
|
+
):
|
|
49
|
+
raise NotImplementedError
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def print_number(
|
|
53
|
+
value: int | float,
|
|
54
|
+
*,
|
|
55
|
+
fmt: PrintFormat,
|
|
56
|
+
decimal_places: int = 0,
|
|
57
|
+
anchor: Vec2,
|
|
58
|
+
pivot: Vec2,
|
|
59
|
+
dimensions: Vec2,
|
|
60
|
+
rotation: float = 0,
|
|
61
|
+
color: PrintColor = PrintColor.THEME,
|
|
62
|
+
alpha: float = 1,
|
|
63
|
+
horizontal_align: HorizontalAlign = HorizontalAlign.LEFT,
|
|
64
|
+
background: bool = False,
|
|
65
|
+
):
|
|
66
|
+
_print(
|
|
67
|
+
value,
|
|
68
|
+
fmt,
|
|
69
|
+
decimal_places,
|
|
70
|
+
anchor.x,
|
|
71
|
+
anchor.y,
|
|
72
|
+
pivot.x,
|
|
73
|
+
pivot.y,
|
|
74
|
+
dimensions.x,
|
|
75
|
+
dimensions.y,
|
|
76
|
+
rotation,
|
|
77
|
+
color,
|
|
78
|
+
alpha,
|
|
79
|
+
horizontal_align,
|
|
80
|
+
background,
|
|
81
|
+
)
|
sonolus/script/runtime.py
CHANGED
|
@@ -7,17 +7,25 @@ from sonolus.script.globals import (
|
|
|
7
7
|
_level_life,
|
|
8
8
|
_level_score,
|
|
9
9
|
_play_runtime_environment,
|
|
10
|
+
_play_runtime_ui,
|
|
11
|
+
_play_runtime_ui_configuration,
|
|
10
12
|
_play_runtime_update,
|
|
13
|
+
_preview_runtime_canvas,
|
|
11
14
|
_preview_runtime_environment,
|
|
15
|
+
_preview_runtime_ui,
|
|
16
|
+
_preview_runtime_ui_configuration,
|
|
12
17
|
_runtime_background,
|
|
13
18
|
_runtime_particle_transform,
|
|
14
19
|
_runtime_skin_transform,
|
|
15
20
|
_runtime_touch_array,
|
|
16
|
-
|
|
17
|
-
_runtime_ui_configuration,
|
|
21
|
+
_tutorial_instruction,
|
|
18
22
|
_tutorial_runtime_environment,
|
|
23
|
+
_tutorial_runtime_ui,
|
|
24
|
+
_tutorial_runtime_ui_configuration,
|
|
19
25
|
_tutorial_runtime_update,
|
|
20
26
|
_watch_runtime_environment,
|
|
27
|
+
_watch_runtime_ui,
|
|
28
|
+
_watch_runtime_ui_configuration,
|
|
21
29
|
_watch_runtime_update,
|
|
22
30
|
)
|
|
23
31
|
from sonolus.script.graphics import Quad, Rect
|
|
@@ -83,21 +91,56 @@ class _TutorialRuntimeUpdate:
|
|
|
83
91
|
navigation_direction: int
|
|
84
92
|
|
|
85
93
|
|
|
94
|
+
class ScrollDirection(IntEnum):
|
|
95
|
+
LEFT_TO_RIGHT = 0
|
|
96
|
+
TOP_TO_BOTTOM = 1
|
|
97
|
+
RIGHT_TO_LEFT = 2
|
|
98
|
+
BOTTOM_TO_TOP = 3
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
@_preview_runtime_canvas
|
|
102
|
+
class _PreviewRuntimeCanvas:
|
|
103
|
+
scroll_direction: ScrollDirection
|
|
104
|
+
size: float
|
|
105
|
+
|
|
106
|
+
|
|
86
107
|
class RuntimeUiConfig(Record):
|
|
87
108
|
scale: float
|
|
88
109
|
alpha: float
|
|
89
110
|
|
|
90
111
|
|
|
91
|
-
@
|
|
92
|
-
class
|
|
112
|
+
@_play_runtime_ui_configuration
|
|
113
|
+
class _PlayRuntimeUiConfigs:
|
|
93
114
|
menu: RuntimeUiConfig
|
|
94
115
|
judgment: RuntimeUiConfig
|
|
95
116
|
combo: RuntimeUiConfig
|
|
96
117
|
primary_metric: RuntimeUiConfig
|
|
97
118
|
secondary_metric: RuntimeUiConfig
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
@_watch_runtime_ui_configuration
|
|
122
|
+
class _WatchRuntimeUiConfigs:
|
|
123
|
+
menu: RuntimeUiConfig
|
|
124
|
+
judgment: RuntimeUiConfig
|
|
125
|
+
combo: RuntimeUiConfig
|
|
126
|
+
primary_metric: RuntimeUiConfig
|
|
127
|
+
secondary_metric: RuntimeUiConfig
|
|
128
|
+
progress: RuntimeUiConfig
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
@_preview_runtime_ui_configuration
|
|
132
|
+
class _PreviewRuntimeUiConfigs:
|
|
133
|
+
menu: RuntimeUiConfig
|
|
98
134
|
progress: RuntimeUiConfig
|
|
99
135
|
|
|
100
136
|
|
|
137
|
+
@_tutorial_runtime_ui_configuration
|
|
138
|
+
class _TutorialRuntimeUiConfigs:
|
|
139
|
+
menu: RuntimeUiConfig
|
|
140
|
+
navigation: RuntimeUiConfig
|
|
141
|
+
instruction: RuntimeUiConfig
|
|
142
|
+
|
|
143
|
+
|
|
101
144
|
class HorizontalAlign(IntEnum):
|
|
102
145
|
LEFT = -1
|
|
103
146
|
CENTER = 0
|
|
@@ -139,8 +182,51 @@ class RuntimeUiLayout(Record):
|
|
|
139
182
|
self.background = background
|
|
140
183
|
|
|
141
184
|
|
|
142
|
-
|
|
143
|
-
|
|
185
|
+
class BasicRuntimeUiLayout(Record):
|
|
186
|
+
anchor: Vec2
|
|
187
|
+
pivot: Vec2
|
|
188
|
+
dimensions: Vec2
|
|
189
|
+
rotation: float
|
|
190
|
+
alpha: float
|
|
191
|
+
background: bool
|
|
192
|
+
|
|
193
|
+
def update(
|
|
194
|
+
self,
|
|
195
|
+
anchor: Vec2 | None = None,
|
|
196
|
+
pivot: Vec2 | None = None,
|
|
197
|
+
dimensions: Vec2 | None = None,
|
|
198
|
+
rotation: float | None = None,
|
|
199
|
+
alpha: float | None = None,
|
|
200
|
+
background: bool | None = None,
|
|
201
|
+
):
|
|
202
|
+
if anchor is not None:
|
|
203
|
+
self.anchor = anchor
|
|
204
|
+
if pivot is not None:
|
|
205
|
+
self.pivot = pivot
|
|
206
|
+
if dimensions is not None:
|
|
207
|
+
self.dimensions = dimensions
|
|
208
|
+
if rotation is not None:
|
|
209
|
+
self.rotation = rotation
|
|
210
|
+
if alpha is not None:
|
|
211
|
+
self.alpha = alpha
|
|
212
|
+
if background is not None:
|
|
213
|
+
self.background = background
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
@_play_runtime_ui
|
|
217
|
+
class _PlayRuntimeUi:
|
|
218
|
+
menu: RuntimeUiLayout
|
|
219
|
+
judgment: RuntimeUiLayout
|
|
220
|
+
combo_value: RuntimeUiLayout
|
|
221
|
+
combo_text: RuntimeUiLayout
|
|
222
|
+
primary_metric_bar: RuntimeUiLayout
|
|
223
|
+
primary_metric_value: RuntimeUiLayout
|
|
224
|
+
secondary_metric_bar: RuntimeUiLayout
|
|
225
|
+
secondary_metric_value: RuntimeUiLayout
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
@_watch_runtime_ui
|
|
229
|
+
class _WatchRuntimeUi:
|
|
144
230
|
menu: RuntimeUiLayout
|
|
145
231
|
judgment: RuntimeUiLayout
|
|
146
232
|
combo_value: RuntimeUiLayout
|
|
@@ -152,6 +238,20 @@ class _RuntimeUi:
|
|
|
152
238
|
progress: RuntimeUiLayout
|
|
153
239
|
|
|
154
240
|
|
|
241
|
+
@_preview_runtime_ui
|
|
242
|
+
class _PreviewRuntimeUi:
|
|
243
|
+
menu: BasicRuntimeUiLayout
|
|
244
|
+
progress: BasicRuntimeUiLayout
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
@_tutorial_runtime_ui
|
|
248
|
+
class _TutorialRuntimeUi:
|
|
249
|
+
menu: BasicRuntimeUiLayout
|
|
250
|
+
previous: BasicRuntimeUiLayout
|
|
251
|
+
next: BasicRuntimeUiLayout
|
|
252
|
+
instruction: BasicRuntimeUiLayout
|
|
253
|
+
|
|
254
|
+
|
|
155
255
|
class Touch(Record):
|
|
156
256
|
id: int
|
|
157
257
|
started: bool
|
|
@@ -324,18 +424,23 @@ class _LevelLife:
|
|
|
324
424
|
self.consecutive_good_step = consecutive_good_step
|
|
325
425
|
|
|
326
426
|
|
|
427
|
+
@_tutorial_instruction
|
|
428
|
+
class _TutorialInstruction:
|
|
429
|
+
text_id: int
|
|
430
|
+
|
|
431
|
+
|
|
327
432
|
@meta_fn
|
|
328
433
|
def is_debug() -> bool:
|
|
329
434
|
if not ctx():
|
|
330
435
|
return False
|
|
331
436
|
match ctx().global_state.mode:
|
|
332
|
-
case Mode.
|
|
437
|
+
case Mode.PLAY:
|
|
333
438
|
return _PlayRuntimeEnvironment.is_debug
|
|
334
|
-
case Mode.
|
|
439
|
+
case Mode.WATCH:
|
|
335
440
|
return _WatchRuntimeEnvironment.is_debug
|
|
336
|
-
case Mode.
|
|
441
|
+
case Mode.PREVIEW:
|
|
337
442
|
return _PreviewRuntimeEnvironment.is_debug
|
|
338
|
-
case Mode.
|
|
443
|
+
case Mode.TUTORIAL:
|
|
339
444
|
return _TutorialRuntimeEnvironment.is_debug
|
|
340
445
|
case _:
|
|
341
446
|
return False
|
|
@@ -346,13 +451,13 @@ def aspect_ratio() -> float:
|
|
|
346
451
|
if not ctx():
|
|
347
452
|
return 16 / 9
|
|
348
453
|
match ctx().global_state.mode:
|
|
349
|
-
case Mode.
|
|
454
|
+
case Mode.PLAY:
|
|
350
455
|
return _PlayRuntimeEnvironment.aspect_ratio
|
|
351
|
-
case Mode.
|
|
456
|
+
case Mode.WATCH:
|
|
352
457
|
return _WatchRuntimeEnvironment.aspect_ratio
|
|
353
|
-
case Mode.
|
|
458
|
+
case Mode.PREVIEW:
|
|
354
459
|
return _PreviewRuntimeEnvironment.aspect_ratio
|
|
355
|
-
case Mode.
|
|
460
|
+
case Mode.TUTORIAL:
|
|
356
461
|
return _TutorialRuntimeEnvironment.aspect_ratio
|
|
357
462
|
|
|
358
463
|
|
|
@@ -361,11 +466,11 @@ def audio_offset() -> float:
|
|
|
361
466
|
if not ctx():
|
|
362
467
|
return 0
|
|
363
468
|
match ctx().global_state.mode:
|
|
364
|
-
case Mode.
|
|
469
|
+
case Mode.PLAY:
|
|
365
470
|
return _PlayRuntimeEnvironment.audio_offset
|
|
366
|
-
case Mode.
|
|
471
|
+
case Mode.WATCH:
|
|
367
472
|
return _WatchRuntimeEnvironment.audio_offset
|
|
368
|
-
case Mode.
|
|
473
|
+
case Mode.TUTORIAL:
|
|
369
474
|
return _TutorialRuntimeEnvironment.audio_offset
|
|
370
475
|
case _:
|
|
371
476
|
return 0
|
|
@@ -376,9 +481,9 @@ def input_offset() -> float:
|
|
|
376
481
|
if not ctx():
|
|
377
482
|
return 0
|
|
378
483
|
match ctx().global_state.mode:
|
|
379
|
-
case Mode.
|
|
484
|
+
case Mode.PLAY:
|
|
380
485
|
return _PlayRuntimeEnvironment.input_offset
|
|
381
|
-
case Mode.
|
|
486
|
+
case Mode.WATCH:
|
|
382
487
|
return _WatchRuntimeEnvironment.input_offset
|
|
383
488
|
case _:
|
|
384
489
|
return 0
|
|
@@ -389,7 +494,7 @@ def is_multiplayer() -> bool:
|
|
|
389
494
|
if not ctx():
|
|
390
495
|
return False
|
|
391
496
|
match ctx().global_state.mode:
|
|
392
|
-
case Mode.
|
|
497
|
+
case Mode.PLAY:
|
|
393
498
|
return _PlayRuntimeEnvironment.is_multiplayer
|
|
394
499
|
case _:
|
|
395
500
|
return False
|
|
@@ -400,7 +505,7 @@ def is_replay() -> bool:
|
|
|
400
505
|
if not ctx():
|
|
401
506
|
return False
|
|
402
507
|
match ctx().global_state.mode:
|
|
403
|
-
case Mode.
|
|
508
|
+
case Mode.WATCH:
|
|
404
509
|
return _WatchRuntimeEnvironment.is_replay
|
|
405
510
|
case _:
|
|
406
511
|
return False
|
|
@@ -411,11 +516,11 @@ def time() -> float:
|
|
|
411
516
|
if not ctx():
|
|
412
517
|
return 0
|
|
413
518
|
match ctx().global_state.mode:
|
|
414
|
-
case Mode.
|
|
519
|
+
case Mode.PLAY:
|
|
415
520
|
return _PlayRuntimeUpdate.time
|
|
416
|
-
case Mode.
|
|
521
|
+
case Mode.WATCH:
|
|
417
522
|
return _WatchRuntimeUpdate.time
|
|
418
|
-
case Mode.
|
|
523
|
+
case Mode.TUTORIAL:
|
|
419
524
|
return _TutorialRuntimeUpdate.time
|
|
420
525
|
case _:
|
|
421
526
|
return 0
|
|
@@ -426,11 +531,11 @@ def delta_time() -> float:
|
|
|
426
531
|
if not ctx():
|
|
427
532
|
return 0
|
|
428
533
|
match ctx().global_state.mode:
|
|
429
|
-
case Mode.
|
|
534
|
+
case Mode.PLAY:
|
|
430
535
|
return _PlayRuntimeUpdate.delta_time
|
|
431
|
-
case Mode.
|
|
536
|
+
case Mode.WATCH:
|
|
432
537
|
return _WatchRuntimeUpdate.delta_time
|
|
433
|
-
case Mode.
|
|
538
|
+
case Mode.TUTORIAL:
|
|
434
539
|
return _TutorialRuntimeUpdate.delta_time
|
|
435
540
|
case _:
|
|
436
541
|
return 0
|
|
@@ -441,11 +546,11 @@ def scaled_time() -> float:
|
|
|
441
546
|
if not ctx():
|
|
442
547
|
return 0
|
|
443
548
|
match ctx().global_state.mode:
|
|
444
|
-
case Mode.
|
|
549
|
+
case Mode.PLAY:
|
|
445
550
|
return _PlayRuntimeUpdate.scaled_time
|
|
446
|
-
case Mode.
|
|
551
|
+
case Mode.WATCH:
|
|
447
552
|
return _WatchRuntimeUpdate.scaled_time
|
|
448
|
-
case Mode.
|
|
553
|
+
case Mode.TUTORIAL:
|
|
449
554
|
return _TutorialRuntimeUpdate.time
|
|
450
555
|
case _:
|
|
451
556
|
return 0
|
|
@@ -456,7 +561,7 @@ def touches() -> VarArray[Touch, 999]:
|
|
|
456
561
|
if not ctx():
|
|
457
562
|
return VarArray(0, Array[Touch, 0]())
|
|
458
563
|
match ctx().global_state.mode:
|
|
459
|
-
case Mode.
|
|
564
|
+
case Mode.PLAY:
|
|
460
565
|
return VarArray(_PlayRuntimeUpdate.touch_count, _TouchArray.touches)
|
|
461
566
|
case _:
|
|
462
567
|
return VarArray(0, Array[Touch, 0]())
|
|
@@ -467,7 +572,7 @@ def is_skip() -> bool:
|
|
|
467
572
|
if not ctx():
|
|
468
573
|
return False
|
|
469
574
|
match ctx().global_state.mode:
|
|
470
|
-
case Mode.
|
|
575
|
+
case Mode.WATCH:
|
|
471
576
|
return _WatchRuntimeUpdate.is_skip
|
|
472
577
|
case _:
|
|
473
578
|
return False
|
|
@@ -478,7 +583,7 @@ def navigation_direction() -> int:
|
|
|
478
583
|
if not ctx():
|
|
479
584
|
return 0
|
|
480
585
|
match ctx().global_state.mode:
|
|
481
|
-
case Mode.
|
|
586
|
+
case Mode.TUTORIAL:
|
|
482
587
|
return _TutorialRuntimeUpdate.navigation_direction
|
|
483
588
|
case _:
|
|
484
589
|
return 0
|
|
@@ -510,8 +615,18 @@ def set_background(value: Quad):
|
|
|
510
615
|
_Background.value = value
|
|
511
616
|
|
|
512
617
|
|
|
513
|
-
|
|
514
|
-
|
|
618
|
+
play_ui = _PlayRuntimeUi
|
|
619
|
+
play_ui_configs = _PlayRuntimeUiConfigs
|
|
620
|
+
watch_ui = _WatchRuntimeUi
|
|
621
|
+
watch_ui_configs = _WatchRuntimeUiConfigs
|
|
622
|
+
preview_ui = _PreviewRuntimeUi
|
|
623
|
+
preview_ui_configs = _PreviewRuntimeUiConfigs
|
|
624
|
+
tutorial_ui = _TutorialRuntimeUi
|
|
625
|
+
tutorial_ui_configs = _TutorialRuntimeUiConfigs
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
def canvas() -> _PreviewRuntimeCanvas:
|
|
629
|
+
return _PreviewRuntimeCanvas
|
|
515
630
|
|
|
516
631
|
|
|
517
632
|
def screen() -> Rect:
|