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
04e46b95
Commit
04e46b95
authored
Aug 15, 2025
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf(play): 优化鱼的生成间隔和位置逻辑
parent
45810069
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
play.component.ts
src/app/play/play.component.ts
+4
-2
No files found.
src/app/play/play.component.ts
View file @
04e46b95
...
@@ -968,7 +968,9 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -968,7 +968,9 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
clearFishes
();
this
.
clearFishes
();
// 修改鱼的生成逻辑,使用当前阶段的随机问题列表
// 修改鱼的生成逻辑,使用当前阶段的随机问题列表
this
.
m_fishInterval
=
3000
;
// 设置鱼的生成间隔为3秒
const
type
=
currentQuestion
.
questionRandomList
.
length
>
3
?
'
small
'
:
'
big
'
;
this
.
m_fishInterval
=
type
===
'
big
'
?
4700
:
3500
;
this
.
m_lastFishTime
=
0
;
// 重置上次生成鱼的时间,使下一帧立即生成鱼
this
.
m_lastFishTime
=
0
;
// 重置上次生成鱼的时间,使下一帧立即生成鱼
// 每一个stage开始的时候播放一次正确问题的音频
// 每一个stage开始的时候播放一次正确问题的音频
...
@@ -2818,7 +2820,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -2818,7 +2820,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// 设置鱼的初始位置在屏幕右侧外部
// 设置鱼的初始位置在屏幕右侧外部
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.35
)
+
this
.
g_canvasHeight
*
0.25
;
// 在屏幕中间区域随机高度
fish
.
ref
.
y
=
this
.
currentFishIndex
%
2
==
0
?
400
:
300
;
//
Math.random() * (this.g_canvasHeight * 0.35) + this.g_canvasHeight * 0.25; // 在屏幕中间区域随机高度
// 设置鱼的游动速度
// 设置鱼的游动速度
fish
.
speed
=
0.45
;
fish
.
speed
=
0.45
;
...
...
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