From abaac7cd18b101241a3d75a051f64bc7af4c601d Mon Sep 17 00:00:00 2001 From: qaq_fei Date: Tue, 22 Oct 2024 20:00:32 +0800 Subject: [PATCH] --- .gitignore | 5 +- 7z.dll => src/7z.dll | Bin 7z.exe => src/7z.exe | Bin .../_compile_pyiextend.py | 0 .../chartfuncs_phi.py | 40 +- .../chartfuncs_rpe.py | 78 +-- Chart_Objects_Phi.py => src/chartobj_phi.py | 32 +- Chart_Objects_Rpe.py => src/chartobj_rpe.py | 38 +- ConsoleWindow.py => src/console_window.py | 0 Const.py => src/const.py | 0 dialog.py => src/dialog.py | 0 errProcesser.py => src/err_processer.py | 0 GUI_Const.py => src/gui_const.py | 0 GUI_Launcher.py => src/gui_launcher.py | 20 +- icon.ico => src/icon.ico | Bin index.html => src/index.html | 0 info_loader.py => src/info_loader.py | 0 initLogging.py => src/init_logging.py | 0 Main.py => src/main.py | 92 +-- Phigros_Tips.py => src/phi_tips.py | 0 PhiCore.py => src/phicore.py | 314 ++++----- PhigrosGameObject.py => src/phigame_obj.py | 92 +-- Phigros.py => src/phigros.py | 596 +++++++++--------- PlaySound.py => src/playsound.py | 0 ppr_help.py => src/ppr_help.py | 4 +- {Resources => src/resources}/AboutUs.mp3 | Bin {Resources => src/resources}/AllSongBlur.png | Bin {Resources => src/resources}/Arrow_Left.png | Bin .../resources}/Arrow_Left_Black.png | Bin {Resources => src/resources}/Arrow_Right.png | Bin .../resources}/Arrow_Right_Black.png | Bin {Resources => src/resources}/Button_Left.png | Bin .../resources}/Button_Left_Black.png | Bin {Resources => src/resources}/Calibration.wav | Bin .../resources}/CalibrationHit.wav | Bin .../resources}/ChapterSelect.mp3 | Bin {Resources => src/resources}/Edit_Add.png | Bin {Resources => src/resources}/Edit_Back.png | Bin .../resources}/Edit_ChangeValue.png | Bin {Resources => src/resources}/Edit_Delete.png | Bin {Resources => src/resources}/Edit_Pause.png | Bin {Resources => src/resources}/Edit_Play.png | Bin {Resources => src/resources}/Edit_Replay.png | Bin {Resources => src/resources}/Edit_Save.png | Bin .../resources}/Introduction/audio.mp3 | Bin .../resources}/Introduction/chart.json | 0 .../resources}/Introduction/image.png | Bin .../resources}/JoinQQGuildBanner.png | Bin .../resources}/JoinQQGuildPromo.png | Bin {Resources => src/resources}/Levels/A.png | Bin {Resources => src/resources}/Levels/AP.png | Bin {Resources => src/resources}/Levels/B.png | Bin {Resources => src/resources}/Levels/C.png | Bin {Resources => src/resources}/Levels/F.png | Bin {Resources => src/resources}/Levels/FC.png | Bin {Resources => src/resources}/Levels/S.png | Bin {Resources => src/resources}/Levels/V.png | Bin {Resources => src/resources}/LoadSuccess.wav | Bin .../resources}/NewSplashSceneBGM.mp3 | Bin .../resources}/Note_Click_Audio/Drag.wav | Bin .../resources}/Note_Click_Audio/Flick.wav | Bin .../resources}/Note_Click_Audio/Hold.wav | Bin .../resources}/Note_Click_Audio/Tap.wav | Bin .../resources}/Note_Click_Effect/Frames/1.png | Bin .../Note_Click_Effect/Frames/10.png | Bin .../Note_Click_Effect/Frames/11.png | Bin .../Note_Click_Effect/Frames/12.png | Bin .../Note_Click_Effect/Frames/13.png | Bin .../Note_Click_Effect/Frames/14.png | Bin .../Note_Click_Effect/Frames/15.png | Bin .../Note_Click_Effect/Frames/16.png | Bin .../Note_Click_Effect/Frames/17.png | Bin .../Note_Click_Effect/Frames/18.png | Bin .../Note_Click_Effect/Frames/19.png | Bin .../resources}/Note_Click_Effect/Frames/2.png | Bin .../Note_Click_Effect/Frames/20.png | Bin .../Note_Click_Effect/Frames/21.png | Bin .../Note_Click_Effect/Frames/22.png | Bin .../Note_Click_Effect/Frames/23.png | Bin .../Note_Click_Effect/Frames/24.png | Bin .../Note_Click_Effect/Frames/25.png | Bin .../Note_Click_Effect/Frames/26.png | Bin .../Note_Click_Effect/Frames/27.png | Bin .../Note_Click_Effect/Frames/28.png | Bin .../Note_Click_Effect/Frames/29.png | Bin .../resources}/Note_Click_Effect/Frames/3.png | Bin .../Note_Click_Effect/Frames/30.png | Bin .../resources}/Note_Click_Effect/Frames/4.png | Bin .../resources}/Note_Click_Effect/Frames/5.png | Bin .../resources}/Note_Click_Effect/Frames/6.png | Bin .../resources}/Note_Click_Effect/Frames/7.png | Bin .../resources}/Note_Click_Effect/Frames/8.png | Bin .../resources}/Note_Click_Effect/Frames/9.png | Bin .../resources}/Note_Click_Effect/Raw.png | Bin .../resources}/Note_Click_Effect/split.py | 0 {Resources => src/resources}/Notes/Drag.png | Bin .../resources}/Notes/Drag_dub.png | Bin {Resources => src/resources}/Notes/Flick.png | Bin .../resources}/Notes/Flick_dub.png | Bin .../resources}/Notes/Hold_Body.png | Bin .../resources}/Notes/Hold_Body_dub.png | Bin .../resources}/Notes/Hold_End.png | Bin .../resources}/Notes/Hold_End_dub.png | Bin .../resources}/Notes/Hold_Head.png | Bin .../resources}/Notes/Hold_Head_dub.png | Bin .../resources}/Notes/SplitPhiraHoldTexture.py | 0 {Resources => src/resources}/Notes/Tap.png | Bin .../resources}/Notes/Tap_dub.png | Bin {Resources => src/resources}/Over.mp3 | Bin {Resources => src/resources}/PUIBack.png | Bin {Resources => src/resources}/PUIResume.png | Bin {Resources => src/resources}/PUIRetry.png | Bin {Resources => src/resources}/Pause.png | Bin {Resources => src/resources}/Pause.wav | Bin {Resources => src/resources}/Retry.png | Bin {Resources => src/resources}/Start.png | Bin {Resources => src/resources}/TouchToStart.mp3 | Bin {Resources => src/resources}/UISound_1.wav | Bin {Resources => src/resources}/UISound_2.wav | Bin {Resources => src/resources}/UISound_3.wav | Bin {Resources => src/resources}/UISound_4.wav | Bin {Resources => src/resources}/WaitLoading.mp3 | Bin {Resources => src/resources}/bilibili.png | Bin {Resources => src/resources}/checked.png | Bin {Resources => src/resources}/close.png | Bin {Resources => src/resources}/collectibles.png | Bin {Resources => src/resources}/edit.png | Bin {Resources => src/resources}/facula.png | Bin {Resources => src/resources}/finger.png | Bin {Resources => src/resources}/font.ttf | Bin {Resources => src/resources}/logoipt.png | Bin {Resources => src/resources}/message.png | Bin {Resources => src/resources}/phigros.png | Bin {Resources => src/resources}/qq.png | Bin {Resources => src/resources}/setting.png | Bin {Resources => src/resources}/taptap.png | Bin {Resources => src/resources}/twitter.png | Bin rpe_easing.py => src/rpe_easing.py | 0 {shaders => src/shaders}/chromatic.glsl | 0 {shaders => src/shaders}/circle_blur.glsl | 0 {shaders => src/shaders}/fisheye.glsl | 0 {shaders => src/shaders}/glitch.glsl | 0 {shaders => src/shaders}/grayscale.glsl | 0 {shaders => src/shaders}/noise.glsl | 0 {shaders => src/shaders}/pixel.glsl | 0 {shaders => src/shaders}/radial_blur.glsl | 0 {shaders => src/shaders}/shockwave.glsl | 0 {shaders => src/shaders}/vignette.glsl | 0 tool-compile.py => src/tool-compile.py | 2 +- .../tool-createAutoplayOneFingerVideo.py | 32 +- .../tool-phiChart2onlyOneNote.py | 0 .../tool-processChartAudio.py | 14 +- tool-video2rpe.py => src/tool-video2rpe.py | 0 Tool_Functions.py => src/tool_funcs.py | 0 web_canvas.html => src/web_canvas.html | 0 webcv.py => src/webcv.py | 0 webphiplayer.html => src/webphiplayer.html | 34 +- 157 files changed, 696 insertions(+), 697 deletions(-) rename 7z.dll => src/7z.dll (100%) rename 7z.exe => src/7z.exe (100%) rename _compile_pyiextend.py => src/_compile_pyiextend.py (100%) rename Chart_Functions_Phi.py => src/chartfuncs_phi.py (81%) rename Chart_Functions_Rpe.py => src/chartfuncs_rpe.py (80%) rename Chart_Objects_Phi.py => src/chartobj_phi.py (92%) rename Chart_Objects_Rpe.py => src/chartobj_rpe.py (88%) rename ConsoleWindow.py => src/console_window.py (100%) rename Const.py => src/const.py (100%) rename dialog.py => src/dialog.py (100%) rename errProcesser.py => src/err_processer.py (100%) rename GUI_Const.py => src/gui_const.py (100%) rename GUI_Launcher.py => src/gui_launcher.py (98%) rename icon.ico => src/icon.ico (100%) rename index.html => src/index.html (100%) rename info_loader.py => src/info_loader.py (100%) rename initLogging.py => src/init_logging.py (100%) rename Main.py => src/main.py (95%) rename Phigros_Tips.py => src/phi_tips.py (100%) rename PhiCore.py => src/phicore.py (89%) rename PhigrosGameObject.py => src/phigame_obj.py (86%) rename Phigros.py => src/phigros.py (85%) rename PlaySound.py => src/playsound.py (100%) rename ppr_help.py => src/ppr_help.py (98%) rename {Resources => src/resources}/AboutUs.mp3 (100%) rename {Resources => src/resources}/AllSongBlur.png (100%) rename {Resources => src/resources}/Arrow_Left.png (100%) rename {Resources => src/resources}/Arrow_Left_Black.png (100%) rename {Resources => src/resources}/Arrow_Right.png (100%) rename {Resources => src/resources}/Arrow_Right_Black.png (100%) rename {Resources => src/resources}/Button_Left.png (100%) rename {Resources => src/resources}/Button_Left_Black.png (100%) rename {Resources => src/resources}/Calibration.wav (100%) rename {Resources => src/resources}/CalibrationHit.wav (100%) rename {Resources => src/resources}/ChapterSelect.mp3 (100%) rename {Resources => src/resources}/Edit_Add.png (100%) rename {Resources => src/resources}/Edit_Back.png (100%) rename {Resources => src/resources}/Edit_ChangeValue.png (100%) rename {Resources => src/resources}/Edit_Delete.png (100%) rename {Resources => src/resources}/Edit_Pause.png (100%) rename {Resources => src/resources}/Edit_Play.png (100%) rename {Resources => src/resources}/Edit_Replay.png (100%) rename {Resources => src/resources}/Edit_Save.png (100%) rename {Resources => src/resources}/Introduction/audio.mp3 (100%) rename {Resources => src/resources}/Introduction/chart.json (100%) rename {Resources => src/resources}/Introduction/image.png (100%) rename {Resources => src/resources}/JoinQQGuildBanner.png (100%) rename {Resources => src/resources}/JoinQQGuildPromo.png (100%) rename {Resources => src/resources}/Levels/A.png (100%) rename {Resources => src/resources}/Levels/AP.png (100%) rename {Resources => src/resources}/Levels/B.png (100%) rename {Resources => src/resources}/Levels/C.png (100%) rename {Resources => src/resources}/Levels/F.png (100%) rename {Resources => src/resources}/Levels/FC.png (100%) rename {Resources => src/resources}/Levels/S.png (100%) rename {Resources => src/resources}/Levels/V.png (100%) rename {Resources => src/resources}/LoadSuccess.wav (100%) rename {Resources => src/resources}/NewSplashSceneBGM.mp3 (100%) rename {Resources => src/resources}/Note_Click_Audio/Drag.wav (100%) rename {Resources => src/resources}/Note_Click_Audio/Flick.wav (100%) rename {Resources => src/resources}/Note_Click_Audio/Hold.wav (100%) rename {Resources => src/resources}/Note_Click_Audio/Tap.wav (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/1.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/10.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/11.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/12.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/13.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/14.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/15.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/16.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/17.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/18.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/19.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/2.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/20.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/21.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/22.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/23.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/24.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/25.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/26.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/27.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/28.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/29.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/3.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/30.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/4.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/5.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/6.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/7.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/8.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Frames/9.png (100%) rename {Resources => src/resources}/Note_Click_Effect/Raw.png (100%) rename {Resources => src/resources}/Note_Click_Effect/split.py (100%) rename {Resources => src/resources}/Notes/Drag.png (100%) rename {Resources => src/resources}/Notes/Drag_dub.png (100%) rename {Resources => src/resources}/Notes/Flick.png (100%) rename {Resources => src/resources}/Notes/Flick_dub.png (100%) rename {Resources => src/resources}/Notes/Hold_Body.png (100%) rename {Resources => src/resources}/Notes/Hold_Body_dub.png (100%) rename {Resources => src/resources}/Notes/Hold_End.png (100%) rename {Resources => src/resources}/Notes/Hold_End_dub.png (100%) rename {Resources => src/resources}/Notes/Hold_Head.png (100%) rename {Resources => src/resources}/Notes/Hold_Head_dub.png (100%) rename {Resources => src/resources}/Notes/SplitPhiraHoldTexture.py (100%) rename {Resources => src/resources}/Notes/Tap.png (100%) rename {Resources => src/resources}/Notes/Tap_dub.png (100%) rename {Resources => src/resources}/Over.mp3 (100%) rename {Resources => src/resources}/PUIBack.png (100%) rename {Resources => src/resources}/PUIResume.png (100%) rename {Resources => src/resources}/PUIRetry.png (100%) rename {Resources => src/resources}/Pause.png (100%) rename {Resources => src/resources}/Pause.wav (100%) rename {Resources => src/resources}/Retry.png (100%) rename {Resources => src/resources}/Start.png (100%) rename {Resources => src/resources}/TouchToStart.mp3 (100%) rename {Resources => src/resources}/UISound_1.wav (100%) rename {Resources => src/resources}/UISound_2.wav (100%) rename {Resources => src/resources}/UISound_3.wav (100%) rename {Resources => src/resources}/UISound_4.wav (100%) rename {Resources => src/resources}/WaitLoading.mp3 (100%) rename {Resources => src/resources}/bilibili.png (100%) rename {Resources => src/resources}/checked.png (100%) rename {Resources => src/resources}/close.png (100%) rename {Resources => src/resources}/collectibles.png (100%) rename {Resources => src/resources}/edit.png (100%) rename {Resources => src/resources}/facula.png (100%) rename {Resources => src/resources}/finger.png (100%) rename {Resources => src/resources}/font.ttf (100%) rename {Resources => src/resources}/logoipt.png (100%) rename {Resources => src/resources}/message.png (100%) rename {Resources => src/resources}/phigros.png (100%) rename {Resources => src/resources}/qq.png (100%) rename {Resources => src/resources}/setting.png (100%) rename {Resources => src/resources}/taptap.png (100%) rename {Resources => src/resources}/twitter.png (100%) rename rpe_easing.py => src/rpe_easing.py (100%) rename {shaders => src/shaders}/chromatic.glsl (100%) rename {shaders => src/shaders}/circle_blur.glsl (100%) rename {shaders => src/shaders}/fisheye.glsl (100%) rename {shaders => src/shaders}/glitch.glsl (100%) rename {shaders => src/shaders}/grayscale.glsl (100%) rename {shaders => src/shaders}/noise.glsl (100%) rename {shaders => src/shaders}/pixel.glsl (100%) rename {shaders => src/shaders}/radial_blur.glsl (100%) rename {shaders => src/shaders}/shockwave.glsl (100%) rename {shaders => src/shaders}/vignette.glsl (100%) rename tool-compile.py => src/tool-compile.py (98%) rename tool-createAutoplayOneFingerVideo.py => src/tool-createAutoplayOneFingerVideo.py (82%) rename tool-phiChart2onlyOneNote.py => src/tool-phiChart2onlyOneNote.py (100%) rename tool-processChartAudio.py => src/tool-processChartAudio.py (85%) rename tool-video2rpe.py => src/tool-video2rpe.py (100%) rename Tool_Functions.py => src/tool_funcs.py (100%) rename web_canvas.html => src/web_canvas.html (100%) rename webcv.py => src/webcv.py (100%) rename webphiplayer.html => src/webphiplayer.html (94%) diff --git a/.gitignore b/.gitignore index 1f80ccd..932f2e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ __pycache__ -PhigrosAssets -PhigrosAssets_tmp -Phigros_UserData.json +phigros_assets +phigros_userdata.json error_*.txt \ No newline at end of file diff --git a/7z.dll b/src/7z.dll similarity index 100% rename from 7z.dll rename to src/7z.dll diff --git a/7z.exe b/src/7z.exe similarity index 100% rename from 7z.exe rename to src/7z.exe diff --git a/_compile_pyiextend.py b/src/_compile_pyiextend.py similarity index 100% rename from _compile_pyiextend.py rename to src/_compile_pyiextend.py diff --git a/Chart_Functions_Phi.py b/src/chartfuncs_phi.py similarity index 81% rename from Chart_Functions_Phi.py rename to src/chartfuncs_phi.py index c7d52d3..c7a0f08 100644 --- a/Chart_Functions_Phi.py +++ b/src/chartfuncs_phi.py @@ -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 @@ -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) @@ -59,21 +59,21 @@ 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), @@ -81,7 +81,7 @@ def _loadMoveEvents(es: list[dict]): ) 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), @@ -89,20 +89,20 @@ def _loadMoveEvents(es: list[dict]): ) 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", []) diff --git a/Chart_Functions_Rpe.py b/src/chartfuncs_rpe.py similarity index 80% rename from Chart_Functions_Rpe.py rename to src/chartfuncs_rpe.py index 833816c..7c17f99 100644 --- a/Chart_Functions_Rpe.py +++ b/src/chartfuncs_rpe.py @@ -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"), @@ -18,8 +18,8 @@ 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) @@ -27,7 +27,7 @@ def Load_Chart_Object(chart: dict): 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), @@ -35,13 +35,13 @@ def Load_Chart_Object(chart: dict): 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), @@ -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), @@ -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), @@ -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), @@ -90,11 +90,11 @@ 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), @@ -102,16 +102,16 @@ def Load_Chart_Object(chart: dict): 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), @@ -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), @@ -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]), @@ -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", ""), @@ -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), diff --git a/Chart_Objects_Phi.py b/src/chartobj_phi.py similarity index 92% rename from Chart_Objects_Phi.py rename to src/chartobj_phi.py index 36ea6f9..5ddefff 100644 --- a/Chart_Objects_Phi.py +++ b/src/chartobj_phi.py @@ -5,8 +5,8 @@ import json from dataclasses import dataclass -import Const -import Tool_Functions +import const +import tool_funcs import rpe_easing def getFloorPosition(line: judgeLine, t: float) -> float: @@ -33,7 +33,7 @@ class note: master: judgeLine|None = None show_effected: bool = False effect_times: list[tuple[int]] | tuple = () - state: int = Const.NOTE_STATE.MISS + state: int = const.NOTE_STATE.MISS player_clicked: bool = False player_click_offset: float = 0.0 player_click_sound_played: bool = False @@ -43,14 +43,14 @@ class note: player_holdmiss_time: float = float("inf") player_last_testholdismiss_time: float = -float("inf") player_holdjudged: bool = False - player_holdclickstate: int = Const.NOTE_STATE.MISS + player_holdclickstate: int = const.NOTE_STATE.MISS player_holdjudged_tomanager: bool = False player_holdjudge_tomanager_time: float = float("nan") # init at note._init function player_drag_judge_safe_used: bool = False def __post_init__(self): - self.id = Tool_Functions.Get_A_New_NoteId() - self.effect_random_blocks = Tool_Functions.get_effect_random_blocks() + self.id = tool_funcs.Get_A_New_NoteId() + self.effect_random_blocks = tool_funcs.get_effect_random_blocks() def __eq__(self, oth:object): if not isinstance(oth, note): @@ -73,13 +73,13 @@ def init(self) -> None: hold_starttime += hold_effect_blocktime if hold_starttime >= self.hold_endtime: break - self.effect_times.append((hold_starttime, Tool_Functions.get_effect_random_blocks())) + self.effect_times.append((hold_starttime, tool_funcs.get_effect_random_blocks())) self.type_string = { - Const.Note.TAP:"Tap", - Const.Note.DRAG:"Drag", - Const.Note.HOLD:"Hold", - Const.Note.FLICK:"Flick" + const.Note.TAP:"Tap", + const.Note.DRAG:"Drag", + const.Note.HOLD:"Hold", + const.Note.FLICK:"Flick" }[self.type] self.floorPosition = getFloorPosition(self.master, self.time) @@ -87,7 +87,7 @@ def init(self) -> None: def getNoteClickPos(self, time: float) -> tuple[float, float]: linePos = self.master.get_datavar_move(time, 1.0, 1.0) lineRotate = self.master.get_datavar_rotate(time) - return Tool_Functions.rotate_point(*linePos, - lineRotate, self.positionX * 0.05625) + return tool_funcs.rotate_point(*linePos, - lineRotate, self.positionX * 0.05625) @dataclass class speedEvent: @@ -184,7 +184,7 @@ def set_master_to_notes(self): def get_datavar_rotate(self, now_time): for e in self.judgeLineRotateEvents: if e.startTime <= now_time <= e.endTime: - return Tool_Functions.linear_interpolation( + return tool_funcs.linear_interpolation( now_time, e.startTime, e.endTime, @@ -196,7 +196,7 @@ def get_datavar_rotate(self, now_time): def get_datavar_disappear(self, now_time): for e in self.judgeLineDisappearEvents: if e.startTime <= now_time <= e.endTime: - return Tool_Functions.linear_interpolation( + return tool_funcs.linear_interpolation( now_time, e.startTime, e.endTime, @@ -210,8 +210,8 @@ def _get_datavar_move_rawphi(self, now_time): for e in self.judgeLineMoveEvents: if e.startTime <= now_time <= e.endTime: v = ( - Tool_Functions.linear_interpolation(now_time, e.startTime, e.endTime, e.start, e.end), - Tool_Functions.linear_interpolation(now_time, e.startTime, e.endTime, e.start2, e.end2) + tool_funcs.linear_interpolation(now_time, e.startTime, e.endTime, e.start, e.end), + tool_funcs.linear_interpolation(now_time, e.startTime, e.endTime, e.start2, e.end2) ) break return v diff --git a/Chart_Objects_Rpe.py b/src/chartobj_rpe.py similarity index 88% rename from Chart_Objects_Rpe.py rename to src/chartobj_rpe.py index de7e103..8680a58 100644 --- a/Chart_Objects_Rpe.py +++ b/src/chartobj_rpe.py @@ -4,9 +4,9 @@ from dataclasses import dataclass from functools import lru_cache, cache -import Tool_Functions +import tool_funcs import rpe_easing -import Const +import const def _init_events(es: list[LineEvent]): aes = [] @@ -53,7 +53,7 @@ class Note: show_effected: bool = False masterLine: JudgeLine|None = None - state: int = Const.NOTE_STATE.MISS + state: int = const.NOTE_STATE.MISS player_clicked: bool = False player_click_offset: float = 0.0 player_click_sound_played: bool = False @@ -63,7 +63,7 @@ class Note: player_holdmiss_time: float = float("inf") player_last_testholdismiss_time: float = -float("inf") player_holdjudged: bool = False - player_holdclickstate: int = Const.NOTE_STATE.MISS + player_holdclickstate: int = const.NOTE_STATE.MISS player_holdjudged_tomanager: bool = False player_holdjudge_tomanager_time: float = float("nan") # init at note._init function player_drag_judge_safe_used: bool = False @@ -74,15 +74,15 @@ class Note: def __post_init__(self): self.phitype = {1:1, 2:3, 3:4, 4:2}[self.type] self.type_string = { - Const.Note.TAP: "Tap", - Const.Note.DRAG: "Drag", - Const.Note.HOLD: "Hold", - Const.Note.FLICK: "Flick" + const.Note.TAP: "Tap", + const.Note.DRAG: "Drag", + const.Note.HOLD: "Hold", + const.Note.FLICK: "Flick" }[self.phitype] self.positionX2 = self.positionX / 1350 self.float_alpha = (255 & int(self.alpha)) / 255 self.ishold = self.type_string == "Hold" - self.effect_random_blocks = Tool_Functions.get_effect_random_blocks() + self.effect_random_blocks = tool_funcs.get_effect_random_blocks() def _init(self, master: Rpe_Chart, avgBpm: float): self.effect_times = [] @@ -94,7 +94,7 @@ def _init(self, master: Rpe_Chart, avgBpm: float): hold_starttime += hold_effect_blocktime if hold_starttime >= hold_endtime: break - self.effect_times.append((hold_starttime, Tool_Functions.get_effect_random_blocks())) + self.effect_times.append((hold_starttime, tool_funcs.get_effect_random_blocks())) self.secst = master.beat2sec(self.startTime.value, self.masterLine.bpmfactor) self.secet = master.beat2sec(self.endTime.value, self.masterLine.bpmfactor) @@ -102,7 +102,7 @@ def _init(self, master: Rpe_Chart, avgBpm: float): def getNoteClickPos(self, time: float, master: Rpe_Chart, line: JudgeLine) -> tuple[float, float]: linePos = line.GetPos(time, master) lineRotate = sum([line.GetEventValue(time, layer.rotateEvents, 0.0) for layer in line.eventLayers]) - return Tool_Functions.rotate_point(*linePos, lineRotate, self.positionX2) + return tool_funcs.rotate_point(*linePos, lineRotate, self.positionX2) @dataclass class LineEvent: @@ -192,13 +192,13 @@ def GetEventValue(self, t: float, es: list[LineEvent], default): for e in es: if e.startTime.value <= t <= e.endTime.value: if isinstance(e.start, float|int): - return Tool_Functions.easing_interpolation(t, e.startTime.value, e.endTime.value, e.start, e.end, e.easingFunc) + return tool_funcs.easing_interpolation(t, e.startTime.value, e.endTime.value, e.start, e.end, e.easingFunc) elif isinstance(e.start, str): return e.start elif isinstance(e.start, list): - r = Tool_Functions.easing_interpolation(t, e.startTime.value, e.endTime.value, e.start[0], e.end[0], e.easingFunc) - g = Tool_Functions.easing_interpolation(t, e.startTime.value, e.endTime.value, e.start[1], e.end[1], e.easingFunc) - b = Tool_Functions.easing_interpolation(t, e.startTime.value, e.endTime.value, e.start[2], e.end[2], e.easingFunc) + r = tool_funcs.easing_interpolation(t, e.startTime.value, e.endTime.value, e.start[0], e.end[0], e.easingFunc) + g = tool_funcs.easing_interpolation(t, e.startTime.value, e.endTime.value, e.start[1], e.end[1], e.easingFunc) + b = tool_funcs.easing_interpolation(t, e.startTime.value, e.endTime.value, e.start[2], e.end[2], e.easingFunc) return (r, g, b) return default @@ -221,7 +221,7 @@ def GetSpeed(self, t: float): for layer in self.eventLayers: for e in layer.speedEvents: if e.startTime.value <= t <= e.endTime.value: - v += Tool_Functions.linear_interpolation(t, e.startTime.value, e.endTime.value, e.start, e.end) + v += tool_funcs.linear_interpolation(t, e.startTime.value, e.endTime.value, e.start, e.end) break # loop for other layers return v @@ -245,7 +245,7 @@ def GetState(self, t: float, defaultColor: tuple[int, int, int], master: Rpe_Cha lineColor = self.GetEventValue(t, self.extended.colorEvents, lineColor) lineText = self.GetEventValue(t, self.extended.textEvents, lineText) - return Tool_Functions.conrpepos(*linePos), lineAlpha / 255, lineRotate, lineColor, lineScaleX, lineScaleY, lineText + return tool_funcs.conrpepos(*linePos), lineAlpha / 255, lineRotate, lineColor, lineScaleX, lineScaleY, lineText def GetNoteFloorPosition(self, t: float, n: Note, master: Rpe_Chart): l, r = master.beat2sec(t, self.bpmfactor), master.beat2sec(n.startTime.value, self.bpmfactor) @@ -269,8 +269,8 @@ def GetFloorPosition(self, l: float, r: float, master: Rpe_Chart): if e.start == e.end: fp += (v2 - v1) * e.start else: - s1 = Tool_Functions.linear_interpolation(v1, st, et, e.start, e.end) - s2 = Tool_Functions.linear_interpolation(v2, st, et, e.start, e.end) + s1 = tool_funcs.linear_interpolation(v1, st, et, e.start, e.end) + s2 = tool_funcs.linear_interpolation(v2, st, et, e.start, e.end) fp += (v2 - v1) * (s1 + s2) / 2 return fp * 120 / 900 diff --git a/ConsoleWindow.py b/src/console_window.py similarity index 100% rename from ConsoleWindow.py rename to src/console_window.py diff --git a/Const.py b/src/const.py similarity index 100% rename from Const.py rename to src/const.py diff --git a/dialog.py b/src/dialog.py similarity index 100% rename from dialog.py rename to src/dialog.py diff --git a/errProcesser.py b/src/err_processer.py similarity index 100% rename from errProcesser.py rename to src/err_processer.py diff --git a/GUI_Const.py b/src/gui_const.py similarity index 100% rename from GUI_Const.py rename to src/gui_const.py diff --git a/GUI_Launcher.py b/src/gui_launcher.py similarity index 98% rename from GUI_Launcher.py rename to src/gui_launcher.py index c026a1e..78005d1 100644 --- a/GUI_Launcher.py +++ b/src/gui_launcher.py @@ -7,21 +7,21 @@ from os.path import exists,isfile,dirname from sys import argv -import GUI_Const -import ConsoleWindow +import gui_const +import console_window -ConsoleWindow.Hide() +console_window.Hide() selfdir = dirname(argv[0]) if selfdir == "": selfdir = "." chdir(selfdir) -if exists("./Main.py"): - target_path = "./Main.py" -elif exists("./Main.exe"): - target_path = "./Main.exe" +if exists("./main.py"): + target_path = "./main.py" +elif exists("./main.exe"): + target_path = "./main.exe" else: - print("Can't find Main.py or Main.exe.") + print("Can't find main.py or main.exe.") raise SystemExit if "--english" in argv or "--eng" in argv: @@ -32,9 +32,9 @@ english = False if english: - TEXT = GUI_Const.ENGLISH + TEXT = gui_const.ENGLISH else: - TEXT = GUI_Const.CHINESE + TEXT = gui_const.CHINESE def hook_dropfiles_first(hwnd, callback): globals()[f"hook_dropfiles_dropfunc_prototype_{hwnd}"] = ctypes.WINFUNCTYPE(*(ctypes.c_uint64,) * 5)(lambda hwnd,msg,wp,lp: [callback([ctypes.windll.shell32.DragQueryFileW(ctypes.c_uint64(wp),0,szFile := ctypes.create_unicode_buffer(260),ctypes.sizeof(szFile)),szFile.value][1]) if msg == 0x233 else None,ctypes.windll.user32.CallWindowProcW(*map(ctypes.c_uint64,(lptr,hwnd,msg,wp,lp)))][1]);ctypes.windll.shell32.DragAcceptFiles(hwnd,True);lptr = ctypes.windll.user32.GetWindowLongPtrA(hwnd,-4);ctypes.windll.user32.SetWindowLongPtrA(hwnd,-4,globals()[f"hook_dropfiles_dropfunc_prototype_{hwnd}"]) diff --git a/icon.ico b/src/icon.ico similarity index 100% rename from icon.ico rename to src/icon.ico diff --git a/index.html b/src/index.html similarity index 100% rename from index.html rename to src/index.html diff --git a/info_loader.py b/src/info_loader.py similarity index 100% rename from info_loader.py rename to src/info_loader.py diff --git a/initLogging.py b/src/init_logging.py similarity index 100% rename from initLogging.py rename to src/init_logging.py diff --git a/Main.py b/src/main.py similarity index 95% rename from Main.py rename to src/main.py index 34d8595..052dd2c 100644 --- a/Main.py +++ b/src/main.py @@ -1,5 +1,5 @@ -import errProcesser as _ -import initLogging as _ +import err_processer as _ +import init_logging as _ import json import sys @@ -19,17 +19,17 @@ from pydub import AudioSegment import webcv -import PlaySound -import Chart_Objects_Phi -import Chart_Functions_Phi -import Chart_Functions_Rpe -import Const -import ConsoleWindow -import Tool_Functions +import playsound +import chartobj_phi +import chartfuncs_phi +import chartfuncs_rpe +import const +import console_window +import tool_funcs import dialog import info_loader import ppr_help -from PhiCore import * +from phicore import * selfdir = dirname(sys.argv[0]) if selfdir == "": selfdir = abspath(".") @@ -44,7 +44,7 @@ print(HELP) windll.kernel32.ExitProcess(0) -ConsoleWindow.Hide() if "--hideconsole" in sys.argv else None +console_window.Hide() if "--hideconsole" in sys.argv else None for item in [item for item in listdir(gettempdir()) if item.startswith("phigros_chart_temp_")]: item = f"{gettempdir()}\\{item}" @@ -83,7 +83,7 @@ combotips = ("Autoplay" if not noautoplay else "Combo") if "--combotips" not in sys.argv else sys.argv[sys.argv.index("--combotips") + 1] noplaychart = "--noplaychart" in sys.argv clicksound_volume = float(sys.argv[sys.argv.index("--clicksound-volume") + 1]) if "--clicksound-volume" in sys.argv else 1.0 -respaths = ["./Resources"] +respaths = ["./resources"] if "--res" in sys.argv: respaths.append(sys.argv[sys.argv.index("--res") + 1]) @@ -108,7 +108,7 @@ popen(f".\\7z.exe x \"{sys.argv[1]}\" -o\"{temp_dir}\" -y >> nul").read() logging.info("Loading All Files of Chart...") -chart_files = Tool_Functions.Get_All_Files(temp_dir) +chart_files = tool_funcs.Get_All_Files(temp_dir) chart_files_dict = { "charts": [], "images": [], @@ -310,9 +310,9 @@ phigros_chart_filepath = chart_files_dict["charts"][phigros_chart_index][0] if "formatVersion" in chart_json: - CHART_TYPE = Const.CHART_TYPE.PHI + CHART_TYPE = const.CHART_TYPE.PHI elif "META" in chart_json: - CHART_TYPE = Const.CHART_TYPE.RPE + CHART_TYPE = const.CHART_TYPE.RPE render_range_more = False else: logging.fatal("This is what format chart???") @@ -320,17 +320,17 @@ def LoadChartObject(first: bool = False): global chart_obj - if CHART_TYPE == Const.CHART_TYPE.PHI: - chart_obj = Chart_Functions_Phi.Load_Chart_Object(chart_json) - elif CHART_TYPE == Const.CHART_TYPE.RPE: - chart_obj = Chart_Functions_Rpe.Load_Chart_Object(chart_json) + if CHART_TYPE == const.CHART_TYPE.PHI: + chart_obj = chartfuncs_phi.Load_Chart_Object(chart_json) + elif CHART_TYPE == const.CHART_TYPE.RPE: + chart_obj = chartfuncs_rpe.Load_Chart_Object(chart_json) if not first: updateCoreConfigure() LoadChartObject(True) if len(chart_files_dict["images"]) > 1: - if CHART_TYPE == Const.CHART_TYPE.RPE and chart_obj.META.background in [i[0].split("/")[-1].split("\\")[-1] for i in chart_files_dict["images"]]: + if CHART_TYPE == const.CHART_TYPE.RPE and chart_obj.META.background in [i[0].split("/")[-1].split("\\")[-1] for i in chart_files_dict["images"]]: chart_image_index = [i[0].split("/")[-1].split("\\")[-1] for i in chart_files_dict["images"]].index(chart_obj.META.background) chart_image:Image.Image = chart_files_dict["images"][chart_image_index][1] else: @@ -344,7 +344,7 @@ def LoadChartObject(first: bool = False): chart_image_filepath = chart_files_dict["images"][chart_image_index][0] if len(chart_files_dict["audio"]) > 1: - if CHART_TYPE == Const.CHART_TYPE.RPE and chart_obj.META.song in [i.split("/")[-1].split("\\")[-1] for i in chart_files_dict["audio"]]: + if CHART_TYPE == const.CHART_TYPE.RPE and chart_obj.META.song in [i.split("/")[-1].split("\\")[-1] for i in chart_files_dict["audio"]]: audio_file_index = [i.split("/")[-1].split("\\")[-1] for i in chart_files_dict["audio"]].index(chart_obj.META.song) audio_file = chart_files_dict["audio"][audio_file_index] else: @@ -368,7 +368,7 @@ def LoadChartObject(first: bool = False): mixer.music.load(audio_file) raw_audio_length = mixer.Sound(audio_file).get_length() -audio_length = raw_audio_length + (chart_obj.META.offset / 1000 if CHART_TYPE == Const.CHART_TYPE.RPE else 0.0) +audio_length = raw_audio_length + (chart_obj.META.offset / 1000 if CHART_TYPE == const.CHART_TYPE.RPE else 0.0) all_inforamtion = {} logging.info("Loading Chart Information...") @@ -471,10 +471,10 @@ def Load_Resource(): "F": Image.open(getResPath("/Levels/F.png")) }, "Note_Click_Audio":{ - "Tap": PlaySound.directSound(loadAudio(getResPath("/Note_Click_Audio/Tap.wav"))), - "Drag": PlaySound.directSound(loadAudio(getResPath("/Note_Click_Audio/Drag.wav"))), - "Hold": PlaySound.directSound(loadAudio(getResPath("/Note_Click_Audio/Hold.wav"))), - "Flick": PlaySound.directSound(loadAudio(getResPath("/Note_Click_Audio/Flick.wav"))) + "Tap": playsound.directSound(loadAudio(getResPath("/Note_Click_Audio/Tap.wav"))), + "Drag": playsound.directSound(loadAudio(getResPath("/Note_Click_Audio/Drag.wav"))), + "Hold": playsound.directSound(loadAudio(getResPath("/Note_Click_Audio/Hold.wav"))), + "Flick": playsound.directSound(loadAudio(getResPath("/Note_Click_Audio/Flick.wav"))) }, "Start": Image.open(getResPath("/Start.png")), "Button_Left": Image.open(getResPath("/Button_Left.png")), @@ -495,14 +495,14 @@ def Load_Resource(): finish_animation_image_mask.putpixel((0, 2), (0, 0, 0, 64)) animation_image = chart_image.copy().convert("RGBA") - Tool_Functions.cutAnimationIllImage(animation_image) + tool_funcs.cutAnimationIllImage(animation_image) finish_animation_image = chart_image.copy().convert("RGBA") finish_animation_image_mask = finish_animation_image_mask.resize(finish_animation_image.size) finish_animation_image.paste(finish_animation_image_mask, (0, 0), finish_animation_image_mask) - Tool_Functions.cutAnimationIllImage(finish_animation_image) + tool_funcs.cutAnimationIllImage(finish_animation_image) - Const.set_NOTE_DUB_FIXSCALE(Resource["Notes"]["Hold_Body_dub"].width / Resource["Notes"]["Hold_Body"].width) + const.set_NOTE_DUB_FIXSCALE(Resource["Notes"]["Hold_Body_dub"].width / Resource["Notes"]["Hold_Body"].width) for k, v in Resource["Notes"].items(): # Resize Notes (if Notes is too big) and reg them if v.width > Note_width: Resource["Notes"][k] = v.resize((int(Note_width),int(Note_width / v.width * v.height))) @@ -536,7 +536,7 @@ def Load_Resource(): root.reg_img(Resource["PauseImg"], "PauseImg") chart_res = {} - if CHART_TYPE == Const.CHART_TYPE.RPE: + if CHART_TYPE == const.CHART_TYPE.RPE: for line in chart_obj.JudgeLineList: if line.Texture != "line.png": paths = [ @@ -697,7 +697,7 @@ def PlayerStart(): def _f(): nonlocal play_restart_flag; play_restart_flag = True - @Tool_Functions.NoJoinThreadFunc + @tool_funcs.NoJoinThreadFunc def space(): global show_start_time nonlocal pause_flag, pause_st @@ -723,14 +723,14 @@ def space(): while pause_flag: time.sleep(1 / 30) now_t = time.time() - show_start_time - if CHART_TYPE == Const.CHART_TYPE.PHI: + if CHART_TYPE == const.CHART_TYPE.PHI: Task = GetFrameRenderTask_Phi(now_t) - elif CHART_TYPE == Const.CHART_TYPE.RPE: + elif CHART_TYPE == const.CHART_TYPE.RPE: Task = GetFrameRenderTask_Rpe(now_t) Task.ExecTask() - break_flag = Chart_Functions_Phi.FrameData_ProcessExTask( + break_flag = chartfuncs_phi.FrameData_ProcessExTask( Task.ExTask, lambda x: eval(x) ) @@ -767,9 +767,9 @@ def space(): if frame_count * frame_time > audio_length or frame_count - lfdaot_start_frame_num >= lfdaot_run_frame_num: break - if CHART_TYPE == Const.CHART_TYPE.PHI: + if CHART_TYPE == const.CHART_TYPE.PHI: lfdaot_tasks.update({frame_count: GetFrameRenderTask_Phi(frame_count * frame_time)}) - elif CHART_TYPE == Const.CHART_TYPE.RPE: + elif CHART_TYPE == const.CHART_TYPE.RPE: lfdaot_tasks.update({frame_count: GetFrameRenderTask_Rpe(frame_count * frame_time)}) frame_count += 1 @@ -784,8 +784,8 @@ def space(): ) if lfdaot_fp != "": - recorder = Chart_Objects_Phi.FrameTaskRecorder( - meta = Chart_Objects_Phi.FrameTaskRecorder_Meta( + recorder = chartobj_phi.FrameTaskRecorder( + meta = chartobj_phi.FrameTaskRecorder_Meta( frame_speed = frame_speed, frame_num = len(lfdaot_tasks), render_range_more = render_range_more, @@ -819,9 +819,9 @@ def space(): }) for index,Task_data in enumerate(data["data"]): lfdaot_tasks.update({ - index:Chart_Objects_Phi.FrameRenderTask( + index:chartobj_phi.FrameRenderTask( RenderTasks = [ - Chart_Objects_Phi.RenderTask( + chartobj_phi.RenderTask( func = Task_function_mapping[render_task_data["func_name"]], args = tuple(render_task_data["args"]), kwargs = render_task_data["kwargs"] @@ -845,14 +845,14 @@ def space(): music_play_fcount = int(now_t / frame_time) will_process_extask = [] try: - Task:Chart_Objects_Phi.FrameRenderTask = lfdaot_tasks[music_play_fcount] + Task:chartobj_phi.FrameRenderTask = lfdaot_tasks[music_play_fcount] except KeyError: continue if last_music_play_fcount is not None: for fcount in range(last_music_play_fcount,music_play_fcount): try: - Task:Chart_Objects_Phi.FrameRenderTask = lfdaot_tasks[fcount] + Task:chartobj_phi.FrameRenderTask = lfdaot_tasks[fcount] if Task.ExTask is not None: will_process_extask.append(Task.ExTask) Task.ExTask = None @@ -872,7 +872,7 @@ def space(): will_process_extask.append(Task.ExTask) Task.ExTask = None for ExTask in will_process_extask: - break_flag = Chart_Functions_Phi.FrameData_ProcessExTask( + break_flag = chartfuncs_phi.FrameData_ProcessExTask( ExTask, lambda x: eval(x) ) @@ -899,7 +899,7 @@ def space(): ) if video_fp != "": - root.jsapi.uploadFrame = lambda dataUrl: writer.write(Tool_Functions.DataUrl2MatLike(dataUrl)) + root.jsapi.uploadFrame = lambda dataUrl: writer.write(tool_funcs.DataUrl2MatLike(dataUrl)) for Task in lfdaot_tasks.values(): Task.ExecTask() @@ -958,12 +958,12 @@ def _f(): def loopClick(clientX, clientY): nonlocal a2_loop_clicked - if clientX <= w * Const.FINISH_UI_BUTTON_SIZE and clientY <= w * Const.FINISH_UI_BUTTON_SIZE / 190 * 145: + if clientX <= w * const.FINISH_UI_BUTTON_SIZE and clientY <= w * const.FINISH_UI_BUTTON_SIZE / 190 * 145: a2_loop_clicked = True def continueClick(clientX, clientY): nonlocal a2_continue_clicked - if clientX >= w - w * Const.FINISH_UI_BUTTON_SIZE and clientY >= h - w * Const.FINISH_UI_BUTTON_SIZE / 190 * 145: + if clientX >= w - w * const.FINISH_UI_BUTTON_SIZE and clientY >= h - w * const.FINISH_UI_BUTTON_SIZE / 190 * 145: a2_continue_clicked = True root.jsapi.set_attr("loopClick", loopClick) diff --git a/Phigros_Tips.py b/src/phi_tips.py similarity index 100% rename from Phigros_Tips.py rename to src/phi_tips.py diff --git a/PhiCore.py b/src/phicore.py similarity index 89% rename from PhiCore.py rename to src/phicore.py index 8c9084a..b5cbfc2 100644 --- a/PhiCore.py +++ b/src/phicore.py @@ -10,13 +10,13 @@ from PIL import Image import webcv -import Const -import Tool_Functions +import const +import tool_funcs import rpe_easing -import Chart_Objects_Phi -import Chart_Objects_Rpe -import Chart_Functions_Phi -import Phigros_Tips +import chartobj_phi +import chartobj_rpe +import chartfuncs_phi +import phi_tips @dataclass class PhiCoreConfigure: @@ -26,7 +26,7 @@ class PhiCoreConfigure: w: int h: int chart_information: dict - chart_obj: Chart_Objects_Phi.Phigros_Chart | Chart_Objects_Rpe.Rpe_Chart + chart_obj: chartobj_phi.Phigros_Chart | chartobj_rpe.Rpe_Chart CHART_TYPE: int Resource: dict ClickEffect_Size: float @@ -279,7 +279,7 @@ def getLevelString(self) -> typing.Literal["AP", "FC", "V", "S", "A", "B", "C", elif 1000000 <= score: return "AP" -def process_effect_base(x: float, y: float, p: float, effect_random_blocks, perfect: bool, Task: Chart_Objects_Phi.FrameRenderTask): +def process_effect_base(x: float, y: float, p: float, effect_random_blocks, perfect: bool, Task: chartobj_phi.FrameRenderTask): color = (254, 255, 169) if perfect else (162, 238, 255) imn = f"Note_Click_Effect_{"Perfect" if perfect else "Good"}" if clickeffect_randomblock: @@ -288,7 +288,7 @@ def process_effect_base(x: float, y: float, p: float, effect_random_blocks, perf randomblock_r = ClickEffect_Size * rpe_easing.ease_funcs[17](p) / 1.35 block_size = EFFECT_RANDOM_BLOCK_SIZE * (0.4 * math.sin(p * math.pi) + 0.6) for deg in effect_random_blocks: - effect_random_point = Tool_Functions.rotate_point( + effect_random_point = tool_funcs.rotate_point( x, y, beforedeg + deg, randomblock_r ) @@ -332,9 +332,9 @@ def PlayChart_ThreadFunction(_t: bool = False, _e: TEvent|None = None, _stope: T KeyDownCount = 0 keymap = {chr(i): False for i in range(97, 123)} - notes = [i for line in chart_obj.judgeLineList for i in line.notesAbove + line.notesBelow] if CHART_TYPE == Const.CHART_TYPE.PHI else [i for line in chart_obj.JudgeLineList for i in line.notes if not i.isFake] + notes = [i for line in chart_obj.judgeLineList for i in line.notesAbove + line.notesBelow] if CHART_TYPE == const.CHART_TYPE.PHI else [i for line in chart_obj.JudgeLineList for i in line.notes if not i.isFake] - if CHART_TYPE == Const.CHART_TYPE.PHI: + if CHART_TYPE == const.CHART_TYPE.PHI: def _KeyDown(key: str): nonlocal KeyDownCount key = key.lower() @@ -346,11 +346,11 @@ def _KeyDown(key: str): can_judge_notes = [(i, offset) for i in notes if ( not i.player_clicked and - i.type in (Const.Note.TAP, Const.Note.HOLD) and - abs((offset := (i.time * i.master.T - PlayChart_NowTime))) <= (0.2 if i.type == Const.Note.TAP else 0.16) + i.type in (const.Note.TAP, const.Note.HOLD) and + abs((offset := (i.time * i.master.T - PlayChart_NowTime))) <= (0.2 if i.type == const.Note.TAP else 0.16) )] can_use_safedrag = [(i, offset) for i in notes if ( - i.type == Const.Note.DRAG and + i.type == const.Note.DRAG and not i.player_drag_judge_safe_used and abs((offset := (i.time * i.master.T - PlayChart_NowTime))) <= 0.16 )] @@ -362,15 +362,15 @@ def _KeyDown(key: str): n, offset = can_judge_notes[0] abs_offset = abs(offset) if 0.0 <= abs_offset <= 0.08: - n.state = Const.NOTE_STATE.PERFECT - if n.type == Const.Note.HOLD: + n.state = const.NOTE_STATE.PERFECT + if n.type == const.Note.HOLD: n.player_holdjudged = True n.player_holdclickstate = n.state else: # TAP PhigrosPlayManagerObject.addEvent("P") elif 0.08 < abs_offset <= 0.16: - n.state = Const.NOTE_STATE.GOOD - if n.type == Const.Note.HOLD: + n.state = const.NOTE_STATE.GOOD + if n.type == const.Note.HOLD: n.player_holdjudged = True n.player_holdclickstate = n.state else: # TAP @@ -385,13 +385,13 @@ def _KeyDown(key: str): return n.player_badtime = PlayChart_NowTime - n.state = Const.NOTE_STATE.BAD + n.state = const.NOTE_STATE.BAD PhigrosPlayManagerObject.addEvent("B") - if n.state != Const.NOTE_STATE.MISS: + if n.state != const.NOTE_STATE.MISS: n.player_click_offset = offset n.player_clicked = True - elif CHART_TYPE == Const.CHART_TYPE.RPE: + elif CHART_TYPE == const.CHART_TYPE.RPE: def _KeyDown(key: str): nonlocal KeyDownCount key = key.lower() @@ -403,11 +403,11 @@ def _KeyDown(key: str): can_judge_notes = [(i, offset) for i in notes if ( not i.player_clicked and - i.phitype in (Const.Note.TAP, Const.Note.HOLD) and - abs((offset := (i.secst - PlayChart_NowTime))) <= (0.2 if i.phitype == Const.Note.TAP else 0.16) + i.phitype in (const.Note.TAP, const.Note.HOLD) and + abs((offset := (i.secst - PlayChart_NowTime))) <= (0.2 if i.phitype == const.Note.TAP else 0.16) )] can_use_safedrag = [(i, offset) for i in notes if ( - i.phitype == Const.Note.DRAG and + i.phitype == const.Note.DRAG and not i.player_drag_judge_safe_used and abs((offset := (i.secst - PlayChart_NowTime))) <= 0.16 )] @@ -419,14 +419,14 @@ def _KeyDown(key: str): n, offset = can_judge_notes[0] abs_offset = abs(offset) if 0.0 <= abs_offset <= 0.08: - n.state = Const.NOTE_STATE.PERFECT + n.state = const.NOTE_STATE.PERFECT if n.ishold: n.player_holdjudged = True n.player_holdclickstate = n.state else: # TAP PhigrosPlayManagerObject.addEvent("P") elif 0.08 < abs_offset <= 0.16: - n.state = Const.NOTE_STATE.GOOD + n.state = const.NOTE_STATE.GOOD if n.ishold: n.player_holdjudged = True n.player_holdclickstate = n.state @@ -444,10 +444,10 @@ def _KeyDown(key: str): n.player_badtime = PlayChart_NowTime n.player_badtime_beat = chart_obj.sec2beat(n.player_badtime, n.masterLine.bpmfactor) n.player_badjudge_floorp = n.floorPosition - n.masterLine.playingFloorPosition - n.state = Const.NOTE_STATE.BAD + n.state = const.NOTE_STATE.BAD PhigrosPlayManagerObject.addEvent("B") - if n.state != Const.NOTE_STATE.MISS: + if n.state != const.NOTE_STATE.MISS: n.player_click_offset = offset n.player_clicked = True @@ -470,13 +470,13 @@ def _KeyUp(key:str): keydown = KeyDownCount > 0 for note in notes: - if CHART_TYPE == Const.CHART_TYPE.PHI: + if CHART_TYPE == const.CHART_TYPE.PHI: note_time_sec = note.time * note.master.T if ( # (Drag / Flick) judge keydown and not note.player_clicked and - note.type in (Const.Note.FLICK, Const.Note.DRAG) and + note.type in (const.Note.FLICK, const.Note.DRAG) and abs((cktime := note_time_sec - PlayChart_NowTime)) <= 0.16 # +- 160ms ): note.player_will_click = True @@ -490,13 +490,13 @@ def _KeyUp(key:str): note_time_sec <= PlayChart_NowTime ): note.player_clicked = True - note.state = Const.NOTE_STATE.PERFECT + note.state = const.NOTE_STATE.PERFECT PhigrosPlayManagerObject.addEvent("P") if ( # play click sound note.player_clicked and not note.player_click_sound_played and - note.state in (Const.NOTE_STATE.PERFECT, Const.NOTE_STATE.GOOD) + note.state in (const.NOTE_STATE.PERFECT, const.NOTE_STATE.GOOD) ): if enable_clicksound: Resource["Note_Click_Audio"][note.type_string].play() @@ -512,9 +512,9 @@ def _KeyUp(key:str): if ( # hold judge sustain keydown and - note.type == Const.Note.HOLD and + note.type == const.Note.HOLD and note.player_clicked and - note.state != Const.NOTE_STATE.MISS and + note.state != const.NOTE_STATE.MISS and note.hold_endtime - 0.2 >= PlayChart_NowTime ): note.player_last_testholdismiss_time = time.time() @@ -522,32 +522,32 @@ def _KeyUp(key:str): if ( # hold hold sustain miss judge not keydown and - note.type == Const.Note.HOLD and + note.type == const.Note.HOLD and note.player_clicked and - note.state != Const.NOTE_STATE.MISS and + note.state != const.NOTE_STATE.MISS and note.hold_endtime - 0.2 >= PlayChart_NowTime and note.player_last_testholdismiss_time + 0.16 <= time.time() ): note.player_holdmiss_time = PlayChart_NowTime - note.state = Const.NOTE_STATE.MISS + note.state = const.NOTE_STATE.MISS note.player_missed = True PhigrosPlayManagerObject.addEvent("M") if ( # hold end add event to manager judge - note.type == Const.Note.HOLD and + note.type == const.Note.HOLD and note.player_holdjudged and # if judged is true, hold state is perfect/good/ miss(miss at clicking) not note.player_holdjudged_tomanager and note.player_holdjudge_tomanager_time <= PlayChart_NowTime ): note.player_holdjudged_tomanager = True - if note.state == Const.NOTE_STATE.PERFECT: PhigrosPlayManagerObject.addEvent("P") - elif note.state == Const.NOTE_STATE.GOOD: PhigrosPlayManagerObject.addEvent("G", note.player_click_offset) + if note.state == const.NOTE_STATE.PERFECT: PhigrosPlayManagerObject.addEvent("P") + elif note.state == const.NOTE_STATE.GOOD: PhigrosPlayManagerObject.addEvent("G", note.player_click_offset) else: pass # note state is miss at clicking - elif CHART_TYPE == Const.CHART_TYPE.RPE: + elif CHART_TYPE == const.CHART_TYPE.RPE: if ( # (Drag / Flick) judge keydown and not note.player_clicked and - note.phitype in (Const.Note.FLICK, Const.Note.DRAG) and + note.phitype in (const.Note.FLICK, const.Note.DRAG) and abs((cktime := note.secst - PlayChart_NowTime)) <= 0.16 # +- 160ms ): note.player_will_click = True @@ -561,13 +561,13 @@ def _KeyUp(key:str): note.secst <= PlayChart_NowTime ): note.player_clicked = True - note.state = Const.NOTE_STATE.PERFECT + note.state = const.NOTE_STATE.PERFECT PhigrosPlayManagerObject.addEvent("P") if ( # play click sound note.player_clicked and not note.player_click_sound_played and - note.state in (Const.NOTE_STATE.PERFECT, Const.NOTE_STATE.GOOD) + note.state in (const.NOTE_STATE.PERFECT, const.NOTE_STATE.GOOD) ): if enable_clicksound: Resource["Note_Click_Audio"][note.type_string].play() @@ -586,7 +586,7 @@ def _KeyUp(key:str): keydown and note.ishold and note.player_clicked and - note.state != Const.NOTE_STATE.MISS and + note.state != const.NOTE_STATE.MISS and note.secet - 0.2 >= PlayChart_NowTime ): note.player_last_testholdismiss_time = time.time() @@ -595,12 +595,12 @@ def _KeyUp(key:str): not keydown and note.ishold and note.player_clicked and - note.state != Const.NOTE_STATE.MISS and + note.state != const.NOTE_STATE.MISS and note.secet - 0.2 >= PlayChart_NowTime and note.player_last_testholdismiss_time + 0.16 <= time.time() ): note.player_holdmiss_time = PlayChart_NowTime - note.state = Const.NOTE_STATE.MISS + note.state = const.NOTE_STATE.MISS note.player_missed = True PhigrosPlayManagerObject.addEvent("M") @@ -611,8 +611,8 @@ def _KeyUp(key:str): note.player_holdjudge_tomanager_time <= PlayChart_NowTime ): note.player_holdjudged_tomanager = True - if note.state == Const.NOTE_STATE.PERFECT: PhigrosPlayManagerObject.addEvent("P") - elif note.state == Const.NOTE_STATE.GOOD: PhigrosPlayManagerObject.addEvent("G", note.player_click_offset) + if note.state == const.NOTE_STATE.PERFECT: PhigrosPlayManagerObject.addEvent("P") + elif note.state == const.NOTE_STATE.GOOD: PhigrosPlayManagerObject.addEvent("G", note.player_click_offset) else: pass # note state is miss at clicking if _stope.is_set(): @@ -842,7 +842,7 @@ def draw_ui( lastCallDrawUI = time.time() -def CheckMusicOffsetAndEnd(now_t: float, Task: Chart_Objects_Phi.FrameRenderTask): +def CheckMusicOffsetAndEnd(now_t: float, Task: chartobj_phi.FrameRenderTask): global show_start_time if now_t >= raw_audio_length: @@ -865,7 +865,7 @@ def GetFrameRenderTask_Phi(now_t: float, clear: bool = True, rjc: bool = True): now_t *= speed PlayChart_NowTime = now_t - Task = Chart_Objects_Phi.FrameRenderTask([], []) + Task = chartobj_phi.FrameRenderTask([], []) if clear: Task(root.clear_canvas, wait_execute = True) Task(draw_background) if noplaychart: Task.ExTask.append(("break", )) @@ -884,14 +884,14 @@ def GetFrameRenderTask_Phi(now_t: float, clear: bool = True, rjc: bool = True): for lineIndex, line in enumerate(chart_obj.judgeLineList): lineBTime = now_t / line.T - lineFloorPosition = Chart_Objects_Phi.getFloorPosition(line, lineBTime) * PHIGROS_Y + lineFloorPosition = chartobj_phi.getFloorPosition(line, lineBTime) * PHIGROS_Y linePos = line.get_datavar_move(lineBTime, w, h) lineRotate = line.get_datavar_rotate(lineBTime) lineAlpha = line.get_datavar_disappear(lineBTime) judgeLine_DrawPos = ( - *Tool_Functions.rotate_point(*linePos, -lineRotate, 5.76 * h / 2), - *Tool_Functions.rotate_point(*linePos, -lineRotate + 180, 5.76 * h / 2) + *tool_funcs.rotate_point(*linePos, -lineRotate, 5.76 * h / 2), + *tool_funcs.rotate_point(*linePos, -lineRotate + 180, 5.76 * h / 2) ) judgeLine_color = (*((254, 255, 169) if not noautoplay else PhigrosPlayManagerObject.getJudgelineColor()), lineAlpha if not judgeline_notransparent else 1.0) judgeLine_webCanvas_color = f"rgba{judgeLine_color}" @@ -916,7 +916,7 @@ def GetFrameRenderTask_Phi(now_t: float, clear: bool = True, rjc: bool = True): if debug: Task( root.create_text, - *Tool_Functions.rotate_point(*linePos, 90 - lineRotate - 180, (w + h) / 75), + *tool_funcs.rotate_point(*linePos, 90 - lineRotate - 180, (w + h) / 75), text = f"{lineIndex}", font = f"{(w + h) / 85 / 0.75}px PhigrosFont", textAlign = "center", @@ -943,11 +943,11 @@ def GetFrameRenderTask_Phi(now_t: float, clear: bool = True, rjc: bool = True): add_code_array = True ) - def process(notes_list: typing.List[Chart_Objects_Phi.note], t: typing.Literal[1, -1]): # above => t = 1, below => t = -1 + def process(notes_list: typing.List[chartobj_phi.note], t: typing.Literal[1, -1]): # above => t = 1, below => t = -1 for note_item in notes_list: this_note_sectime = note_item.time * line.T this_noteitem_clicked = this_note_sectime < now_t - this_note_ishold = note_item.type == Const.Note.HOLD + this_note_ishold = note_item.type == const.Note.HOLD if this_noteitem_clicked and not note_item.clicked: note_item.clicked = True @@ -962,32 +962,32 @@ def process(notes_list: typing.List[Chart_Objects_Phi.note], t: typing.Literal[1 continue elif this_note_ishold and now_t > note_item.hold_endtime: continue - elif noautoplay and note_item.state == Const.NOTE_STATE.BAD: + elif noautoplay and note_item.state == const.NOTE_STATE.BAD: continue elif noautoplay and not this_note_ishold and note_item.player_clicked: continue - elif not note_item.clicked and (note_item.floorPosition - lineFloorPosition / PHIGROS_Y) < -0.001 and note_item.type != Const.Note.HOLD: + elif not note_item.clicked and (note_item.floorPosition - lineFloorPosition / PHIGROS_Y) < -0.001 and note_item.type != const.Note.HOLD: continue note_now_floorPosition = note_item.floorPosition * PHIGROS_Y - ( lineFloorPosition if not (this_note_ishold and note_item.clicked) else ( - Chart_Objects_Phi.getFloorPosition( + chartobj_phi.getFloorPosition( line, note_item.time - ) * PHIGROS_Y + Tool_Functions.linear_interpolation(note_item.hold_endtime - now_t, 0, note_item.hold_length_sec, note_item.hold_length_pgry * PHIGROS_Y, 0) + ) * PHIGROS_Y + tool_funcs.linear_interpolation(note_item.hold_endtime - now_t, 0, note_item.hold_length_sec, note_item.hold_length_pgry * PHIGROS_Y, 0) ) ) if note_now_floorPosition > h * 2 and not render_range_more: continue - rotatenote_at_judgeLine_pos = Tool_Functions.rotate_point(*linePos, -lineRotate, note_item.positionX * PHIGROS_X) + rotatenote_at_judgeLine_pos = tool_funcs.rotate_point(*linePos, -lineRotate, note_item.positionX * PHIGROS_X) judgeLine_to_note_rotate_deg = (-90 if t == 1 else 90) - lineRotate - x, y = Tool_Functions.rotate_point(*rotatenote_at_judgeLine_pos, judgeLine_to_note_rotate_deg, note_now_floorPosition) + x, y = tool_funcs.rotate_point(*rotatenote_at_judgeLine_pos, judgeLine_to_note_rotate_deg, note_now_floorPosition) if this_note_ishold: note_hold_draw_length = note_now_floorPosition + note_item.hold_length_pgry * PHIGROS_Y - holdend_x, holdend_y = Tool_Functions.rotate_point(*rotatenote_at_judgeLine_pos, judgeLine_to_note_rotate_deg, note_hold_draw_length) + holdend_x, holdend_y = tool_funcs.rotate_point(*rotatenote_at_judgeLine_pos, judgeLine_to_note_rotate_deg, note_hold_draw_length) if note_item.clicked: holdhead_pos = rotatenote_at_judgeLine_pos @@ -995,27 +995,27 @@ def process(notes_list: typing.List[Chart_Objects_Phi.note], t: typing.Literal[1 holdhead_pos = x, y holdbody_range = ( - Tool_Functions.rotate_point(*holdhead_pos, judgeLine_to_note_rotate_deg - 90, Note_width / 2), - Tool_Functions.rotate_point(holdend_x, holdend_y, judgeLine_to_note_rotate_deg - 90, Note_width / 2), - Tool_Functions.rotate_point(holdend_x, holdend_y, judgeLine_to_note_rotate_deg + 90, Note_width / 2), - Tool_Functions.rotate_point(*holdhead_pos, judgeLine_to_note_rotate_deg + 90, Note_width / 2), + tool_funcs.rotate_point(*holdhead_pos, judgeLine_to_note_rotate_deg - 90, Note_width / 2), + tool_funcs.rotate_point(holdend_x, holdend_y, judgeLine_to_note_rotate_deg - 90, Note_width / 2), + tool_funcs.rotate_point(holdend_x, holdend_y, judgeLine_to_note_rotate_deg + 90, Note_width / 2), + tool_funcs.rotate_point(*holdhead_pos, judgeLine_to_note_rotate_deg + 90, Note_width / 2), ) if not render_range_more: note_iscan_render = ( - Tool_Functions.Note_CanRender(w, h, note_max_size_half, x, y) + tool_funcs.Note_CanRender(w, h, note_max_size_half, x, y) if not this_note_ishold - else Tool_Functions.Note_CanRender(w, h, note_max_size_half, x, y, holdbody_range) + else tool_funcs.Note_CanRender(w, h, note_max_size_half, x, y, holdbody_range) ) else: note_iscan_render = ( - Tool_Functions.Note_CanRender( + tool_funcs.Note_CanRender( w, h, note_max_size_half, x / render_range_more_scale + fr_x, y / render_range_more_scale + fr_y ) if not this_note_ishold - else Tool_Functions.Note_CanRender( + else tool_funcs.Note_CanRender( w, h, note_max_size_half, x / render_range_more_scale + fr_x, y / render_range_more_scale + fr_y,[ @@ -1045,7 +1045,7 @@ def process(notes_list: typing.List[Chart_Objects_Phi.note], t: typing.Literal[1 this_note_img_end = Resource["Notes"][this_note_img_end_keyname] this_note_imgname_end = f"Note_{this_note_img_end_keyname}" - fix_scale = Const.NOTE_DUB_FIXSCALE if note_item.morebets else 1.0 # because the note img if has morebets frame, the note will be look small, so we will `*` a fix scale to fix the frame size make the note look is small. + fix_scale = const.NOTE_DUB_FIXSCALE if note_item.morebets else 1.0 # because the note img if has morebets frame, the note will be look small, so we will `*` a fix scale to fix the frame size make the note look is small. this_note_width = Note_width * fix_scale this_note_height = Note_width / this_note_img.width * this_note_img.height @@ -1056,7 +1056,7 @@ def process(notes_list: typing.List[Chart_Objects_Phi.note], t: typing.Literal[1 holdbody_x,holdbody_y = rotatenote_at_judgeLine_pos holdbody_length = note_hold_draw_length - this_noteend_height / 2 else: - holdbody_x,holdbody_y = Tool_Functions.rotate_point( + holdbody_x,holdbody_y = tool_funcs.rotate_point( *holdhead_pos, judgeLine_to_note_rotate_deg, this_note_height / 2 ) holdbody_length = note_item.hold_length_pgry * PHIGROS_Y - (this_note_height + this_noteend_height) / 2 @@ -1115,7 +1115,7 @@ def process(notes_list: typing.List[Chart_Objects_Phi.note], t: typing.Literal[1 bad_effect_time = 0.5 def process_effect( - note: Chart_Objects_Phi.note, + note: chartobj_phi.note, t: float, effect_random_blocks, perfect: bool @@ -1124,23 +1124,23 @@ def process_effect( if not (0.0 <= p <= 1.0): return will_show_effect_pos = line.get_datavar_move(t, w, h) will_show_effect_rotate = line.get_datavar_rotate(t) - pos = Tool_Functions.rotate_point(*will_show_effect_pos, -will_show_effect_rotate, note.positionX * PHIGROS_X) + pos = tool_funcs.rotate_point(*will_show_effect_pos, -will_show_effect_rotate, note.positionX * PHIGROS_X) process_effect_base(*pos, p, effect_random_blocks, perfect, Task) def process_miss( - note:Chart_Objects_Phi.note + note:chartobj_phi.note ): t = now_t / note.master.T p = (now_t - note.time * note.master.T) / miss_effect_time will_show_effect_pos = line.get_datavar_move(t, w, h) will_show_effect_rotate = line.get_datavar_rotate(t) - pos = Tool_Functions.rotate_point( + pos = tool_funcs.rotate_point( *will_show_effect_pos, -will_show_effect_rotate, note.positionX * PHIGROS_X ) - floorp = note.floorPosition - Chart_Objects_Phi.getFloorPosition(note.master, t) - x,y = Tool_Functions.rotate_point( + floorp = note.floorPosition - chartobj_phi.getFloorPosition(note.master, t) + x,y = tool_funcs.rotate_point( *pos, (-90 if note.above else 90) - will_show_effect_rotate, floorp * PHIGROS_Y @@ -1163,19 +1163,19 @@ def process_miss( ) def process_bad( - note:Chart_Objects_Phi.note + note:chartobj_phi.note ): t = note.player_badtime / note.master.T p = (now_t - note.player_badtime) / bad_effect_time will_show_effect_pos = line.get_datavar_move(t, w, h) will_show_effect_rotate = line.get_datavar_rotate(t) - pos = Tool_Functions.rotate_point( + pos = tool_funcs.rotate_point( *will_show_effect_pos, -will_show_effect_rotate, note.positionX * PHIGROS_X ) - floorp = note.floorPosition - Chart_Objects_Phi.getFloorPosition(note.master, t) - x,y = Tool_Functions.rotate_point( + floorp = note.floorPosition - chartobj_phi.getFloorPosition(note.master, t) + x,y = tool_funcs.rotate_point( *pos, (-90 if note.above else 90) - will_show_effect_rotate, floorp * PHIGROS_Y @@ -1187,7 +1187,7 @@ def process_bad( {root.get_img_jsvarname("Note_Bad")},\ {x},\ {y},\ - {Note_width * (Const.NOTE_DUB_FIXSCALE if note.morebets else 1.0)},\ + {Note_width * (const.NOTE_DUB_FIXSCALE if note.morebets else 1.0)},\ {Note_width / this_note_img.width * this_note_img.height},\ {- will_show_effect_rotate},\ {1 - p ** 3}\ @@ -1205,7 +1205,7 @@ def process_bad( for line in chart_obj.judgeLineList: for note in line.notesAbove + line.notesBelow: note_time = note.time * line.T - note_ishold = note.type == Const.Note.HOLD + note_ishold = note.type == const.Note.HOLD if not note_ishold and note.show_effected: continue @@ -1232,25 +1232,25 @@ def process_bad( True ) else: # noautoplay - if note.player_holdjudged or (note.state == Const.NOTE_STATE.PERFECT or note.state == Const.NOTE_STATE.GOOD and note.player_clicked): + if note.player_holdjudged or (note.state == const.NOTE_STATE.PERFECT or note.state == const.NOTE_STATE.GOOD and note.player_clicked): if note_time - note.player_click_offset <= now_t: if now_t - (note_time - note.player_click_offset) <= effect_time: process_effect( note, note.time - note.player_click_offset / note.master.T, note.effect_random_blocks, - note.state == Const.NOTE_STATE.PERFECT if note.type != Const.Note.HOLD else note.player_holdclickstate == Const.NOTE_STATE.PERFECT + note.state == const.NOTE_STATE.PERFECT if note.type != const.Note.HOLD else note.player_holdclickstate == const.NOTE_STATE.PERFECT ) else: note.show_effected = True - elif note.state == Const.NOTE_STATE.MISS: - if 0.0 <= now_t - note_time <= miss_effect_time and note.type != Const.Note.HOLD: + elif note.state == const.NOTE_STATE.MISS: + if 0.0 <= now_t - note_time <= miss_effect_time and note.type != const.Note.HOLD: process_miss(note) - elif note.state == Const.NOTE_STATE.BAD: + elif note.state == const.NOTE_STATE.BAD: if 0.0 <= now_t - note.player_badtime <= bad_effect_time: process_bad(note) - if note_ishold and note.player_holdjudged and note.player_holdclickstate != Const.NOTE_STATE.MISS: + if note_ishold and note.player_holdjudged and note.player_holdclickstate != const.NOTE_STATE.MISS: efct_et = note.player_holdmiss_time + effect_time if efct_et >= now_t: for temp_time, hold_effect_random_blocks in note.effect_times: @@ -1261,7 +1261,7 @@ def process_bad( note, temp_time / line.T, hold_effect_random_blocks, - note.player_holdclickstate == Const.NOTE_STATE.PERFECT + note.player_holdclickstate == const.NOTE_STATE.PERFECT ) if render_range_more: @@ -1288,7 +1288,7 @@ def process_bad( ] Task( root.run_js_code, - f"ctx.lineWidth = {JUDGELINE_WIDTH / render_range_more_scale}; ctx.strokeStyle = \"{Const.RENDER_RANGE_MORE_FRAME_LINE_COLOR}\"; ctx.beginPath(); ctx.moveTo({fr_x},{fr_y});", + f"ctx.lineWidth = {JUDGELINE_WIDTH / render_range_more_scale}; ctx.strokeStyle = \"{const.RENDER_RANGE_MORE_FRAME_LINE_COLOR}\"; ctx.beginPath(); ctx.moveTo({fr_x},{fr_y});", add_code_array = True ) for line_pos in line_poses: @@ -1303,7 +1303,7 @@ def process_bad( add_code_array = True ) - combo = Chart_Functions_Phi.Cal_Combo(now_t, chart_obj) if not noautoplay else PhigrosPlayManagerObject.getCombo() + combo = chartfuncs_phi.Cal_Combo(now_t, chart_obj) if not noautoplay else PhigrosPlayManagerObject.getCombo() now_t /= speed Task( draw_ui, @@ -1324,7 +1324,7 @@ def GetFrameRenderTask_Rpe(now_t:float, clear: bool = True, rjc: bool = True): global PlayChart_NowTime now_t *= speed - Task = Chart_Objects_Phi.FrameRenderTask([], []) + Task = chartobj_phi.FrameRenderTask([], []) if clear: Task(root.clear_canvas, wait_execute = True) Task(draw_background) PlayChart_NowTime = now_t @@ -1339,8 +1339,8 @@ def GetFrameRenderTask_Rpe(now_t:float, clear: bool = True, rjc: bool = True): if judgeline_notransparent: lineAlpha = 1.0 linePos = (linePos[0] * w, linePos[1] * h) judgeLine_DrawPos = ( - *Tool_Functions.rotate_point(*linePos, lineRotate, w * 4000 / 1350 * lineScaleX / 2), - *Tool_Functions.rotate_point(*linePos, lineRotate + 180, w * 4000 / 1350 * lineScaleX / 2) + *tool_funcs.rotate_point(*linePos, lineRotate, w * 4000 / 1350 * lineScaleX / 2), + *tool_funcs.rotate_point(*linePos, lineRotate + 180, w * 4000 / 1350 * lineScaleX / 2) ) negative_alpha = lineAlpha < 0.0 judgeLine_webCanvas_color = f"rgba{lineColor + (lineAlpha, )}" @@ -1348,7 +1348,7 @@ def GetFrameRenderTask_Rpe(now_t:float, clear: bool = True, rjc: bool = True): _, texture_size = chart_res[line.Texture] texture_width = texture_size[0] / 1104 * w * 0.75 * lineScaleX texture_height = texture_size[1] / 621 * h * 0.75 * lineScaleY - if Tool_Functions.TextureLine_CanRender(w, h, (texture_width ** 2 + texture_height ** 2) ** 0.5 / 2, *linePos): + if tool_funcs.TextureLine_CanRender(w, h, (texture_width ** 2 + texture_height ** 2) ** 0.5 / 2, *linePos): Task( root.run_js_code, f"{f"setTextureLineColorFilterColorMatrixValueByRgbValue{tuple(map(lambda x: x / 255, lineColor))}; ctx.filter = 'url(#textureLineColorFilter)'; " if lineColor != (255, 255, 255) else ""}ctx.drawRotateImage(\ @@ -1398,10 +1398,10 @@ def GetFrameRenderTask_Rpe(now_t:float, clear: bool = True, rjc: bool = True): add_code_array = True ) - if debug and line.attachUI is None and Tool_Functions.point_in_screen(linePos, w, h) and lineAlpha > 0.0: + if debug and line.attachUI is None and tool_funcs.point_in_screen(linePos, w, h) and lineAlpha > 0.0: Task( root.create_text, - *Tool_Functions.rotate_point(*linePos, 90 + lineRotate - 180, (w + h) / 75), + *tool_funcs.rotate_point(*linePos, 90 + lineRotate - 180, (w + h) / 75), text = f"{line_index}", font = f"{(w + h) / 85 / 0.75}px PhigrosFont", textAlign = "center", @@ -1438,7 +1438,7 @@ def GetFrameRenderTask_Rpe(now_t:float, clear: bool = True, rjc: bool = True): continue elif note.ishold and beatTime > note.endTime.value: continue - elif noautoplay and note.state == Const.NOTE_STATE.BAD: + elif noautoplay and note.state == const.NOTE_STATE.BAD: continue elif noautoplay and not note.ishold and note.player_clicked: continue @@ -1447,18 +1447,18 @@ def GetFrameRenderTask_Rpe(now_t:float, clear: bool = True, rjc: bool = True): if noteFloorPosition < 0 and not note.clicked: continue - noteAtJudgeLinePos = Tool_Functions.rotate_point( + noteAtJudgeLinePos = tool_funcs.rotate_point( *linePos, lineRotate, note.positionX2 * w ) lineToNoteRotate = (-90 if note.above == 1 else 90) + lineRotate - x, y = Tool_Functions.rotate_point( + x, y = tool_funcs.rotate_point( *noteAtJudgeLinePos, lineToNoteRotate, noteFloorPosition ) if note.ishold: holdLength = note.holdLength * h noteHoldDrawLength = noteFloorPosition + holdLength - holdend_x, holdend_y = Tool_Functions.rotate_point( + holdend_x, holdend_y = tool_funcs.rotate_point( *noteAtJudgeLinePos, lineToNoteRotate, noteHoldDrawLength ) if note.clicked: @@ -1466,16 +1466,16 @@ def GetFrameRenderTask_Rpe(now_t:float, clear: bool = True, rjc: bool = True): else: holdhead_pos = x, y holdbody_range = ( - Tool_Functions.rotate_point(*holdhead_pos, lineToNoteRotate - 90, Note_width / 2), - Tool_Functions.rotate_point(holdend_x, holdend_y, lineToNoteRotate - 90, Note_width / 2), - Tool_Functions.rotate_point(holdend_x, holdend_y, lineToNoteRotate + 90, Note_width / 2), - Tool_Functions.rotate_point(*holdhead_pos, lineToNoteRotate + 90, Note_width / 2), + tool_funcs.rotate_point(*holdhead_pos, lineToNoteRotate - 90, Note_width / 2), + tool_funcs.rotate_point(holdend_x, holdend_y, lineToNoteRotate - 90, Note_width / 2), + tool_funcs.rotate_point(holdend_x, holdend_y, lineToNoteRotate + 90, Note_width / 2), + tool_funcs.rotate_point(*holdhead_pos, lineToNoteRotate + 90, Note_width / 2), ) canRender = ( - Tool_Functions.Note_CanRender(w, h, note_max_size_half, x, y) + tool_funcs.Note_CanRender(w, h, note_max_size_half, x, y) if not note.ishold - else Tool_Functions.Note_CanRender(w, h, note_max_size_half, x, y, holdbody_range) + else tool_funcs.Note_CanRender(w, h, note_max_size_half, x, y, holdbody_range) ) and not negative_alpha and now_t >= 0.0 if canRender and abs(now_t - note.secst) <= note.visibleTime: @@ -1497,7 +1497,7 @@ def GetFrameRenderTask_Rpe(now_t:float, clear: bool = True, rjc: bool = True): this_note_img_end = Resource["Notes"][this_note_img_end_keyname] this_note_imgname_end = f"Note_{this_note_img_end_keyname}" - fix_scale = Const.NOTE_DUB_FIXSCALE if note.morebets else 1.0 + fix_scale = const.NOTE_DUB_FIXSCALE if note.morebets else 1.0 this_note_width = Note_width * fix_scale this_note_height = Note_width / this_note_img.width * this_note_img.height @@ -1508,7 +1508,7 @@ def GetFrameRenderTask_Rpe(now_t:float, clear: bool = True, rjc: bool = True): holdbody_x, holdbody_y = noteAtJudgeLinePos holdbody_length = noteHoldDrawLength - this_noteend_height / 2 else: - holdbody_x, holdbody_y = Tool_Functions.rotate_point( + holdbody_x, holdbody_y = tool_funcs.rotate_point( *holdhead_pos, lineToNoteRotate, this_note_height / 2 ) holdbody_length = holdLength - (this_note_height + this_noteend_height) / 2 @@ -1567,16 +1567,16 @@ def GetFrameRenderTask_Rpe(now_t:float, clear: bool = True, rjc: bool = True): bad_effect_time = 0.5 def process_effect( - note: Chart_Objects_Rpe.Note, + note: chartobj_rpe.Note, t: float, effect_random_blocks, perfect: bool ): p = (now_t - chart_obj.beat2sec(t, note.masterLine.bpmfactor)) / effect_time if not (0.0 <= p <= 1.0): return - linePos = Tool_Functions.conrpepos(*line.GetPos(t, chart_obj)); linePos = (linePos[0] * w, linePos[1] * h) + linePos = tool_funcs.conrpepos(*line.GetPos(t, chart_obj)); linePos = (linePos[0] * w, linePos[1] * h) lineRotate = sum([line.GetEventValue(t, layer.rotateEvents, 0.0) for layer in line.eventLayers]) - pos = Tool_Functions.rotate_point( + pos = tool_funcs.rotate_point( *linePos, lineRotate, note.positionX2 * w @@ -1584,19 +1584,19 @@ def process_effect( process_effect_base(*pos, p, effect_random_blocks, perfect, Task) def process_miss( - note:Chart_Objects_Rpe.Note + note:chartobj_rpe.Note ): t = chart_obj.sec2beat(now_t, note.masterLine.bpmfactor) p = (now_t - note.secst) / miss_effect_time - linePos = Tool_Functions.conrpepos(*line.GetPos(t, chart_obj)); linePos = (linePos[0] * w, linePos[1] * h) + linePos = tool_funcs.conrpepos(*line.GetPos(t, chart_obj)); linePos = (linePos[0] * w, linePos[1] * h) lineRotate = sum([line.GetEventValue(t, layer.rotateEvents, 0.0) for layer in line.eventLayers]) - pos = Tool_Functions.rotate_point( + pos = tool_funcs.rotate_point( *linePos, lineRotate, note.positionX2 * w ) floorp = note.floorPosition - line.playingFloorPosition - x, y = Tool_Functions.rotate_point( + x, y = tool_funcs.rotate_point( *pos, (-90 if note.above == 1 else 90) + lineRotate, floorp * h @@ -1619,18 +1619,18 @@ def process_miss( ) def process_bad( - note:Chart_Objects_Rpe.Note + note:chartobj_rpe.Note ): t = note.player_badtime_beat p = (now_t - note.player_badtime) / bad_effect_time - linePos = Tool_Functions.conrpepos(*line.GetPos(t, chart_obj)); linePos = (linePos[0] * w, linePos[1] * h) + linePos = tool_funcs.conrpepos(*line.GetPos(t, chart_obj)); linePos = (linePos[0] * w, linePos[1] * h) lineRotate = sum([line.GetEventValue(t, layer.rotateEvents, 0.0) for layer in line.eventLayers]) - pos = Tool_Functions.rotate_point( + pos = tool_funcs.rotate_point( *linePos, lineRotate, note.positionX2 * w ) - x, y = Tool_Functions.rotate_point( + x, y = tool_funcs.rotate_point( *pos, (-90 if note.above == 1 else 90) + lineRotate, note.player_badjudge_floorp * h @@ -1642,7 +1642,7 @@ def process_bad( {root.get_img_jsvarname("Note_Bad")},\ {x},\ {y},\ - {Note_width * note.width * (Const.NOTE_DUB_FIXSCALE if note.morebets else 1.0)},\ + {Note_width * note.width * (const.NOTE_DUB_FIXSCALE if note.morebets else 1.0)},\ {Note_width / this_note_img.width * this_note_img.height},\ {lineRotate},\ {note.float_alpha * (1 - p ** 3)}\ @@ -1682,25 +1682,25 @@ def process_bad( True ) else: # noautoplay - if note.player_holdjudged or (note.state == Const.NOTE_STATE.PERFECT or note.state == Const.NOTE_STATE.GOOD and note.player_clicked): + if note.player_holdjudged or (note.state == const.NOTE_STATE.PERFECT or note.state == const.NOTE_STATE.GOOD and note.player_clicked): if note.secst - note.player_click_offset <= now_t: if now_t - (note.secst - note.player_click_offset) <= effect_time: process_effect( note, chart_obj.sec2beat(note.secst - note.player_click_offset, note.masterLine.bpmfactor), note.effect_random_blocks, - note.state == Const.NOTE_STATE.PERFECT if not note.ishold else note.player_holdclickstate == Const.NOTE_STATE.PERFECT + note.state == const.NOTE_STATE.PERFECT if not note.ishold else note.player_holdclickstate == const.NOTE_STATE.PERFECT ) else: note.show_effected = True - elif note.state == Const.NOTE_STATE.MISS: + elif note.state == const.NOTE_STATE.MISS: if 0.0 <= now_t - note.secst <= miss_effect_time and not note.ishold: process_miss(note) - elif note.state == Const.NOTE_STATE.BAD: + elif note.state == const.NOTE_STATE.BAD: if 0.0 <= now_t - note.player_badtime <= bad_effect_time: process_bad(note) - if note.ishold and note.player_holdjudged and note.player_holdclickstate != Const.NOTE_STATE.MISS: + if note.ishold and note.player_holdjudged and note.player_holdclickstate != const.NOTE_STATE.MISS: efct_et = note.player_holdmiss_time + effect_time if efct_et >= now_t: for temp_time, hold_effect_random_blocks in note.effect_times: @@ -1711,7 +1711,7 @@ def process_bad( note, chart_obj.sec2beat(temp_time, note.masterLine.bpmfactor), hold_effect_random_blocks, - note.player_holdclickstate == Const.NOTE_STATE.PERFECT + note.player_holdclickstate == const.NOTE_STATE.PERFECT ) combo = len([i for line in chart_obj.JudgeLineList for i in line.notes if not i.isFake and ((not i.ishold and i.clicked) or (i.ishold and i.secet - 0.2 < now_t))]) if not noautoplay else PhigrosPlayManagerObject.getCombo() @@ -1746,14 +1746,14 @@ def Get_LevelNumber() -> str: def Get_LevelText() -> str: return chart_information["Level"].split(" ")[0] -def BeginLoadingAnimation(p: float, clear: bool = True, fcb: typing.Callable[[], typing.Any] = lambda: None) -> Chart_Objects_Phi.FrameRenderTask: - Task = Chart_Objects_Phi.FrameRenderTask([], []) +def BeginLoadingAnimation(p: float, clear: bool = True, fcb: typing.Callable[[], typing.Any] = lambda: None) -> chartobj_phi.FrameRenderTask: + Task = chartobj_phi.FrameRenderTask([], []) if clear: Task(root.clear_canvas, wait_execute = True) - all_ease_value = Tool_Functions.begin_animation_eases.im_ease(p) - background_ease_value = Tool_Functions.begin_animation_eases.background_ease(p) * 1.25 - info_data_ease_value = Tool_Functions.begin_animation_eases.info_data_ease((p - 0.2) * 3.25) - info_data_ease_value_2 = Tool_Functions.begin_animation_eases.info_data_ease((p - 0.275) * 3.25) + all_ease_value = tool_funcs.begin_animation_eases.im_ease(p) + background_ease_value = tool_funcs.begin_animation_eases.background_ease(p) * 1.25 + info_data_ease_value = tool_funcs.begin_animation_eases.info_data_ease((p - 0.2) * 3.25) + info_data_ease_value_2 = tool_funcs.begin_animation_eases.info_data_ease((p - 0.275) * 3.25) im_size = 1 / 2.5 Task(draw_background) @@ -1860,7 +1860,7 @@ def BeginLoadingAnimation(p: float, clear: bool = True, fcb: typing.Callable[[], text = f"Tip: {tip}", font = f"{tip_font_size}px PhigrosFont", textBaseline = "bottom", - fillStyle = f"rgba(255, 255, 255, {Tool_Functions.begin_animation_eases.tip_alpha_ease(p)})", + fillStyle = f"rgba(255, 255, 255, {tool_funcs.begin_animation_eases.tip_alpha_ease(p)})", wait_execute = True ) @@ -1926,8 +1926,8 @@ def BeginLoadingAnimation(p: float, clear: bool = True, fcb: typing.Callable[[], Task(root.run_js_wait_code) return Task -def BeginJudgeLineAnimation(p: float) -> Chart_Objects_Phi.FrameRenderTask: - Task = Chart_Objects_Phi.FrameRenderTask([], []) +def BeginJudgeLineAnimation(p: float) -> chartobj_phi.FrameRenderTask: + Task = chartobj_phi.FrameRenderTask([], []) val = rpe_easing.ease_funcs[12](p) Task( draw_ui, @@ -1938,7 +1938,7 @@ def BeginJudgeLineAnimation(p: float) -> Chart_Objects_Phi.FrameRenderTask: root.create_line, w / 2 - (val * w / 2), h / 2, w / 2 + (val * w / 2), h / 2, - strokeStyle = Const.JUDGELINE_PERFECT_COLOR, + strokeStyle = const.JUDGELINE_PERFECT_COLOR, lineWidth = JUDGELINE_WIDTH / render_range_more_scale if render_range_more else JUDGELINE_WIDTH, wait_execute = True ) @@ -1962,7 +1962,7 @@ def Begin_Animation(clear: bool = True, fcb: typing.Callable[[], typing.Any] = l chart_charter_text_width_1px = root.run_js_code(f"ctx.font='50px PhigrosFont'; ctx.measureText({root.process_code_string_syntax_tocode(chart_charter_text)}).width;") / 50 chart_illustrator_text = chart_information["Illustrator"] chart_illustrator_text_width_1px = root.run_js_code(f"ctx.font='50px PhigrosFont'; ctx.measureText({root.process_code_string_syntax_tocode(chart_illustrator_text)}).width;") / 50 - tip = Phigros_Tips.get_tip() + tip = phi_tips.get_tip() tip_font_size = w * 0.020833 / 1.25 infoframe_x = w * 0.095 infoframe_y = h * 0.47 @@ -2063,18 +2063,18 @@ def initFinishAnimation(): def Chart_Finish_Animation_Frame(p: float, rjc: bool = True): root.clear_canvas(wait_execute = True) - im_ease_value = Tool_Functions.finish_animation_eases.all_ease(p) + im_ease_value = tool_funcs.finish_animation_eases.all_ease(p) im_ease_pos = w * 1.25 * (1 - im_ease_value) - data_block_1_ease_value = Tool_Functions.finish_animation_eases.all_ease(p - 0.015) + data_block_1_ease_value = tool_funcs.finish_animation_eases.all_ease(p - 0.015) data_block_1_ease_pos = w * 1.25 * (1 - data_block_1_ease_value) - data_block_2_ease_value = Tool_Functions.finish_animation_eases.all_ease(p - 0.035) + data_block_2_ease_value = tool_funcs.finish_animation_eases.all_ease(p - 0.035) data_block_2_ease_pos = w * 1.25 * (1 - data_block_2_ease_value) - data_block_3_ease_value = Tool_Functions.finish_animation_eases.all_ease(p - 0.055) + data_block_3_ease_value = tool_funcs.finish_animation_eases.all_ease(p - 0.055) data_block_3_ease_pos = w * 1.25 * (1 - data_block_3_ease_value) - button_ease_value = Tool_Functions.finish_animation_eases.button_ease(p * 4.5 - 0.95) + button_ease_value = tool_funcs.finish_animation_eases.button_ease(p * 4.5 - 0.95) level_size = 0.125 - level_size *= Tool_Functions.finish_animation_eases.level_size_ease(p) - button_ease_pos = - w * Const.FINISH_UI_BUTTON_SIZE * (1 - button_ease_value) + level_size *= tool_funcs.finish_animation_eases.level_size_ease(p) + button_ease_pos = - w * const.FINISH_UI_BUTTON_SIZE * (1 - button_ease_value) draw_background() @@ -2154,12 +2154,12 @@ def Chart_Finish_Animation_Frame(p: float, rjc: bool = True): h * 0.433, text = ScoreString, font = f"{(w + h) / 42}px PhigrosFont", - fillStyle = f"rgba(255, 255, 255, {Tool_Functions.finish_animation_eases.score_alpha_ease(p)})", + fillStyle = f"rgba(255, 255, 255, {tool_funcs.finish_animation_eases.score_alpha_ease(p)})", wait_execute = True ) root.run_js_code( - f"ctx.globalAlpha = {Tool_Functions.finish_animation_eases.level_alpha_ease(p)};", + f"ctx.globalAlpha = {tool_funcs.finish_animation_eases.level_alpha_ease(p)};", add_code_array = True ) @@ -2178,7 +2178,7 @@ def Chart_Finish_Animation_Frame(p: float, rjc: bool = True): ) root.run_js_code( - f"ctx.globalAlpha = {Tool_Functions.finish_animation_eases.playdata_alpha_ease(p - 0.02)}", + f"ctx.globalAlpha = {tool_funcs.finish_animation_eases.playdata_alpha_ease(p - 0.02)}", add_code_array = True ) @@ -2221,7 +2221,7 @@ def Chart_Finish_Animation_Frame(p: float, rjc: bool = True): ) root.run_js_code( - f"ctx.globalAlpha = {Tool_Functions.finish_animation_eases.playdata_alpha_ease(p - 0.04)}", + f"ctx.globalAlpha = {tool_funcs.finish_animation_eases.playdata_alpha_ease(p - 0.04)}", add_code_array = True ) @@ -2354,8 +2354,8 @@ def Chart_Finish_Animation_Frame(p: float, rjc: bool = True): add_code_array = True ) - Retry_Button_Width = w * Const.FINISH_UI_BUTTON_SIZE - Retry_Button_Height = w * Const.FINISH_UI_BUTTON_SIZE / 190 * 145 + Retry_Button_Width = w * const.FINISH_UI_BUTTON_SIZE + Retry_Button_Height = w * const.FINISH_UI_BUTTON_SIZE / 190 * 145 Retry_imsize = Retry_Button_Height * 0.3 Continue_Button_Width, Continue_Button_Height = Retry_Button_Width, Retry_Button_Height @@ -2371,7 +2371,7 @@ def Chart_Finish_Animation_Frame(p: float, rjc: bool = True): root.create_image( "Retry", - button_ease_pos + w * Const.FINISH_UI_BUTTON_SIZE * 0.3 - Retry_imsize / 2, + button_ease_pos + w * const.FINISH_UI_BUTTON_SIZE * 0.3 - Retry_imsize / 2, Retry_Button_Height / 2 - (Retry_Button_Height * (8 / 145)) - Retry_imsize / 2, width = Retry_imsize, height = Retry_imsize, @@ -2388,7 +2388,7 @@ def Chart_Finish_Animation_Frame(p: float, rjc: bool = True): root.create_image( "Arrow_Right", - w - (button_ease_pos + w * Const.FINISH_UI_BUTTON_SIZE * 0.35 + Continue_imsize / 2), + w - (button_ease_pos + w * const.FINISH_UI_BUTTON_SIZE * 0.35 + Continue_imsize / 2), h - (Continue_Button_Height / 2 - (Continue_Button_Height * (8 / 145)) * 1.15 + Continue_imsize / 2), width = Continue_imsize, height = Continue_imsize, diff --git a/PhigrosGameObject.py b/src/phigame_obj.py similarity index 86% rename from PhigrosGameObject.py rename to src/phigame_obj.py index 66e1c7a..a9e7599 100644 --- a/PhigrosGameObject.py +++ b/src/phigame_obj.py @@ -8,8 +8,8 @@ from PIL import Image -import Tool_Functions -import Const +import tool_funcs +import const import rpe_easing @dataclass @@ -46,7 +46,7 @@ def __init__(self) -> None: self.releaseEvents: list[ReleaseEvent] = [] def _callClickCallback(self, e: ClickEvent, x: int, y: int) -> None: - if Tool_Functions.InRect(x, y, e.rect): + if tool_funcs.InRect(x, y, e.rect): e.callback(x, y) if e.once: self.unregEvent(e) @@ -105,7 +105,7 @@ def main(self): self.faculas.remove(facula) def getFaculaState(self, facula: dict) -> dict: - p = (time.time() - facula["startTime"]) / (facula["endTime"] - facula["startTime"]) # cannot use Tool_Functions.linear_interpolation, it will return 0.0, i tkink is jit bug?. or f32 precision problem? + p = (time.time() - facula["startTime"]) / (facula["endTime"] - facula["startTime"]) # cannot use tool_funcs.linear_interpolation, it will return 0.0, i tkink is jit bug?. or f32 precision problem? if p <= 0.2: ep = 1.0 - (1.0 - (p / 0.2)) ** 2 elif p <= 0.8: @@ -183,8 +183,8 @@ class Setting: @dataclass class SettingState: - aFrom: int = Const.PHIGROS_SETTING_STATE.PLAY - aTo: int = Const.PHIGROS_SETTING_STATE.PLAY + aFrom: int = const.PHIGROS_SETTING_STATE.PLAY + aTo: int = const.PHIGROS_SETTING_STATE.PLAY aSTime: float = float("-inf") def __post_init__(self): @@ -193,38 +193,38 @@ def __post_init__(self): self.atime = 0.65 def getBarWidth(self): - sv = Const.PHIGROS_SETTING_BAR_WIDTH_MAP[self.aFrom] - ev = Const.PHIGROS_SETTING_BAR_WIDTH_MAP[self.aTo] + sv = const.PHIGROS_SETTING_BAR_WIDTH_MAP[self.aFrom] + ev = const.PHIGROS_SETTING_BAR_WIDTH_MAP[self.aTo] if self.aSTime == float("-inf"): return ev st = self.aSTime et = self.aSTime + self.atime p = (time.time() - st) / (et - st) - p = Tool_Functions.fixOutofRangeP(p) + p = tool_funcs.fixOutofRangeP(p) p = self._ease_slow(p) return p * (ev - sv) + sv def getLabelWidth(self): - sv = Const.PHIGROS_SETTING_LABEL_WIDTH_MAP[self.aFrom] - ev = Const.PHIGROS_SETTING_LABEL_WIDTH_MAP[self.aTo] + sv = const.PHIGROS_SETTING_LABEL_WIDTH_MAP[self.aFrom] + ev = const.PHIGROS_SETTING_LABEL_WIDTH_MAP[self.aTo] if self.aSTime == float("-inf"): return ev st = self.aSTime et = self.aSTime + self.atime p = (time.time() - st) / (et - st) - p = Tool_Functions.fixOutofRangeP(p) + p = tool_funcs.fixOutofRangeP(p) p = self._ease_fast(p) return p * (ev - sv) + sv def getLabelX(self): - sv = Const.PHIGROS_SETTING_LABEL_X_MAP[self.aFrom] - ev = Const.PHIGROS_SETTING_LABEL_X_MAP[self.aTo] + sv = const.PHIGROS_SETTING_LABEL_X_MAP[self.aFrom] + ev = const.PHIGROS_SETTING_LABEL_X_MAP[self.aTo] if self.aSTime == float("-inf"): return ev st = self.aSTime et = self.aSTime + self.atime p = (time.time() - st) / (et - st) - p = Tool_Functions.fixOutofRangeP(p) + p = tool_funcs.fixOutofRangeP(p) p = self._ease_slow(p) return p * (ev - sv) + sv @@ -243,7 +243,7 @@ def getTextColor(self, t: int): st = self.aSTime et = self.aSTime + self.atime p = (time.time() - st) / (et - st) - p = Tool_Functions.fixOutofRangeP(p) + p = tool_funcs.fixOutofRangeP(p) # 这里奇怪的算法: 为了视觉上好看和还原一点 absv = abs(self.aFrom - self.aTo) if self.aFrom != self.aTo else 1.0 @@ -265,20 +265,20 @@ def getTextScale(self, t: int): st = self.aSTime et = self.aSTime + self.atime p = (time.time() - st) / (et - st) - p = Tool_Functions.fixOutofRangeP(p) + p = tool_funcs.fixOutofRangeP(p) p = self._ease_slow(p) - return Tool_Functions.linear_interpolation(p, 0.0, 1.0, 1.175, 1.0) if self.aFrom == t else Tool_Functions.linear_interpolation(p, 0.0, 1.0, 1.0, 1.175) + return tool_funcs.linear_interpolation(p, 0.0, 1.0, 1.175, 1.0) if self.aFrom == t else tool_funcs.linear_interpolation(p, 0.0, 1.0, 1.0, 1.175) def getShadowRect(self): - sv = Const.PHIGROS_SETTING_SHADOW_XRECT_MAP[self.aFrom] - ev = Const.PHIGROS_SETTING_SHADOW_XRECT_MAP[self.aTo] + sv = const.PHIGROS_SETTING_SHADOW_XRECT_MAP[self.aFrom] + ev = const.PHIGROS_SETTING_SHADOW_XRECT_MAP[self.aTo] if self.aSTime == float("-inf"): return ev st = self.aSTime et = self.aSTime + self.atime p = (time.time() - st) / (et - st) - p = Tool_Functions.fixOutofRangeP(p) + p = tool_funcs.fixOutofRangeP(p) p = self._ease_slow(p) return ( p * (ev[0] - sv[0]) + sv[0], @@ -290,7 +290,7 @@ def changeState(self, state: int): self.aSTime = time.time() def getSettingDx(self, shadowRectLeft: float, w: int, t: int): - return (Const.PHIGROS_SETTING_SHADOW_XRECT_MAP[t][0] - shadowRectLeft) * w + return (const.PHIGROS_SETTING_SHADOW_XRECT_MAP[t][0] - shadowRectLeft) * w def render( self, @@ -302,22 +302,22 @@ def render( ): sp_state = self.aFrom == self.aTo # before user change ui state if sp_state: - self.aFrom = Const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT - self.aTo = Const.PHIGROS_SETTING_STATE.PLAY + self.aFrom = const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT + self.aTo = const.PHIGROS_SETTING_STATE.PLAY st = self.aSTime et = self.aSTime + self.atime p = (time.time() - st) / (et - st) if self.aSTime != float("-inf") else 1.0 - p = Tool_Functions.fixOutofRangeP(p) + p = tool_funcs.fixOutofRangeP(p) p = self._ease_slow(p) - drawPlaySettingDx = self.getSettingDx(shadowRectLeft, w, Const.PHIGROS_SETTING_STATE.PLAY) - drawAccountAndCountSettingDx = self.getSettingDx(shadowRectLeft, w, Const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT) - drawOtherSettingDx = self.getSettingDx(shadowRectLeft, w, Const.PHIGROS_SETTING_STATE.OTHER) + drawPlaySettingDx = self.getSettingDx(shadowRectLeft, w, const.PHIGROS_SETTING_STATE.PLAY) + drawAccountAndCountSettingDx = self.getSettingDx(shadowRectLeft, w, const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT) + drawOtherSettingDx = self.getSettingDx(shadowRectLeft, w, const.PHIGROS_SETTING_STATE.OTHER) - drawPlaySettingAlpha = 0.0 if Const.PHIGROS_SETTING_STATE.PLAY not in (self.aFrom, self.aTo) else ((1.0 - p) if self.aFrom == Const.PHIGROS_SETTING_STATE.PLAY else p) - drawAccountAndCountSettingAlpha = 0.0 if Const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT not in (self.aFrom, self.aTo) else ((1.0 - p) if self.aFrom == Const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT else p) - drawOtherSettingAlpha = 0.0 if Const.PHIGROS_SETTING_STATE.OTHER not in (self.aFrom, self.aTo) else ((1.0 - p) if self.aFrom == Const.PHIGROS_SETTING_STATE.OTHER else p) + drawPlaySettingAlpha = 0.0 if const.PHIGROS_SETTING_STATE.PLAY not in (self.aFrom, self.aTo) else ((1.0 - p) if self.aFrom == const.PHIGROS_SETTING_STATE.PLAY else p) + drawAccountAndCountSettingAlpha = 0.0 if const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT not in (self.aFrom, self.aTo) else ((1.0 - p) if self.aFrom == const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT else p) + drawOtherSettingAlpha = 0.0 if const.PHIGROS_SETTING_STATE.OTHER not in (self.aFrom, self.aTo) else ((1.0 - p) if self.aFrom == const.PHIGROS_SETTING_STATE.OTHER else p) drawPlaySetting(drawPlaySettingDx, drawPlaySettingAlpha) drawAccountAndCountSetting(drawAccountAndCountSettingDx, drawAccountAndCountSettingAlpha) @@ -326,17 +326,17 @@ def render( settingDx.extend([drawPlaySettingDx, drawAccountAndCountSettingDx, drawOtherSettingDx]) if sp_state: - self.aFrom = Const.PHIGROS_SETTING_STATE.PLAY - self.aTo = Const.PHIGROS_SETTING_STATE.PLAY + self.aFrom = const.PHIGROS_SETTING_STATE.PLAY + self.aTo = const.PHIGROS_SETTING_STATE.PLAY return drawPlaySettingDx, drawAccountAndCountSettingDx, drawOtherSettingDx @property - def atis_p(self): return self.aTo == Const.PHIGROS_SETTING_STATE.PLAY + def atis_p(self): return self.aTo == const.PHIGROS_SETTING_STATE.PLAY @property - def atis_a(self): return self.aTo == Const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT + def atis_a(self): return self.aTo == const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT @property - def atis_o(self): return self.aTo == Const.PHIGROS_SETTING_STATE.OTHER + def atis_o(self): return self.aTo == const.PHIGROS_SETTING_STATE.OTHER @dataclass class PhiBaseWidget: @@ -379,14 +379,14 @@ def _fixValue(self): def _SliderEvent(self, x: int, y: int): if not self._mouseDown or ( - Tool_Functions.InRect(x, y, self.rconButtonRect) - or Tool_Functions.InRect(x, y, self.lconButtonRect) + tool_funcs.InRect(x, y, self.rconButtonRect) + or tool_funcs.InRect(x, y, self.lconButtonRect) ): return p = (x - self.sliderRect[0]) / (self.sliderRect[2] - self.sliderRect[0]) p = 0.0 if p < 0.02 else (1.0 if p > 0.97 else p) - v = Tool_Functions.sliderValueValue(p, self.number_points) + v = tool_funcs.sliderValueValue(p, self.number_points) if self.sliderUnit != self.sliderUnit: # nan self.value = v else: @@ -397,10 +397,10 @@ def _SliderEvent(self, x: int, y: int): self._fixValue() def _ConButtonEvent(self, x: int, y: int): - if Tool_Functions.InRect(x, y, self.lconButtonRect): + if tool_funcs.InRect(x, y, self.lconButtonRect): self.value -= self.conUnit - elif Tool_Functions.InRect(x, y, self.rconButtonRect): + elif tool_funcs.InRect(x, y, self.rconButtonRect): self.value += self.conUnit self._fixValue() @@ -419,9 +419,9 @@ def MouseMove(self, x: int, y: int): def InRect(self, x: int, y: int): return any([ - Tool_Functions.InRect(x, y, self.sliderRect), - Tool_Functions.InRect(x, y, self.lconButtonRect), - Tool_Functions.InRect(x, y, self.rconButtonRect) + tool_funcs.InRect(x, y, self.sliderRect), + tool_funcs.InRect(x, y, self.lconButtonRect), + tool_funcs.InRect(x, y, self.rconButtonRect) ]) @dataclass @@ -446,7 +446,7 @@ def MouseUp(self, x: int, y: int): self._mouseDown = False def InRect(self, x: int, y: int): - return Tool_Functions.InRect(x, y, self.checkboxRect) + return tool_funcs.InRect(x, y, self.checkboxRect) @dataclass class PhiButton(PhiBaseWidget): @@ -462,7 +462,7 @@ def MouseDown(self, x: int, y: int): self.command() def InRect(self, x: int, y: int): - return Tool_Functions.InRect(x, y, self.buttonRect) + return tool_funcs.InRect(x, y, self.buttonRect) class WidgetEventManager: def __init__(self, widgets: list[PhiBaseWidget], condition: typing.Callable[[int, int], bool]): diff --git a/Phigros.py b/src/phigros.py similarity index 85% rename from Phigros.py rename to src/phigros.py index 52afe0f..033b4ff 100644 --- a/Phigros.py +++ b/src/phigros.py @@ -1,5 +1,5 @@ -import errProcesser as _ -import initLogging as _ +import err_processer as _ +import init_logging as _ import webbrowser import typing @@ -21,15 +21,15 @@ from pydub import AudioSegment import webcv -import Const -import Tool_Functions -import PhigrosGameObject +import const +import tool_funcs +import phigame_obj import rpe_easing -import ConsoleWindow -import PhiCore -import Chart_Functions_Phi -import Chart_Functions_Rpe -import PlaySound +import console_window +import phicore +import chartfuncs_phi +import chartfuncs_rpe +import playsound selfdir = dirname(sys.argv[0]) if selfdir == "": selfdir = abspath(".") @@ -39,18 +39,18 @@ logging.fatal("7z.exe or 7z.dll Not Found") windll.kernel32.ExitProcess(1) -if not exists("./PhigrosAssets") or not all([ - exists(f"./PhigrosAssets/{i}") for i in [ +if not exists("./phigros_assets") or not all([ + exists(f"./phigros_assets/{i}") for i in [ "config.json", "chapters.json" ] ]): - logging.error("PhigrosAssets not found or corrupted, you can download it from https://github.com/qaqFei/PhigrosPlayer_PhigrosAssets") + logging.error("phigros_assets not found or corrupted, you can download it from https://github.com/qaqFei/PhigrosPlayer_phigros_assets") system("pause") windll.kernel32.ExitProcess(0) if sys.argv[0].endswith(".exe"): - ConsoleWindow.Hide() + console_window.Hide() for item in [item for item in listdir(gettempdir()) if item.startswith("phigros_temp_")]: try: rmtree(f"{gettempdir()}\\{item}") @@ -60,7 +60,7 @@ try: mkdir(temp_dir) except FileExistsError: pass -assetConfig = json.loads(open("./PhigrosAssets/config.json", "r", encoding="utf-8").read()) +assetConfig = json.loads(open("./phigros_assets/config.json", "r", encoding="utf-8").read()) userData_default = { "userdata-userName": "GUEST", "userdata-userAvatar": assetConfig["default-avatar"], @@ -83,18 +83,18 @@ def saveUserData(data: dict): try: - with open("./Phigros_UserData.json", "w", encoding="utf-8") as f: + with open("./phigros_userdata.json", "w", encoding="utf-8") as f: f.write(json.dumps(data, indent=4, ensure_ascii=False)) except Exception as e: - logging.error(f"Phigros_UserData.json save failed: {e}") + logging.error(f"phigros_userdata.json save failed: {e}") def loadUserData(): global userData userData = userData_default.copy() try: - userData.update(json.loads(open("./Phigros_UserData.json", "r", encoding="utf-8").read())) + userData.update(json.loads(open("./phigros_userdata.json", "r", encoding="utf-8").read())) except Exception as e: - logging.error(f"Phigros_UserData.json load failed, using default data, {e}") + logging.error(f"phigros_userdata.json load failed, using default data, {e}") def getUserData(key: str): return userData.get(key, userData_default[key]) @@ -102,7 +102,7 @@ def getUserData(key: str): def setUserData(key: str, value: typing.Any): userData[key] = value -if not exists("./Phigros_UserData.json"): +if not exists("./phigros_userdata.json"): saveUserData(userData_default) loadUserData() @@ -120,28 +120,28 @@ def setUserData(key: str, value: typing.Any): mainUI_ChaptersMouseDown = False changeChapterMouseDownX = float("nan") lastChangeChapterTime = float("-inf") -setting = PhigrosGameObject.Setting() -PlaySettingWidgets: dict[str, PhigrosGameObject.PhiBaseWidget] = {} -dspSettingWidgets: dict[str, PhigrosGameObject.PhiBaseWidget] = {} +setting = phigame_obj.Setting() +PlaySettingWidgets: dict[str, phigame_obj.PhiBaseWidget] = {} +dspSettingWidgets: dict[str, phigame_obj.PhiBaseWidget] = {} def Load_Chapters(): global Chapters, ChaptersMaxDx - jsonData = json.loads(open("./PhigrosAssets/chapters.json", "r", encoding="utf-8").read()) - Chapters = PhigrosGameObject.Chapters( + jsonData = json.loads(open("./phigros_assets/chapters.json", "r", encoding="utf-8").read()) + Chapters = phigame_obj.Chapters( [ - PhigrosGameObject.Chapter( + phigame_obj.Chapter( name = chapter["name"], cn_name = chapter["cn-name"], o_name = chapter["o-name"], image = chapter["image"], songs = [ - PhigrosGameObject.Song( + phigame_obj.Song( name = song["name"], composer = song["composer"], image = song["image"], preview = song["preview"], difficlty = [ - PhigrosGameObject.SongDifficlty( + phigame_obj.SongDifficlty( name = diff["name"], level = diff["level"], chart_audio = diff["chart_audio"], @@ -200,23 +200,23 @@ def Load_Resource(): global LoadSuccess logging.info("Loading Resource...") - LoadSuccess = mixer.Sound(("./Resources/LoadSuccess.wav")) - ClickEffectFrameCount = len(listdir("./Resources/Note_Click_Effect/Frames")) - ClickEffectImages = [Image.open(f"./Resources/Note_Click_Effect/Frames/{i + 1}.png") for i in range(ClickEffectFrameCount)] + LoadSuccess = mixer.Sound(("./resources/LoadSuccess.wav")) + ClickEffectFrameCount = len(listdir("./resources/Note_Click_Effect/Frames")) + ClickEffectImages = [Image.open(f"./resources/Note_Click_Effect/Frames/{i + 1}.png") for i in range(ClickEffectFrameCount)] Resource = { "Notes":{ - "Tap": Image.open("./Resources/Notes/Tap.png"), - "Tap_dub": Image.open("./Resources/Notes/Tap_dub.png"), - "Drag": Image.open("./Resources/Notes/Drag.png"), - "Drag_dub": Image.open("./Resources/Notes/Drag_dub.png"), - "Flick": Image.open("./Resources/Notes/Flick.png"), - "Flick_dub": Image.open("./Resources/Notes/Flick_dub.png"), - "Hold_Head": Image.open("./Resources/Notes/Hold_Head.png"), - "Hold_Head_dub": Image.open("./Resources/Notes/Hold_Head_dub.png"), - "Hold_End": Image.open("./Resources/Notes/Hold_End.png"), - "Hold_End_dub": Image.open("./Resources/Notes/Hold_End_dub.png"), - "Hold_Body": Image.open("./Resources/Notes/Hold_Body.png"), - "Hold_Body_dub": Image.open("./Resources/Notes/Hold_Body_dub.png"), + "Tap": Image.open("./resources/Notes/Tap.png"), + "Tap_dub": Image.open("./resources/Notes/Tap_dub.png"), + "Drag": Image.open("./resources/Notes/Drag.png"), + "Drag_dub": Image.open("./resources/Notes/Drag_dub.png"), + "Flick": Image.open("./resources/Notes/Flick.png"), + "Flick_dub": Image.open("./resources/Notes/Flick_dub.png"), + "Hold_Head": Image.open("./resources/Notes/Hold_Head.png"), + "Hold_Head_dub": Image.open("./resources/Notes/Hold_Head_dub.png"), + "Hold_End": Image.open("./resources/Notes/Hold_End.png"), + "Hold_End_dub": Image.open("./resources/Notes/Hold_End_dub.png"), + "Hold_Body": Image.open("./resources/Notes/Hold_Body.png"), + "Hold_Body_dub": Image.open("./resources/Notes/Hold_Body_dub.png"), "Bad": None }, "Note_Click_Effect":{ @@ -224,61 +224,61 @@ def Load_Resource(): "Good": list(map(lambda im: putColor((180, 225, 255), im), ClickEffectImages)), }, "Levels":{ - "AP": Image.open("./Resources/Levels/AP.png"), - "FC": Image.open("./Resources/Levels/FC.png"), - "V": Image.open("./Resources/Levels/V.png"), - "S": Image.open("./Resources/Levels/S.png"), - "A": Image.open("./Resources/Levels/A.png"), - "B": Image.open("./Resources/Levels/B.png"), - "C": Image.open("./Resources/Levels/C.png"), - "F": Image.open("./Resources/Levels/F.png") + "AP": Image.open("./resources/Levels/AP.png"), + "FC": Image.open("./resources/Levels/FC.png"), + "V": Image.open("./resources/Levels/V.png"), + "S": Image.open("./resources/Levels/S.png"), + "A": Image.open("./resources/Levels/A.png"), + "B": Image.open("./resources/Levels/B.png"), + "C": Image.open("./resources/Levels/C.png"), + "F": Image.open("./resources/Levels/F.png") }, "Note_Click_Audio":{ - "Tap": PlaySound.directSound(loadAudio("./Resources/Note_Click_Audio/Tap.wav")), - "Drag": PlaySound.directSound(loadAudio("./Resources/Note_Click_Audio/Drag.wav")), - "Hold": PlaySound.directSound(loadAudio("./Resources/Note_Click_Audio/Hold.wav")), - "Flick": PlaySound.directSound(loadAudio("./Resources/Note_Click_Audio/Flick.wav")) + "Tap": playsound.directSound(loadAudio("./resources/Note_Click_Audio/Tap.wav")), + "Drag": playsound.directSound(loadAudio("./resources/Note_Click_Audio/Drag.wav")), + "Hold": playsound.directSound(loadAudio("./resources/Note_Click_Audio/Hold.wav")), + "Flick": playsound.directSound(loadAudio("./resources/Note_Click_Audio/Flick.wav")) }, - "logoipt": Image.open("./Resources/logoipt.png"), - "warning": Image.open("./Resources/Start.png"), - "phigros": Image.open("./Resources/phigros.png"), - "AllSongBlur": Image.open("./Resources/AllSongBlur.png"), - "facula": Image.open("./Resources/facula.png"), - "collectibles": Image.open("./Resources/collectibles.png"), - "setting": Image.open("./Resources/setting.png"), - "ButtonLeftBlack": Image.open("./Resources/Button_Left_Black.png"), + "logoipt": Image.open("./resources/logoipt.png"), + "warning": Image.open("./resources/Start.png"), + "phigros": Image.open("./resources/phigros.png"), + "AllSongBlur": Image.open("./resources/AllSongBlur.png"), + "facula": Image.open("./resources/facula.png"), + "collectibles": Image.open("./resources/collectibles.png"), + "setting": Image.open("./resources/setting.png"), + "ButtonLeftBlack": Image.open("./resources/Button_Left_Black.png"), "ButtonRightBlack": None, - "message": Image.open("./Resources/message.png"), - "JoinQQGuildBanner": Image.open("./Resources/JoinQQGuildBanner.png"), - "UISound_1": mixer.Sound("./Resources/UISound_1.wav"), - "UISound_2": mixer.Sound("./Resources/UISound_2.wav"), - "UISound_3": mixer.Sound("./Resources/UISound_3.wav"), - "UISound_4": mixer.Sound("./Resources/UISound_4.wav"), - "JoinQQGuildPromo": Image.open("./Resources/JoinQQGuildPromo.png"), - "Arrow_Left": Image.open("./Resources/Arrow_Left.png"), - "Arrow_Right": Image.open("./Resources/Arrow_Right.png"), - "Arrow_Right_Black": Image.open("./Resources/Arrow_Right_Black.png"), - "twitter": Image.open("./Resources/twitter.png"), - "qq": Image.open("./Resources/qq.png"), - "bilibili": Image.open("./Resources/bilibili.png"), - "taptap": Image.open("./Resources/taptap.png"), - "checked": Image.open("./Resources/checked.png"), - "CalibrationHit": PlaySound.directSound(loadAudio("./Resources/CalibrationHit.wav")), - "Button_Left": Image.open("./Resources/Button_Left.png"), - "Retry": Image.open("./Resources/Retry.png"), - "Pause": mixer.Sound("./Resources/Pause.wav"), - "PauseImg": Image.open("./Resources/Pause.png"), - "PUIBack": Image.open("./Resources/PUIBack.png"), - "PUIRetry": Image.open("./Resources/PUIRetry.png"), - "PUIResume": Image.open("./Resources/PUIResume.png"), - "edit": Image.open("./Resources/edit.png"), - "close": Image.open("./Resources/close.png"), + "message": Image.open("./resources/message.png"), + "JoinQQGuildBanner": Image.open("./resources/JoinQQGuildBanner.png"), + "UISound_1": mixer.Sound("./resources/UISound_1.wav"), + "UISound_2": mixer.Sound("./resources/UISound_2.wav"), + "UISound_3": mixer.Sound("./resources/UISound_3.wav"), + "UISound_4": mixer.Sound("./resources/UISound_4.wav"), + "JoinQQGuildPromo": Image.open("./resources/JoinQQGuildPromo.png"), + "Arrow_Left": Image.open("./resources/Arrow_Left.png"), + "Arrow_Right": Image.open("./resources/Arrow_Right.png"), + "Arrow_Right_Black": Image.open("./resources/Arrow_Right_Black.png"), + "twitter": Image.open("./resources/twitter.png"), + "qq": Image.open("./resources/qq.png"), + "bilibili": Image.open("./resources/bilibili.png"), + "taptap": Image.open("./resources/taptap.png"), + "checked": Image.open("./resources/checked.png"), + "CalibrationHit": playsound.directSound(loadAudio("./resources/CalibrationHit.wav")), + "Button_Left": Image.open("./resources/Button_Left.png"), + "Retry": Image.open("./resources/Retry.png"), + "Pause": mixer.Sound("./resources/Pause.wav"), + "PauseImg": Image.open("./resources/Pause.png"), + "PUIBack": Image.open("./resources/PUIBack.png"), + "PUIRetry": Image.open("./resources/PUIRetry.png"), + "PUIResume": Image.open("./resources/PUIResume.png"), + "edit": Image.open("./resources/edit.png"), + "close": Image.open("./resources/close.png"), } Resource["Button_Right"] = Resource["Button_Left"].transpose(Image.FLIP_LEFT_RIGHT).transpose(Image.FLIP_TOP_BOTTOM) Resource["ButtonRightBlack"] = Resource["ButtonLeftBlack"].transpose(Image.FLIP_LEFT_RIGHT).transpose(Image.FLIP_TOP_BOTTOM) Resource["Notes"]["Bad"] = putColor((90, 60, 70), Resource["Notes"]["Tap"]) - Const.set_NOTE_DUB_FIXSCALE(Resource["Notes"]["Hold_Body_dub"].width / Resource["Notes"]["Hold_Body"].width) + const.set_NOTE_DUB_FIXSCALE(Resource["Notes"]["Hold_Body_dub"].width / Resource["Notes"]["Hold_Body"].width) imageBlackMaskHeight = 12 imageBlackMask = Image.new("RGBA", (1, imageBlackMaskHeight), (0, 0, 0, 0)) @@ -351,17 +351,17 @@ def Load_Resource(): root.reg_img(Resource["Note_Click_Effect"]["Good"][i], f"Note_Click_Effect_Good_{i + 1}") for chapter in Chapters.items: - im = Image.open(f"./PhigrosAssets/{chapter.image}") + im = Image.open(f"./phigros_assets/{chapter.image}") chapter.im = im root.reg_img(im, f"chapter_{chapter.chapterId}_raw") root.reg_img(im.filter(ImageFilter.GaussianBlur(radius = (im.width + im.height) / 100)), f"chapter_{chapter.chapterId}_blur") for index, avatar in enumerate(assetConfig["avatars"]): - root.reg_img(Image.open(f"./PhigrosAssets/{avatar}"), f"avatar_{index}") + root.reg_img(Image.open(f"./phigros_assets/{avatar}"), f"avatar_{index}") - root.reg_img(Image.open(f"./PhigrosAssets/{getUserData("userdata-userBackground")}"), "userBackground") + root.reg_img(Image.open(f"./phigros_assets/{getUserData("userdata-userBackground")}"), "userBackground") - with open("./Resources/font.ttf", "rb") as f: + with open("./resources/font.ttf", "rb") as f: root.reg_res(f.read(),"PhigrosFont") root.load_allimg() for im in root._is_loadimg.keys(): # ... create image draw cache @@ -426,48 +426,48 @@ def bindEvents(): root.run_js_code("_mouseup = (e) => pywebview.api.call_attr('mouseup', e.x, e.y);") root.run_js_code("document.addEventListener('mouseup', _mouseup);") - mainUISlideControler = PhigrosGameObject.SlideControler( + mainUISlideControler = phigame_obj.SlideControler( mainUI_slideControlerMouseDown_valid, mainUI_slideControler_setValue, 0.0, ChaptersMaxDx, 0.0, 0.0, w, h ) eventManager.regClickEventFs(mainUISlideControler.mouseDown, False) - eventManager.regReleaseEvent(PhigrosGameObject.ReleaseEvent(mainUISlideControler.mouseUp)) - eventManager.regMoveEvent(PhigrosGameObject.MoveEvent(mainUISlideControler.mouseMove)) + eventManager.regReleaseEvent(phigame_obj.ReleaseEvent(mainUISlideControler.mouseUp)) + eventManager.regMoveEvent(phigame_obj.MoveEvent(mainUISlideControler.mouseMove)) - settingUIPlaySlideControler = PhigrosGameObject.SlideControler( + settingUIPlaySlideControler = phigame_obj.SlideControler( settingUI_slideControlerMouseDown_valid, settingUI_slideControler_setValue, 0.0, 0.0, 0.0, 0.0, w, h ) eventManager.regClickEventFs(settingUIPlaySlideControler.mouseDown, False) - eventManager.regReleaseEvent(PhigrosGameObject.ReleaseEvent(settingUIPlaySlideControler.mouseUp)) - eventManager.regMoveEvent(PhigrosGameObject.MoveEvent(settingUIPlaySlideControler.mouseMove)) + eventManager.regReleaseEvent(phigame_obj.ReleaseEvent(settingUIPlaySlideControler.mouseUp)) + eventManager.regMoveEvent(phigame_obj.MoveEvent(settingUIPlaySlideControler.mouseMove)) - settingUIOpenSourceLicenseSlideControler = PhigrosGameObject.SlideControler( + settingUIOpenSourceLicenseSlideControler = phigame_obj.SlideControler( lambda x, y: w * 0.2 <= x <= w * 0.8, lambda x, y: None, 0.0, 0.0, 0.0, 0.0, w, h ) eventManager.regClickEventFs(settingUIOpenSourceLicenseSlideControler.mouseDown, False) - eventManager.regReleaseEvent(PhigrosGameObject.ReleaseEvent(settingUIOpenSourceLicenseSlideControler.mouseUp)) - eventManager.regMoveEvent(PhigrosGameObject.MoveEvent(settingUIOpenSourceLicenseSlideControler.mouseMove)) + eventManager.regReleaseEvent(phigame_obj.ReleaseEvent(settingUIOpenSourceLicenseSlideControler.mouseUp)) + eventManager.regMoveEvent(phigame_obj.MoveEvent(settingUIOpenSourceLicenseSlideControler.mouseMove)) - SettingPlayWidgetEventManager = PhigrosGameObject.WidgetEventManager([], settingPlayWidgetEvent_valid) + SettingPlayWidgetEventManager = phigame_obj.WidgetEventManager([], settingPlayWidgetEvent_valid) eventManager.regClickEventFs(SettingPlayWidgetEventManager.MouseDown, False) - eventManager.regReleaseEvent(PhigrosGameObject.ReleaseEvent(SettingPlayWidgetEventManager.MouseUp)) - eventManager.regMoveEvent(PhigrosGameObject.MoveEvent(SettingPlayWidgetEventManager.MouseMove)) + eventManager.regReleaseEvent(phigame_obj.ReleaseEvent(SettingPlayWidgetEventManager.MouseUp)) + eventManager.regMoveEvent(phigame_obj.MoveEvent(SettingPlayWidgetEventManager.MouseMove)) - dspSettingWidgetEventManager = PhigrosGameObject.WidgetEventManager([], lambda x, y: True) + dspSettingWidgetEventManager = phigame_obj.WidgetEventManager([], lambda x, y: True) eventManager.regClickEventFs(dspSettingWidgetEventManager.MouseDown, False) - eventManager.regReleaseEvent(PhigrosGameObject.ReleaseEvent(dspSettingWidgetEventManager.MouseUp)) - eventManager.regMoveEvent(PhigrosGameObject.MoveEvent(dspSettingWidgetEventManager.MouseMove)) + eventManager.regReleaseEvent(phigame_obj.ReleaseEvent(dspSettingWidgetEventManager.MouseUp)) + eventManager.regMoveEvent(phigame_obj.MoveEvent(dspSettingWidgetEventManager.MouseMove)) eventManager.regClickEventFs(changeChapterMouseDown, False) - eventManager.regReleaseEvent(PhigrosGameObject.ReleaseEvent(changeChapterMouseUp)) + eventManager.regReleaseEvent(phigame_obj.ReleaseEvent(changeChapterMouseUp)) def drawBackground(): f, t = Chapters.aFrom, Chapters.aTo @@ -505,7 +505,7 @@ def drawFaculas(): add_code_array = True ) -def getChapterP(chapter: PhigrosGameObject.Chapter): +def getChapterP(chapter: phigame_obj.Chapter): chapterIndex = Chapters.items.index(chapter) ef = rpe_easing.ease_funcs[0] atime = 1.0 @@ -519,7 +519,7 @@ def getChapterP(chapter: PhigrosGameObject.Chapter): else: p = 0.0 - return ef(Tool_Functions.fixOutofRangeP(p)) + return ef(tool_funcs.fixOutofRangeP(p)) def getChapterWidth(p: float): return w * (0.221875 + (0.5640625 - 0.221875) * p) @@ -533,13 +533,13 @@ def getChapterRect(dx: float, chapterWidth: float): dx + chapterWidth, h * (1.0 - 140 / 1080) ) -def drawChapterItem(item: PhigrosGameObject.Chapter, dx: float): +def drawChapterItem(item: phigame_obj.Chapter, dx: float): p = getChapterP(item) if dx > w: return getChapterToNextWidth(p) chapterWidth = getChapterWidth(p) if dx + chapterWidth < 0: return getChapterToNextWidth(p) chapterImWidth = h * (1.0 - 140 / 1080 * 2) / item.im.height * item.im.width - dPower = Tool_Functions.getDPower(chapterWidth, h * (1.0 - 140 / 1080 * 2), 75) + dPower = tool_funcs.getDPower(chapterWidth, h * (1.0 - 140 / 1080 * 2), 75) chapterRect = getChapterRect(dx, chapterWidth) @@ -577,7 +577,7 @@ def drawChapterItem(item: PhigrosGameObject.Chapter, dx: float): f"ctx.drawRotateText2(\ '{processStringToLiteral(item.name)}',\ {chapterRect[2] - dPower * chapterWidth - (w + h) / 150}, {chapterRect[3] - (w + h) / 150},\ - -75, 'rgba(255, 255, 255, {0.95 * (1.0 - Tool_Functions.PhigrosChapterNameAlphaValueTransfrom(p))})', '{(w + h) / 50}px PhigrosFont',\ + -75, 'rgba(255, 255, 255, {0.95 * (1.0 - tool_funcs.PhigrosChapterNameAlphaValueTransfrom(p))})', '{(w + h) / 50}px PhigrosFont',\ 'left', 'bottom'\ );", add_code_array = True @@ -607,7 +607,7 @@ def drawChapterItem(item: PhigrosGameObject.Chapter, dx: float): PlayButtonWidth = w * 0.1453125 PlayButtonHeight = h * (5 / 54) - PlayButtonDPower = Tool_Functions.getDPower(PlayButtonWidth, PlayButtonHeight, 75) + PlayButtonDPower = tool_funcs.getDPower(PlayButtonWidth, PlayButtonHeight, 75) playButtonRect = ( chapterRect[2] - dPower * chapterWidth + PlayButtonDPower * PlayButtonWidth - PlayButtonWidth, chapterRect[3] - PlayButtonHeight, @@ -620,7 +620,7 @@ def drawChapterItem(item: PhigrosGameObject.Chapter, dx: float): playButtonRect[0] + (playButtonRect[2] - playButtonRect[0]) * 0.25, playButtonRect[1] + (playButtonRect[3] - playButtonRect[1]) * 0.5 ) - playButtonAlpha = Tool_Functions.PhigrosChapterPlayButtonAlphaValueTransfrom(p) + playButtonAlpha = tool_funcs.PhigrosChapterPlayButtonAlphaValueTransfrom(p) if playButtonAlpha != 0.0: root.run_js_code( @@ -651,7 +651,7 @@ def drawChapterItem(item: PhigrosGameObject.Chapter, dx: float): wait_execute = True ) - dataAlpha = Tool_Functions.PhigrosChapterDataAlphaValueTransfrom(p) + dataAlpha = tool_funcs.PhigrosChapterDataAlphaValueTransfrom(p) if dataAlpha != 0.0: root.create_text( @@ -839,7 +839,7 @@ def start_animation_click_cb(*args): nonlocal start_animation_clicked; start_ani a1_t = 5.0 a1_st = time.time() - mixer.music.load("./Resources/NewSplashSceneBGM.mp3") + mixer.music.load("./resources/NewSplashSceneBGM.mp3") played_NewSplashSceneBGM = False while True: p = (time.time() - a1_st) / a1_t @@ -860,7 +860,7 @@ def start_animation_click_cb(*args): nonlocal start_animation_clicked; start_ani root.run_js_code( f"ctx.drawAlphaImage(\ {root.get_img_jsvarname("logoipt")},\ - 0, 0, {w}, {h}, {Tool_Functions.easeAlpha(p)}\ + 0, 0, {w}, {h}, {tool_funcs.easeAlpha(p)}\ );", add_code_array = True ) @@ -879,7 +879,7 @@ def start_animation_click_cb(*args): nonlocal start_animation_clicked; start_ani root.run_js_code( f"ctx.drawAlphaImage(\ {root.get_img_jsvarname("warning")},\ - 0, 0, {w}, {h}, {Tool_Functions.easeAlpha(p)}\ + 0, 0, {w}, {h}, {tool_funcs.easeAlpha(p)}\ );", add_code_array = True ) @@ -891,7 +891,7 @@ def start_animation_click_cb(*args): nonlocal start_animation_clicked; start_ani eventManager.clickEvents.remove(e) break - faManager = PhigrosGameObject.FaculaAnimationManager() + faManager = phigame_obj.FaculaAnimationManager() Thread(target=faManager.main, daemon=True).start() a3_st = time.time() a3_clicked = False @@ -976,7 +976,7 @@ def a3_click_cb(*args): root.create_text( w / 2, h * 0.98, - text = f"Version: {Const.PHIGROS_VERSION}", + text = f"Version: {const.PHIGROS_VERSION}", font = f"{(w + h) / 250}px PhigrosFont", textAlign = "center", textBaseline = "bottom", @@ -1025,7 +1025,7 @@ def mainUI_slideControlerMouseDown_valid(x, y): return False for e in eventManager.clickEvents: - if e.tag == "mainUI" and Tool_Functions.InRect(x, y, e.rect): + if e.tag == "mainUI" and tool_funcs.InRect(x, y, e.rect): return False return True @@ -1039,7 +1039,7 @@ def settingUI_slideControlerMouseDown_valid(x, y): return False return ( - settingState.aTo == Const.PHIGROS_SETTING_STATE.PLAY and + settingState.aTo == const.PHIGROS_SETTING_STATE.PLAY and w * 0.0921875 <= x <= w * 0.534375 and h * (180 / 1080) <= y <= h * (1015 / 1080) ) @@ -1052,7 +1052,7 @@ def settingPlayWidgetEvent_valid(x, y): if settingState is None: return False - return settingState.aTo == Const.PHIGROS_SETTING_STATE.PLAY and inSettingUI + return settingState.aTo == const.PHIGROS_SETTING_STATE.PLAY and inSettingUI def changeChapterMouseDown(x, y): global changeChapterMouseDownX @@ -1080,8 +1080,8 @@ def changeChapterMouseUp(x, y): for index, i in enumerate(Chapters.items): p = getChapterP(i) width = getChapterWidth(p) - dPower = Tool_Functions.getDPower(width, h * (1.0 - 140 / 1080 * 2), 75) - if Tool_Functions.inDiagonalRectangle(*getChapterRect(chapterX, width), dPower, x, y): + dPower = tool_funcs.getDPower(width, h * (1.0 - 140 / 1080 * 2), 75) + if tool_funcs.inDiagonalRectangle(*getChapterRect(chapterX, width), dPower, x, y): if Chapters.aTo != index: Chapters.aFrom, Chapters.aTo, Chapters.aSTime = Chapters.aTo, index, time.time() lastChangeChapterTime = time.time() @@ -1095,7 +1095,7 @@ def mainRender(): faManager.faculas.clear() mainRenderSt = time.time() - mixer.music.load("./Resources/ChapterSelect.mp3") + mixer.music.load("./resources/ChapterSelect.mp3") mixer.music.play(-1) messageRect = (w * 0.015, h * 0.985 - MessageButtonSize, MessageButtonSize, MessageButtonSize) @@ -1115,7 +1115,7 @@ def clickMessage(*args): clickedMessage = True canClickJoinQQGuildBanner = True Resource["UISound_1"].play() - events.append(PhigrosGameObject.ClickEvent( + events.append(phigame_obj.ClickEvent( rect = (messageRect[0], messageRect[1], messageRect[0] + messageRect[2], messageRect[1] + messageRect[3]), callback = clickMessage, once = False, @@ -1136,7 +1136,7 @@ def clickJoinQQGuildBanner(*args): messageBackTime = float("inf") inMainUI = False Resource["UISound_2"].play() - events.append(PhigrosGameObject.ClickEvent( + events.append(phigame_obj.ClickEvent( rect = (JoinQQGuildBannerRect[0], JoinQQGuildBannerRect[1], JoinQQGuildBannerRect[0] + JoinQQGuildBannerRect[2], JoinQQGuildBannerRect[1] + JoinQQGuildBannerRect[3]), callback = clickJoinQQGuildBanner, once = False @@ -1184,7 +1184,7 @@ def SettingCallback(*args): mixer.music.fadeout(500) Resource["UISound_2"].play() - events.append(PhigrosGameObject.ClickEvent( + events.append(phigame_obj.ClickEvent( rect = (w - ButtonWidth, h - ButtonHeight, w, h), callback = SettingCallback, once = False, @@ -1282,16 +1282,16 @@ def SettingCallback(*args): noRect, yesRect = drawDialog( p, "JoinQQGuildPromo", - Const.JOINQQGUILDPROMO_DIAGONALRECTANGLEPOWER, + const.JOINQQGUILDPROMO_DIAGONALRECTANGLEPOWER, (JoinQQGuildPromoWidth, JoinQQGuildPromoHeight), "关闭", "跳转到外部应用" ) if JoinQQGuildPromoNoEvent is None and JoinQQGuildPromoYesEvent is None: - JoinQQGuildPromoNoEvent = PhigrosGameObject.ClickEvent( # once is false, remove event in callback + JoinQQGuildPromoNoEvent = phigame_obj.ClickEvent( # once is false, remove event in callback noRect, JoinQQGuildPromoNoCallback, False ) - JoinQQGuildPromoYesEvent = PhigrosGameObject.ClickEvent( + JoinQQGuildPromoYesEvent = phigame_obj.ClickEvent( yesRect, JoinQQGuildPromoYesCallback, False ) events.append(JoinQQGuildPromoNoEvent) @@ -1318,7 +1318,7 @@ def SettingCallback(*args): drawDialog( p, "JoinQQGuildPromo", - Const.JOINQQGUILDPROMO_DIAGONALRECTANGLEPOWER, + const.JOINQQGUILDPROMO_DIAGONALRECTANGLEPOWER, (JoinQQGuildPromoWidth, JoinQQGuildPromoHeight), "关闭", "跳转到外部应用" ) @@ -1379,7 +1379,7 @@ def renderPhigrosWidgets( for widget in widgets: x, y = sx - dx_f(sy + (dy + widgets_height)), sy + (dy + widgets_height) - if isinstance(widget, PhigrosGameObject.PhiLabel): + if isinstance(widget, phigame_obj.PhiLabel): _temp = lambda text, align: root.create_text( x + (max_width if align == "right" else 0.0), y, text, font = f"{widget.fontsize}px PhigrosFont", @@ -1394,7 +1394,7 @@ def renderPhigrosWidgets( widgets_height += widget.fontsize widgets_height += widget.tonext widgets_height += h * (27 / 1080) - elif isinstance(widget, PhigrosGameObject.PhiSlider): + elif isinstance(widget, phigame_obj.PhiSlider): sliderShadowRect = ( x, y + h * (6 / 1080), x + max_width, y + h * ((41 + 6) / 1080) @@ -1402,7 +1402,7 @@ def renderPhigrosWidgets( root.run_js_code( f"ctx.drawDiagonalRectangleNoFix(\ {",".join(map(str, sliderShadowRect))},\ - {Tool_Functions.getDPower(*Tool_Functions.getSizeByRect(sliderShadowRect), 75)},\ + {tool_funcs.getDPower(*tool_funcs.getSizeByRect(sliderShadowRect), 75)},\ 'rgba(0, 0, 0, 0.25)'\ );", add_code_array = True @@ -1422,7 +1422,7 @@ def renderPhigrosWidgets( root.run_js_code( f"ctx.drawDiagonalRectangleNoFix(\ {",".join(map(str, lConRect))},\ - {Tool_Functions.getDPower(*Tool_Functions.getSizeByRect(lConRect), 75)},\ + {tool_funcs.getDPower(*tool_funcs.getSizeByRect(lConRect), 75)},\ 'rgb(255, 255, 255)'\ );", add_code_array = True @@ -1431,14 +1431,14 @@ def renderPhigrosWidgets( root.run_js_code( f"ctx.drawDiagonalRectangleNoFix(\ {",".join(map(str, rConRect))},\ - {Tool_Functions.getDPower(*Tool_Functions.getSizeByRect(rConRect), 75)},\ + {tool_funcs.getDPower(*tool_funcs.getSizeByRect(rConRect), 75)},\ 'rgb(255, 255, 255)'\ );", add_code_array = True ) if widget.lr_button: - ctp_l, ctp_r = Tool_Functions.getCenterPointByRect(lConRect), Tool_Functions.getCenterPointByRect(rConRect) + ctp_l, ctp_r = tool_funcs.getCenterPointByRect(lConRect), tool_funcs.getCenterPointByRect(rConRect) coniw_l, coniw_r = (w + h) * 0.003, (w + h) * 0.005 # 控制按钮图标线长度 root.run_js_code( f"ctx.drawLineEx(\ @@ -1465,9 +1465,9 @@ def renderPhigrosWidgets( add_code_array = True ) - slider_p = Tool_Functions.sliderValueP(widget.value, widget.number_points) + slider_p = tool_funcs.sliderValueP(widget.value, widget.number_points) sliderBlockWidth = w * 0.0359375 - sliderFrameWidth = conWidth - conWidth * Tool_Functions.getDPower(*Tool_Functions.getSizeByRect(lConRect), 75) + sliderBlockWidth / 2 + w * 0.0046875 + sliderFrameWidth = conWidth - conWidth * tool_funcs.getDPower(*tool_funcs.getSizeByRect(lConRect), 75) + sliderBlockWidth / 2 + w * 0.0046875 sliderBlockHeight = conButtonHeight sliderBlock_x = x + sliderFrameWidth - sliderBlockWidth / 2 + slider_p * (max_width - sliderFrameWidth * 2) sliderBlockRect = ( @@ -1478,7 +1478,7 @@ def renderPhigrosWidgets( root.run_js_code( f"ctx.drawDiagonalRectangleNoFix(\ {",".join(map(str, sliderBlockRect))},\ - {Tool_Functions.getDPower(*Tool_Functions.getSizeByRect(sliderBlockRect), 75)},\ + {tool_funcs.getDPower(*tool_funcs.getSizeByRect(sliderBlockRect), 75)},\ 'rgb(255, 255, 255)'\ );", add_code_array = True @@ -1492,7 +1492,7 @@ def renderPhigrosWidgets( widget.lconButtonRect, widget.rconButtonRect = lConRect, rConRect widgets_height += widget.tonext - elif isinstance(widget, PhigrosGameObject.PhiCheckbox): + elif isinstance(widget, phigame_obj.PhiCheckbox): root.create_text( x, y, widget.text, font = f"{widget.fontsize}px PhigrosFont", @@ -1509,14 +1509,14 @@ def renderPhigrosWidgets( root.run_js_code( f"ctx.drawDiagonalRectangleNoFix(\ {",".join(map(str, checkboxShadowRect))},\ - {Tool_Functions.getDPower(*Tool_Functions.getSizeByRect(checkboxShadowRect), 75)},\ + {tool_funcs.getDPower(*tool_funcs.getSizeByRect(checkboxShadowRect), 75)},\ 'rgba(0, 0, 0, 0.25)'\ );", add_code_array = True ) checkAnimationP = (time.time() - widget.check_animation_st) / 0.2 - checkAnimationP = Tool_Functions.fixOutofRangeP(checkAnimationP) + checkAnimationP = tool_funcs.fixOutofRangeP(checkAnimationP) if not widget.checked: checkAnimationP = 1.0 - checkAnimationP checkAnimationP = 1.0 - (1.0 - checkAnimationP) ** 2 @@ -1531,7 +1531,7 @@ def renderPhigrosWidgets( f"ctx.drawImage(\ {root.get_img_jsvarname("checked")},\ {x + w * 0.340625 - CheckedIconWidth / 2},\ - {y + Tool_Functions.getSizeByRect(checkButtonRect)[1] / 2 - CheckedIconHeight / 2},\ + {y + tool_funcs.getSizeByRect(checkButtonRect)[1] / 2 - CheckedIconHeight / 2},\ {CheckedIconWidth}, {CheckedIconHeight}\ );", add_code_array = True @@ -1540,7 +1540,7 @@ def renderPhigrosWidgets( root.run_js_code( f"ctx.drawDiagonalRectangleNoFix(\ {",".join(map(str, checkButtonRect))},\ - {Tool_Functions.getDPower(*Tool_Functions.getSizeByRect(checkButtonRect), 75)},\ + {tool_funcs.getDPower(*tool_funcs.getSizeByRect(checkButtonRect), 75)},\ 'rgb(255, 255, 255)'\ );", add_code_array = True @@ -1549,7 +1549,7 @@ def renderPhigrosWidgets( widget.checkboxRect = checkboxShadowRect widgets_height += widget.tonext - elif isinstance(widget, PhigrosGameObject.PhiButton): + elif isinstance(widget, phigame_obj.PhiButton): buttonRect = ( x + max_width / 2 - widget.width / 2, y, x + max_width / 2 + widget.width / 2, y + h * (80 / 1080) @@ -1558,7 +1558,7 @@ def renderPhigrosWidgets( root.run_js_code( f"ctx.drawDiagonalRectangleNoFix(\ {",".join(map(str, buttonRect))},\ - {Tool_Functions.getDPower(*Tool_Functions.getSizeByRect(buttonRect), 75)},\ + {tool_funcs.getDPower(*tool_funcs.getSizeByRect(buttonRect), 75)},\ 'rgb(255, 255, 255)'\ );", add_code_array = True @@ -1576,7 +1576,7 @@ def renderPhigrosWidgets( widget.buttonRect = buttonRect - if not isinstance(widget, PhigrosGameObject.PhiLabel): + if not isinstance(widget, phigame_obj.PhiLabel): widgets_height += h * (150 / 1080) root.run_js_code( @@ -1594,7 +1594,7 @@ def settingRender(): inSettingUI = True settingRenderSt = time.time() - settingState = PhigrosGameObject.SettingState() + settingState = phigame_obj.SettingState() clickedBackButton = False settingPlayWidgetsDy = 0.0 CalibrationClickSoundPlayed = False @@ -1612,12 +1612,12 @@ def settingRender(): settingUIOpenSourceLicenseSlideControler.maxValueY = root.run_js_code( f"ctx.drawRectMultilineText(\ -{w}, -{h}, 0, 0,\ - {root.process_code_string_syntax_tocode(Const.PHI_OPENSOURCELICENSE)},\ + {root.process_code_string_syntax_tocode(const.PHI_OPENSOURCELICENSE)},\ 'rgb(255, 255, 255)', '{(w + h) / 145}px PhigrosFont', {(w + h) / 145}, 1.25\ );" ) + h * (143 / 1080) * 2 - h - mixer.music.load("./Resources/Calibration.wav") + mixer.music.load("./resources/Calibration.wav") mixer.music.play(-1) def unregEvents(): @@ -1633,7 +1633,7 @@ def clickBackButtonCallback(*args): nextUI, tonextUI, tonextUISt = mainRender, True, time.time() Resource["UISound_4"].play() - clickBackButtonEvent = PhigrosGameObject.ClickEvent( + clickBackButtonEvent = phigame_obj.ClickEvent( rect = (0, 0, ButtonWidth, ButtonHeight), callback = clickBackButtonCallback, once = False @@ -1662,40 +1662,40 @@ def settingMainClickCallback(x, y): nonlocal showBackgrounds, showBackgroundsSt # 游玩 - if Tool_Functions.InRect(x, y, ( + if tool_funcs.InRect(x, y, ( w * 346 / 1920, h * 35 / 1080, w * 458 / 1920, h * 97 / 1080 )) and inSettingUI and not editingUserData: - if settingState.aTo == Const.PHIGROS_SETTING_STATE.PLAY: + if settingState.aTo == const.PHIGROS_SETTING_STATE.PLAY: return Thread(target=lambda: (time.sleep(settingState.atime / 2), mixer.music.stop(), mixer.music.play(-1)), daemon=True).start() - _setSettingState(Const.PHIGROS_SETTING_STATE.PLAY) + _setSettingState(const.PHIGROS_SETTING_STATE.PLAY) # 账号与统计 - if Tool_Functions.InRect(x, y, ( + if tool_funcs.InRect(x, y, ( w * 540 / 1920, h * 35 / 1080, w * 723 / 1920, h * 97 / 1080 )) and inSettingUI and not editingUserData: - if settingState.aTo == Const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT: + if settingState.aTo == const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT: return mixer.music.fadeout(500) - _setSettingState(Const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT) + _setSettingState(const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT) # 其他 - if Tool_Functions.InRect(x, y, ( + if tool_funcs.InRect(x, y, ( w * 807 / 1920, h * 35 / 1080, w * 915 / 1920, h * 97 / 1080 )) and inSettingUI and not editingUserData: - if settingState.aTo == Const.PHIGROS_SETTING_STATE.OTHER: + if settingState.aTo == const.PHIGROS_SETTING_STATE.OTHER: return mixer.music.fadeout(500) - _setSettingState(Const.PHIGROS_SETTING_STATE.OTHER) + _setSettingState(const.PHIGROS_SETTING_STATE.OTHER) # 校准延迟点击扩散的线条 - if settingState.atis_p and Tool_Functions.InRect(x, y, ( + if settingState.atis_p and tool_funcs.InRect(x, y, ( w * 0.6015625, 0.0, w, h )) and inSettingUI: @@ -1704,14 +1704,14 @@ def settingMainClickCallback(x, y): CalibrationClickEffectLines.append((time.time(), mixer_pos)) # 账号与统计 - 编辑 - if settingState.atis_a and Tool_Functions.InRect(x, y, ( + if settingState.atis_a and tool_funcs.InRect(x, y, ( w * 0.85625, h * (181 / 1080), w * 0.921875, h * (220 / 1080) )) and not (showAvatars or showBackgrounds): editingUserData = not editingUserData # 编辑用户名字 - if settingState.atis_a and Tool_Functions.InRect(x, y, editUserNameRect) and editingUserData and not (showAvatars or showBackgrounds): + if settingState.atis_a and tool_funcs.InRect(x, y, editUserNameRect) and editingUserData and not (showAvatars or showBackgrounds): newName = root.run_js_code(f"prompt('请输入新名字', {root.process_code_string_syntax_tocode(getUserData("userdata-userName"))});") if newName is not None: setUserData("userdata-userName", newName) @@ -1719,7 +1719,7 @@ def settingMainClickCallback(x, y): saveUserData(userData) # 编辑用户介绍 - if settingState.atis_a and Tool_Functions.InRect(x, y, editIntroductionRect) and editingUserData and not (showAvatars or showBackgrounds): + if settingState.atis_a and tool_funcs.InRect(x, y, editIntroductionRect) and editingUserData and not (showAvatars or showBackgrounds): newName = root.run_js_code(f"prompt('请输入新介绍 (输入\"\\\\n\"可换行)', {root.process_code_string_syntax_tocode(getUserData("userdata-selfIntroduction").replace("\n", "\\n"))});") if newName is not None: setUserData("userdata-selfIntroduction", newName.replace("\\n", "\n")) @@ -1727,15 +1727,15 @@ def settingMainClickCallback(x, y): saveUserData(userData) # 编辑用户头像 - if settingState.atis_a and Tool_Functions.InRect(x, y, editAvatarRect) and editingUserData and not (showAvatars or showBackgrounds): + if settingState.atis_a and tool_funcs.InRect(x, y, editAvatarRect) and editingUserData and not (showAvatars or showBackgrounds): showAvatars, showAvatarsSt = True, time.time() # 编辑用户背景 - if settingState.atis_a and Tool_Functions.InRect(x, y, editBackgroundRect) and editingUserData and not (showAvatars or showBackgrounds): + if settingState.atis_a and tool_funcs.InRect(x, y, editBackgroundRect) and editingUserData and not (showAvatars or showBackgrounds): showBackgrounds, showBackgroundsSt = True, time.time() # 编辑用户头像/背景 - 关闭 - if settingState.atis_a and Tool_Functions.InRect(x, y, ( + if settingState.atis_a and tool_funcs.InRect(x, y, ( w * 0.9078125 - (w + h) * 0.014 / 2, h * (225 / 1080) - (w + h) * 0.014 / 2, w * 0.9078125 + (w + h) * 0.014 / 2, h * (225 / 1080) + (w + h) * 0.014 / 2 )) and (showAvatars or showBackgrounds): @@ -1743,18 +1743,18 @@ def settingMainClickCallback(x, y): if showBackgrounds: showBackgrounds, showBackgroundsSt = False, time.time() # 音频问题疑难解答 - if settingState.atis_o and Tool_Functions.InRect(x, y, otherSettingButtonRects[0]) and inSettingUI: + if settingState.atis_o and tool_funcs.InRect(x, y, otherSettingButtonRects[0]) and inSettingUI: Resource["UISound_4"].play() unregEvents() nextUI, tonextUI, tonextUISt = audioQARender, True, time.time() # 观看教学 - if settingState.atis_o and Tool_Functions.InRect(x, y, otherSettingButtonRects[1]) and inSettingUI: + if settingState.atis_o and tool_funcs.InRect(x, y, otherSettingButtonRects[1]) and inSettingUI: unregEvents() nextUI, tonextUI, tonextUISt = lambda: chartPlayerRender( - chartAudio = "./Resources/Introduction/audio.mp3", - chartImage = "./Resources/Introduction/image.png", - chartFile = "./Resources/Introduction/chart.json", + chartAudio = "./resources/Introduction/audio.mp3", + chartImage = "./resources/Introduction/image.png", + chartFile = "./resources/Introduction/chart.json", startAnimation = False, chart_information = { "Name": "Introduction", @@ -1770,47 +1770,47 @@ def settingMainClickCallback(x, y): ), True, time.time() # 关于我们 - if settingState.atis_o and Tool_Functions.InRect(x, y, otherSettingButtonRects[2]) and inSettingUI: + if settingState.atis_o and tool_funcs.InRect(x, y, otherSettingButtonRects[2]) and inSettingUI: unregEvents() nextUI, tonextUI, tonextUISt = aboutUsRender, True, time.time() # 开源许可证 - if settingState.atis_o and Tool_Functions.InRect(x, y, otherSettingButtonRects[3]) and inSettingUI: + if settingState.atis_o and tool_funcs.InRect(x, y, otherSettingButtonRects[3]) and inSettingUI: inSettingUI = False ShowOpenSource, ShowOpenSourceSt = True, time.time() settingUIOpenSourceLicenseSlideControler.setDy(settingUIOpenSourceLicenseSlideControler.minValueY) # 隐私政策 - if settingState.atis_o and Tool_Functions.InRect(x, y, otherSettingButtonRects[4]) and inSettingUI: - webbrowser.open(Const.PHIGROS_LINKS.PRIVACYPOLIC) + if settingState.atis_o and tool_funcs.InRect(x, y, otherSettingButtonRects[4]) and inSettingUI: + webbrowser.open(const.PHIGROS_LINKS.PRIVACYPOLIC) # 推特链接 - if settingState.atis_o and Tool_Functions.InRect(x, y, ( + if settingState.atis_o and tool_funcs.InRect(x, y, ( w * 128 / 1920, h * 1015 / 1080, w * 315 / 1920, h * 1042 / 1080 )) and inSettingUI: - webbrowser.open(Const.PHIGROS_LINKS.TWITTER) + webbrowser.open(const.PHIGROS_LINKS.TWITTER) # B站链接 - if settingState.atis_o and Tool_Functions.InRect(x, y, ( + if settingState.atis_o and tool_funcs.InRect(x, y, ( w * 376 / 1920, h * 1015 / 1080, w * 561 / 1920, h * 1042 / 1080 )) and inSettingUI: - webbrowser.open(Const.PHIGROS_LINKS.BILIBILI) + webbrowser.open(const.PHIGROS_LINKS.BILIBILI) # QQ链接 - if settingState.atis_o and Tool_Functions.InRect(x, y, ( + if settingState.atis_o and tool_funcs.InRect(x, y, ( w * 626 / 1920, h * 1015 / 1080, w * 856 / 1920, h * 1042 / 1080 )) and inSettingUI: - webbrowser.open(Const.PHIGROS_LINKS.QQ) + webbrowser.open(const.PHIGROS_LINKS.QQ) # 开源许可证的关闭按钮 - if Tool_Functions.InRect(x, y, (0, 0, ButtonWidth, ButtonHeight)) and ShowOpenSource and time.time() - ShowOpenSourceSt > 0.15: + if tool_funcs.InRect(x, y, (0, 0, ButtonWidth, ButtonHeight)) and ShowOpenSource and time.time() - ShowOpenSourceSt > 0.15: ShowOpenSource, ShowOpenSourceSt = False, float("nan") CloseOpenSource, CloseOpenSourceSt = True, time.time() - settingMainClickEvent = PhigrosGameObject.ClickEvent( + settingMainClickEvent = phigame_obj.ClickEvent( rect = (0, 0, w, h), callback = settingMainClickCallback, once = False @@ -1820,7 +1820,7 @@ def settingMainClickCallback(x, y): settingDx = [0.0, 0.0, 0.0] def getShadowDiagonalXByY(y: float): - return w * Tool_Functions.getDPower(w, h, 75) * ((h - y) / h) + return w * tool_funcs.getDPower(w, h, 75) * ((h - y) / h) def drawOtherSettingButton(x0: float, y0: float, x1: float, y1: float, dpower: float): root.run_js_code( @@ -1937,7 +1937,7 @@ def drawPlaySetting(dx: float, alpha: float): random.seed(st) block_size = noteWidth / 5.5 * (0.4 * math.sin(p * math.pi) + 0.6) for i, deg in enumerate([random.uniform(0, 90) for _ in range(4)]): - effect_random_point = Tool_Functions.rotate_point( + effect_random_point = tool_funcs.rotate_point( w * 0.75, h * 0.85, deg + i * 90, ClickEffect_Size * rpe_easing.ease_funcs[17](p) / 1.35 ) @@ -2003,7 +2003,7 @@ def drawAccountAndCountSetting(dx: float, alpha: float): {root.get_img_jsvarname("userBackground")},\ 0, {(h * 0.425 - w * 0.8609375 / 16 * 9) / 2},\ {w * 0.8609375}, {w * 0.8609375 / 16 * 9},\ - {Tool_Functions.getDPower(w * 0.8609375, h * 0.425, 75)}, 1.0\ + {tool_funcs.getDPower(w * 0.8609375, h * 0.425, 75)}, 1.0\ );", add_code_array = True ) @@ -2012,7 +2012,7 @@ def drawAccountAndCountSetting(dx: float, alpha: float): f"ctx.drawDiagonalRectangleNoFix(\ {w * 0.0796875}, {h * 0.225},\ {w * 0.940625}, {h * 0.65},\ - {Tool_Functions.getDPower(w * 0.8609375, h * 0.425, 75)},\ + {tool_funcs.getDPower(w * 0.8609375, h * 0.425, 75)},\ 'rgba(0, 0, 0, 0.375)'\ );", add_code_array = True @@ -2024,11 +2024,11 @@ def drawAccountAndCountSetting(dx: float, alpha: float): w * 0.8796875, h * (257 / 1080), w * 0.93125, h * (301 / 1080) ) - editBackgroundRectSize = Tool_Functions.getSizeByRect(editBackgroundRect) + editBackgroundRectSize = tool_funcs.getSizeByRect(editBackgroundRect) root.run_js_code( f"ctx.drawDiagonalRectangleNoFix(\ {",".join(map(str, editBackgroundRect))},\ - {Tool_Functions.getDPower(*editBackgroundRectSize, 75)},\ + {tool_funcs.getDPower(*editBackgroundRectSize, 75)},\ 'rgb(255, 255, 255)'\ );", add_code_array = True @@ -2049,7 +2049,7 @@ def drawAccountAndCountSetting(dx: float, alpha: float): f"ctx.drawDiagonalRectangleNoFix(\ {w * 0.0796875}, {h * 0.225},\ {w * ((0.940625 - 0.0796875) * leftBlackDiagonalX + 0.0796875)}, {h * 0.65},\ - {Tool_Functions.getDPower(w * ((0.940625 - 0.0796875) * leftBlackDiagonalX), h * 0.425, 75)},\ + {tool_funcs.getDPower(w * ((0.940625 - 0.0796875) * leftBlackDiagonalX), h * 0.425, 75)},\ 'rgba(0, 0, 0, 0.25)'\ );", add_code_array = True @@ -2059,7 +2059,7 @@ def drawAccountAndCountSetting(dx: float, alpha: float): f"ctx.drawDiagonalRectangleNoFix(\ {w * 0.121875}, {h * (283 / 1080)},\ {w * 0.465625}, {h * (397 / 1080)},\ - {Tool_Functions.getDPower(w * 0.34375, h * (114 / 1080), 75)},\ + {tool_funcs.getDPower(w * 0.34375, h * (114 / 1080), 75)},\ 'rgba(0, 0, 0, 0.9)'\ );", add_code_array = True @@ -2070,7 +2070,7 @@ def drawAccountAndCountSetting(dx: float, alpha: float): w * 0.128125, h * (280 / 1080), w * 0.225, h * (400 / 1080) ) - avatarWidth, avatarHeight = Tool_Functions.getSizeByRect(avatarRect) + avatarWidth, avatarHeight = tool_funcs.getSizeByRect(avatarRect) root.run_js_code( f"ctx.drawDiagonalRectangleClipImage(\ {",".join(map(str, avatarRect))},\ @@ -2078,7 +2078,7 @@ def drawAccountAndCountSetting(dx: float, alpha: float): {(avatarWidth - avatarSize) / 2},\ {(avatarHeight - avatarSize) / 2},\ {avatarSize}, {avatarSize},\ - {Tool_Functions.getDPower(avatarWidth, avatarHeight, 75)}, 1.0\ + {tool_funcs.getDPower(avatarWidth, avatarHeight, 75)}, 1.0\ );", add_code_array = True ) @@ -2091,11 +2091,11 @@ def drawAccountAndCountSetting(dx: float, alpha: float): avatarRect[2], avatarRect[1] + avatarHeight * (1 / 3) ) - editAvatarRectSize = Tool_Functions.getSizeByRect(editAvatarRect) + editAvatarRectSize = tool_funcs.getSizeByRect(editAvatarRect) root.run_js_code( f"ctx.drawDiagonalRectangleNoFix(\ {",".join(map(str, editAvatarRect))},\ - {Tool_Functions.getDPower(*editAvatarRectSize, 75)},\ + {tool_funcs.getDPower(*editAvatarRectSize, 75)},\ 'rgb(255, 255, 255)'\ );", add_code_array = True @@ -2122,7 +2122,7 @@ def drawAccountAndCountSetting(dx: float, alpha: float): ) rankingScoreRect = ( - w * 0.465625 - (w * 0.34375) * Tool_Functions.getDPower(w * 0.34375, h * (114 / 1080), 75), + w * 0.465625 - (w * 0.34375) * tool_funcs.getDPower(w * 0.34375, h * (114 / 1080), 75), h * (357 / 1080), w * 0.5140625, h * (397 / 1080) @@ -2130,7 +2130,7 @@ def drawAccountAndCountSetting(dx: float, alpha: float): root.run_js_code( # 这个矩形真头疼... f"ctx.drawDiagonalRectangleNoFix(\ {",".join(map(str, rankingScoreRect))},\ - {Tool_Functions.getDPower(rankingScoreRect[2] - rankingScoreRect[0], rankingScoreRect[3] - rankingScoreRect[1], 75)},\ + {tool_funcs.getDPower(rankingScoreRect[2] - rankingScoreRect[0], rankingScoreRect[3] - rankingScoreRect[1], 75)},\ 'rgb(255, 255, 255)'\ );", add_code_array = True @@ -2165,7 +2165,7 @@ def drawAccountAndCountSetting(dx: float, alpha: float): root.run_js_code( f"ctx.drawDiagonalRectangleNoFix(\ {",".join(map(str, editButtonRect))},\ - {Tool_Functions.getDPower(editButtonRect[2] - editButtonRect[0], editButtonRect[3] - editButtonRect[1], 75)},\ + {tool_funcs.getDPower(editButtonRect[2] - editButtonRect[0], editButtonRect[3] - editButtonRect[1], 75)},\ 'rgb(255, 255, 255)'\ );", add_code_array = True @@ -2198,7 +2198,7 @@ def drawAccountAndCountSetting(dx: float, alpha: float): root.run_js_code( f"ctx.drawDiagonalRectangleNoFix(\ {",".join(map(str, loginButtonRect))},\ - {Tool_Functions.getDPower(loginButtonRect[2] - loginButtonRect[0], loginButtonRect[3] - loginButtonRect[1], 75)},\ + {tool_funcs.getDPower(loginButtonRect[2] - loginButtonRect[0], loginButtonRect[3] - loginButtonRect[1], 75)},\ 'rgba(255, 255, 255, {1.0 if not editingUserData else 0.75})'\ );", add_code_array = True @@ -2211,7 +2211,7 @@ def drawAccountAndCountSetting(dx: float, alpha: float): {((loginButtonRect[2] - loginButtonRect[0]) - TapTapIconWidth) / 2},\ {((loginButtonRect[3] - loginButtonRect[1]) - TapTapIconHeight) / 2},\ {TapTapIconWidth}, {TapTapIconHeight},\ - {Tool_Functions.getDPower(loginButtonRect[2] - loginButtonRect[0], loginButtonRect[3] - loginButtonRect[1], 75)},\ + {tool_funcs.getDPower(loginButtonRect[2] - loginButtonRect[0], loginButtonRect[3] - loginButtonRect[1], 75)},\ {1.0 if not editingUserData else 0.75}\ );", add_code_array = True @@ -2224,7 +2224,7 @@ def drawAccountAndCountSetting(dx: float, alpha: float): root.run_js_code( f"ctx.drawDiagonalRectangleNoFix(\ {",".join(map(str, chartDataDifRect))},\ - {Tool_Functions.getDPower(chartDataDifRect[2] - chartDataDifRect[0], chartDataDifRect[3] - chartDataDifRect[1], 75)},\ + {tool_funcs.getDPower(chartDataDifRect[2] - chartDataDifRect[0], chartDataDifRect[3] - chartDataDifRect[1], 75)},\ 'rgb(255, 255, 255)'\ );", add_code_array = True @@ -2241,7 +2241,7 @@ def drawAccountAndCountSetting(dx: float, alpha: float): ) chartDataRect = ( - chartDataDifRect[2] - Tool_Functions.getDPower(chartDataDifRect[2] - chartDataDifRect[0], chartDataDifRect[3] - chartDataDifRect[1], 75) * (chartDataDifRect[2] - chartDataDifRect[0]) * (77 / 85), + chartDataDifRect[2] - tool_funcs.getDPower(chartDataDifRect[2] - chartDataDifRect[0], chartDataDifRect[3] - chartDataDifRect[1], 75) * (chartDataDifRect[2] - chartDataDifRect[0]) * (77 / 85), chartDataDifRect[1] + (chartDataDifRect[3] - chartDataDifRect[1]) * (9 / 85), w * 0.871875, chartDataDifRect[1] + (chartDataDifRect[3] - chartDataDifRect[1]) * (77 / 85), @@ -2249,7 +2249,7 @@ def drawAccountAndCountSetting(dx: float, alpha: float): root.run_js_code( f"ctx.drawDiagonalRectangleNoFix(\ {",".join(map(str, chartDataRect))},\ - {Tool_Functions.getDPower(chartDataRect[2] - chartDataRect[0], chartDataRect[3] - chartDataRect[1], 75)},\ + {tool_funcs.getDPower(chartDataRect[2] - chartDataRect[0], chartDataRect[3] - chartDataRect[1], 75)},\ 'rgb(0, 0, 0, 0.45)'\ );", add_code_array = True @@ -2331,8 +2331,8 @@ def _strokeRect(rect): def _drawChooseDialog(p: float, text: str): top = h - (905 / 1080) * h * p - settingShadowRect = Const.PHIGROS_SETTING_SHADOW_XRECT_MAP[Const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT] - settingShadowDPower = Tool_Functions.getDPower((settingShadowRect[1] - settingShadowRect[0]) * w, h, 75) + settingShadowRect = const.PHIGROS_SETTING_SHADOW_XRECT_MAP[const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT] + settingShadowDPower = tool_funcs.getDPower((settingShadowRect[1] - settingShadowRect[0]) * w, h, 75) settingShadowDWidth = (settingShadowRect[1] - settingShadowRect[0]) * w * settingShadowDPower chooseDialogLeftX = settingShadowRect[0] * w chooseDialogRightX = settingShadowRect[1] * w - settingShadowDWidth + settingShadowDWidth * (h - top) / h @@ -2344,7 +2344,7 @@ def _drawChooseDialog(p: float, text: str): root.run_js_code( f"ctx.save(); ctx.clipDiagonalRectangle(\ {",".join(map(str, chooseDialogRect))},\ - {Tool_Functions.getDPower(*Tool_Functions.getSizeByRect(chooseDialogRect), 75)},\ + {tool_funcs.getDPower(*tool_funcs.getSizeByRect(chooseDialogRect), 75)},\ );", add_code_array = True ) @@ -2354,7 +2354,7 @@ def _drawChooseDialog(p: float, text: str): root.run_js_code( f"ctx.drawDiagonalRectangleNoFix(\ {",".join(map(str, chooseDialogRect))},\ - {Tool_Functions.getDPower(*Tool_Functions.getSizeByRect(chooseDialogRect), 75)},\ + {tool_funcs.getDPower(*tool_funcs.getSizeByRect(chooseDialogRect), 75)},\ 'rgba(0, 0, 0, 0.65)'\ );", add_code_array = True @@ -2387,14 +2387,14 @@ def _drawChooseDialog(p: float, text: str): ) if showAvatars: - p = Tool_Functions.fixOutofRangeP((time.time() - showAvatarsSt) / 1.25) + p = tool_funcs.fixOutofRangeP((time.time() - showAvatarsSt) / 1.25) _drawChooseDialog(1.0 - (1.0 - p) ** 12, "选择头像") elif not showAvatars and time.time() - showAvatarsSt <= 1.25: p = (time.time() - showAvatarsSt) / 1.25 _drawChooseDialog((p - 1.0) ** 12, "选择头像") if showBackgrounds: - p = Tool_Functions.fixOutofRangeP((time.time() - showBackgroundsSt) / 1.25) + p = tool_funcs.fixOutofRangeP((time.time() - showBackgroundsSt) / 1.25) _drawChooseDialog(1.0 - (1.0 - p) ** 12, "选择背景") elif not showBackgrounds and time.time() - showBackgroundsSt <= 1.25: p = (time.time() - showBackgroundsSt) / 1.25 @@ -2435,7 +2435,7 @@ def drawOtherSetting(dx: float, alpha: float): root.create_text( w * 0.5703125, h * (308 / 1080), - f"Version: {Const.PHIGROS_VERSION}", + f"Version: {const.PHIGROS_VERSION}", font = f"{(w + h) /125}px PhigrosFont", textAlign = "left", textBaseline = "middle", @@ -2445,7 +2445,7 @@ def drawOtherSetting(dx: float, alpha: float): root.create_text( w * 0.5703125, h * (361 / 1080), - f"Device: {Const.DEVICE}", + f"Device: {const.DEVICE}", font = f"{(w + h) /125}px PhigrosFont", textAlign = "left", textBaseline = "middle", @@ -2453,7 +2453,7 @@ def drawOtherSetting(dx: float, alpha: float): wait_execute = True ) - settingOtherButtonDPower = Tool_Functions.getDPower(90, 50, 75) + settingOtherButtonDPower = tool_funcs.getDPower(90, 50, 75) root.create_text( w * (0.0515625 + 0.0265625) + getShadowDiagonalXByY(h * 0.575), @@ -2516,7 +2516,7 @@ def drawOtherSetting(dx: float, alpha: float): root.create_text( w * 0.5453125, h * (1031 / 1080), - Const.OTHERSERTTING_RIGHTDOWN_TEXT, + const.OTHERSERTTING_RIGHTDOWN_TEXT, font = f"{(w + h) / 135}px PhigrosFont", textAlign = "left", textBaseline = "middle", @@ -2535,7 +2535,7 @@ def drawOtherSetting(dx: float, alpha: float): root.create_text( w * 0.0875, h * (1031 / 1080), - Const.OTHER_SETTING_LB_STRINGS.TWITTER, + const.OTHER_SETTING_LB_STRINGS.TWITTER, font = f"{(w + h) / 135}px PhigrosFont", textAlign = "left", textBaseline = "middle", @@ -2554,7 +2554,7 @@ def drawOtherSetting(dx: float, alpha: float): root.create_text( w * 0.2171875, h * (1031 / 1080), - Const.OTHER_SETTING_LB_STRINGS.BILIBILI, + const.OTHER_SETTING_LB_STRINGS.BILIBILI, font = f"{(w + h) / 135}px PhigrosFont", textAlign = "left", textBaseline = "middle", @@ -2573,7 +2573,7 @@ def drawOtherSetting(dx: float, alpha: float): root.create_text( w * 0.346875, h * (1031 / 1080), - Const.OTHER_SETTING_LB_STRINGS.QQ, + const.OTHER_SETTING_LB_STRINGS.QQ, font = f"{(w + h) / 135}px PhigrosFont", textAlign = "left", textBaseline = "middle", @@ -2589,13 +2589,13 @@ def drawOtherSetting(dx: float, alpha: float): SettingPlayWidgetEventManager.widgets.clear() PlaySettingWidgets.clear() PlaySettingWidgets.update({ - "OffsetLabel": PhigrosGameObject.PhiLabel( + "OffsetLabel": phigame_obj.PhiLabel( left_text = "谱面延时", right_text = "", fontsize = (w + h) / 75, color = "#FFFFFF" ), - "OffsetSlider": PhigrosGameObject.PhiSlider( + "OffsetSlider": phigame_obj.PhiSlider( tonext = h * (-67 / 1080), value = getUserData("setting-chartOffset"), number_points = ( @@ -2609,91 +2609,91 @@ def drawOtherSetting(dx: float, alpha: float): numberType = int, command = updateConfig ), - "OffsetTip": PhigrosGameObject.PhiLabel( + "OffsetTip": phigame_obj.PhiLabel( left_text = "", right_text = "", fontsize = (w + h) / 150, color = "rgba(255, 255, 255, 0.6)" ), - "NoteScaleLabel": PhigrosGameObject.PhiLabel( + "NoteScaleLabel": phigame_obj.PhiLabel( left_text = "按键缩放", right_text = "", fontsize = (w + h) / 75, color = "#FFFFFF" ), - "NoteScaleSlider": PhigrosGameObject.PhiSlider( + "NoteScaleSlider": phigame_obj.PhiSlider( value = getUserData("setting-noteScale"), number_points = ((0.0, 1.0), (1.0, 1.29)), lr_button = False, command = updateConfig ), - "BackgroundDimLabel": PhigrosGameObject.PhiLabel( + "BackgroundDimLabel": phigame_obj.PhiLabel( left_text = "背景亮度", right_text = "", fontsize = (w + h) / 75, color = "#FFFFFF" ), - "BackgroundDimSlider": PhigrosGameObject.PhiSlider( + "BackgroundDimSlider": phigame_obj.PhiSlider( value = getUserData("setting-backgroundDim"), number_points = ((0.0, 0.05), (1.0, 0.4)), lr_button = False, command = updateConfig ), - "ClickSoundCheckbox": PhigrosGameObject.PhiCheckbox( + "ClickSoundCheckbox": phigame_obj.PhiCheckbox( text = "打开打击音效", fontsize = (w + h) / 75, checked = getUserData("setting-enableClickSound"), command = updateConfig ), - "MusicVolumeLabel": PhigrosGameObject.PhiLabel( + "MusicVolumeLabel": phigame_obj.PhiLabel( left_text = "音乐音量", right_text = "", fontsize = (w + h) / 75, color = "#FFFFFF" ), - "MusicVolumeSlider": PhigrosGameObject.PhiSlider( + "MusicVolumeSlider": phigame_obj.PhiSlider( value = getUserData("setting-musicVolume"), number_points = ((0.0, 0.0), (1.0, 1.0)), lr_button = False, command = updateConfig ), - "UISoundVolumeLabel": PhigrosGameObject.PhiLabel( + "UISoundVolumeLabel": phigame_obj.PhiLabel( left_text = "界面音效音量", right_text = "", fontsize = (w + h) / 75, color = "#FFFFFF" ), - "UISoundVolumeSlider": PhigrosGameObject.PhiSlider( + "UISoundVolumeSlider": phigame_obj.PhiSlider( value = getUserData("setting-uiVolume"), number_points = ((0.0, 0.0), (1.0, 1.0)), lr_button = False, command = updateConfig ), - "ClickSoundVolumeLabel": PhigrosGameObject.PhiLabel( + "ClickSoundVolumeLabel": phigame_obj.PhiLabel( left_text = "打击音效音量", right_text = "", fontsize = (w + h) / 75, color = "#FFFFFF" ), - "ClickSoundVolumeSlider": PhigrosGameObject.PhiSlider( + "ClickSoundVolumeSlider": phigame_obj.PhiSlider( value = getUserData("setting-clickSoundVolume"), number_points = ((0.0, 0.0), (1.0, 1.0)), lr_button = False, command = updateConfig ), - "MorebetsAuxiliaryCheckbox": PhigrosGameObject.PhiCheckbox( + "MorebetsAuxiliaryCheckbox": phigame_obj.PhiCheckbox( text = "开启多押辅助", fontsize = (w + h) / 75, checked = getUserData("setting-enableMorebetsAuxiliary"), command = updateConfig ), - "FCAPIndicatorCheckbox": PhigrosGameObject.PhiCheckbox( + "FCAPIndicatorCheckbox": phigame_obj.PhiCheckbox( text = "开启FC/AP指示器", fontsize = (w + h) / 75, checked = getUserData("setting-enableFCAPIndicator"), command = updateConfig ), - "LowQualityCheckbox": PhigrosGameObject.PhiCheckbox( + "LowQualityCheckbox": phigame_obj.PhiCheckbox( text = "低分辨率模式", fontsize = (w + h) / 75, checked = getUserData("setting-enableLowQuality"), @@ -2721,7 +2721,7 @@ def drawOtherSetting(dx: float, alpha: float): ShadowXRect[0] * w, 0.0, ShadowXRect[1] * w, h ) - ShadowDPower = Tool_Functions.getDPower(ShadowRect[2] - ShadowRect[0], h, 75) + ShadowDPower = tool_funcs.getDPower(ShadowRect[2] - ShadowRect[0], h, 75) root.run_js_code( f"ctx.drawDiagonalRectangleNoFix(\ @@ -2733,7 +2733,7 @@ def drawOtherSetting(dx: float, alpha: float): BarWidth = settingState.getBarWidth() * w BarHeight = h * (2 / 27) - BarDPower = Tool_Functions.getDPower(BarWidth, BarHeight, 75) + BarDPower = tool_funcs.getDPower(BarWidth, BarHeight, 75) BarRect = ( w * 0.153125, h * 0.025, w * 0.153125 + BarWidth, h * 0.025 + BarHeight @@ -2751,7 +2751,7 @@ def drawOtherSetting(dx: float, alpha: float): LabelWidth = settingState.getLabelWidth() * w LabelHeight = h * (113 / 1080) - LabelDPower = Tool_Functions.getDPower(LabelWidth, LabelHeight, 75) + LabelDPower = tool_funcs.getDPower(LabelWidth, LabelHeight, 75) LabelX = settingState.getLabelX() * w LabelRect = ( LabelX, h * 1 / 108, @@ -2766,12 +2766,12 @@ def drawOtherSetting(dx: float, alpha: float): add_code_array = True ) - PlayTextColor = settingState.getTextColor(Const.PHIGROS_SETTING_STATE.PLAY) + (BarAlpha, ) - AccountAndCountTextColor = settingState.getTextColor(Const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT) + (BarAlpha, ) - OtherTextColor = settingState.getTextColor(Const.PHIGROS_SETTING_STATE.OTHER) + (BarAlpha, ) - PlayTextFontScale = settingState.getTextScale(Const.PHIGROS_SETTING_STATE.PLAY) - AccountAndCountTextFontScale = settingState.getTextScale(Const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT) - OtherTextFontScale = settingState.getTextScale(Const.PHIGROS_SETTING_STATE.OTHER) + PlayTextColor = settingState.getTextColor(const.PHIGROS_SETTING_STATE.PLAY) + (BarAlpha, ) + AccountAndCountTextColor = settingState.getTextColor(const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT) + (BarAlpha, ) + OtherTextColor = settingState.getTextColor(const.PHIGROS_SETTING_STATE.OTHER) + (BarAlpha, ) + PlayTextFontScale = settingState.getTextScale(const.PHIGROS_SETTING_STATE.PLAY) + AccountAndCountTextFontScale = settingState.getTextScale(const.PHIGROS_SETTING_STATE.ACCOUNT_AND_COUNT) + OtherTextFontScale = settingState.getTextScale(const.PHIGROS_SETTING_STATE.OTHER) settingTextY = h * 0.025 + BarHeight / 2 root.create_text( @@ -2817,10 +2817,10 @@ def drawOtherSetting(dx: float, alpha: float): root.run_js_code("dialog_canvas_ctx.clear()", add_code_array = True) if ShowOpenSource: - p = Tool_Functions.fixOutofRangeP((time.time() - ShowOpenSourceSt) / 0.15) + p = tool_funcs.fixOutofRangeP((time.time() - ShowOpenSourceSt) / 0.15) p = 1.0 - (1.0 - p) ** 3 else: # CloseOpenSource - p = Tool_Functions.fixOutofRangeP((time.time() - CloseOpenSourceSt) / 0.35) + p = tool_funcs.fixOutofRangeP((time.time() - CloseOpenSourceSt) / 0.35) p = abs(p - 1.0) ** 3 if ShowOpenSource or CloseOpenSource: @@ -2833,7 +2833,7 @@ def drawOtherSetting(dx: float, alpha: float): root.run_js_code( f"ctx.drawRectMultilineText(\ {w * 0.2}, {settingUIOpenSourceLicenseSlideControler.getDy() + h * (143 / 1080)}, {w * 0.8}, {h},\ - {root.process_code_string_syntax_tocode(Const.PHI_OPENSOURCELICENSE)},\ + {root.process_code_string_syntax_tocode(const.PHI_OPENSOURCELICENSE)},\ 'rgb(255, 255, 255)', '{(w + h) / 145}px PhigrosFont', {(w + h) / 145}, 1.25\ );", add_code_array = True @@ -2889,7 +2889,7 @@ def clickBackButtonCallback(*args): mixer.music.fadeout(500) Resource["UISound_4"].play() - clickBackButtonEvent = PhigrosGameObject.ClickEvent( + clickBackButtonEvent = phigame_obj.ClickEvent( rect = (0, 0, ButtonWidth, ButtonHeight), callback = clickBackButtonCallback, once = False @@ -2899,13 +2899,13 @@ def clickBackButtonCallback(*args): dspSettingWidgetEventManager.widgets.clear() dspSettingWidgets.clear() dspSettingWidgets.update({ - "ValueLabel": PhigrosGameObject.PhiLabel( + "ValueLabel": phigame_obj.PhiLabel( left_text = "DSP Buffer", right_text = "", fontsize = (w + h) / 75, color = "#FFFFFF" ), - "ValueSlider": PhigrosGameObject.PhiSlider( + "ValueSlider": phigame_obj.PhiSlider( value = getUserData("internal-dspBufferExponential"), number_points = [(0.0, 7.0), (1.0, 12.0)], lr_button = False, @@ -2913,11 +2913,11 @@ def clickBackButtonCallback(*args): numberType = int, command = updateConfig ), - "PlayButton": PhigrosGameObject.PhiButton( + "PlayButton": phigame_obj.PhiButton( text = "播放音频", fontsize = (w + h) / 75, width = w * 0.19375, - command = lambda: (mixer.music.load("./Resources/TouchToStart.mp3"), mixer.music.play()) + command = lambda: (mixer.music.load("./resources/TouchToStart.mp3"), mixer.music.play()) ) }) @@ -2943,14 +2943,14 @@ def clickBackButtonCallback(*args): root.run_js_code( f"ctx.drawDiagonalRectangleNoFix(\ {",".join(map(str, shadowRect))},\ - {Tool_Functions.getDPower(*Tool_Functions.getSizeByRect(shadowRect), 75)}, 'rgba(0, 0, 0, 0.25)'\ + {tool_funcs.getDPower(*tool_funcs.getSizeByRect(shadowRect), 75)}, 'rgba(0, 0, 0, 0.25)'\ );", add_code_array = True ) renderPhigrosWidgets( dspSettingWidgets.values(), w * 0.275, h * (665 / 1080), 0.0, - lambda y: ((y - h * (665 / 1080)) / h) * (Tool_Functions.getSizeByRect(shadowRect)[0] * Tool_Functions.getDPower(*Tool_Functions.getSizeByRect(shadowRect), 75)), + lambda y: ((y - h * (665 / 1080)) / h) * (tool_funcs.getSizeByRect(shadowRect)[0] * tool_funcs.getDPower(*tool_funcs.getSizeByRect(shadowRect), 75)), w * 0.425, 0.0, h ) @@ -2967,7 +2967,7 @@ def clickBackButtonCallback(*args): root.run_js_code( f"ctx.drawRectMultilineTextDiagonal(\ {w * 0.28125}, {h * (241 / 1080)},\ - {w * 0.7984375}, {h}, {root.process_code_string_syntax_tocode(Const.DSP_SETTING_TIP)},\ + {w * 0.7984375}, {h}, {root.process_code_string_syntax_tocode(const.DSP_SETTING_TIP)},\ 'rgb(255, 255, 255)',\ '{(w + h) / 120}px PhigrosFont', {(w + h) / 120}, {- w * 0.0046875}, 1.25\ );", @@ -3059,14 +3059,14 @@ def clickStartButtonCallback(*args): if clickedStart: if not mixer.music.get_busy(): - mixer.music.load("./Resources/AboutUs.mp3") + mixer.music.load("./resources/AboutUs.mp3") mixer.music.play(-1) dy = h - h * ((time.time() - clickedStartButtonTime) / 12.5) fontsize = (w + h) / 102.5 root.run_js_code( f"aboutus_textheight = ctx.drawRectMultilineTextCenter(\ {w * 0.05}, {dy}, {w * 0.95}, {h},\ - {root.process_code_string_syntax_tocode(Const.PHI_ABOUTUSTEXT)},\ + {root.process_code_string_syntax_tocode(const.PHI_ABOUTUSTEXT)},\ 'rgb(255, 255, 255)', '{fontsize}px PhigrosFont', {fontsize}, 1.4\ );", add_code_array = True @@ -3138,13 +3138,13 @@ def chartPlayerRender( chart_information["BackgroundDim"] = getUserData("setting-backgroundDim") chartJsonData: dict = json.loads(open(chartFile, "r", encoding="utf-8").read()) - CHART_TYPE = Const.CHART_TYPE.PHI if "formatVersion" in chartJsonData else Const.CHART_TYPE.RPE - if CHART_TYPE == Const.CHART_TYPE.PHI: chartJsonData["offset"] += getUserData("setting-chartOffset") / 1000 - elif CHART_TYPE == Const.CHART_TYPE.RPE: chartJsonData["META"]["offset"] += getUserData("setting-chartOffset") - chart_obj = Chart_Functions_Phi.Load_Chart_Object(chartJsonData) if CHART_TYPE == Const.CHART_TYPE.PHI else Chart_Functions_Rpe.Load_Chart_Object(chartJsonData) + CHART_TYPE = const.CHART_TYPE.PHI if "formatVersion" in chartJsonData else const.CHART_TYPE.RPE + if CHART_TYPE == const.CHART_TYPE.PHI: chartJsonData["offset"] += getUserData("setting-chartOffset") / 1000 + elif CHART_TYPE == const.CHART_TYPE.RPE: chartJsonData["META"]["offset"] += getUserData("setting-chartOffset") + chart_obj = chartfuncs_phi.Load_Chart_Object(chartJsonData) if CHART_TYPE == const.CHART_TYPE.PHI else chartfuncs_rpe.Load_Chart_Object(chartJsonData) mixer.music.load(chartAudio) raw_audio_length = mixer.Sound(chartAudio).get_length() - audio_length = raw_audio_length + (chart_obj.META.offset / 1000 if CHART_TYPE == Const.CHART_TYPE.RPE else 0.0) + audio_length = raw_audio_length + (chart_obj.META.offset / 1000 if CHART_TYPE == const.CHART_TYPE.RPE else 0.0) root.run_js_code("delete background; delete begin_animation_image; delete finish_animation_image;") chart_image = Image.open(chartImage) @@ -3158,19 +3158,19 @@ def chartPlayerRender( finish_animation_image_mask.putpixel((0, 2), (0, 0, 0, 64)) animation_image = chart_image.copy().convert("RGBA") - Tool_Functions.cutAnimationIllImage(animation_image) + tool_funcs.cutAnimationIllImage(animation_image) finish_animation_image = chart_image.copy().convert("RGBA") finish_animation_image_mask = finish_animation_image_mask.resize(finish_animation_image.size) finish_animation_image.paste(finish_animation_image_mask, (0, 0), finish_animation_image_mask) - Tool_Functions.cutAnimationIllImage(finish_animation_image) + tool_funcs.cutAnimationIllImage(finish_animation_image) root.reg_img(animation_image, "begin_animation_image") root.reg_img(finish_animation_image, "finish_animation_image") root.load_allimg() - coreConfig = PhiCore.PhiCoreConfigure( + coreConfig = phicore.PhiCoreConfigure( SETTER = lambda vn, vv: globals().update({vn: vv}), root = root, w = w, h = h, chart_information = chart_information, @@ -3197,18 +3197,18 @@ def chartPlayerRender( combotips = "Combo", noplaychart = False, clicksound_volume = getUserData("setting-clickSoundVolume"), ) - PhiCore.CoreConfig(coreConfig) + phicore.CoreConfig(coreConfig) if startAnimation: - PhiCore.Begin_Animation(False, foregroundFrameRender) + phicore.Begin_Animation(False, foregroundFrameRender) - playChartThreadEvent, playChartThreadStopEvent = PhiCore.PlayChart_ThreadFunction() + playChartThreadEvent, playChartThreadStopEvent = phicore.PlayChart_ThreadFunction() playChartThreadEvent.wait() playChartThreadEvent.clear() show_start_time = time.time() coreConfig.show_start_time = show_start_time - PhiCore.CoreConfig(coreConfig) + phicore.CoreConfig(coreConfig) def clickEventCallback(x, y): global show_start_time @@ -3217,8 +3217,8 @@ def clickEventCallback(x, y): if rendingAnimationSt != rendingAnimationSt: # nan, playing chart pauseATime = 0.25 if paused else 3.0 - pauseP = Tool_Functions.fixOutofRangeP((time.time() - pauseAnimationSt) / pauseATime) - if not paused and Tool_Functions.InRect(x, y, ( + pauseP = tool_funcs.fixOutofRangeP((time.time() - pauseAnimationSt) / pauseATime) + if not paused and tool_funcs.InRect(x, y, ( w * 9.6 / 1920, h * -1.0 / 1080, w * 96 / 1920, h * 102.6 / 1080 )) and (time.time() - chartPlayerRenderSt) > 1.25 and pauseP == 1.0: @@ -3228,7 +3228,7 @@ def clickEventCallback(x, y): pauseSt = time.time() pauseUIButtonR = (w + h) * 0.0275 - if paused and Tool_Functions.InRect(x, y, ( + if paused and tool_funcs.InRect(x, y, ( w * 0.5 - w * 0.1109375 - pauseUIButtonR / 2, h * 0.5 - pauseUIButtonR / 2, w * 0.5 - w * 0.1109375 + pauseUIButtonR / 2, @@ -3236,7 +3236,7 @@ def clickEventCallback(x, y): )): eventManager.unregEvent(clickEvent) tonextUI, tonextUISt = True, time.time() - elif paused and Tool_Functions.InRect(x, y, ( + elif paused and tool_funcs.InRect(x, y, ( w * 0.5 - pauseUIButtonR / 2, h * 0.5 - pauseUIButtonR / 2, w * 0.5 + pauseUIButtonR / 2, @@ -3254,7 +3254,7 @@ def clickEventCallback(x, y): foregroundFrameRender = lambda: None, nextUI = nextUIBak ), True, time.time() - elif paused and Tool_Functions.InRect(x, y, ( + elif paused and tool_funcs.InRect(x, y, ( w * 0.5 + w * 0.1109375 - pauseUIButtonR / 2, h * 0.5 - pauseUIButtonR / 2, w * 0.5 + w * 0.1109375 + pauseUIButtonR / 2, @@ -3262,12 +3262,12 @@ def clickEventCallback(x, y): )): paused, pauseAnimationSt = False, time.time() - if rendingAnimation is not PhiCore.Chart_Finish_Animation_Frame or (time.time() - rendingAnimationSt) <= 0.5: + if rendingAnimation is not phicore.Chart_Finish_Animation_Frame or (time.time() - rendingAnimationSt) <= 0.5: return - if Tool_Functions.InRect(x, y, ( + if tool_funcs.InRect(x, y, ( 0, 0, - w * Const.FINISH_UI_BUTTON_SIZE, w * Const.FINISH_UI_BUTTON_SIZE / 190 * 145 + w * const.FINISH_UI_BUTTON_SIZE, w * const.FINISH_UI_BUTTON_SIZE / 190 * 145 )): eventManager.unregEvent(clickEvent) nextUIBak = nextUI @@ -3282,8 +3282,8 @@ def clickEventCallback(x, y): nextUI = nextUIBak ), True, time.time() mixer.music.fadeout(500) - elif Tool_Functions.InRect(x, y, ( - w - w * Const.FINISH_UI_BUTTON_SIZE, h - w * Const.FINISH_UI_BUTTON_SIZE / 190 * 145, + elif tool_funcs.InRect(x, y, ( + w - w * const.FINISH_UI_BUTTON_SIZE, h - w * const.FINISH_UI_BUTTON_SIZE / 190 * 145, w, h )): eventManager.unregEvent(clickEvent) @@ -3295,14 +3295,14 @@ def clickEventCallback(x, y): # 前面初始化时间太长了, 放这里 chartPlayerRenderSt = time.time() nextUI, tonextUI, tonextUISt = nextUI, False, float("nan") - rendingAnimation = PhiCore.Chart_BeforeFinish_Animation_Frame + rendingAnimation = phicore.Chart_BeforeFinish_Animation_Frame rendingAnimationSt = float("nan") stoped = False paused, pauseAnimationSt, pauseSt = False, 0.0, float("nan") mixer.music.play() while True: pauseATime = 0.25 if paused else 3.0 - pauseP = Tool_Functions.fixOutofRangeP((time.time() - pauseAnimationSt) / pauseATime) + pauseP = tool_funcs.fixOutofRangeP((time.time() - pauseAnimationSt) / pauseATime) pauseBgBlurP = (1.0 - (1.0 - pauseP) ** 4) if paused else 1.0 - pauseP ** 15 root.run_js_code(f"mask.style.backdropFilter = 'blur({(w + h) / 100 * pauseBgBlurP}px)';", add_code_array = True) @@ -3356,7 +3356,7 @@ def _drawNumber(number: str, dxv: float): mixer.music.unpause() show_start_time += time.time() - pauseSt coreConfig.show_start_time = show_start_time - PhiCore.CoreConfig(coreConfig) + phicore.CoreConfig(coreConfig) pauseSt = float("nan") if not paused and pauseP == 1.0: @@ -3364,33 +3364,33 @@ def _drawNumber(number: str, dxv: float): if not stoped: now_t = time.time() - show_start_time - if CHART_TYPE == Const.CHART_TYPE.PHI: - Task = PhiCore.GetFrameRenderTask_Phi(now_t, False, False) - elif CHART_TYPE == Const.CHART_TYPE.RPE: - Task = PhiCore.GetFrameRenderTask_Rpe(now_t, False, False) + if CHART_TYPE == const.CHART_TYPE.PHI: + Task = phicore.GetFrameRenderTask_Phi(now_t, False, False) + elif CHART_TYPE == const.CHART_TYPE.RPE: + Task = phicore.GetFrameRenderTask_Rpe(now_t, False, False) Task.ExecTask() - break_flag = Chart_Functions_Phi.FrameData_ProcessExTask( + break_flag = chartfuncs_phi.FrameData_ProcessExTask( Task.ExTask, lambda x: eval(x) ) if break_flag and not stoped: - PhiCore.initFinishAnimation() + phicore.initFinishAnimation() rendingAnimationSt = time.time() stoped = True else: - if rendingAnimation is PhiCore.Chart_BeforeFinish_Animation_Frame: + if rendingAnimation is phicore.Chart_BeforeFinish_Animation_Frame: if time.time() - rendingAnimationSt <= 0.75: rendingAnimation((time.time() - rendingAnimationSt) / 0.75, globals()["PhigrosPlayManagerObject"].getCombo(), False) else: - rendingAnimation, rendingAnimationSt = PhiCore.Chart_Finish_Animation_Frame, time.time() - mixer.music.load("./Resources/Over.mp3") + rendingAnimation, rendingAnimationSt = phicore.Chart_Finish_Animation_Frame, time.time() + mixer.music.load("./resources/Over.mp3") Thread(target=lambda: (time.sleep(0.25), mixer.music.play(-1)), daemon=True).start() - if rendingAnimation is PhiCore.Chart_Finish_Animation_Frame: # 不能用elif, 不然会少渲染一个帧 - rendingAnimation(Tool_Functions.fixOutofRangeP((time.time() - rendingAnimationSt) / 3.5), False) + if rendingAnimation is phicore.Chart_Finish_Animation_Frame: # 不能用elif, 不然会少渲染一个帧 + rendingAnimation(tool_funcs.fixOutofRangeP((time.time() - rendingAnimationSt) / 3.5), False) if time.time() - chartPlayerRenderSt < 1.25 and blackIn: p = (time.time() - chartPlayerRenderSt) / 1.25 @@ -3531,7 +3531,7 @@ def applyConfig(): Load_Chapters() Resource = Load_Resource() -eventManager = PhigrosGameObject.EventManager() +eventManager = phigame_obj.EventManager() bindEvents() updateFontSizes() applyConfig() diff --git a/PlaySound.py b/src/playsound.py similarity index 100% rename from PlaySound.py rename to src/playsound.py diff --git a/ppr_help.py b/src/ppr_help.py similarity index 98% rename from ppr_help.py rename to src/ppr_help.py index 25c2e71..e01399a 100644 --- a/ppr_help.py +++ b/src/ppr_help.py @@ -1,5 +1,5 @@ HELP_EN = '''\ -Usage: Main [...] [...] +Usage: main [...] [...] --hideconsole: Hide the console window. @@ -46,7 +46,7 @@ ''' HELP_ZH = '''\ -使用: Main <谱面文件> [<参数>...] [<关键字参数>...] +使用: main <谱面文件> [<参数>...] [<关键字参数>...] <参数> --hideconsole: 隐藏控制台窗口 diff --git a/Resources/AboutUs.mp3 b/src/resources/AboutUs.mp3 similarity index 100% rename from Resources/AboutUs.mp3 rename to src/resources/AboutUs.mp3 diff --git a/Resources/AllSongBlur.png b/src/resources/AllSongBlur.png similarity index 100% rename from Resources/AllSongBlur.png rename to src/resources/AllSongBlur.png diff --git a/Resources/Arrow_Left.png b/src/resources/Arrow_Left.png similarity index 100% rename from Resources/Arrow_Left.png rename to src/resources/Arrow_Left.png diff --git a/Resources/Arrow_Left_Black.png b/src/resources/Arrow_Left_Black.png similarity index 100% rename from Resources/Arrow_Left_Black.png rename to src/resources/Arrow_Left_Black.png diff --git a/Resources/Arrow_Right.png b/src/resources/Arrow_Right.png similarity index 100% rename from Resources/Arrow_Right.png rename to src/resources/Arrow_Right.png diff --git a/Resources/Arrow_Right_Black.png b/src/resources/Arrow_Right_Black.png similarity index 100% rename from Resources/Arrow_Right_Black.png rename to src/resources/Arrow_Right_Black.png diff --git a/Resources/Button_Left.png b/src/resources/Button_Left.png similarity index 100% rename from Resources/Button_Left.png rename to src/resources/Button_Left.png diff --git a/Resources/Button_Left_Black.png b/src/resources/Button_Left_Black.png similarity index 100% rename from Resources/Button_Left_Black.png rename to src/resources/Button_Left_Black.png diff --git a/Resources/Calibration.wav b/src/resources/Calibration.wav similarity index 100% rename from Resources/Calibration.wav rename to src/resources/Calibration.wav diff --git a/Resources/CalibrationHit.wav b/src/resources/CalibrationHit.wav similarity index 100% rename from Resources/CalibrationHit.wav rename to src/resources/CalibrationHit.wav diff --git a/Resources/ChapterSelect.mp3 b/src/resources/ChapterSelect.mp3 similarity index 100% rename from Resources/ChapterSelect.mp3 rename to src/resources/ChapterSelect.mp3 diff --git a/Resources/Edit_Add.png b/src/resources/Edit_Add.png similarity index 100% rename from Resources/Edit_Add.png rename to src/resources/Edit_Add.png diff --git a/Resources/Edit_Back.png b/src/resources/Edit_Back.png similarity index 100% rename from Resources/Edit_Back.png rename to src/resources/Edit_Back.png diff --git a/Resources/Edit_ChangeValue.png b/src/resources/Edit_ChangeValue.png similarity index 100% rename from Resources/Edit_ChangeValue.png rename to src/resources/Edit_ChangeValue.png diff --git a/Resources/Edit_Delete.png b/src/resources/Edit_Delete.png similarity index 100% rename from Resources/Edit_Delete.png rename to src/resources/Edit_Delete.png diff --git a/Resources/Edit_Pause.png b/src/resources/Edit_Pause.png similarity index 100% rename from Resources/Edit_Pause.png rename to src/resources/Edit_Pause.png diff --git a/Resources/Edit_Play.png b/src/resources/Edit_Play.png similarity index 100% rename from Resources/Edit_Play.png rename to src/resources/Edit_Play.png diff --git a/Resources/Edit_Replay.png b/src/resources/Edit_Replay.png similarity index 100% rename from Resources/Edit_Replay.png rename to src/resources/Edit_Replay.png diff --git a/Resources/Edit_Save.png b/src/resources/Edit_Save.png similarity index 100% rename from Resources/Edit_Save.png rename to src/resources/Edit_Save.png diff --git a/Resources/Introduction/audio.mp3 b/src/resources/Introduction/audio.mp3 similarity index 100% rename from Resources/Introduction/audio.mp3 rename to src/resources/Introduction/audio.mp3 diff --git a/Resources/Introduction/chart.json b/src/resources/Introduction/chart.json similarity index 100% rename from Resources/Introduction/chart.json rename to src/resources/Introduction/chart.json diff --git a/Resources/Introduction/image.png b/src/resources/Introduction/image.png similarity index 100% rename from Resources/Introduction/image.png rename to src/resources/Introduction/image.png diff --git a/Resources/JoinQQGuildBanner.png b/src/resources/JoinQQGuildBanner.png similarity index 100% rename from Resources/JoinQQGuildBanner.png rename to src/resources/JoinQQGuildBanner.png diff --git a/Resources/JoinQQGuildPromo.png b/src/resources/JoinQQGuildPromo.png similarity index 100% rename from Resources/JoinQQGuildPromo.png rename to src/resources/JoinQQGuildPromo.png diff --git a/Resources/Levels/A.png b/src/resources/Levels/A.png similarity index 100% rename from Resources/Levels/A.png rename to src/resources/Levels/A.png diff --git a/Resources/Levels/AP.png b/src/resources/Levels/AP.png similarity index 100% rename from Resources/Levels/AP.png rename to src/resources/Levels/AP.png diff --git a/Resources/Levels/B.png b/src/resources/Levels/B.png similarity index 100% rename from Resources/Levels/B.png rename to src/resources/Levels/B.png diff --git a/Resources/Levels/C.png b/src/resources/Levels/C.png similarity index 100% rename from Resources/Levels/C.png rename to src/resources/Levels/C.png diff --git a/Resources/Levels/F.png b/src/resources/Levels/F.png similarity index 100% rename from Resources/Levels/F.png rename to src/resources/Levels/F.png diff --git a/Resources/Levels/FC.png b/src/resources/Levels/FC.png similarity index 100% rename from Resources/Levels/FC.png rename to src/resources/Levels/FC.png diff --git a/Resources/Levels/S.png b/src/resources/Levels/S.png similarity index 100% rename from Resources/Levels/S.png rename to src/resources/Levels/S.png diff --git a/Resources/Levels/V.png b/src/resources/Levels/V.png similarity index 100% rename from Resources/Levels/V.png rename to src/resources/Levels/V.png diff --git a/Resources/LoadSuccess.wav b/src/resources/LoadSuccess.wav similarity index 100% rename from Resources/LoadSuccess.wav rename to src/resources/LoadSuccess.wav diff --git a/Resources/NewSplashSceneBGM.mp3 b/src/resources/NewSplashSceneBGM.mp3 similarity index 100% rename from Resources/NewSplashSceneBGM.mp3 rename to src/resources/NewSplashSceneBGM.mp3 diff --git a/Resources/Note_Click_Audio/Drag.wav b/src/resources/Note_Click_Audio/Drag.wav similarity index 100% rename from Resources/Note_Click_Audio/Drag.wav rename to src/resources/Note_Click_Audio/Drag.wav diff --git a/Resources/Note_Click_Audio/Flick.wav b/src/resources/Note_Click_Audio/Flick.wav similarity index 100% rename from Resources/Note_Click_Audio/Flick.wav rename to src/resources/Note_Click_Audio/Flick.wav diff --git a/Resources/Note_Click_Audio/Hold.wav b/src/resources/Note_Click_Audio/Hold.wav similarity index 100% rename from Resources/Note_Click_Audio/Hold.wav rename to src/resources/Note_Click_Audio/Hold.wav diff --git a/Resources/Note_Click_Audio/Tap.wav b/src/resources/Note_Click_Audio/Tap.wav similarity index 100% rename from Resources/Note_Click_Audio/Tap.wav rename to src/resources/Note_Click_Audio/Tap.wav diff --git a/Resources/Note_Click_Effect/Frames/1.png b/src/resources/Note_Click_Effect/Frames/1.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/1.png rename to src/resources/Note_Click_Effect/Frames/1.png diff --git a/Resources/Note_Click_Effect/Frames/10.png b/src/resources/Note_Click_Effect/Frames/10.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/10.png rename to src/resources/Note_Click_Effect/Frames/10.png diff --git a/Resources/Note_Click_Effect/Frames/11.png b/src/resources/Note_Click_Effect/Frames/11.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/11.png rename to src/resources/Note_Click_Effect/Frames/11.png diff --git a/Resources/Note_Click_Effect/Frames/12.png b/src/resources/Note_Click_Effect/Frames/12.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/12.png rename to src/resources/Note_Click_Effect/Frames/12.png diff --git a/Resources/Note_Click_Effect/Frames/13.png b/src/resources/Note_Click_Effect/Frames/13.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/13.png rename to src/resources/Note_Click_Effect/Frames/13.png diff --git a/Resources/Note_Click_Effect/Frames/14.png b/src/resources/Note_Click_Effect/Frames/14.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/14.png rename to src/resources/Note_Click_Effect/Frames/14.png diff --git a/Resources/Note_Click_Effect/Frames/15.png b/src/resources/Note_Click_Effect/Frames/15.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/15.png rename to src/resources/Note_Click_Effect/Frames/15.png diff --git a/Resources/Note_Click_Effect/Frames/16.png b/src/resources/Note_Click_Effect/Frames/16.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/16.png rename to src/resources/Note_Click_Effect/Frames/16.png diff --git a/Resources/Note_Click_Effect/Frames/17.png b/src/resources/Note_Click_Effect/Frames/17.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/17.png rename to src/resources/Note_Click_Effect/Frames/17.png diff --git a/Resources/Note_Click_Effect/Frames/18.png b/src/resources/Note_Click_Effect/Frames/18.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/18.png rename to src/resources/Note_Click_Effect/Frames/18.png diff --git a/Resources/Note_Click_Effect/Frames/19.png b/src/resources/Note_Click_Effect/Frames/19.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/19.png rename to src/resources/Note_Click_Effect/Frames/19.png diff --git a/Resources/Note_Click_Effect/Frames/2.png b/src/resources/Note_Click_Effect/Frames/2.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/2.png rename to src/resources/Note_Click_Effect/Frames/2.png diff --git a/Resources/Note_Click_Effect/Frames/20.png b/src/resources/Note_Click_Effect/Frames/20.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/20.png rename to src/resources/Note_Click_Effect/Frames/20.png diff --git a/Resources/Note_Click_Effect/Frames/21.png b/src/resources/Note_Click_Effect/Frames/21.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/21.png rename to src/resources/Note_Click_Effect/Frames/21.png diff --git a/Resources/Note_Click_Effect/Frames/22.png b/src/resources/Note_Click_Effect/Frames/22.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/22.png rename to src/resources/Note_Click_Effect/Frames/22.png diff --git a/Resources/Note_Click_Effect/Frames/23.png b/src/resources/Note_Click_Effect/Frames/23.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/23.png rename to src/resources/Note_Click_Effect/Frames/23.png diff --git a/Resources/Note_Click_Effect/Frames/24.png b/src/resources/Note_Click_Effect/Frames/24.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/24.png rename to src/resources/Note_Click_Effect/Frames/24.png diff --git a/Resources/Note_Click_Effect/Frames/25.png b/src/resources/Note_Click_Effect/Frames/25.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/25.png rename to src/resources/Note_Click_Effect/Frames/25.png diff --git a/Resources/Note_Click_Effect/Frames/26.png b/src/resources/Note_Click_Effect/Frames/26.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/26.png rename to src/resources/Note_Click_Effect/Frames/26.png diff --git a/Resources/Note_Click_Effect/Frames/27.png b/src/resources/Note_Click_Effect/Frames/27.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/27.png rename to src/resources/Note_Click_Effect/Frames/27.png diff --git a/Resources/Note_Click_Effect/Frames/28.png b/src/resources/Note_Click_Effect/Frames/28.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/28.png rename to src/resources/Note_Click_Effect/Frames/28.png diff --git a/Resources/Note_Click_Effect/Frames/29.png b/src/resources/Note_Click_Effect/Frames/29.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/29.png rename to src/resources/Note_Click_Effect/Frames/29.png diff --git a/Resources/Note_Click_Effect/Frames/3.png b/src/resources/Note_Click_Effect/Frames/3.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/3.png rename to src/resources/Note_Click_Effect/Frames/3.png diff --git a/Resources/Note_Click_Effect/Frames/30.png b/src/resources/Note_Click_Effect/Frames/30.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/30.png rename to src/resources/Note_Click_Effect/Frames/30.png diff --git a/Resources/Note_Click_Effect/Frames/4.png b/src/resources/Note_Click_Effect/Frames/4.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/4.png rename to src/resources/Note_Click_Effect/Frames/4.png diff --git a/Resources/Note_Click_Effect/Frames/5.png b/src/resources/Note_Click_Effect/Frames/5.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/5.png rename to src/resources/Note_Click_Effect/Frames/5.png diff --git a/Resources/Note_Click_Effect/Frames/6.png b/src/resources/Note_Click_Effect/Frames/6.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/6.png rename to src/resources/Note_Click_Effect/Frames/6.png diff --git a/Resources/Note_Click_Effect/Frames/7.png b/src/resources/Note_Click_Effect/Frames/7.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/7.png rename to src/resources/Note_Click_Effect/Frames/7.png diff --git a/Resources/Note_Click_Effect/Frames/8.png b/src/resources/Note_Click_Effect/Frames/8.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/8.png rename to src/resources/Note_Click_Effect/Frames/8.png diff --git a/Resources/Note_Click_Effect/Frames/9.png b/src/resources/Note_Click_Effect/Frames/9.png similarity index 100% rename from Resources/Note_Click_Effect/Frames/9.png rename to src/resources/Note_Click_Effect/Frames/9.png diff --git a/Resources/Note_Click_Effect/Raw.png b/src/resources/Note_Click_Effect/Raw.png similarity index 100% rename from Resources/Note_Click_Effect/Raw.png rename to src/resources/Note_Click_Effect/Raw.png diff --git a/Resources/Note_Click_Effect/split.py b/src/resources/Note_Click_Effect/split.py similarity index 100% rename from Resources/Note_Click_Effect/split.py rename to src/resources/Note_Click_Effect/split.py diff --git a/Resources/Notes/Drag.png b/src/resources/Notes/Drag.png similarity index 100% rename from Resources/Notes/Drag.png rename to src/resources/Notes/Drag.png diff --git a/Resources/Notes/Drag_dub.png b/src/resources/Notes/Drag_dub.png similarity index 100% rename from Resources/Notes/Drag_dub.png rename to src/resources/Notes/Drag_dub.png diff --git a/Resources/Notes/Flick.png b/src/resources/Notes/Flick.png similarity index 100% rename from Resources/Notes/Flick.png rename to src/resources/Notes/Flick.png diff --git a/Resources/Notes/Flick_dub.png b/src/resources/Notes/Flick_dub.png similarity index 100% rename from Resources/Notes/Flick_dub.png rename to src/resources/Notes/Flick_dub.png diff --git a/Resources/Notes/Hold_Body.png b/src/resources/Notes/Hold_Body.png similarity index 100% rename from Resources/Notes/Hold_Body.png rename to src/resources/Notes/Hold_Body.png diff --git a/Resources/Notes/Hold_Body_dub.png b/src/resources/Notes/Hold_Body_dub.png similarity index 100% rename from Resources/Notes/Hold_Body_dub.png rename to src/resources/Notes/Hold_Body_dub.png diff --git a/Resources/Notes/Hold_End.png b/src/resources/Notes/Hold_End.png similarity index 100% rename from Resources/Notes/Hold_End.png rename to src/resources/Notes/Hold_End.png diff --git a/Resources/Notes/Hold_End_dub.png b/src/resources/Notes/Hold_End_dub.png similarity index 100% rename from Resources/Notes/Hold_End_dub.png rename to src/resources/Notes/Hold_End_dub.png diff --git a/Resources/Notes/Hold_Head.png b/src/resources/Notes/Hold_Head.png similarity index 100% rename from Resources/Notes/Hold_Head.png rename to src/resources/Notes/Hold_Head.png diff --git a/Resources/Notes/Hold_Head_dub.png b/src/resources/Notes/Hold_Head_dub.png similarity index 100% rename from Resources/Notes/Hold_Head_dub.png rename to src/resources/Notes/Hold_Head_dub.png diff --git a/Resources/Notes/SplitPhiraHoldTexture.py b/src/resources/Notes/SplitPhiraHoldTexture.py similarity index 100% rename from Resources/Notes/SplitPhiraHoldTexture.py rename to src/resources/Notes/SplitPhiraHoldTexture.py diff --git a/Resources/Notes/Tap.png b/src/resources/Notes/Tap.png similarity index 100% rename from Resources/Notes/Tap.png rename to src/resources/Notes/Tap.png diff --git a/Resources/Notes/Tap_dub.png b/src/resources/Notes/Tap_dub.png similarity index 100% rename from Resources/Notes/Tap_dub.png rename to src/resources/Notes/Tap_dub.png diff --git a/Resources/Over.mp3 b/src/resources/Over.mp3 similarity index 100% rename from Resources/Over.mp3 rename to src/resources/Over.mp3 diff --git a/Resources/PUIBack.png b/src/resources/PUIBack.png similarity index 100% rename from Resources/PUIBack.png rename to src/resources/PUIBack.png diff --git a/Resources/PUIResume.png b/src/resources/PUIResume.png similarity index 100% rename from Resources/PUIResume.png rename to src/resources/PUIResume.png diff --git a/Resources/PUIRetry.png b/src/resources/PUIRetry.png similarity index 100% rename from Resources/PUIRetry.png rename to src/resources/PUIRetry.png diff --git a/Resources/Pause.png b/src/resources/Pause.png similarity index 100% rename from Resources/Pause.png rename to src/resources/Pause.png diff --git a/Resources/Pause.wav b/src/resources/Pause.wav similarity index 100% rename from Resources/Pause.wav rename to src/resources/Pause.wav diff --git a/Resources/Retry.png b/src/resources/Retry.png similarity index 100% rename from Resources/Retry.png rename to src/resources/Retry.png diff --git a/Resources/Start.png b/src/resources/Start.png similarity index 100% rename from Resources/Start.png rename to src/resources/Start.png diff --git a/Resources/TouchToStart.mp3 b/src/resources/TouchToStart.mp3 similarity index 100% rename from Resources/TouchToStart.mp3 rename to src/resources/TouchToStart.mp3 diff --git a/Resources/UISound_1.wav b/src/resources/UISound_1.wav similarity index 100% rename from Resources/UISound_1.wav rename to src/resources/UISound_1.wav diff --git a/Resources/UISound_2.wav b/src/resources/UISound_2.wav similarity index 100% rename from Resources/UISound_2.wav rename to src/resources/UISound_2.wav diff --git a/Resources/UISound_3.wav b/src/resources/UISound_3.wav similarity index 100% rename from Resources/UISound_3.wav rename to src/resources/UISound_3.wav diff --git a/Resources/UISound_4.wav b/src/resources/UISound_4.wav similarity index 100% rename from Resources/UISound_4.wav rename to src/resources/UISound_4.wav diff --git a/Resources/WaitLoading.mp3 b/src/resources/WaitLoading.mp3 similarity index 100% rename from Resources/WaitLoading.mp3 rename to src/resources/WaitLoading.mp3 diff --git a/Resources/bilibili.png b/src/resources/bilibili.png similarity index 100% rename from Resources/bilibili.png rename to src/resources/bilibili.png diff --git a/Resources/checked.png b/src/resources/checked.png similarity index 100% rename from Resources/checked.png rename to src/resources/checked.png diff --git a/Resources/close.png b/src/resources/close.png similarity index 100% rename from Resources/close.png rename to src/resources/close.png diff --git a/Resources/collectibles.png b/src/resources/collectibles.png similarity index 100% rename from Resources/collectibles.png rename to src/resources/collectibles.png diff --git a/Resources/edit.png b/src/resources/edit.png similarity index 100% rename from Resources/edit.png rename to src/resources/edit.png diff --git a/Resources/facula.png b/src/resources/facula.png similarity index 100% rename from Resources/facula.png rename to src/resources/facula.png diff --git a/Resources/finger.png b/src/resources/finger.png similarity index 100% rename from Resources/finger.png rename to src/resources/finger.png diff --git a/Resources/font.ttf b/src/resources/font.ttf similarity index 100% rename from Resources/font.ttf rename to src/resources/font.ttf diff --git a/Resources/logoipt.png b/src/resources/logoipt.png similarity index 100% rename from Resources/logoipt.png rename to src/resources/logoipt.png diff --git a/Resources/message.png b/src/resources/message.png similarity index 100% rename from Resources/message.png rename to src/resources/message.png diff --git a/Resources/phigros.png b/src/resources/phigros.png similarity index 100% rename from Resources/phigros.png rename to src/resources/phigros.png diff --git a/Resources/qq.png b/src/resources/qq.png similarity index 100% rename from Resources/qq.png rename to src/resources/qq.png diff --git a/Resources/setting.png b/src/resources/setting.png similarity index 100% rename from Resources/setting.png rename to src/resources/setting.png diff --git a/Resources/taptap.png b/src/resources/taptap.png similarity index 100% rename from Resources/taptap.png rename to src/resources/taptap.png diff --git a/Resources/twitter.png b/src/resources/twitter.png similarity index 100% rename from Resources/twitter.png rename to src/resources/twitter.png diff --git a/rpe_easing.py b/src/rpe_easing.py similarity index 100% rename from rpe_easing.py rename to src/rpe_easing.py diff --git a/shaders/chromatic.glsl b/src/shaders/chromatic.glsl similarity index 100% rename from shaders/chromatic.glsl rename to src/shaders/chromatic.glsl diff --git a/shaders/circle_blur.glsl b/src/shaders/circle_blur.glsl similarity index 100% rename from shaders/circle_blur.glsl rename to src/shaders/circle_blur.glsl diff --git a/shaders/fisheye.glsl b/src/shaders/fisheye.glsl similarity index 100% rename from shaders/fisheye.glsl rename to src/shaders/fisheye.glsl diff --git a/shaders/glitch.glsl b/src/shaders/glitch.glsl similarity index 100% rename from shaders/glitch.glsl rename to src/shaders/glitch.glsl diff --git a/shaders/grayscale.glsl b/src/shaders/grayscale.glsl similarity index 100% rename from shaders/grayscale.glsl rename to src/shaders/grayscale.glsl diff --git a/shaders/noise.glsl b/src/shaders/noise.glsl similarity index 100% rename from shaders/noise.glsl rename to src/shaders/noise.glsl diff --git a/shaders/pixel.glsl b/src/shaders/pixel.glsl similarity index 100% rename from shaders/pixel.glsl rename to src/shaders/pixel.glsl diff --git a/shaders/radial_blur.glsl b/src/shaders/radial_blur.glsl similarity index 100% rename from shaders/radial_blur.glsl rename to src/shaders/radial_blur.glsl diff --git a/shaders/shockwave.glsl b/src/shaders/shockwave.glsl similarity index 100% rename from shaders/shockwave.glsl rename to src/shaders/shockwave.glsl diff --git a/shaders/vignette.glsl b/src/shaders/vignette.glsl similarity index 100% rename from shaders/vignette.glsl rename to src/shaders/vignette.glsl diff --git a/tool-compile.py b/src/tool-compile.py similarity index 98% rename from tool-compile.py rename to src/tool-compile.py index 4a50898..69e456c 100644 --- a/tool-compile.py +++ b/src/tool-compile.py @@ -19,7 +19,7 @@ def compile(file:str, hideconsole:bool): debug = "--debug" in argv compile_files = [ - ("Main.py", False), + ("main.py", False), ("GUI_Launcher.py", False), ("Phigros.py", False) ] diff --git a/tool-createAutoplayOneFingerVideo.py b/src/tool-createAutoplayOneFingerVideo.py similarity index 82% rename from tool-createAutoplayOneFingerVideo.py rename to src/tool-createAutoplayOneFingerVideo.py index e35bc39..d0df2f7 100644 --- a/tool-createAutoplayOneFingerVideo.py +++ b/src/tool-createAutoplayOneFingerVideo.py @@ -8,12 +8,12 @@ import numpy from PIL import Image -import Chart_Functions_Phi -import Chart_Functions_Rpe -import Chart_Objects_Phi -import Chart_Objects_Rpe -import Const -import Tool_Functions +import chartfuncs_phi +import chartfuncs_rpe +import chartobj_phi +import chartobj_rpe +import const +import tool_funcs from rpe_easing import ease_funcs if len(argv) < 4: @@ -27,10 +27,10 @@ with open(chartFile, "r", encoding="utf-8") as f: jsonData = json.load(f) -chartObj = Chart_Functions_Phi.Load_Chart_Object(jsonData) if "formatVersion" in jsonData else Chart_Functions_Rpe.Load_Chart_Object(jsonData) +chartObj = chartfuncs_phi.Load_Chart_Object(jsonData) if "formatVersion" in jsonData else chartfuncs_rpe.Load_Chart_Object(jsonData) moveDatas = [] -if isinstance(chartObj, Chart_Objects_Phi.Phigros_Chart): +if isinstance(chartObj, chartobj_phi.Phigros_Chart): for line in chartObj.judgeLineList: for note in line.notesAbove + line.notesBelow: moveDatas.append({ @@ -38,7 +38,7 @@ "pos": note.getNoteClickPos(note.time) }) - if note.type == Const.Note.HOLD: + if note.type == const.Note.HOLD: dw = 1 / 12.5 / (1.875 / line.bpm) ht = note.time while ht < note.time + note.holdTime: @@ -48,13 +48,13 @@ "pos": note.getNoteClickPos(ht) }) - if note.type == Const.Note.FLICK: + if note.type == const.Note.FLICK: e = moveDatas[-1] moveDatas.append({ "time": e["time"] + 0.05, "pos": (e["pos"][0], e["pos"][1] - 0.1) }) -elif isinstance(chartObj, Chart_Objects_Rpe.Rpe_Chart): # eq else +elif isinstance(chartObj, chartobj_rpe.Rpe_Chart): # eq else for line in chartObj.JudgeLineList: for note in line.notes: moveDatas.append({ @@ -62,7 +62,7 @@ "pos": note.getNoteClickPos(note.startTime.value, chartObj, line) }) - if note.phitype == Const.Note.HOLD: + if note.phitype == const.Note.HOLD: dw = chartObj.sec2beat(1 / 12.5, line.bpmfactor) ht = note.startTime.value while ht < note.endTime.value: @@ -72,7 +72,7 @@ "pos": note.getNoteClickPos(ht, chartObj, line) }) - if note.phitype == Const.Note.FLICK: + if note.phitype == const.Note.FLICK: e = moveDatas[-1] moveDatas.append({ "time": e["time"] + 0.05, @@ -110,8 +110,8 @@ def gfingerp(sec: float) -> tuple[float, float]: for e in moveEvents: if e["st"] <= sec < e["et"]: return ( - Tool_Functions.easing_interpolation(sec, e["st"], e["et"], e["sp"][0], e["ep"][0], ease_funcs[9]), - Tool_Functions.easing_interpolation(sec, e["st"], e["et"], e["sp"][1], e["ep"][1], ease_funcs[9]) + tool_funcs.easing_interpolation(sec, e["st"], e["et"], e["sp"][0], e["ep"][0], ease_funcs[9]), + tool_funcs.easing_interpolation(sec, e["st"], e["et"], e["sp"][1], e["ep"][1], ease_funcs[9]) ) return moveEvents[-1]["ep"] @@ -123,7 +123,7 @@ def gfingerp(sec: float) -> tuple[float, float]: selfdir = dirname(argv[0]) if selfdir == "": selfdir = abspath(".") chdir(selfdir) -finger = Image.open("./Resources/finger.png") +finger = Image.open("./resources/finger.png") finger = finger.resize((int(w * 0.4), int(w * 0.4 / finger.width * finger.height))) try: diff --git a/tool-phiChart2onlyOneNote.py b/src/tool-phiChart2onlyOneNote.py similarity index 100% rename from tool-phiChart2onlyOneNote.py rename to src/tool-phiChart2onlyOneNote.py diff --git a/tool-processChartAudio.py b/src/tool-processChartAudio.py similarity index 85% rename from tool-processChartAudio.py rename to src/tool-processChartAudio.py index 6923bc1..b97ed54 100644 --- a/tool-processChartAudio.py +++ b/src/tool-processChartAudio.py @@ -3,21 +3,21 @@ from pydub import AudioSegment -import Const -import Chart_Functions_Rpe +import const +import chartfuncs_rpe NoteClickAudios = { - Const.Note.TAP: AudioSegment.from_file("./Resources/Note_Click_Audio/Tap.wav"), - Const.Note.DRAG: AudioSegment.from_file("./Resources/Note_Click_Audio/Drag.wav"), - Const.Note.HOLD: AudioSegment.from_file("./Resources/Note_Click_Audio/Hold.wav"), - Const.Note.FLICK: AudioSegment.from_file("./Resources/Note_Click_Audio/Flick.wav") + const.Note.TAP: AudioSegment.from_file("./resources/Note_Click_Audio/Tap.wav"), + const.Note.DRAG: AudioSegment.from_file("./resources/Note_Click_Audio/Drag.wav"), + const.Note.HOLD: AudioSegment.from_file("./resources/Note_Click_Audio/Hold.wav"), + const.Note.FLICK: AudioSegment.from_file("./resources/Note_Click_Audio/Flick.wav") } with open(argv[1], "r", encoding="utf-8") as f: Chart = load(f) if "META" in Chart and "formatVersion" not in Chart: - rpeobj = Chart_Functions_Rpe.Load_Chart_Object(Chart) + rpeobj = chartfuncs_rpe.Load_Chart_Object(Chart) Chart = { "formatVersion": 3, "offset": rpeobj.META.offset / 1000, diff --git a/tool-video2rpe.py b/src/tool-video2rpe.py similarity index 100% rename from tool-video2rpe.py rename to src/tool-video2rpe.py diff --git a/Tool_Functions.py b/src/tool_funcs.py similarity index 100% rename from Tool_Functions.py rename to src/tool_funcs.py diff --git a/web_canvas.html b/src/web_canvas.html similarity index 100% rename from web_canvas.html rename to src/web_canvas.html diff --git a/webcv.py b/src/webcv.py similarity index 100% rename from webcv.py rename to src/webcv.py diff --git a/webphiplayer.html b/src/webphiplayer.html similarity index 94% rename from webphiplayer.html rename to src/webphiplayer.html index a1e8a07..52a54a4 100644 --- a/webphiplayer.html +++ b/src/webphiplayer.html @@ -6,22 +6,22 @@
- - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + {