diff --git a/Musicreater.py b/Musicreater.py index 9f2bb46..d3dc43c 100644 --- a/Musicreater.py +++ b/Musicreater.py @@ -1766,7 +1766,7 @@ def __main__(): tk.Button(UpLeftFrame, text=READABLETEXT[96], command=ResetSetting).pack() # 装入窗口 UpLeftFrame.pack(side='left') - + # 中间的框容器 UpMidleFrame = tk.Frame(UpFrame, bg='blue') # 列表 diff --git a/bgArrayLib/__pycache__/instrumentConstant.cpython-38.pyc b/bgArrayLib/__pycache__/instrumentConstant.cpython-38.pyc new file mode 100644 index 0000000..9f05e01 Binary files /dev/null and b/bgArrayLib/__pycache__/instrumentConstant.cpython-38.pyc differ diff --git a/bgArrayLib/__pycache__/reader.cpython-38.pyc b/bgArrayLib/__pycache__/reader.cpython-38.pyc index 345313f..2907da1 100644 Binary files a/bgArrayLib/__pycache__/reader.cpython-38.pyc and b/bgArrayLib/__pycache__/reader.cpython-38.pyc differ diff --git a/msctspt/__pycache__/bdxOpera_CP.cpython-38.pyc b/msctspt/__pycache__/bdxOpera_CP.cpython-38.pyc index 9d82605..ab55042 100644 Binary files a/msctspt/__pycache__/bdxOpera_CP.cpython-38.pyc and b/msctspt/__pycache__/bdxOpera_CP.cpython-38.pyc differ diff --git a/msctspt/__pycache__/threadOpera.cpython-38.pyc b/msctspt/__pycache__/threadOpera.cpython-38.pyc index 1cd248c..61df044 100644 Binary files a/msctspt/__pycache__/threadOpera.cpython-38.pyc and b/msctspt/__pycache__/threadOpera.cpython-38.pyc differ diff --git a/msctspt/__pycache__/transfer.cpython-38.pyc b/msctspt/__pycache__/transfer.cpython-38.pyc index befb6f4..2e10188 100644 Binary files a/msctspt/__pycache__/transfer.cpython-38.pyc and b/msctspt/__pycache__/transfer.cpython-38.pyc differ diff --git a/msctspt/bdxOpera_CP.py b/msctspt/bdxOpera_CP.py index 831bf7f..7f00c39 100644 --- a/msctspt/bdxOpera_CP.py +++ b/msctspt/bdxOpera_CP.py @@ -7,7 +7,7 @@ import brotli class BdxConverter: __header = "BD@" __bin_header = b"BDX" - __generator_author = b"&Charlie_Ping" + __generator_author = b"&Musicreater" keys = { # x--, x++, addSmallX(-128~127), addX(-32768~32767), addBigX(-2147483648~2147483647) @@ -50,9 +50,7 @@ class BdxConverter: @property def create_and_upload_file(self): """ - (瞎用property? 害怕 创建一个bdx文件 - 要close! :return: 一个文件对象 """ _dir = os.path.dirname(self.file_path) @@ -73,7 +71,8 @@ class BdxConverter: with open(self.file_path, "ab+") as f: f.write(brotli.compress(_bytes)) f.close() - return + return open(self.file_path,'a+') + def upload_blocks(self): """ 计算差值 @@ -83,6 +82,8 @@ class BdxConverter: :return: """ _types = b"" + + for block in self.blocks: # print(f"当前方块:{block['block_name']}, 位置: {block['direction']}]") diff = self.move_pointer(self.direction, block["direction"]) @@ -94,6 +95,8 @@ class BdxConverter: else: _types += self.obtain_universal_block(block) self.direction = block["direction"] + + return _types def move_pointer(self, direction: list, new_direction): diff --git a/msctspt/threadOpera.py b/msctspt/threadOpera.py index acddc2c..f18f14c 100644 --- a/msctspt/threadOpera.py +++ b/msctspt/threadOpera.py @@ -10,14 +10,14 @@ class NewThread(threading.Thread): super(NewThread, self).__init__() self.func = func self.args = args + self.result = None + def run(self): self.result = self.func(*self.args) + def getResult(self): threading.Thread.join(self) # 等待线程执行完毕 - try: - return self.result - except Exception: - return None + return self.result # # ———————————————— diff --git a/msctspt/transfer.py b/msctspt/transfer.py index d508c91..993b9f2 100644 --- a/msctspt/transfer.py +++ b/msctspt/transfer.py @@ -260,6 +260,10 @@ def note2bdx(filePath: str, dire: list, Notes: list, ScoreboardName: str, Instru return BdxConverter(filePath, 'Build by RyounMusicreater', blocks) + + + + def music2BDX(filePath: str, direction: Iterable, music: dict, isProsess: bool = False, height: int = 200, isSquare: bool = False): """使用方法同Note2Cmd @@ -272,20 +276,22 @@ def music2BDX(filePath: str, direction: Iterable, music: dict, isProsess: bool = isSquare: 生成的结构是否需要遵循生成正方形原则 :return 返回一个BdxConverter类,同时在指定位置生成.bdx文件""" from msctspt.bdxOpera_CP import BdxConverter + from msctspt.threadOpera import NewThread - blocks = [] + allblocks = [] '''需要放置的方块''' baseDire = direction direction = list(direction) - for track in music['musics']: + def trackDealing(direction,track): + blocks = [] cmdList = classList_conversion_SinglePlayer(track['notes'], track['set']['ScoreboardName'], music['mainset']['PlayerSelect'], isProsess) if len(cmdList) == 0: - continue + return elif cmdList is []: - continue + return dire = direction down = False '''当前是否为向下的阶段?''' @@ -306,7 +312,6 @@ def music2BDX(filePath: str, direction: Iterable, music: dict, isProsess: bool = for cmd in cmdList: blocks.append(formCmdBlock(dire, cmd, 5 if (down is False and dire[1] == height + direction[1]) or ( down and dire[1] == direction + 1) else 0 if down else 1, 2, needRedstone=False)) - if down: if dire[1] > direction[1] + 1: dire[1] -= 1 @@ -317,9 +322,18 @@ def music2BDX(filePath: str, direction: Iterable, music: dict, isProsess: bool = if (down is False and dire[1] == height + direction[1]) or (down and dire[1] == direction + 1): down = not down dire[0] += 1 + return blocks + + threads = [] + for track in music['musics']: + threads.append(NewThread(trackDealing,(direction,track))) + threads[threads.__len__()-1].start() direction[2] += 2 - return BdxConverter(filePath, 'Build by Ryoun Musicreater', blocks) + for th in threads: + allblocks += th.getResult() + + return BdxConverter(filePath, 'Build by Ryoun Musicreater', allblocks) def note2webs(Notes: list, Instrument: str, speed: float = 5.0, PlayerSelect: str = '', isProsess: bool = False): diff --git a/resources/MSCT Dev Log.txt b/resources/MSCT Dev Log.txt index f8c64c1..d212414 100644 --- a/resources/MSCT Dev Log.txt +++ b/resources/MSCT Dev Log.txt @@ -10,10 +10,10 @@ Copyright © W-YI 2022 1.可以导出自定义的结构文件用于存储要导入地图中的结构 2.进度条 3.可以将音乐写入音符盒(红乐) - +4.修改UI界面使之适应当前功能 5.支持自动给音符盒绑定更多的音色 6.可以由.schematic文件导入地图,亦可反向处理 - +7.制作软件下载器使用户更直观地操作 8.支持自定义创建websockeet服务器播放音乐(感谢由 Fuckcraft “鸣凤鸽子”等 带来的我的世界websocket服务器功能) 9.支持使用红石播放音乐 10.支持采用延时的播放器 @@ -24,23 +24,24 @@ Copyright © W-YI 2022 17.支持自动搜寻地图目录位置(网易&微软) -++++++ -4.修改UI界面使之适应当前功能 -7.制作软件下载器使用户更直观地操作 -15. -16. - +=============== + 2022 年度挑战 +1.重构代码使全部变量皆使用类存储 +2.修改UI界面 +3.增加进度条 +4.修复生成bug +=============== 新更新日志 - Delta 0.2.0 -2022 2 1 - 2022 x(TO-DO) -1.程序图标完善 -2.修改窗口样式,可显示诸多信息 -3.修复生成bug -4.全部变量皆使用类存储 + + Delta 0.1.5.2 +2022 2 1 农历大年初一 +0.程序图标完善 +1.修复了解析指令导致的错误 +2.注意!bug没有改完,也从未改完。 Delta 0.1.5.1 2022 2 1 农历大年初一 diff --git a/测试用/【ff14双人大合奏】僵王处刑曲Brainiac Maniac.mid b/测试用/【ff14双人大合奏】僵王处刑曲Brainiac Maniac.mid new file mode 100644 index 0000000..8792dcc Binary files /dev/null and b/测试用/【ff14双人大合奏】僵王处刑曲Brainiac Maniac.mid differ diff --git a/测试用/铭刻时间的歌.mid b/测试用/铭刻时间的歌.mid deleted file mode 100644 index ff8d124..0000000 Binary files a/测试用/铭刻时间的歌.mid and /dev/null differ diff --git a/铭刻时间的歌.mid b/铭刻时间的歌.mid deleted file mode 100644 index ff8d124..0000000 Binary files a/铭刻时间的歌.mid and /dev/null differ