feat: 游玩记录多版本功能 - 支持多版本记录存储和回放 - 相同路径自动去重只保留最新 - 版本列表支持删除功能 - AI草稿箱游玩不记录历史 - iOS日期格式兼容修复

This commit is contained in:
wangwuww111
2026-03-10 12:44:55 +08:00
parent 9948ccba8f
commit baf7dd1e2b
8 changed files with 693 additions and 35 deletions

View File

@@ -9,7 +9,8 @@ export default class EndingScene extends BaseScene {
this.storyId = params.storyId;
this.ending = params.ending;
this.draftId = params.draftId || null; // 保存草稿ID
console.log('EndingScene 接收到的结局:', JSON.stringify(this.ending));
this.isReplay = params.isReplay || false; // 是否是回放模式
console.log('EndingScene 接收到的结局:', JSON.stringify(this.ending), ', isReplay:', this.isReplay);
this.showButtons = false;
this.fadeIn = 0;
this.particles = [];
@@ -41,6 +42,31 @@ export default class EndingScene extends BaseScene {
setTimeout(() => {
this.showButtons = true;
}, 1500);
// 保存游玩记录回放模式和AI草稿不保存
if (!this.isReplay && !this.draftId) {
this.savePlayRecord();
}
}
async savePlayRecord() {
try {
// 获取当前游玩路径
const pathHistory = this.main.storyManager.pathHistory || [];
const endingName = this.ending?.name || '未知结局';
const endingType = this.ending?.type || '';
// 调用保存接口
await this.main.userManager.savePlayRecord(
this.storyId,
endingName,
endingType,
pathHistory
);
console.log('游玩记录保存成功');
} catch (e) {
console.error('保存游玩记录失败:', e);
}
}
async loadQuota() {