Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SSIWB2504
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
SSIWB2504
Commits
fd3bd85f
Commit
fd3bd85f
authored
Aug 14, 2025
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复细节问题
parent
944790f6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
play.component.ts
src/app/play/play.component.ts
+18
-15
No files found.
src/app/play/play.component.ts
View file @
fd3bd85f
...
...
@@ -386,8 +386,8 @@ export class PlayComponent implements OnInit, OnDestroy {
// 初始化教室底部背景图像
jiaoshiElement
.
ref
.
init
(
this
.
g_cartoon
.
images
.
get
(
"
bei_jing___jiao_shi
"
));
// 设置教室底部背景的缩放比例,
保持与主背景
一致
jiaoshiElement
.
ref
.
scaleX
=
this
.
g_mapScale
;
// 设置教室底部背景的缩放比例,
与主背景X方向缩放保持
一致
jiaoshiElement
.
ref
.
scaleX
=
bgScale
*
this
.
g_mapScale
;
jiaoshiElement
.
ref
.
scaleY
=
this
.
g_mapScale
;
// 设置教室底部背景的X坐标位置(居中)
...
...
@@ -972,7 +972,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
m_lastFishTime
=
0
;
// 重置上次生成鱼的时间,使下一帧立即生成鱼
// 每一个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
);
}
}
...
...
@@ -1865,11 +1865,11 @@ export class PlayComponent implements OnInit, OnDestroy {
switch
(
position
)
{
case
'
left
'
:
// 左侧位置
starBg
.
ref
.
x
=
bgWidth
/
2
+
20
*
this
.
g_mapScale
;
starBg
.
ref
.
x
=
this
.
g_canvasWidth
/
2
-
400
*
this
.
g_mapScale
break
;
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
;
case
'
center
'
:
default
:
...
...
@@ -1877,7 +1877,7 @@ export class PlayComponent implements OnInit, OnDestroy {
break
;
}
starBg
.
ref
.
y
=
bgHeight
/
2
+
1
0
*
this
.
g_mapScale
;
// 距离顶部10像素
starBg
.
ref
.
y
=
bgHeight
/
2
+
3
0
*
this
.
g_mapScale
;
// 距离顶部10像素
// 渲染星星背景
this
.
render
(
starBg
.
ref
,
zIndexMap
.
card
+
10
);
...
...
@@ -1922,9 +1922,8 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
position
!==
'
center
'
)
{
// 创建时间标签
const
timeLabel
=
new
Label
();
timeLabel
.
fontSize
=
30
;
// 设置字体大小
timeLabel
.
fontColor
=
'
#FFFFFF
'
;
// 设置字体颜色为白色
timeLabel
.
setOutline
(
3
,
'
#000000
'
);
// 设置黑色描边,增强可读性
timeLabel
.
fontSize
=
30
*
this
.
g_mapScale
;
// 设置字体大小
timeLabel
.
fontColor
=
'
#000000
'
;
// 设置字体颜色为白色
timeLabel
.
text
=
'
00:00
'
;
// 初始时间显示
// 设置标签位置在背景板的右侧
...
...
@@ -2170,7 +2169,7 @@ export class PlayComponent implements OnInit, OnDestroy {
element
.
ref
.
scaleX
=
this
.
g_mapScale
;
element
.
ref
.
scaleY
=
this
.
g_mapScale
;
// 设置元素位置(根据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
;
// 默认隐藏
...
...
@@ -2180,7 +2179,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
else
{
// 如果元素已存在,更新其位置
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 {
*/
private
isGameStart
=
false
;
private
currentFishIndex
=
0
;
updateFish
()
{
// 如果没有游戏阶段或当前阶段索引超出范围,不生成鱼
if
(
!
this
.
gameStages
||
this
.
currentStageIndex
>=
this
.
gameStages
.
length
)
{
...
...
@@ -2797,21 +2797,24 @@ export class PlayComponent implements OnInit, OnDestroy {
// 创建新的鱼
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
];
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
.
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 方法,但为了确保,这里再次检查
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment