Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/plugins/history/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from PyQt5.QtCore import QCoreApplication

from shared_types.enums import BaseDiaPlayEnum
from shared_types.enums import GameBoardState, GameMode, GameLevel, BaseDiaPlayEnum

_translate = QCoreApplication.translate

Expand Down Expand Up @@ -109,7 +109,7 @@ class HistoryData:
"""历史记录数据行(纯数据类,用类属性定义字段)"""

replay_id: int = 0
game_state: int = 6
game_state: GameBoardState = GameBoardState.Display
nf: int = 0
row: int = 0
column: int = 0
Expand All @@ -118,7 +118,7 @@ class HistoryData:
left: int = 0
right: int = 0
double: int = 0
level: int = 3
level: GameLevel = GameLevel.BEGINNER
cl: int = 0
ce: int = 0
rce: int = 0
Expand All @@ -131,7 +131,7 @@ class HistoryData:
path: float = 0.0
start_time: datetime = datetime.now()
end_time: datetime = datetime.now()
mode: int = 0
mode: GameMode = GameMode.Standard
software: str = ""
player_identifier: str = ""
race_identifier: str = ""
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/history/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class HistoryPlugin(BasePlugin[HistoryConfig]):
@classmethod
def plugin_info(cls) -> PluginInfo:
return PluginInfo(
name="history",
name="历史记录",
description="游戏历史记录(SQLite 持久化)",
author="ljzloser",
version="1.0.0",
Expand Down Expand Up @@ -344,11 +344,11 @@ def delete_record(self, record_id: int) -> bool:
def raw_query(self, sql: str, params: tuple = ()) -> list[dict[str, Any]]:
"""
直接执行 SQL 查询

Args:
sql: SQL 查询语句(使用 ? 作为参数占位符)
params: 参数元组

Returns:
字典列表
"""
Expand Down
53 changes: 39 additions & 14 deletions src/shared_types/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,29 +47,54 @@ class GameBoardState(BaseDiaPlayEnum):
游戏板状态枚举

这些魔数遵循 ms_toollib 标准。
'ready'、'study'、'show'、'playing'、'joking'、
# 'fail'、'win'、'jofail'、'jowin'、'display'、'showdisplay'
jofail:作弊过且失败
jowin:作弊过且成功
display:播放录像中
showdisplay:播放录像的同时显示是雷的概率
study:研究模式(摆雷模式)
show:游戏过程中正在按下空格显示是雷的概率
joking:作弊后游戏中
playing:游戏中
"""
Ready = 1
Playing = 2
Win = 3
Loss = 4
PreFlaging = 5
Display = 6
Ready = 0
Study = 1
Show = 2
Playing = 3
Joking = 4
Fail = 5
Win = 6
Jofail = 7
Jowin = 8
Display = 9
ShowDisplay = 10

@property
def display_name(self) -> str:
match self:
case GameBoardState.Win:
return _translate("Form", "胜利")
case GameBoardState.Loss:
return _translate("Form", "失败")
case GameBoardState.Ready:
return _translate("Form", "准备")
case GameBoardState.Study:
return _translate("Form", "研究模式")
case GameBoardState.Show:
return _translate("Form", "显示概率")
case GameBoardState.Playing:
return _translate("Form", "进行中")
case GameBoardState.PreFlaging:
return _translate("Form", "预标记")
return _translate("Form", "游戏中")
case GameBoardState.Joking:
return _translate("Form", "作弊中")
case GameBoardState.Fail:
return _translate("Form", "失败")
case GameBoardState.Win:
return _translate("Form", "胜利")
case GameBoardState.Jofail:
return _translate("Form", "作弊且失败")
case GameBoardState.Jowin:
return _translate("Form", "作弊且成功")
case GameBoardState.Display:
return _translate("Form", "回放")
return _translate("Form", "播放录像中")
case GameBoardState.ShowDisplay:
return _translate("Form", "播放录像时显示概率")
case _:
return str(self.value)

Expand Down
Loading