Commit fd3bd85f authored by Tt's avatar Tt

修复细节问题

parent 944790f6
...@@ -386,8 +386,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -386,8 +386,8 @@ export class PlayComponent implements OnInit, OnDestroy {
// 初始化教室底部背景图像 // 初始化教室底部背景图像
jiaoshiElement.ref.init(this.g_cartoon.images.get("bei_jing___jiao_shi")); jiaoshiElement.ref.init(this.g_cartoon.images.get("bei_jing___jiao_shi"));
// 设置教室底部背景的缩放比例,保持与主背景一致 // 设置教室底部背景的缩放比例,与主背景X方向缩放保持一致
jiaoshiElement.ref.scaleX = this.g_mapScale; jiaoshiElement.ref.scaleX = bgScale * this.g_mapScale;
jiaoshiElement.ref.scaleY = this.g_mapScale; jiaoshiElement.ref.scaleY = this.g_mapScale;
// 设置教室底部背景的X坐标位置(居中) // 设置教室底部背景的X坐标位置(居中)
...@@ -972,7 +972,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -972,7 +972,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_lastFishTime = 0; // 重置上次生成鱼的时间,使下一帧立即生成鱼 this.m_lastFishTime = 0; // 重置上次生成鱼的时间,使下一帧立即生成鱼
// 每一个stage开始的时候播放一次正确问题的音频 // 每一个stage开始的时候播放一次正确问题的音频
if (currentQuestion.correctQuestion && currentQuestion.correctQuestion.audio) { if (currentQuestion.correctQuestion && currentQuestion.correctQuestion.audio && (this.g_formData.doubleModal || this.currentStageIndex !== 0)) {
this.g_cartoon.playAudio(currentQuestion.correctQuestion.audio); this.g_cartoon.playAudio(currentQuestion.correctQuestion.audio);
} }
} }
...@@ -1865,11 +1865,11 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1865,11 +1865,11 @@ export class PlayComponent implements OnInit, OnDestroy {
switch (position) { switch (position) {
case 'left': case 'left':
// 左侧位置 // 左侧位置
starBg.ref.x = bgWidth / 2 + 20 * this.g_mapScale; starBg.ref.x = this.g_canvasWidth / 2 - 400 * this.g_mapScale
break; break;
case 'right': case 'right':
// 右侧位置 // 右侧位置
starBg.ref.x = this.g_canvasWidth - bgWidth / 2 - 20 * this.g_mapScale; starBg.ref.x = this.g_canvasWidth / 2 + 400 * this.g_mapScale
break; break;
case 'center': case 'center':
default: default:
...@@ -1877,7 +1877,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1877,7 +1877,7 @@ export class PlayComponent implements OnInit, OnDestroy {
break; break;
} }
starBg.ref.y = bgHeight / 2 + 10 * this.g_mapScale; // 距离顶部10像素 starBg.ref.y = bgHeight / 2 + 30 * this.g_mapScale; // 距离顶部10像素
// 渲染星星背景 // 渲染星星背景
this.render(starBg.ref, zIndexMap.card + 10); this.render(starBg.ref, zIndexMap.card + 10);
...@@ -1922,9 +1922,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1922,9 +1922,8 @@ export class PlayComponent implements OnInit, OnDestroy {
if (position !== 'center') { if (position !== 'center') {
// 创建时间标签 // 创建时间标签
const timeLabel = new Label(); const timeLabel = new Label();
timeLabel.fontSize = 30; // 设置字体大小 timeLabel.fontSize = 30 * this.g_mapScale; // 设置字体大小
timeLabel.fontColor = '#FFFFFF'; // 设置字体颜色为白色 timeLabel.fontColor = '#000000'; // 设置字体颜色为白色
timeLabel.setOutline(3, '#000000'); // 设置黑色描边,增强可读性
timeLabel.text = '00:00'; // 初始时间显示 timeLabel.text = '00:00'; // 初始时间显示
// 设置标签位置在背景板的右侧 // 设置标签位置在背景板的右侧
...@@ -2170,7 +2169,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2170,7 +2169,7 @@ export class PlayComponent implements OnInit, OnDestroy {
element.ref.scaleX = this.g_mapScale; element.ref.scaleX = this.g_mapScale;
element.ref.scaleY = this.g_mapScale; element.ref.scaleY = this.g_mapScale;
// 设置元素位置(根据type调整画面中心的x坐标) // 设置元素位置(根据type调整画面中心的x坐标)
element.ref.x = this.g_canvasWidth / 2 + xOffset; element.ref.x = this.g_canvasWidth / 2 + xOffset * this.g_mapScale;
element.ref.y = this.g_canvasHeight / 2 + 60 * this.g_mapScale; element.ref.y = this.g_canvasHeight / 2 + 60 * this.g_mapScale;
// 默认隐藏 // 默认隐藏
...@@ -2180,7 +2179,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2180,7 +2179,7 @@ export class PlayComponent implements OnInit, OnDestroy {
} else { } else {
// 如果元素已存在,更新其位置 // 如果元素已存在,更新其位置
const element = this.g_cartoon.cartoonElementsBuffer[elementName]; const element = this.g_cartoon.cartoonElementsBuffer[elementName];
element.ref.x = this.g_canvasWidth / 2 + xOffset; element.ref.x = this.g_canvasWidth / 2 + xOffset * this.g_mapScale;
} }
}); });
} }
...@@ -2781,6 +2780,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2781,6 +2780,7 @@ export class PlayComponent implements OnInit, OnDestroy {
*/ */
private isGameStart = false; private isGameStart = false;
private currentFishIndex = 0;
updateFish() { updateFish() {
// 如果没有游戏阶段或当前阶段索引超出范围,不生成鱼 // 如果没有游戏阶段或当前阶段索引超出范围,不生成鱼
if (!this.gameStages || this.currentStageIndex >= this.gameStages.length) { if (!this.gameStages || this.currentStageIndex >= this.gameStages.length) {
...@@ -2797,21 +2797,24 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2797,21 +2797,24 @@ export class PlayComponent implements OnInit, OnDestroy {
// 创建新的鱼 // 创建新的鱼
if (currentStage && currentStage.questionRandomList && currentStage.questionRandomList.length > 0) { if (currentStage && currentStage.questionRandomList && currentStage.questionRandomList.length > 0) {
// 从当前阶段的随机问题列表中选择一个问题数据 // 从当前阶段的随机问题列表中选择一个问题数据
const randomIndex = Math.floor(Math.random() * currentStage.questionRandomList.length); if (!this.currentFishIndex) this.currentFishIndex = 0;
const randomIndex = this.currentFishIndex % currentStage.questionRandomList.length;
const fishData = currentStage.questionRandomList[randomIndex]; const fishData = currentStage.questionRandomList[randomIndex];
this.currentFishIndex++;
const type = currentStage.questionRandomList.length > 3 ? 'small' : 'big';
// 创建小型鱼 // 创建小型鱼
const fish = this.createFish('small', fishData); const fish = this.createFish(type, fishData);
// 存储问题数据到鱼对象中,以便点击时可以获取 // 存储问题数据到鱼对象中,以便点击时可以获取
fish.questionData = fishData; fish.questionData = fishData;
// 设置鱼的初始位置在屏幕右侧外部 // 设置鱼的初始位置在屏幕右侧外部
fish.ref.x = this.g_canvasWidth + fish.ref.width * fish.ref.scaleX / 2; fish.ref.x = this.g_canvasWidth + fish.ref.width * fish.ref.scaleX / 2;
fish.ref.y = Math.random() * (this.g_canvasHeight * 0.6) + this.g_canvasHeight * 0.2; // 在屏幕中间区域随机高度 fish.ref.y = Math.random() * (this.g_canvasHeight * 0.35) + this.g_canvasHeight * 0.25; // 在屏幕中间区域随机高度
// 设置鱼的游动速度 // 设置鱼的游动速度
fish.speed = 0.3; // 降低游动速度 fish.speed = 0.45;
// 确保鱼已添加到渲染队列中 // 确保鱼已添加到渲染队列中
// createFish 方法中已经调用了 render 方法,但为了确保,这里再次检查 // createFish 方法中已经调用了 render 方法,但为了确保,这里再次检查
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment