慢慢改bug

This commit is contained in:
EillesWan 2022-02-02 15:09:11 +08:00
parent 073ae827ab
commit 99509be48c
13 changed files with 47 additions and 29 deletions

View File

@ -1766,7 +1766,7 @@ def __main__():
tk.Button(UpLeftFrame, text=READABLETEXT[96], command=ResetSetting).pack() tk.Button(UpLeftFrame, text=READABLETEXT[96], command=ResetSetting).pack()
# 装入窗口 # 装入窗口
UpLeftFrame.pack(side='left') UpLeftFrame.pack(side='left')
# 中间的框容器 # 中间的框容器
UpMidleFrame = tk.Frame(UpFrame, bg='blue') UpMidleFrame = tk.Frame(UpFrame, bg='blue')
# 列表 # 列表

View File

@ -7,7 +7,7 @@ import brotli
class BdxConverter: class BdxConverter:
__header = "BD@" __header = "BD@"
__bin_header = b"BDX" __bin_header = b"BDX"
__generator_author = b"&Charlie_Ping" __generator_author = b"&Musicreater"
keys = { keys = {
# x--, x++, addSmallX(-128~127), addX(-32768~32767), addBigX(-2147483648~2147483647) # x--, x++, addSmallX(-128~127), addX(-32768~32767), addBigX(-2147483648~2147483647)
@ -50,9 +50,7 @@ class BdxConverter:
@property @property
def create_and_upload_file(self): def create_and_upload_file(self):
""" """
瞎用property 害怕
创建一个bdx文件 创建一个bdx文件
要close
:return: 一个文件对象 :return: 一个文件对象
""" """
_dir = os.path.dirname(self.file_path) _dir = os.path.dirname(self.file_path)
@ -73,7 +71,8 @@ class BdxConverter:
with open(self.file_path, "ab+") as f: with open(self.file_path, "ab+") as f:
f.write(brotli.compress(_bytes)) f.write(brotli.compress(_bytes))
f.close() f.close()
return return open(self.file_path,'a+')
def upload_blocks(self): def upload_blocks(self):
""" """
计算差值 计算差值
@ -83,6 +82,8 @@ class BdxConverter:
:return: :return:
""" """
_types = b"" _types = b""
for block in self.blocks: for block in self.blocks:
# print(f"当前方块:{block['block_name']}, 位置: {block['direction']}]") # print(f"当前方块:{block['block_name']}, 位置: {block['direction']}]")
diff = self.move_pointer(self.direction, block["direction"]) diff = self.move_pointer(self.direction, block["direction"])
@ -94,6 +95,8 @@ class BdxConverter:
else: else:
_types += self.obtain_universal_block(block) _types += self.obtain_universal_block(block)
self.direction = block["direction"] self.direction = block["direction"]
return _types return _types
def move_pointer(self, direction: list, new_direction): def move_pointer(self, direction: list, new_direction):

View File

@ -10,14 +10,14 @@ class NewThread(threading.Thread):
super(NewThread, self).__init__() super(NewThread, self).__init__()
self.func = func self.func = func
self.args = args self.args = args
self.result = None
def run(self): def run(self):
self.result = self.func(*self.args) self.result = self.func(*self.args)
def getResult(self): def getResult(self):
threading.Thread.join(self) # 等待线程执行完毕 threading.Thread.join(self) # 等待线程执行完毕
try: return self.result
return self.result
except Exception:
return None
# #
# ———————————————— # ————————————————

View File

@ -260,6 +260,10 @@ def note2bdx(filePath: str, dire: list, Notes: list, ScoreboardName: str, Instru
return BdxConverter(filePath, 'Build by RyounMusicreater', blocks) return BdxConverter(filePath, 'Build by RyounMusicreater', blocks)
def music2BDX(filePath: str, direction: Iterable, music: dict, isProsess: bool = False, height: int = 200, def music2BDX(filePath: str, direction: Iterable, music: dict, isProsess: bool = False, height: int = 200,
isSquare: bool = False): isSquare: bool = False):
"""使用方法同Note2Cmd """使用方法同Note2Cmd
@ -272,20 +276,22 @@ def music2BDX(filePath: str, direction: Iterable, music: dict, isProsess: bool =
isSquare: 生成的结构是否需要遵循生成正方形原则 isSquare: 生成的结构是否需要遵循生成正方形原则
:return 返回一个BdxConverter类同时在指定位置生成.bdx文件""" :return 返回一个BdxConverter类同时在指定位置生成.bdx文件"""
from msctspt.bdxOpera_CP import BdxConverter from msctspt.bdxOpera_CP import BdxConverter
from msctspt.threadOpera import NewThread
blocks = [] allblocks = []
'''需要放置的方块''' '''需要放置的方块'''
baseDire = direction baseDire = direction
direction = list(direction) direction = list(direction)
for track in music['musics']: def trackDealing(direction,track):
blocks = []
cmdList = classList_conversion_SinglePlayer(track['notes'], track['set']['ScoreboardName'], cmdList = classList_conversion_SinglePlayer(track['notes'], track['set']['ScoreboardName'],
music['mainset']['PlayerSelect'], isProsess) music['mainset']['PlayerSelect'], isProsess)
if len(cmdList) == 0: if len(cmdList) == 0:
continue return
elif cmdList is []: elif cmdList is []:
continue return
dire = direction dire = direction
down = False down = False
'''当前是否为向下的阶段?''' '''当前是否为向下的阶段?'''
@ -306,7 +312,6 @@ def music2BDX(filePath: str, direction: Iterable, music: dict, isProsess: bool =
for cmd in cmdList: for cmd in cmdList:
blocks.append(formCmdBlock(dire, cmd, 5 if (down is False and dire[1] == height + direction[1]) or ( 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)) down and dire[1] == direction + 1) else 0 if down else 1, 2, needRedstone=False))
if down: if down:
if dire[1] > direction[1] + 1: if dire[1] > direction[1] + 1:
dire[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): if (down is False and dire[1] == height + direction[1]) or (down and dire[1] == direction + 1):
down = not down down = not down
dire[0] += 1 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 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): def note2webs(Notes: list, Instrument: str, speed: float = 5.0, PlayerSelect: str = '', isProsess: bool = False):

View File

@ -10,10 +10,10 @@ Copyright © W-YI 2022
1.可以导出自定义的结构文件用于存储要导入地图中的结构 1.可以导出自定义的结构文件用于存储要导入地图中的结构
2.进度条 2.进度条
3.可以将音乐写入音符盒(红乐) 3.可以将音乐写入音符盒(红乐)
4.修改UI界面使之适应当前功能
5.支持自动给音符盒绑定更多的音色 5.支持自动给音符盒绑定更多的音色
6.可以由.schematic文件导入地图亦可反向处理 6.可以由.schematic文件导入地图亦可反向处理
7.制作软件下载器使用户更直观地操作
8.支持自定义创建websockeet服务器播放音乐感谢由 Fuckcraft <https://github.com/fuckcraft> “鸣凤鸽子”等 带来的我的世界websocket服务器功能 8.支持自定义创建websockeet服务器播放音乐感谢由 Fuckcraft <https://github.com/fuckcraft> “鸣凤鸽子”等 带来的我的世界websocket服务器功能
9.支持使用红石播放音乐 9.支持使用红石播放音乐
10.支持采用延时的播放器 10.支持采用延时的播放器
@ -24,23 +24,24 @@ Copyright © W-YI 2022
17.支持自动搜寻地图目录位置(网易&微软) 17.支持自动搜寻地图目录位置(网易&微软)
++++++
4.修改UI界面使之适应当前功能
7.制作软件下载器使用户更直观地操作
15.
16.
===============
2022 年度挑战
1.重构代码使全部变量皆使用类存储
2.修改UI界面
3.增加进度条
4.修复生成bug
===============
新更新日志 新更新日志
Delta 0.2.0
2022 2 1 - 2022 xTO-DO Delta 0.1.5.2
1.程序图标完善 2022 2 1 农历大年初一
2.修改窗口样式,可显示诸多信息 0.程序图标完善
3.修复生成bug 1.修复了解析指令导致的错误
4.全部变量皆使用类存储 2.注意bug没有改完也从未改完。
Delta 0.1.5.1 Delta 0.1.5.1
2022 2 1 农历大年初一 2022 2 1 农历大年初一

Binary file not shown.

Binary file not shown.