创建回放控制器 / Create replay controller Args: recording_path: 录制 JSONL 文件路径,由 RecordController 写入。截图路径基于该文件所在目录解析。 Path to the recording JSONL file written by RecordController. Screenshot paths are resolved relative to this fil
(
self,
recording_path: Union[str, Path],
)
| 1100 | """回放控制器,用于回放录制文件 / Replay controller for replaying recorded operations""" |
| 1101 | |
| 1102 | def __init__( |
| 1103 | self, |
| 1104 | recording_path: Union[str, Path], |
| 1105 | ): |
| 1106 | """创建回放控制器 / Create replay controller |
| 1107 | |
| 1108 | Args: |
| 1109 | recording_path: 录制 JSONL 文件路径,由 RecordController 写入。截图路径基于该文件所在目录解析。 |
| 1110 | |
| 1111 | Path to the recording JSONL file written by RecordController. Screenshot |
| 1112 | paths are resolved relative to this file's parent directory. |
| 1113 | |
| 1114 | Raises: |
| 1115 | RuntimeError: 如果创建失败 |
| 1116 | """ |
| 1117 | super().__init__() |
| 1118 | self._set_replay_api_properties() |
| 1119 | |
| 1120 | self._handle = Library.framework().MaaReplayControllerCreate( |
| 1121 | str(recording_path).encode(), |
| 1122 | ) |
| 1123 | |
| 1124 | if not self._handle: |
| 1125 | raise RuntimeError("Failed to create replay controller.") |
| 1126 | |
| 1127 | def _set_replay_api_properties(self): |
| 1128 | Library.framework().MaaReplayControllerCreate.restype = MaaControllerHandle |
nothing calls this directly
no test coverage detected