-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnote.py
36 lines (30 loc) · 897 Bytes
/
note.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class Note:
typ: int
time: int
x: float
hold: float
speed: float
floor: float
TAP: int = 1
DRAG: int = 2
HOLD: int = 3
FLICK: int = 4
def __init__(self, typ: int, time: int, x: float, hold: float, speed: float, floor: float):
self.typ = typ
self.time = time
self.x = x
self.hold = hold
self.speed = speed
self.floor = floor
@classmethod
def from_dict(cls, d: dict):
return cls(d['type'], d['time'], d['positionX'], d['holdTime'], d['speed'], d['floorPosition'])
def __repr__(self):
return (f'''Note({['TAP', 'DRAG', 'HOLD', 'FLICK'][self.typ - 1]}, time={self.time}, x={self.x}, '''
f'''hold={self.hold}, speed={self.speed}, floor={self.floor})''')
@property
def width(self):
return 48
@property
def height(self):
return 2