Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
qaqFei committed Oct 22, 2024
1 parent 51b2c13 commit abaac7c
Show file tree
Hide file tree
Showing 157 changed files with 696 additions and 697 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
__pycache__
PhigrosAssets
PhigrosAssets_tmp
Phigros_UserData.json
phigros_assets
phigros_userdata.json
error_*.txt
File renamed without changes.
File renamed without changes.
File renamed without changes.
40 changes: 20 additions & 20 deletions Chart_Functions_Phi.py → src/chartfuncs_phi.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import logging

import Chart_Objects_Phi
import Const
import Tool_Functions
import chartobj_phi
import const
import tool_funcs

def Cal_Combo(now_time:float, chart_obj: Chart_Objects_Phi.Phigros_Chart) -> int:
def Cal_Combo(now_time:float, chart_obj: chartobj_phi.Phigros_Chart) -> int:
combo = 0
for judgeLine in chart_obj.judgeLineList:
for note in judgeLine.notesAbove + judgeLine.notesBelow:
if note.time * judgeLine.T <= now_time and note.type != Const.Note.HOLD:
if note.time * judgeLine.T <= now_time and note.type != const.Note.HOLD:
combo += 1
elif note.type == Const.Note.HOLD:
elif note.type == const.Note.HOLD:
if note.hold_length_sec > 0.2:
if note.hold_endtime - 0.2 <= now_time:
combo += 1
Expand Down Expand Up @@ -39,18 +39,18 @@ def _loadMoveEvents(es: list[dict]):
match fmtVersion:
case 1:
return [
Chart_Objects_Phi.judgeLineMoveEvent(
chartobj_phi.judgeLineMoveEvent(
startTime = e.get("startTime", -1.0),
endTime = e.get("endTime", -1.0),
start = Tool_Functions.unpack_pos(e.get("start", 0.0))[0] / 880,
end = Tool_Functions.unpack_pos(e.get("end", 0.0))[0] / 880,
start2 = Tool_Functions.unpack_pos(e.get("start", 0.0))[1] / 520,
end2 = Tool_Functions.unpack_pos(e.get("end", 0.0))[1] / 520
start = tool_funcs.unpack_pos(e.get("start", 0.0))[0] / 880,
end = tool_funcs.unpack_pos(e.get("end", 0.0))[0] / 880,
start2 = tool_funcs.unpack_pos(e.get("start", 0.0))[1] / 520,
end2 = tool_funcs.unpack_pos(e.get("end", 0.0))[1] / 520
) for e in es
]
case 3:
return [
Chart_Objects_Phi.judgeLineMoveEvent(
chartobj_phi.judgeLineMoveEvent(
startTime = e.get("startTime", -1.0), endTime = e.get("endTime", -1.0),
start = e.get("start", 0.5), end = e.get("end", 0.5),
start2 = e.get("start2", 0.5), end2 = e.get("end2", 0.5)
Expand All @@ -59,50 +59,50 @@ def _loadMoveEvents(es: list[dict]):
case _:
logging.warning(f"Unsupported format version: {fmtVersion}")
return [
Chart_Objects_Phi.judgeLineMoveEvent(
chartobj_phi.judgeLineMoveEvent(
startTime = e.get("startTime", -1.0), endTime = e.get("endTime", -1.0),
start = e.get("start", 0.0), end = e.get("end", 0.0),
start2 = e.get("start2", 0.0), end2 = e.get("end2", 0.0)
) for e in es
]

phigros_chart_obj = Chart_Objects_Phi.Phigros_Chart(
phigros_chart_obj = chartobj_phi.Phigros_Chart(
formatVersion = fmtVersion,
offset = phigros_chart.get("offset", 0.0),
judgeLineList = [
Chart_Objects_Phi.judgeLine(
chartobj_phi.judgeLine(
bpm = line.get("bpm", -1.0),
notesAbove = [
Chart_Objects_Phi.note(
chartobj_phi.note(
type = n.get("type", 1), time = n.get("time", -1.0),
positionX = n.get("positionX", 0.0), holdTime = n.get("holdTime", 0.0),
speed = n.get("speed", -1.0), floorPosition = n.get("floorPosition", -1.0),
above = True
) for n in line.get("notesAbove", [])
],
notesBelow = [
Chart_Objects_Phi.note(
chartobj_phi.note(
type = n.get("type", 1), time = n.get("time", -1.0),
positionX = n.get("positionX", 0.0), holdTime = n.get("holdTime", 0.0),
speed = n.get("speed", -1.0), floorPosition = n.get("floorPosition", -1.0),
above = False
) for n in line.get("notesBelow", [])
],
speedEvents = [
Chart_Objects_Phi.speedEvent(
chartobj_phi.speedEvent(
startTime = e.get("startTime", -1.0),
endTime = e.get("endTime", -1.0), value = e.get("value", 0.0)
) for e in line.get("speedEvents", [])
],
judgeLineMoveEvents = _loadMoveEvents(line.get("judgeLineMoveEvents", [])),
judgeLineRotateEvents = [
Chart_Objects_Phi.judgeLineRotateEvent(
chartobj_phi.judgeLineRotateEvent(
startTime = e.get("startTime", -1.0), endTime = e.get("endTime", -1.0),
start = e.get("start", 0.0), end = e.get("end", 0.0)
) for e in line.get("judgeLineRotateEvents", [])
],
judgeLineDisappearEvents = [
Chart_Objects_Phi.judgeLineDisappearEvent(
chartobj_phi.judgeLineDisappearEvent(
startTime = e.get("startTime", -1.0), endTime = e.get("endTime", -1.0),
start = e.get("start", 0.0), end = e.get("end", 0.0)
) for e in line.get("judgeLineDisappearEvents", [])
Expand Down
78 changes: 39 additions & 39 deletions Chart_Functions_Rpe.py → src/chartfuncs_rpe.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import logging

import Chart_Objects_Rpe
import chartobj_rpe

def Load_Chart_Object(chart: dict):
logging.info("Loading Chart Object, fmt = rpe")
meta = chart.get("META", {})
rpe_chart_obj = Chart_Objects_Rpe.Rpe_Chart(
META = Chart_Objects_Rpe.MetaData(
rpe_chart_obj = chartobj_rpe.Rpe_Chart(
META = chartobj_rpe.MetaData(
RPEVersion = meta.get("RPEVersion", -1),
offset = meta.get("offset", 0),
name = meta.get("name", "Unknow"),
Expand All @@ -18,30 +18,30 @@ def Load_Chart_Object(chart: dict):
level = meta.get("level", "Unknow"),
),
BPMList = [
Chart_Objects_Rpe.BPMEvent(
startTime = Chart_Objects_Rpe.Beat(
chartobj_rpe.BPMEvent(
startTime = chartobj_rpe.Beat(
*BPMEvent_item.get("startTime", [0, 0, 1])
),
bpm = BPMEvent_item.get("bpm", 140)
)
for BPMEvent_item in chart.get("BPMList", [])
],
JudgeLineList = [
Chart_Objects_Rpe.JudgeLine(
chartobj_rpe.JudgeLine(
isCover = judgeLine_item.get("isCover", 1),
Texture = judgeLine_item.get("Texture", "line.png"),
attachUI = judgeLine_item.get("attachUI", None),
bpmfactor = judgeLine_item.get("bpmfactor", 1.0),
father = judgeLine_item.get("father", -1),
zOrder = judgeLine_item.get("zOrder", 0),
eventLayers = [
Chart_Objects_Rpe.EventLayer(
chartobj_rpe.EventLayer(
speedEvents = [
Chart_Objects_Rpe.LineEvent(
startTime = Chart_Objects_Rpe.Beat(
chartobj_rpe.LineEvent(
startTime = chartobj_rpe.Beat(
*LineEvent_item.get("startTime", [0, 0, 1])
),
endTime = Chart_Objects_Rpe.Beat(
endTime = chartobj_rpe.Beat(
*LineEvent_item.get("endTime", [0, 0, 1])
),
start = LineEvent_item.get("start", 0.0),
Expand All @@ -51,11 +51,11 @@ def Load_Chart_Object(chart: dict):
for LineEvent_item in EventLayer_item.get("speedEvents", [])
] if EventLayer_item.get("speedEvents", []) is not None else [],
moveXEvents = [
Chart_Objects_Rpe.LineEvent(
startTime = Chart_Objects_Rpe.Beat(
chartobj_rpe.LineEvent(
startTime = chartobj_rpe.Beat(
*LineEvent_item.get("startTime", [0, 0, 1])
),
endTime = Chart_Objects_Rpe.Beat(
endTime = chartobj_rpe.Beat(
*LineEvent_item.get("endTime", [0, 0, 1])
),
start = LineEvent_item.get("start", 0.0),
Expand All @@ -64,11 +64,11 @@ def Load_Chart_Object(chart: dict):
) for LineEvent_item in EventLayer_item.get("moveXEvents", [])
] if EventLayer_item.get("moveXEvents", []) is not None else [],
moveYEvents = [
Chart_Objects_Rpe.LineEvent(
startTime = Chart_Objects_Rpe.Beat(
chartobj_rpe.LineEvent(
startTime = chartobj_rpe.Beat(
*LineEvent_item.get("startTime", [0, 0, 1])
),
endTime = Chart_Objects_Rpe.Beat(
endTime = chartobj_rpe.Beat(
*LineEvent_item.get("endTime", [0, 0, 1])
),
start = LineEvent_item.get("start", 0.0),
Expand All @@ -77,11 +77,11 @@ def Load_Chart_Object(chart: dict):
) for LineEvent_item in EventLayer_item.get("moveYEvents", [])
] if EventLayer_item.get("moveYEvents", []) is not None else [],
rotateEvents = [
Chart_Objects_Rpe.LineEvent(
startTime = Chart_Objects_Rpe.Beat(
chartobj_rpe.LineEvent(
startTime = chartobj_rpe.Beat(
*LineEvent_item.get("startTime", [0, 0, 1])
),
endTime = Chart_Objects_Rpe.Beat(
endTime = chartobj_rpe.Beat(
*LineEvent_item.get("endTime", [0, 0, 1])
),
start = LineEvent_item.get("start", 0.0),
Expand All @@ -90,28 +90,28 @@ def Load_Chart_Object(chart: dict):
) for LineEvent_item in EventLayer_item.get("rotateEvents", [])
] if EventLayer_item.get("rotateEvents", []) is not None else [],
alphaEvents = [
Chart_Objects_Rpe.LineEvent(
startTime = Chart_Objects_Rpe.Beat(
chartobj_rpe.LineEvent(
startTime = chartobj_rpe.Beat(
*LineEvent_item.get("startTime", [0, 0, 1])
),
endTime = Chart_Objects_Rpe.Beat(
endTime = chartobj_rpe.Beat(
*LineEvent_item.get("endTime", [0, 0, 1])
),
start = LineEvent_item.get("start", 0.0),
end = LineEvent_item.get("end", 0.0),
easingType = LineEvent_item.get("easingType", 1)
) for LineEvent_item in EventLayer_item.get("alphaEvents", [])
] if EventLayer_item.get("alphaEvents", []) is not None else []
) if EventLayer_item is not None else Chart_Objects_Rpe.EventLayer(speedEvents = [], moveXEvents = [], moveYEvents = [], rotateEvents = [], alphaEvents = [])
) if EventLayer_item is not None else chartobj_rpe.EventLayer(speedEvents = [], moveXEvents = [], moveYEvents = [], rotateEvents = [], alphaEvents = [])
for EventLayer_item in judgeLine_item.get("eventLayers", [])
],
extended = Chart_Objects_Rpe.Extended(
extended = chartobj_rpe.Extended(
scaleXEvents = [
Chart_Objects_Rpe.LineEvent(
startTime = Chart_Objects_Rpe.Beat(
chartobj_rpe.LineEvent(
startTime = chartobj_rpe.Beat(
*LineEvent_item.get("startTime", [0, 0, 1])
),
endTime = Chart_Objects_Rpe.Beat(
endTime = chartobj_rpe.Beat(
*LineEvent_item.get("endTime", [0, 0, 1])
),
start = LineEvent_item.get("start", 1.0),
Expand All @@ -120,11 +120,11 @@ def Load_Chart_Object(chart: dict):
) for LineEvent_item in judgeLine_item.get("extended", {}).get("scaleXEvents", [])
] if judgeLine_item.get("extended", {}).get("scaleXEvents", []) is not None else [],
scaleYEvents = [
Chart_Objects_Rpe.LineEvent(
startTime = Chart_Objects_Rpe.Beat(
chartobj_rpe.LineEvent(
startTime = chartobj_rpe.Beat(
*LineEvent_item.get("startTime", [0, 0, 1])
),
endTime = Chart_Objects_Rpe.Beat(
endTime = chartobj_rpe.Beat(
*LineEvent_item.get("endTime", [0, 0, 1])
),
start = LineEvent_item.get("start", 1.0),
Expand All @@ -133,11 +133,11 @@ def Load_Chart_Object(chart: dict):
) for LineEvent_item in judgeLine_item.get("extended", {}).get("scaleYEvents", [])
] if judgeLine_item.get("extended", {}).get("scaleYEvents", []) is not None else [],
colorEvents = [
Chart_Objects_Rpe.LineEvent(
startTime = Chart_Objects_Rpe.Beat(
chartobj_rpe.LineEvent(
startTime = chartobj_rpe.Beat(
*LineEvent_item.get("startTime", [0, 0, 1])
),
endTime = Chart_Objects_Rpe.Beat(
endTime = chartobj_rpe.Beat(
*LineEvent_item.get("endTime", [0, 0, 1])
),
start = LineEvent_item.get("start", [255, 255, 255]),
Expand All @@ -146,11 +146,11 @@ def Load_Chart_Object(chart: dict):
) for LineEvent_item in judgeLine_item.get("extended", {}).get("colorEvents", [])
] if judgeLine_item.get("extended", {}).get("colorEvents", []) is not None else [],
textEvents = [
Chart_Objects_Rpe.LineEvent(
startTime = Chart_Objects_Rpe.Beat(
chartobj_rpe.LineEvent(
startTime = chartobj_rpe.Beat(
*LineEvent_item.get("startTime", [0, 0, 1])
),
endTime = Chart_Objects_Rpe.Beat(
endTime = chartobj_rpe.Beat(
*LineEvent_item.get("endTime", [0, 0, 1])
),
start = LineEvent_item.get("start", ""),
Expand All @@ -160,12 +160,12 @@ def Load_Chart_Object(chart: dict):
] if judgeLine_item.get("extended", {}).get("textEvents", []) is not None else [],
) if judgeLine_item.get("extended", {}) is not None else None,
notes = [
Chart_Objects_Rpe.Note(
chartobj_rpe.Note(
type = Note_item.get("type", 1),
startTime = Chart_Objects_Rpe.Beat(
startTime = chartobj_rpe.Beat(
*Note_item.get("startTime", [0, 0, 1])
),
endTime = Chart_Objects_Rpe.Beat(
endTime = chartobj_rpe.Beat(
*Note_item.get("endTime", [0, 0, 1])
),
positionX = Note_item.get("positionX", 0),
Expand Down
Loading

0 comments on commit abaac7c

Please sign in to comment.