feat: 新增AI创作中心场景,支持改写/续写/创作
This commit is contained in:
@@ -116,6 +116,24 @@ export default class HomeScene extends BaseScene {
|
||||
ctx.fillStyle = 'rgba(255,255,255,0.6)';
|
||||
ctx.font = '13px sans-serif';
|
||||
ctx.fillText('每个选择,都是一个新世界', 20, 75);
|
||||
|
||||
// AI创作入口按钮
|
||||
const btnWidth = 80;
|
||||
const btnHeight = 32;
|
||||
const btnX = this.screenWidth - btnWidth - 15;
|
||||
const btnY = 35;
|
||||
const btnGradient = ctx.createLinearGradient(btnX, btnY, btnX + btnWidth, btnY);
|
||||
btnGradient.addColorStop(0, '#a855f7');
|
||||
btnGradient.addColorStop(1, '#ec4899');
|
||||
ctx.fillStyle = btnGradient;
|
||||
this.roundRect(ctx, btnX, btnY, btnWidth, btnHeight, 16);
|
||||
ctx.fill();
|
||||
ctx.fillStyle = '#ffffff';
|
||||
ctx.font = 'bold 12px sans-serif';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.fillText('✨ AI创作', btnX + btnWidth / 2, btnY + 21);
|
||||
|
||||
this.aiCreateBtnRect = { x: btnX, y: btnY, width: btnWidth, height: btnHeight };
|
||||
}
|
||||
|
||||
renderCategories(ctx) {
|
||||
@@ -470,6 +488,15 @@ export default class HomeScene extends BaseScene {
|
||||
const x = touch.clientX;
|
||||
const y = touch.clientY;
|
||||
|
||||
// 检测AI创作按钮点击
|
||||
if (this.aiCreateBtnRect) {
|
||||
const btn = this.aiCreateBtnRect;
|
||||
if (x >= btn.x && x <= btn.x + btn.width && y >= btn.y && y <= btn.y + btn.height) {
|
||||
this.main.sceneManager.switchScene('aiCreate');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 检测Tab栏点击
|
||||
if (y > this.screenHeight - 65) {
|
||||
const tabWidth = this.screenWidth / 3;
|
||||
|
||||
Reference in New Issue
Block a user