Start mapping notes! Spheres and some lines
This commit is contained in:
+20
-5
@@ -3,9 +3,14 @@ from __future__ import annotations
|
||||
from dataclasses import dataclass
|
||||
from dataclasses import field
|
||||
|
||||
from model.dancerush import DRS_LEFT
|
||||
from model.dancerush import DRS_RIGHT
|
||||
|
||||
LEFT_NOTE = 8
|
||||
RIGHT_NOTE = 9
|
||||
DD_LEFT = 8
|
||||
DD_RIGHT = 9
|
||||
|
||||
DD_LINE_LEFT = 12
|
||||
DD_LINE_RIGHT = 13
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -32,7 +37,17 @@ class DDLineNode:
|
||||
noteType: int
|
||||
postionOffset: X_Y_Z | None # Yes, postionOffset - not positionOffset.
|
||||
isPlayAudio: bool
|
||||
Ticks: int
|
||||
|
||||
|
||||
DRS_TO_DDS_NOTE_TYPE = {
|
||||
DRS_LEFT: DD_LEFT,
|
||||
DRS_RIGHT: DD_RIGHT,
|
||||
}
|
||||
|
||||
DRS_TO_DDS_LINE_NOTE_TYPE = {
|
||||
DRS_LEFT: DD_LINE_LEFT,
|
||||
DRS_RIGHT: DD_LINE_RIGHT,
|
||||
}
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -42,7 +57,7 @@ class DDSphereNode:
|
||||
position: X_Y
|
||||
position2D: X_Y
|
||||
size: X_Y_Z
|
||||
noteType: int
|
||||
noteType: DD_LEFT | DD_RIGHT
|
||||
postionOffset: dict | None
|
||||
isPlayAudio: bool
|
||||
|
||||
@@ -51,7 +66,7 @@ def create_note_sphere(
|
||||
time: float,
|
||||
position: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9,
|
||||
note_order: int,
|
||||
note_type: LEFT_NOTE | RIGHT_NOTE,
|
||||
note_type: DD_LEFT | DD_RIGHT,
|
||||
):
|
||||
return DDSphereNode(
|
||||
noteOrder=note_order,
|
||||
|
||||
+18
-10
@@ -5,6 +5,9 @@ from dataclasses import field
|
||||
|
||||
import xmltodict
|
||||
|
||||
MIN_POS = 0
|
||||
MAX_POS = 65536
|
||||
|
||||
|
||||
def safe_int(value):
|
||||
try:
|
||||
@@ -254,14 +257,18 @@ class DRSTrackStepPositionInfo:
|
||||
left_pos: int
|
||||
right_pos: int
|
||||
|
||||
@property
|
||||
def to_dance_dash_x(self):
|
||||
center_pos = (self.left_pos + self.right_pos) / 2
|
||||
mapped_value = 1 + (center_pos / MAX_POS) * 8
|
||||
return round(mapped_value)
|
||||
|
||||
|
||||
@dataclass
|
||||
class DRSTrackPoint:
|
||||
class DRSTrackPoint(DRSTrackStepPositionInfo):
|
||||
tick: int
|
||||
left_pos: int
|
||||
right_pos: int
|
||||
left_end_pos: int
|
||||
right_end_pos: int
|
||||
left_end_pos: int | None = None
|
||||
right_end_pos: int | None = None
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -272,12 +279,13 @@ class DRSTrackStepPlayerInfo:
|
||||
DRS_LEFT = 1
|
||||
DRS_RIGHT = 2
|
||||
DRS_DOWN = 3
|
||||
DRS_JUMP = 4
|
||||
|
||||
|
||||
@dataclass
|
||||
class DRSTrackStep:
|
||||
tick_info: DRSTrackStepTickInfo
|
||||
kind: DRS_LEFT | DRS_RIGHT | DRS_DOWN
|
||||
kind: DRS_LEFT | DRS_RIGHT | DRS_DOWN | DRS_JUMP
|
||||
position_info: DRSTrackStepPositionInfo
|
||||
player_info: DRSTrackStepPlayerInfo
|
||||
long_point: list[DRSTrackPoint] = field(default_factory=list)
|
||||
@@ -339,16 +347,16 @@ class DRSTrackStep:
|
||||
tick=int(point['tick']) if point.get('tick') else None,
|
||||
left_pos=int(point['left_pos']) if point.get(
|
||||
'left_pos',
|
||||
) else None,
|
||||
) is not None else None,
|
||||
right_pos=int(point['right_pos']) if point.get(
|
||||
'right_pos',
|
||||
) else None,
|
||||
) is not None else None,
|
||||
left_end_pos=int(point['left_end_pos']) if point.get(
|
||||
'left_end_pos',
|
||||
) else None,
|
||||
) is not None else None,
|
||||
right_end_pos=int(point['right_end_pos']) if point.get(
|
||||
'right_end_pos',
|
||||
) else None,
|
||||
) is not None else None,
|
||||
) for point in data['long_point']
|
||||
],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user