@@ -416,11 +416,13 @@ def mineAreaLeftRelease(self, i, j):
416416 # 正式埋雷开始
417417 self .layMine (i // self .pixSize , j // self .pixSize )
418418
419+ # 只有没有“局面约束”时,录像才可能是“official”的
419420 if self .board_constraint :
420421 self .game_state = 'joking'
421422 else :
422423 self .game_state = 'playing'
423424
425+ # 假如未开启“直播模式”,禁用代码截图
424426 if self .player_identifier [:6 ] != "[live]" :
425427 self .disable_screenshot ()
426428 else :
@@ -527,7 +529,7 @@ def mineMouseMove(self, i, j):
527529 self .label_info .setText ('(是雷的概率)' )
528530 else :
529531 text4 = '{:.3f}' .format (
530- max (0 , self .label .boardPossibility [i // self .pixSize ][j // self .pixSize ]))
532+ max (0 , self .label .boardProbability [i // self .pixSize ][j // self .pixSize ]))
531533 self .label_info .setText (text4 )
532534 # 播放录像时的鼠标移动事件
533535 elif self .game_state == 'showdisplay' :
@@ -600,7 +602,7 @@ def gameStart(self):
600602 self .timer_10ms .stop ()
601603 self .score_board_manager .editing_row = - 1
602604
603- self .label .paintPossibility = False
605+ self .label .paintProbability = False
604606 self .label_info .setText (self .player_identifier )
605607
606608 # 这里有点乱
@@ -652,7 +654,7 @@ def gameRestart(self, e=None): # 画界面,但是不埋雷,改数据而不
652654 self .label .ms_board .reset (self .row , self .column , self .pixSize )
653655 self .label .update ()
654656
655- self .label .paintPossibility = False
657+ self .label .paintProbability = False
656658 # self.label.paint_cursor = False
657659 # self.label.setMouseTracking(False) # 鼠标未按下时,组织移动事件回调
658660
@@ -1105,7 +1107,7 @@ def setBoard_and_start(self, row, column, mineNum):
11051107 # 把局面设置成(row, column, mineNum),把3BV的限制设置成min3BV, max3BV
11061108 # 比gameStart更高级
11071109 if self .game_state == 'display' or self .game_state == 'showdisplay' :
1108- self .label .paintPossibility = False
1110+ self .label .paintProbability = False
11091111 if (self .row , self .column , self .mineNum ) != (row , column , mineNum ):
11101112 self .setBoard (row , column , mineNum )
11111113 self .gameStart ()
@@ -1220,6 +1222,7 @@ def screenShot(self):
12201222 self .video_playing = False
12211223 self .timer_video .stop ()
12221224
1225+ self .unlimit_cursor ()
12231226 self .enable_screenshot ()
12241227
12251228 ui = captureScreen .CaptureScreen ()
@@ -1231,7 +1234,7 @@ def screenShot(self):
12311234
12321235 # 会报两种runtimeerror,标记阶段无解的局面、枚举阶段无解的局面
12331236 try :
1234- ans = ms .cal_possibility_onboard (
1237+ ans = ms .cal_probability_onboard (
12351238 ui .board , 0.20625 if len (ui .board [0 ]) >= 24 else 0.15625 )
12361239 except :
12371240 return
@@ -1279,15 +1282,15 @@ def screenShot(self):
12791282 # self.setBoard_and_start(len(ui.board), len(ui.board[0]), ans[1][1])
12801283 self .setBoard (self .row , self .column , ans [1 ][1 ])
12811284
1282- self .label .paintPossibility = True
1285+ self .label .paintProbability = True
12831286 self .label .set_rcp (self .row , self .column , self .pixSize )
12841287
12851288 self .label .ms_board .game_board = ui .board
12861289 self .label .ms_board .mouse_state = 1
12871290 self .label .ms_board .game_board_state = 1
12881291 self .mineNumShow = ans [1 ][1 ]
12891292 self .showMineNum (self .mineNumShow )
1290- self .label .boardPossibility = ans [0 ]
1293+ self .label .boardProbability = ans [0 ]
12911294
12921295 self .label .update ()
12931296 # self.label.setMouseTracking(True)
@@ -1297,26 +1300,26 @@ def screenShot(self):
12971300 def render_poss_on_board (self ):
12981301 # 雷数条拉动后、改局面后,显示雷数并展示
12991302 try :
1300- ans = ms .cal_possibility_onboard (
1303+ ans = ms .cal_probability_onboard (
13011304 self .label .ms_board .game_board , self .mineNumShow )
13021305 except :
13031306 try :
1304- ans = ms .cal_possibility_onboard (self .label .ms_board .game_board ,
1307+ ans = ms .cal_probability_onboard (self .label .ms_board .game_board ,
13051308 self .mineNumShow / self .row / self .column )
13061309 except :
13071310 # 无解,算法增加雷数后无解
1308- self .label .paintPossibility = False
1311+ self .label .paintProbability = False
13091312 self .num_bar_ui .QWidget .hide ()
13101313 self .label .update ()
13111314 return
13121315 else :
13131316 # 无解,算法增加雷数后有解
13141317 self .mineNumShow = ans [1 ][1 ]
1315- self .label .boardPossibility = ans [0 ]
1316- self .label .paintPossibility = True
1318+ self .label .boardProbability = ans [0 ]
1319+ self .label .paintProbability = True
13171320
1318- self .label .boardPossibility = ans [0 ]
1319- self .label .paintPossibility = True
1321+ self .label .boardProbability = ans [0 ]
1322+ self .label .paintProbability = True
13201323 self .num_bar_ui .QWidget .show ()
13211324 self .num_bar_ui .spinBox .setMinimum (ans [1 ][0 ])
13221325 self .num_bar_ui .spinBox .setMaximum (ans [1 ][2 ])
@@ -1342,34 +1345,34 @@ def showScores(self):
13421345 ...
13431346 elif self .game_state == 'playing' or self .game_state == 'joking' :
13441347 self .game_state = 'show'
1345- self .label .paintPossibility = True
1348+ self .label .paintProbability = True
13461349 # self.label.setMouseTracking(True)
13471350 mineNum = self .mineNum
13481351 # 删去用户标的雷,因为可能标错
13491352 # game_board = list(map(lambda x: list(map(lambda y: min(y, 10), x)),
13501353 # self.label.ms_board.game_board))
1351- ans = ms .cal_possibility_onboard (
1354+ ans = ms .cal_probability_onboard (
13521355 self .label .ms_board .game_board , mineNum )
1353- self .label .boardPossibility = ans [0 ]
1356+ self .label .boardProbability = ans [0 ]
13541357 self .label .update ()
13551358
13561359 def mineKeyReleaseEvent (self , keyName ):
13571360 # 松开空格键
13581361 if keyName == 'Space' :
13591362 if self .game_state == 'show' :
13601363 self .game_state = 'joking'
1361- self .label .paintPossibility = False
1364+ self .label .paintProbability = False
13621365 # self.label.setMouseTracking(False)
13631366 self .label_info .setText (self .player_identifier )
13641367 self .label .update ()
13651368 elif self .game_state == 'display' :
13661369 self .game_state = 'showdisplay'
1367- self .label .paintPossibility = True
1370+ self .label .paintProbability = True
13681371 # self.label.setMouseTracking(True)
13691372 self .label .update ()
13701373 elif self .game_state == 'showdisplay' :
13711374 self .game_state = 'display'
1372- self .label .paintPossibility = False
1375+ self .label .paintProbability = False
13731376 # self.label.setMouseTracking(False)
13741377 self .label .update ()
13751378
@@ -1448,7 +1451,7 @@ def play_video(self, video):
14481451 # 调整窗口
14491452 if (video .row , video .column ) != (self .row , self .column ):
14501453 self .setBoard (video .row , video .column , video .mine_num )
1451- self .label .paintPossibility = False
1454+ self .label .paintProbability = False
14521455 self .label .set_rcp (self .row , self .column , self .pixSize )
14531456 # self.label.reloadCellPic(self.pixSize)
14541457 self .label .setMinimumSize (QtCore .QSize (
@@ -1602,8 +1605,11 @@ def limit_cursor(self):
16021605 rect = QRect (widget_pos , widget_size )
16031606 self ._clip_mouse (rect )
16041607
1605- # 取消将鼠标区域限制在游戏界面中
1608+
16061609 def unlimit_cursor (self ):
1610+ '''
1611+ 取消将鼠标区域限制在游戏界面中。
1612+ '''
16071613 ctypes .windll .user32 .ClipCursor (None )
16081614
16091615 def _clip_mouse (self , rect ):
0 commit comments