Skip to content

Commit 07431cb

Browse files
committed
feat:升级evf4、调整法埋雷算法升级、回车等于窗口确定、增加pluck、图标改色、播放器进度条时间3位小数
1 parent e8ca85f commit 07431cb

27 files changed

+94
-84
lines changed

.github/workflows/python-app.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
8484
- name: Package with PyInstaller
8585
run: |
86-
pyinstaller -i cat.ico -w -y --clean --add-data "./media/*;./media" --add-data "./de_DE.qm;." --add-data "./pl_PL.qm;." --add-data "./en_US.qm;." -p src src/main.py -n metaminesweeper
86+
pyinstaller -i "media/cat.ico" -w -y --clean --add-data "./media/*;./media" --add-data "./de_DE.qm;." --add-data "./pl_PL.qm;." --add-data "./en_US.qm;." -p src src/main.py -n metaminesweeper
8787
8888
- name: Move media and qm file
8989
run: |

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ Currently in the lengthy development phase, with updates approximately every 1 t
134134

135135
开源扫雷网官方扫雷软件[https://openms.top](https://openms.top)
136136

137+
![](https://api.star-history.com/svg?repos=eee555/Metasweeper&type=Date&theme=light)
138+
137139
## 赞助
138140
感谢您考虑支持我们的开源项目,赞助时请备注您的称呼(或Github主页)。您的赞助将有助于项目的持续发展和改进,使我们能够继续提高软件的质量(owner许诺向所有contributor按获得赞助时commit数量的比例分配赞助得到的收入)。
139141

cat.ico

-27.7 KB
Binary file not shown.

media/cat.ico

-9.04 KB
Binary file not shown.

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
pyQt5==5.15.7
2-
ms-toollib==1.4.12
2+
ms-toollib==1.4.15

src/captureScreen.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ def getBoard(self):
9898
byteCount = image.byteCount()
9999
s = Struct(str(byteCount) + 'B')
100100
self.data = s.unpack(bits[0:])
101-
102101
self.success_flag = True
103102
try:
104103
self.board = ms_toollib.OBR_board(self.data, self.height, self.width)

src/demo_OBR.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/gameScoreBoard.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class gameScoreBoardManager():
7373
video_index = ["bbbv", "op", "isl", "cell0", "cell1", "cell2", "cell3",
7474
"cell4", "cell5", "cell6", "cell7", "cell8", "fps", "etime",
7575
"stnb", "rqp", "qg", "ioe", "thrp", "corr", "ce",
76-
"ce_s", "bbbv_solved", "bbbv_s", "op_solved", "isl_solved"]
76+
"ce_s", "bbbv_solved", "bbbv_s", "op_solved", "isl_solved", "pluck"]
7777

7878
# is_visible = False
7979
# 5、错误的表达式,一旦算出报错,永远不再算,显示error
@@ -227,7 +227,8 @@ def update_namespace(self, ms_board, index_type):
227227
"thrp": ms_board.thrp,
228228
"corr": ms_board.corr,
229229
"ce": ms_board.ce,
230-
"ce_s": ms_board.ce_s, # 一直为0
230+
"ce_s": ms_board.ce_s,
231+
"pluck": ms_board.pluck,
231232
})
232233

233234

src/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def find_window(class_name, window_name):
137137
# bbbv_s, (op_solved), (isl_solved)
138138
# 录像静态类:bbbv,op, isl, cell0, cell1, cell2, cell3, cell4, cell5, cell6,
139139
# cell7, cell8, fps, (hizi)
140+
# 录像动态类(依赖分析):pluck
140141
# 其他类:checksum_ok, race_identifier, mode, is_offical, is_fair
141142

142143
# 工具箱中局面状态和鼠标状态的定义:

src/mineSweeperGUI.py

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import ctypes
1818
import hashlib, uuid
1919
# from PyQt5.QtWidgets import QApplication
20-
# from country_name import country_name
20+
from country_name import country_name
2121
import metaminesweeper_checksum
2222
from mainWindowGUI import MainWindow
2323

@@ -34,10 +34,10 @@ def __init__(self, MainWindow: MainWindow, args):
3434
self.time_10ms: int = 0 # 已毫秒为单位的游戏时间,全局统一的
3535
self.showTime(self.time_10ms // 100)
3636
self.timer_10ms = QTimer()
37-
# 开了高精度反而精度降低
38-
# self.timer_10ms.setTimerType(Qt.PreciseTimer)
3937
self.timer_10ms.setInterval(10) # 10毫秒回调一次的定时器
4038
self.timer_10ms.timeout.connect(self.timeCount)
39+
# 开了高精度反而精度降低
40+
self.timer_10ms.setTimerType(Qt.PreciseTimer)
4141
# text4 = '1'
4242
# self.label_info.setText(text4)
4343
self.mineUnFlagedNum = self.mineNum # 没有标出的雷,显示在左上角
@@ -683,27 +683,27 @@ def dump_evf_file_data(self):
683683

684684
self.label.ms_board.software = superGUI.version
685685
self.label.ms_board.mode = self.gameMode
686-
self.label.ms_board.player_identifier = self.player_identifier.encode( "UTF-8" )
687-
self.label.ms_board.race_identifier = self.race_identifier.encode( "UTF-8" )
688-
self.label.ms_board.uniqueness_identifier = self.unique_identifier.encode( "UTF-8" )
689-
self.label.ms_board.country = self.country.encode( "UTF-8" )
686+
self.label.ms_board.player_identifier = self.player_identifier
687+
self.label.ms_board.race_identifier = self.race_identifier
688+
self.label.ms_board.uniqueness_identifier = self.unique_identifier
689+
self.label.ms_board.country = country_name[self.country].upper()
690690
self.label.ms_board.device_uuid = hashlib.md5(bytes(str(uuid.getnode()).encode())).hexdigest().encode( "UTF-8" )
691691

692-
self.label.ms_board.generate_evf_v3_raw_data()
692+
self.label.ms_board.generate_evf_v4_raw_data()
693693
# 补上校验值
694694
checksum = self.checksum_guard.get_checksum(self.label.ms_board.raw_data[:-1])
695-
self.label.ms_board.checksum = checksum
695+
self.label.ms_board.checksum_evf_v4 = checksum
696696
return
697697
elif isinstance(self.label.ms_board, ms.EvfVideo):
698698
return
699699
elif isinstance(self.label.ms_board, ms.AvfVideo):
700-
self.label.ms_board.generate_evf_v3_raw_data()
700+
self.label.ms_board.generate_evf_v4_raw_data()
701701
return
702702
elif isinstance(self.label.ms_board, ms.MvfVideo):
703-
self.label.ms_board.generate_evf_v3_raw_data()
703+
self.label.ms_board.generate_evf_v4_raw_data()
704704
return
705705
elif isinstance(self.label.ms_board, ms.RmvVideo):
706-
self.label.ms_board.generate_evf_v3_raw_data()
706+
self.label.ms_board.generate_evf_v4_raw_data()
707707
return
708708

709709

@@ -714,26 +714,26 @@ def save_evf_file(self):
714714
if not os.path.exists(self.replay_path):
715715
os.mkdir(self.replay_path)
716716

717-
if (self.row, self.column, self.mineNum) == (8, 8, 10):
717+
if (self.label.ms_board.row, self.label.ms_board.column, self.label.ms_board.mine_num) == (8, 8, 10):
718718
filename_level = "b_"
719-
elif (self.row, self.column, self.mineNum) == (16, 16, 40):
719+
elif (self.label.ms_board.row, self.label.ms_board.column, self.label.ms_board.mine_num) == (16, 16, 40):
720720
filename_level = "i_"
721-
elif (self.row, self.column, self.mineNum) == (16, 30, 99):
721+
elif (self.label.ms_board.row, self.label.ms_board.column, self.label.ms_board.mine_num) == (16, 30, 99):
722722
filename_level = "e_"
723723
else:
724724
filename_level = "c_"
725725
file_name = self.replay_path + '\\' + filename_level +\
726-
str(self.gameMode) + '_' +\
726+
f'{self.label.ms_board.mode}' + '_' +\
727727
f'{self.label.ms_board.rtime:.3f}' +\
728728
'_' + f'{self.label.ms_board.bbbv}' +\
729729
'_' + f'{self.label.ms_board.bbbv_s:.3f}' +\
730-
'_' + bytes(self.label.ms_board.player_identifier).decode()
730+
'_' + self.label.ms_board.player_identifier
731731

732732
if not self.label.ms_board.is_completed:
733733
file_name += "_fail"
734734
if not self.label.ms_board.is_fair:
735735
file_name += "_cheat"
736-
if bytes(self.label.ms_board.software).decode()[0] != "元":
736+
if self.label.ms_board.software[0] != "元":
737737
file_name += "_trans"
738738
elif not self.checksum_module_ok():
739739
file_name += "_fake"
@@ -1069,6 +1069,7 @@ def action_NEvent(self):
10691069
self.player_identifier = ui.player_identifier
10701070
self.label_info.setText(self.player_identifier)
10711071
self.race_identifier = ui.race_identifier
1072+
# 国家或地区名的全称,例如”中国“
10721073
self.country = ui.country
10731074
self.set_country_flag()
10741075
self.autosave_video = ui.autosave_video
@@ -1135,7 +1136,7 @@ def action_AEvent(self):
11351136
def auto_Update(self):
11361137
data = {
11371138
"Github": "https://api.github.com/repos/",
1138-
# "Gitee": "https://api.gitee.com/repos/",
1139+
"Gitee": "https://api.gitee.com/repos/",
11391140
}
11401141
update_dialog = CheckUpdateGui(GitHub(SourceManager(data), "eee555",
11411142
"Metasweeper", superGUI.version.decode( "UTF-8" ), "(\d+\.\d+\.\d+)"), parent = self)
@@ -1277,9 +1278,9 @@ def showScores(self):
12771278
# self.label.setMouseTracking(True)
12781279
mineNum = self.mineNum
12791280
# 删去用户标的雷,因为可能标错
1280-
game_board = list(map(lambda x: list(map(lambda y: min(y, 10), x)),
1281-
self.label.ms_board.game_board))
1282-
ans = ms.cal_possibility_onboard(game_board, mineNum)
1281+
# game_board = list(map(lambda x: list(map(lambda y: min(y, 10), x)),
1282+
# self.label.ms_board.game_board))
1283+
ans = ms.cal_possibility_onboard(self.label.ms_board.game_board, mineNum)
12831284
self.label.boardPossibility = ans[0]
12841285
self.label.update()
12851286

@@ -1366,11 +1367,10 @@ def play_video(self, video):
13661367
"mouse_trace", "vision_transfer", "survive_poss"])
13671368

13681369
# 组织录像评论
1369-
event_len = video.events_len
13701370
comments = []
1371-
for event_id in range(event_len):
1372-
t = video.events_time(event_id)
1373-
comment = video.events_comments(event_id)
1371+
for event in video.events:
1372+
t = event.time
1373+
comment = event.comments
13741374
if comment:
13751375
comments.append((t, [i.split(': ') for i in comment.split(';')[:-1]]))
13761376
# 调整窗口
@@ -1410,9 +1410,10 @@ def play_video(self, video):
14101410
video.video_playing_pix_size = self.label.pixSize
14111411
self.label.ms_board = video
14121412
# 改成录像的标识
1413-
self.label_info.setText(bytes(self.label.ms_board.player_identifier).decode())
1413+
# print(self.label.ms_board.player_identifier)
1414+
self.label_info.setText(self.label.ms_board.player_identifier)
14141415
# 改成录像的国旗
1415-
self.set_country_flag(bytes(self.label.ms_board.country).decode())
1416+
self.set_country_flag(self.label.ms_board.country)
14161417

14171418

14181419
def video_playing_step(self):
@@ -1426,7 +1427,7 @@ def video_playing_step(self):
14261427
self.video_time += self.video_time_step
14271428
self.showTime(int(self.video_time))
14281429
self.ui_video_control.horizontalSlider_time.blockSignals(True)
1429-
self.ui_video_control.horizontalSlider_time.setValue(int(self.video_time * 100))
1430+
self.ui_video_control.horizontalSlider_time.setValue(int(self.video_time * 1000))
14301431
self.ui_video_control.horizontalSlider_time.blockSignals(False)
14311432
self.ui_video_control.doubleSpinBox_time.blockSignals(True)
14321433
self.ui_video_control.doubleSpinBox_time.setValue(self.label.ms_board.time)
@@ -1453,15 +1454,15 @@ def video_set_speed(self, speed):
14531454

14541455
def video_set_time(self, t):
14551456
# 把录像定位到某一个时刻。是拖动进度条的回调
1456-
self.video_time = t / 100
1457+
self.video_time = t / 1000
14571458
self.label.ms_board.current_time = self.video_time
14581459
self.label.update()
14591460
self.score_board_manager.show(self.label.ms_board, index_type = 2)
14601461

14611462
def video_set_a_time(self, t):
14621463
# 把录像定位到某一段时间,默认前后一秒,自动播放。是点录像事件的回调
1463-
self.video_time = (t - 100) / 100
1464-
self.video_stop_time = (t + 100) / 100 # 大了也没关系,ms_toollib自动处理
1464+
self.video_time = (t - 1000) / 1000
1465+
self.video_stop_time = (t + 1000) / 1000 # 大了也没关系,ms_toollib自动处理
14651466
self.timer_video.start()
14661467
self.video_playing = True
14671468

0 commit comments

Comments
 (0)