fix: AI改写按钮位置优化 + 返回首页清除故事状态

This commit is contained in:
2026-03-09 18:01:41 +08:00
parent bbdccfa843
commit c960f9fa79
2 changed files with 18 additions and 13 deletions

View File

@@ -645,6 +645,9 @@ export default class EndingScene extends BaseScene {
// 返回首页
if (this.isInRect(x, y, padding + buttonWidth + buttonMargin, row3Y, buttonWidth, buttonHeight)) {
// 清除当前故事状态
this.main.storyManager.currentStory = null;
this.main.storyManager.currentNodeKey = 'start';
this.main.sceneManager.switchScene('home');
return;
}

View File

@@ -252,11 +252,12 @@ export default class StoryScene extends BaseScene {
ctx.fillText(title, this.screenWidth / 2, 35);
}
// AI改写按钮右上角
const btnX = this.screenWidth - 70;
const btnY = 18;
const btnW = 55;
const btnH = 26;
// AI改写按钮对话框上方右侧
const boxY = this.screenHeight * 0.42;
const btnW = 70;
const btnH = 30;
const btnX = this.screenWidth - btnW - 15;
const btnY = boxY - btnH - 12;
// 按钮背景
if (this.isAIRewriting) {
@@ -267,14 +268,14 @@ export default class StoryScene extends BaseScene {
gradient.addColorStop(1, '#ec4899');
ctx.fillStyle = gradient;
}
this.roundRect(ctx, btnX, btnY, btnW, btnH, 13);
this.roundRect(ctx, btnX, btnY, btnW, btnH, 15);
ctx.fill();
// 按钮文字
ctx.fillStyle = '#ffffff';
ctx.font = '11px sans-serif';
ctx.font = '12px sans-serif';
ctx.textAlign = 'center';
ctx.fillText(this.isAIRewriting ? '生成中' : 'AI改写', btnX + btnW / 2, btnY + 17);
ctx.fillText(this.isAIRewriting ? '生成中...' : 'AI改写', btnX + btnW / 2, btnY + 20);
}
renderDialogBox(ctx) {
@@ -554,11 +555,12 @@ export default class StoryScene extends BaseScene {
return;
}
// AI改写按钮点击
const btnX = this.screenWidth - 70;
const btnY = 18;
const btnW = 55;
const btnH = 26;
// AI改写按钮点击(对话框上方右侧)
const boxY = this.screenHeight * 0.42;
const btnW = 70;
const btnH = 30;
const btnX = this.screenWidth - btnW - 15;
const btnY = boxY - btnH - 12;
if (y >= btnY && y <= btnY + btnH && x >= btnX && x <= btnX + btnW) {
if (!this.isAIRewriting) {
this.showAIRewriteInput();