poi-plugin-kcsave-exporter 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +5 -10
  2. package/index.es +209 -0
  3. package/package.json +10 -7
  4. package/index.js +0 -300
package/README.md CHANGED
@@ -1,17 +1,12 @@
1
- # poi-plugin-kcsave-exporter
1
+ # poi-plugin-kcsave-exporter (poi 12.0.1)
2
2
 
3
- 零外部依赖的 poi 插件,可将当前登录的舰队 Collection 正式服数据一键完全导出为单机版 `.kcsave`(`KCSAVE5`)存档。
4
-
5
- ## 导出内容
6
-
7
- - **自动从 poi 内存读取**:提督信息、8 项资源、全部舰娘(等级/经验/改修/锁船/打孔/装备)、全部装备(改修/熟练度/锁定)、4 支舰队编成、入渠/建造渠、持有道具与家具币、海域攻略进度、基地航空队。
8
- - **自动监听接口捕获(打开对应游戏界面一次即自动记录)**:全部持有家具与母港皮肤(登录时 `require_info`)、编成记录(`preset_deck`)、远征通关记录(`mission`)、舰船/装备图鉴(`picture_book`)、任务列表(`questlist`)。
3
+ 基于 **poi 12.0.1** 插件规范(`.es` ESM + JSX、React Hooks、`react-redux` `useSelector`、`@blueprintjs/core`、`@electron/remote`)编写的零依赖单机版 `.kcsave`(`KCSAVE5`)完全导出插件。
9
4
 
10
5
  ## 安装方法
11
6
 
12
- 1. 将解压后的 `poi-plugin-kcsave-exporter` 整个文件夹复制到 poi 的插件目录:
7
+ 1. 解压后将 `poi-plugin-kcsave-exporter` 文件夹复制到 poi 插件目录:
13
8
  - Windows: `%APPDATA%\poi\plugins\node_modules\`
14
9
  - macOS: `~/Library/Application Support/poi/plugins/node_modules/`
15
10
  - Linux: `~/.config/poi/plugins/node_modules/`
16
- *(也可在 poi 设置 -> 扩展程序 -> 手动安装中直接选择该文件夹)*
17
- 2. 重启 poi,在插件栏打开 **单机存档导出** 即可使用(无需 `npm install`,纯内置模块零依赖)。
11
+ (也可在 poi「设置 -> 扩展程序 -> 手动安装」中选择该文件夹)
12
+ 2. 重启 poi,在插件栏打开 **单机存档导出** 即可使用,无需执行 `npm install`。
package/index.es ADDED
@@ -0,0 +1,209 @@
1
+ import fs from 'fs'
2
+ import path from 'path'
3
+ import React, { useState, useEffect, useCallback } from 'react'
4
+ import { useSelector } from 'react-redux'
5
+ import {
6
+ Button,
7
+ Callout,
8
+ Card,
9
+ Divider,
10
+ Elevation,
11
+ Intent,
12
+ Tag,
13
+ } from '@blueprintjs/core'
14
+ import { dialog } from '@electron/remote'
15
+ import { ApiCaptureStore } from './lib/capture'
16
+ import { exportToKcsaveBuffer } from './lib/exporter'
17
+
18
+ const captureStore = new ApiCaptureStore()
19
+
20
+ const formatTime = (ts) => (ts ? new Date(ts).toLocaleTimeString() : '未捕获')
21
+
22
+ const KcsaveExporter = () => {
23
+ const basic = useSelector((state) => state.info?.basic || {})
24
+ const shipsCount = useSelector((state) => Object.keys(state.info?.ships || {}).length)
25
+ const equipsCount = useSelector((state) => Object.keys(state.info?.equips || {}).length)
26
+ const mapsCount = useSelector((state) => Object.keys(state.info?.maps || {}).length)
27
+ const airbaseCount = useSelector((state) => (Array.isArray(state.info?.airbase) ? state.info.airbase.length : 0))
28
+
29
+ const [captured, setCaptured] = useState(() => ({ ...captureStore.data }))
30
+ const [baseFilePath, setBaseFilePath] = useState('')
31
+ const [exporting, setExporting] = useState(false)
32
+ const [status, setStatus] = useState(null) // { text, intent }
33
+ const [lastStats, setLastStats] = useState(null)
34
+
35
+ useEffect(() => {
36
+ captureStore.attach()
37
+ const unsub = captureStore.subscribe((data) => {
38
+ setCaptured({ ...data })
39
+ })
40
+ return () => unsub()
41
+ }, [])
42
+
43
+ const handlePickBase = useCallback(async () => {
44
+ try {
45
+ const res = await dialog.showOpenDialog({
46
+ title: '选择已有单机版 .kcsave 模板(可选)',
47
+ filters: [{ name: 'KanColle Offline Save', extensions: ['kcsave'] }],
48
+ properties: ['openFile'],
49
+ })
50
+ const filePath = !res.canceled && res.filePaths?.[0]
51
+ if (filePath) {
52
+ setBaseFilePath(filePath)
53
+ setStatus({ text: `已选择模板:${path.basename(filePath)}`, intent: Intent.PRIMARY })
54
+ }
55
+ } catch (err) {
56
+ setStatus({ text: `选择模板失败:${err.message}`, intent: Intent.DANGER })
57
+ }
58
+ }, [])
59
+
60
+ const handleClearBase = useCallback(() => {
61
+ setBaseFilePath('')
62
+ setStatus({ text: '已清除模板,将使用内置默认模板独立导出。', intent: Intent.NONE })
63
+ }, [])
64
+
65
+ const handleClearCache = useCallback(() => {
66
+ captureStore.clearCache()
67
+ setStatus({ text: '已清空本地捕获缓存,重新打开对应游戏界面后会自动记录。', intent: Intent.NONE })
68
+ }, [])
69
+
70
+ const handleExport = useCallback(async () => {
71
+ setExporting(true)
72
+ setStatus({ text: '正在汇总数据并生成 .kcsave 存档...', intent: Intent.PRIMARY })
73
+ try {
74
+ const reduxState = typeof window.getStore === 'function' ? window.getStore() : {}
75
+ const baseBuf =
76
+ baseFilePath && fs.existsSync(baseFilePath) ? fs.readFileSync(baseFilePath) : null
77
+
78
+ const { buffer, stats } = exportToKcsaveBuffer(reduxState, captureStore.data, baseBuf)
79
+
80
+ const safeName = (stats.nickname || 'admiral').replace(/[\\/:*?"<>|]/g, '_')
81
+ const stamp = new Date().toISOString().slice(0, 10).replace(/-/g, '')
82
+ const defaultPath = `kancolle-${safeName}-${stamp}.kcsave`
83
+
84
+ const res = await dialog.showSaveDialog({
85
+ title: '导出单机版 .kcsave 存档',
86
+ defaultPath,
87
+ filters: [{ name: 'KanColle Offline Save', extensions: ['kcsave'] }],
88
+ })
89
+
90
+ if (res.canceled || !res.filePath) {
91
+ setStatus({ text: '已取消保存。', intent: Intent.NONE })
92
+ return
93
+ }
94
+
95
+ fs.writeFileSync(res.filePath, buffer)
96
+ setLastStats(stats)
97
+ setStatus({
98
+ text: `导出成功!已保存至 ${res.filePath}(${(buffer.length / 1024 / 1024).toFixed(2)} MB)`,
99
+ intent: Intent.SUCCESS,
100
+ })
101
+ } catch (err) {
102
+ setStatus({
103
+ text: `导出失败:${err?.message || String(err)}`,
104
+ intent: Intent.DANGER,
105
+ })
106
+ } finally {
107
+ setExporting(false)
108
+ }
109
+ }, [baseFilePath])
110
+
111
+ const capAt = captured.capturedAt || {}
112
+ const furnitureCount = (captured.furnitureOwned || []).length
113
+ const presetsCount = Object.keys(captured.presets || {}).length
114
+ const expeditionsCount = Object.keys(captured.expeditionHistory || {}).length
115
+ const albumShipsCount = Object.keys(captured.albumShips || {}).length
116
+ const albumEquipsCount = Object.keys(captured.albumEquips || {}).length
117
+ const questsCount = Object.keys(captured.quests || {}).length
118
+
119
+ return (
120
+ <div style={{ padding: 14, height: '100%', overflowY: 'auto', display: 'flex', flexDirection: 'column', gap: 12 }}>
121
+ <Card elevation={Elevation.ONE}>
122
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 8 }}>
123
+ <strong>当前 poi 内存数据</strong>
124
+ <Tag intent={basic.api_nickname ? Intent.SUCCESS : Intent.WARNING} minimal>
125
+ {basic.api_nickname ? `${basic.api_nickname} (Lv.${basic.api_level || 0})` : '未进入母港'}
126
+ </Tag>
127
+ </div>
128
+ <div style={{ display: 'flex', flexWrap: 'wrap', gap: 6 }}>
129
+ <Tag minimal>舰娘 {shipsCount}</Tag>
130
+ <Tag minimal>装备 {equipsCount}</Tag>
131
+ <Tag minimal>海域 {mapsCount}</Tag>
132
+ <Tag minimal>陆航 {airbaseCount}</Tag>
133
+ </div>
134
+ </Card>
135
+
136
+ <Card elevation={Elevation.ONE}>
137
+ <strong style={{ display: 'block', marginBottom: 8 }}>额外完整数据捕获状态(打开对应界面自动记录)</strong>
138
+ <div style={{ fontSize: 12, lineHeight: 1.8 }}>
139
+ <div>• 持有家具与设置 (require_info):{furnitureCount} 件({formatTime(capAt.require_info)})</div>
140
+ <div>• 编成记录 (preset_deck):{presetsCount} 组({formatTime(capAt.preset_deck)})</div>
141
+ <div>• 远征通关记录 (mission):{expeditionsCount} 项({formatTime(capAt.mission)})</div>
142
+ <div>• 图鉴记录 (picture_book):舰船 {albumShipsCount} / 装备 {albumEquipsCount}({formatTime(capAt.album_ships || capAt.album_equips)})</div>
143
+ <div>• 任务列表 (questlist):{questsCount} 项({formatTime(capAt.questlist)})</div>
144
+ </div>
145
+ <Divider style={{ margin: '10px 0' }} />
146
+ <div style={{ fontSize: 12, opacity: 0.78 }}>
147
+ 提示:舰娘、装备、资源、舰队、渠位、道具、海域与陆航可直接导出;如需连带家具、远征、编成记录、图鉴与任务一起导出,请先在游戏内打开对应界面一次即可自动捕获。
148
+ </div>
149
+ </Card>
150
+
151
+ <Card elevation={Elevation.ONE}>
152
+ <div style={{ fontSize: 12, marginBottom: 10 }}>
153
+ <strong>可选基础模板:</strong>
154
+ {baseFilePath ? path.basename(baseFilePath) : '无(使用内置默认模板独立导出)'}
155
+ </div>
156
+ <div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
157
+ <Button
158
+ intent={Intent.PRIMARY}
159
+ icon="export"
160
+ loading={exporting}
161
+ onClick={handleExport}
162
+ >
163
+ 一键完全导出 .kcsave
164
+ </Button>
165
+ <Button icon="document-open" onClick={handlePickBase}>
166
+ 选择模板 .kcsave(可选)
167
+ </Button>
168
+ {baseFilePath && (
169
+ <Button icon="cross" onClick={handleClearBase}>
170
+ 清除模板
171
+ </Button>
172
+ )}
173
+ <Button icon="trash" minimal onClick={handleClearCache}>
174
+ 清空捕获缓存
175
+ </Button>
176
+ </div>
177
+ </Card>
178
+
179
+ {status && (
180
+ <Callout intent={status.intent} style={{ wordBreak: 'break-all' }}>
181
+ {status.text}
182
+ </Callout>
183
+ )}
184
+
185
+ {lastStats && (
186
+ <Callout title="本次导出明细" intent={Intent.SUCCESS}>
187
+ <div style={{ fontSize: 12, lineHeight: 1.7 }}>
188
+ 提督 {lastStats.nickname} (Lv.{lastStats.level}) | 舰娘 {lastStats.ships} | 装备 {lastStats.equipment} |
189
+ 舰队 {lastStats.decks} | 道具 {lastStats.inventory} | 家具 {lastStats.furniture} |
190
+ 海域 {lastStats.maps} | 陆航 {lastStats.airBases} | 编成记录 {lastStats.presets} |
191
+ 图鉴 {lastStats.albumShips}/{lastStats.albumEquips}
192
+ </div>
193
+ </Callout>
194
+ )}
195
+ </div>
196
+ )
197
+ }
198
+
199
+ export const reactClass = KcsaveExporter
200
+
201
+ export const windowMode = false
202
+
203
+ export const pluginDidLoad = () => {
204
+ captureStore.attach()
205
+ }
206
+
207
+ export const pluginWillUnload = () => {
208
+ captureStore.detach()
209
+ }
package/package.json CHANGED
@@ -1,19 +1,22 @@
1
1
  {
2
2
  "name": "poi-plugin-kcsave-exporter",
3
- "version": "1.0.0",
4
- "description": "一键将舰队 Collection 正式服数据完全导出为单机版 .kcsave (KCSAVE5) 存档",
5
- "main": "index.js",
3
+ "version": "1.0.1",
4
+ "description": "一键将舰队 Collection 正式服数据完全导出为单机版 .kcsave (KCSAVE5) 存档(适配 poi 12.0.1)",
5
+ "main": "index.es",
6
6
  "keywords": [
7
- "poi-plugin",
8
7
  "kancolle",
8
+ "poi",
9
+ "poi-plugin",
9
10
  "kcsave"
10
11
  ],
11
12
  "license": "MIT",
12
13
  "poiPlugin": {
13
- "id": "poi-plugin-kcsave-exporter",
14
14
  "title": "单机存档导出",
15
+ "description": "零依赖一键完全导出舰队单机版 .kcsave 存档",
15
16
  "icon": "fa/floppy-o",
16
- "category": "utility",
17
- "description": "零依赖一键完全导出舰队单机版 .kcsave 存档"
17
+ "priority": 100,
18
+ "apiVer": {
19
+ "12.0.0": "1.0.0"
20
+ }
18
21
  }
19
22
  }
package/index.js DELETED
@@ -1,300 +0,0 @@
1
- 'use strict';
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
- const React = require('react');
6
- const { ApiCaptureStore } = require('./lib/capture');
7
- const { exportToKcsaveBuffer } = require('./lib/exporter');
8
-
9
- const captureStore = new ApiCaptureStore();
10
-
11
- function getElectronDialog() {
12
- try {
13
- const remote = require('@electron/remote');
14
- if (remote && remote.dialog) return remote.dialog;
15
- } catch (_) {}
16
- try {
17
- const electron = require('electron');
18
- if (electron && electron.remote && electron.remote.dialog) {
19
- return electron.remote.dialog;
20
- }
21
- } catch (_) {}
22
- return null;
23
- }
24
-
25
- function getReduxState() {
26
- if (typeof window !== 'undefined' && typeof window.getStore === 'function') {
27
- return window.getStore();
28
- }
29
- return {};
30
- }
31
-
32
- function formatTime(ts) {
33
- if (!ts) return '未捕获';
34
- const d = new Date(ts);
35
- return `${d.toLocaleTimeString()}`;
36
- }
37
-
38
- class KcsaveExporterPanel extends React.Component {
39
- constructor(props) {
40
- super(props);
41
- this.state = {
42
- status: '',
43
- statusType: 'info',
44
- exporting: false,
45
- baseFilePath: '',
46
- lastStats: null,
47
- captured: captureStore.data,
48
- };
49
- this._unsub = null;
50
- this._handleExport = this._handleExport.bind(this);
51
- this._handlePickBase = this._handlePickBase.bind(this);
52
- this._handleClearBase = this._handleClearBase.bind(this);
53
- this._handleClearCache = this._handleClearCache.bind(this);
54
- }
55
-
56
- componentDidMount() {
57
- captureStore.attach();
58
- this._unsub = captureStore.subscribe((data) => {
59
- this.setState({ captured: Object.assign({}, data) });
60
- });
61
- }
62
-
63
- componentWillUnmount() {
64
- if (this._unsub) {
65
- this._unsub();
66
- this._unsub = null;
67
- }
68
- }
69
-
70
- async _handlePickBase() {
71
- const dialog = getElectronDialog();
72
- if (!dialog) {
73
- this.setState({ status: '当前环境无法打开文件选择框,可直接无模板导出。', statusType: 'warn' });
74
- return;
75
- }
76
- try {
77
- const res = await dialog.showOpenDialog({
78
- title: '选择已有单机版 .kcsave 模板(可选)',
79
- filters: [{ name: 'KanColle Offline Save', extensions: ['kcsave'] }],
80
- properties: ['openFile'],
81
- });
82
- const filePath = res && !res.canceled && res.filePaths && res.filePaths[0];
83
- if (filePath) {
84
- this.setState({ baseFilePath: filePath, status: `已选择模板: ${path.basename(filePath)}`, statusType: 'info' });
85
- }
86
- } catch (err) {
87
- this.setState({ status: `选择模板失败: ${err.message}`, statusType: 'error' });
88
- }
89
- }
90
-
91
- _handleClearBase() {
92
- this.setState({ baseFilePath: '', status: '已清除模板,将使用内置默认配置导出。', statusType: 'info' });
93
- }
94
-
95
- _handleClearCache() {
96
- captureStore.clearCache();
97
- this.setState({ status: '已清空本地捕获缓存。重新进入母港或相关页面后会自动重新捕获。', statusType: 'info' });
98
- }
99
-
100
- async _handleExport() {
101
- this.setState({ exporting: true, status: '正在汇总数据并生成 .kcsave 存档...', statusType: 'info' });
102
- try {
103
- const reduxState = getReduxState();
104
- let baseBuf = null;
105
- if (this.state.baseFilePath && fs.existsSync(this.state.baseFilePath)) {
106
- baseBuf = fs.readFileSync(this.state.baseFilePath);
107
- }
108
- const { buffer, stats } = exportToKcsaveBuffer(reduxState, captureStore.data, baseBuf);
109
-
110
- const safeName = (stats.nickname || 'admiral').replace(/[\\/:*?"<>|]/g, '_');
111
- const stamp = new Date().toISOString().slice(0, 10).replace(/-/g, '');
112
- const defaultFile = `kancolle-${safeName}-${stamp}.kcsave`;
113
-
114
- const dialog = getElectronDialog();
115
- if (dialog) {
116
- const res = await dialog.showSaveDialog({
117
- title: '导出单机版 .kcsave 存档',
118
- defaultPath: defaultFile,
119
- filters: [{ name: 'KanColle Offline Save', extensions: ['kcsave'] }],
120
- });
121
- const targetPath = typeof res === 'string' ? res : (res && !res.canceled ? res.filePath : null);
122
- if (!targetPath) {
123
- this.setState({ exporting: false, status: '已取消保存。', statusType: 'info' });
124
- return;
125
- }
126
- fs.writeFileSync(targetPath, buffer);
127
- this.setState({
128
- exporting: false,
129
- lastStats: stats,
130
- status: `导出成功!已保存至: ${targetPath} (${(buffer.length / 1024 / 1024).toFixed(2)} MB)`,
131
- statusType: 'success',
132
- });
133
- } else {
134
- // 浏览器下载回退方案
135
- const blob = new Blob([buffer], { type: 'application/octet-stream' });
136
- const url = URL.createObjectURL(blob);
137
- const a = document.createElement('a');
138
- a.href = url;
139
- a.download = defaultFile;
140
- document.body.appendChild(a);
141
- a.click();
142
- document.body.removeChild(a);
143
- URL.revokeObjectURL(url);
144
- this.setState({
145
- exporting: false,
146
- lastStats: stats,
147
- status: `导出成功!已触发下载 ${defaultFile} (${(buffer.length / 1024 / 1024).toFixed(2)} MB)`,
148
- statusType: 'success',
149
- });
150
- }
151
- } catch (err) {
152
- this.setState({
153
- exporting: false,
154
- status: `导出失败: ${err && err.message ? err.message : String(err)}`,
155
- statusType: 'error',
156
- });
157
- }
158
- }
159
-
160
- render() {
161
- const h = React.createElement;
162
- const reduxState = getReduxState();
163
- const info = (reduxState && reduxState.info) || {};
164
- const basic = info.basic || {};
165
- const shipsCount = info.ships ? Object.keys(info.ships).length : 0;
166
- const equipsCount = info.equips ? Object.keys(info.equips).length : 0;
167
- const mapsCount = info.maps ? Object.keys(info.maps).length : 0;
168
- const airbaseCount = Array.isArray(info.airbase) ? info.airbase.length : 0;
169
- const cap = this.state.captured || {};
170
- const capAt = cap.capturedAt || {};
171
-
172
- const cardStyle = {
173
- padding: '12px 14px',
174
- borderRadius: '6px',
175
- background: 'rgba(255,255,255,0.05)',
176
- border: '1px solid rgba(255,255,255,0.12)',
177
- marginBottom: '12px',
178
- };
179
- const btnPrimary = {
180
- padding: '8px 16px',
181
- borderRadius: '4px',
182
- border: 'none',
183
- background: '#137cbd',
184
- color: '#fff',
185
- fontWeight: 600,
186
- cursor: this.state.exporting ? 'not-allowed' : 'pointer',
187
- marginRight: '8px',
188
- };
189
- const btnSecondary = {
190
- padding: '6px 12px',
191
- borderRadius: '4px',
192
- border: '1px solid rgba(255,255,255,0.22)',
193
- background: 'transparent',
194
- color: 'inherit',
195
- cursor: 'pointer',
196
- marginRight: '8px',
197
- };
198
- const statusColors = {
199
- info: '#8abbff',
200
- success: '#3dcc91',
201
- warn: '#ffb366',
202
- error: '#ff7373',
203
- };
204
-
205
- return h(
206
- 'div',
207
- { style: { padding: '14px', fontSize: '13px', lineHeight: 1.6, overflowY: 'auto', height: '100%' } },
208
- h('h3', { style: { marginTop: 0, marginBottom: '10px' } }, '单机版存档完全导出 (.kcsave)'),
209
-
210
- // 当前游戏状态卡片
211
- h(
212
- 'div',
213
- { style: cardStyle },
214
- h('div', { style: { fontWeight: 600, marginBottom: '6px' } }, '当前内存数据(自动从 poi 读取)'),
215
- h(
216
- 'div',
217
- null,
218
- `提督: ${basic.api_nickname || '未登录'} (Lv.${basic.api_level || 0}) | 舰娘: ${shipsCount} | 装备: ${equipsCount} | 海域: ${mapsCount} | 陆航: ${airbaseCount}`
219
- )
220
- ),
221
-
222
- // 额外捕获状态卡片
223
- h(
224
- 'div',
225
- { style: cardStyle },
226
- h('div', { style: { fontWeight: 600, marginBottom: '6px' } }, '额外完整数据捕获状态(打开对应界面自动记录)'),
227
- h('div', null, `• 登录家具与设置 (require_info): ${(cap.furnitureOwned || []).length} 件家具 (${formatTime(capAt.require_info)})`),
228
- h('div', null, `• 编成记录 (preset_deck): ${Object.keys(cap.presets || {}).length} 组 (${formatTime(capAt.preset_deck)})`),
229
- h('div', null, `• 远征通关记录 (mission): ${Object.keys(cap.expeditionHistory || {}).length} 项 (${formatTime(capAt.mission)})`),
230
- h('div', null, `• 图鉴记录 (picture_book): 舰船 ${Object.keys(cap.albumShips || {}).length} / 装备 ${Object.keys(cap.albumEquips || {}).length} (${formatTime(capAt.album_ships || capAt.album_equips)})`),
231
- h('div', null, `• 任务列表 (questlist): ${Object.keys(cap.quests || {}).length} 项 (${formatTime(capAt.questlist)})`),
232
- h(
233
- 'div',
234
- { style: { marginTop: '6px', opacity: 0.78, fontSize: '12px' } },
235
- '提示:舰娘/装备/资源/舰队/渠位/道具/海域/陆航可直接导出;如需连带家具、远征、编成记录、图鉴一起导出,导出前先在游戏内点开一次对应界面即可自动捕获。'
236
- )
237
- ),
238
-
239
- // 可选模板与操作按钮
240
- h(
241
- 'div',
242
- { style: cardStyle },
243
- h('div', { style: { marginBottom: '8px' } },
244
- h('strong', null, '可选基础模板: '),
245
- this.state.baseFilePath ? path.basename(this.state.baseFilePath) : '无(使用内置默认模板,直接独立导出)'
246
- ),
247
- h(
248
- 'div',
249
- { style: { display: 'flex', flexWrap: 'wrap', gap: '6px', alignItems: 'center' } },
250
- h('button', { style: btnPrimary, disabled: this.state.exporting, onClick: this._handleExport },
251
- this.state.exporting ? '正在导出...' : '一键完全导出 .kcsave'
252
- ),
253
- h('button', { style: btnSecondary, onClick: this._handlePickBase }, '选择模板 .kcsave(可选)'),
254
- this.state.baseFilePath
255
- ? h('button', { style: btnSecondary, onClick: this._handleClearBase }, '清除模板')
256
- : null,
257
- h('button', { style: btnSecondary, onClick: this._handleClearCache }, '清空捕获缓存')
258
- )
259
- ),
260
-
261
- // 状态输出
262
- this.state.status
263
- ? h(
264
- 'div',
265
- {
266
- style: Object.assign({}, cardStyle, {
267
- color: statusColors[this.state.statusType] || '#fff',
268
- wordBreak: 'break-all',
269
- }),
270
- },
271
- this.state.status
272
- )
273
- : null,
274
-
275
- // 最近导出统计
276
- this.state.lastStats
277
- ? h(
278
- 'div',
279
- { style: Object.assign({}, cardStyle, { fontSize: '12px', opacity: 0.9 }) },
280
- h('div', { style: { fontWeight: 600, marginBottom: '4px' } }, '本次导出明细'),
281
- h(
282
- 'div',
283
- null,
284
- `舰娘 ${this.state.lastStats.ships} | 装备 ${this.state.lastStats.equipment} | 舰队 ${this.state.lastStats.decks} | 道具 ${this.state.lastStats.inventory} | 家具 ${this.state.lastStats.furniture} | 海域 ${this.state.lastStats.maps} | 陆航 ${this.state.lastStats.airBases} | 编成记录 ${this.state.lastStats.presets} | 图鉴 ${this.state.lastStats.albumShips}/${this.state.lastStats.albumEquips}`
285
- )
286
- )
287
- : null
288
- );
289
- }
290
- }
291
-
292
- module.exports = {
293
- reactClass: KcsaveExporterPanel,
294
- pluginDidLoad() {
295
- captureStore.attach();
296
- },
297
- pluginWillUnload() {
298
- captureStore.detach();
299
- },
300
- };