Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RB_StrongestBrain_250520
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
SparkProjects
RB_StrongestBrain_250520
Commits
5b67b667
Commit
5b67b667
authored
May 23, 2025
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
11
parent
7afc9941
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
145 additions
and
2 deletions
+145
-2
img.png
src/assets/Game/level19/img.png
+0
-0
qs.png
src/assets/Game/level19/qs.png
+0
-0
right.png
src/assets/Game/level19/right.png
+0
-0
船.png
src/assets/Game/level19/船.png
+0
-0
Game.ts
src/pages/GamePage/Game.ts
+2
-1
Level19.ts
src/pages/GamePage/Level/Level19.ts
+141
-0
LevelConfig.ts
src/pages/GamePage/Level/LevelConfig.ts
+2
-1
No files found.
src/assets/Game/level19/img.png
0 → 100644
View file @
5b67b667
390 KB
src/assets/Game/level19/qs.png
0 → 100644
View file @
5b67b667
2.83 KB
src/assets/Game/level19/right.png
0 → 100644
View file @
5b67b667
2.26 KB
src/assets/Game/level19/船.png
0 → 100644
View file @
5b67b667
66 KB
src/pages/GamePage/Game.ts
View file @
5b67b667
...
@@ -18,6 +18,7 @@ import { Level13 } from "@/pages/GamePage/Level/Level13.ts";
...
@@ -18,6 +18,7 @@ import { Level13 } from "@/pages/GamePage/Level/Level13.ts";
import
{
Level14
}
from
"@/pages/GamePage/Level/Level14.ts"
;
import
{
Level14
}
from
"@/pages/GamePage/Level/Level14.ts"
;
import
{
Level15
}
from
"@/pages/GamePage/Level/Level15.ts"
;
import
{
Level15
}
from
"@/pages/GamePage/Level/Level15.ts"
;
import
{
Level18
}
from
"@/pages/GamePage/Level/Level18.ts"
;
import
{
Level18
}
from
"@/pages/GamePage/Level/Level18.ts"
;
import
{
Level19
}
from
"@/pages/GamePage/Level/Level19.ts"
;
import
{
Level20
}
from
"@/pages/GamePage/Level/Level20.ts"
;
import
{
Level20
}
from
"@/pages/GamePage/Level/Level20.ts"
;
import
{
Level21
}
from
"@/pages/GamePage/Level/Level21.ts"
;
import
{
Level21
}
from
"@/pages/GamePage/Level/Level21.ts"
;
import
{
Level22
}
from
"@/pages/GamePage/Level/Level22.ts"
;
import
{
Level22
}
from
"@/pages/GamePage/Level/Level22.ts"
;
...
@@ -35,7 +36,7 @@ export class Game extends Base {
...
@@ -35,7 +36,7 @@ export class Game extends Base {
const
qsBg
=
this
.
addChild
(
new
Sprite
(
Assets
.
get
(
"问题.png"
)));
const
qsBg
=
this
.
addChild
(
new
Sprite
(
Assets
.
get
(
"问题.png"
)));
qsBg
.
position
.
set
(
49
,
316
);
qsBg
.
position
.
set
(
49
,
316
);
this
.
level
=
this
.
addChild
(
new
Level1
1
());
this
.
level
=
this
.
addChild
(
new
Level1
9
());
globalEvent
.
on
(
GameEvent
.
NextLevel
,
this
.
nextLevel
,
this
);
globalEvent
.
on
(
GameEvent
.
NextLevel
,
this
.
nextLevel
,
this
);
// this.nextLevel();
// this.nextLevel();
...
...
src/pages/GamePage/Level/Level19.ts
0 → 100644
View file @
5b67b667
import
{
LevelBase
}
from
"@/pages/GamePage/Components/LevelBase.ts"
;
import
{
Assets
,
Sprite
}
from
"pixi.js"
;
import
{
Ease
,
Tween
}
from
"@/core/tween"
;
import
{
GameEvent
,
globalEvent
}
from
"@/pages/GamePage/GameEvent.ts"
;
export
class
Level19
extends
LevelBase
{
level
:
number
=
19
;
A
:
Sprite
;
right
:
Sprite
;
error
:
Sprite
;
// 双指缩放相关属性
private
initialDistance
:
number
=
0
;
private
initialScale
:
number
=
1
;
private
isTouching
:
boolean
=
false
;
private
touchPoints
:
Map
<
number
,
{
x
:
number
,
y
:
number
}
>
=
new
Map
();
onLoad
()
{
super
.
onLoad
();
this
.
addChild
(
new
Sprite
(
Assets
.
get
(
`level
${
this
.
level
}
/img.png`
)))
.
position
.
set
(
0
,
868
);
this
.
A
=
this
.
addChild
(
new
Sprite
(
Assets
.
get
(
`level
${
this
.
level
}
/船.png`
)));
this
.
A
.
anchor
.
set
(
0.4
,
0.4
);
this
.
A
.
position
.
set
(
430
,
1100
);
this
.
A
.
scale
.
set
(
0.5948827292110874
);
this
.
right
=
this
.
addChild
(
new
Sprite
(
Assets
.
get
(
`level
${
this
.
level
}
/right.png`
)));
this
.
right
.
position
.
set
(
613
,
1104
);
this
.
right
.
alpha
=
0
;
this
.
right
.
interactive
=
false
;
this
.
right
.
eventMode
=
"none"
;
this
.
A
.
on
(
"pointerdown"
,
this
.
onPointerDown
,
this
);
this
.
A
.
on
(
"globalpointermove"
,
this
.
onPointerMove
,
this
);
this
.
A
.
on
(
"pointerup"
,
this
.
onPointerUp
,
this
);
this
.
A
.
on
(
"pointerupoutside"
,
this
.
onPointerUp
,
this
);
}
onPointerDown
(
e
)
{
console
.
log
(
"pointerdown"
,
e
.
pointerId
,
e
.
data
.
global
);
// 记录触摸点
this
.
touchPoints
.
set
(
e
.
pointerId
,
{
x
:
e
.
data
.
global
.
x
,
y
:
e
.
data
.
global
.
y
});
// 如果有两个触摸点,开始缩放
if
(
this
.
touchPoints
.
size
===
2
)
{
const
points
=
Array
.
from
(
this
.
touchPoints
.
values
());
this
.
initialDistance
=
this
.
getDistance
(
points
[
0
],
points
[
1
]);
this
.
initialScale
=
this
.
A
.
scale
.
x
;
this
.
isTouching
=
true
;
console
.
log
(
"开始缩放"
,
this
.
initialDistance
,
this
.
initialScale
);
}
}
onPointerMove
(
e
)
{
if
(
!
this
.
touchPoints
.
has
(
e
.
pointerId
))
return
;
// 更新触摸点位置
this
.
touchPoints
.
set
(
e
.
pointerId
,
{
x
:
e
.
data
.
global
.
x
,
y
:
e
.
data
.
global
.
y
});
if
(
this
.
isTouching
&&
this
.
touchPoints
.
size
===
2
)
{
const
points
=
Array
.
from
(
this
.
touchPoints
.
values
());
const
currentDistance
=
this
.
getDistance
(
points
[
0
],
points
[
1
]);
// 计算缩放比例
const
scaleRatio
=
currentDistance
/
this
.
initialDistance
;
const
newScale
=
this
.
initialScale
*
scaleRatio
;
// 限制最小和最大缩放
const
finalScale
=
Math
.
max
(
0.5
,
Math
.
min
(
newScale
,
5
));
this
.
A
.
scale
.
set
(
finalScale
);
console
.
log
(
"缩放中"
,
currentDistance
,
scaleRatio
,
finalScale
);
// 检查是否达到目标大小
this
.
checkSize
();
}
}
onPointerUp
(
e
)
{
console
.
log
(
"pointerup"
,
e
.
pointerId
);
// 移除触摸点
this
.
touchPoints
.
delete
(
e
.
pointerId
);
// 如果少于两个触摸点,停止缩放
if
(
this
.
touchPoints
.
size
<
2
)
{
this
.
isTouching
=
false
;
console
.
log
(
"停止缩放"
);
}
}
getDistance
(
point1
:
{
x
:
number
,
y
:
number
},
point2
:
{
x
:
number
,
y
:
number
}):
number
{
const
dx
=
point1
.
x
-
point2
.
x
;
const
dy
=
point1
.
y
-
point2
.
y
;
return
Math
.
sqrt
(
dx
*
dx
+
dy
*
dy
);
}
checkSize
()
{
if
(
this
.
A
.
scale
.
x
>=
1
)
{
this
.
triggerSuccess
();
}
}
triggerSuccess
()
{
// 防止重复触发
if
(
this
.
right
.
alpha
>
0
)
return
;
this
.
setTouchEnable
(
false
);
Tween
.
get
(
this
.
right
)
.
to
({
alpha
:
1
},
444
,
Ease
.
quadInOut
)
.
wait
(
2000
)
.
call
(()
=>
{
globalEvent
.
emit
(
GameEvent
.
NextLevel
);
});
}
onDestroy
()
{
super
.
onDestroy
();
Tween
.
removeTweens
(
this
.
A
);
Tween
.
removeTweens
(
this
.
right
);
// 移除触摸事件监听
this
.
A
.
off
(
"pointerdown"
,
this
.
onPointerDown
,
this
);
this
.
A
.
off
(
"globalpointermove"
,
this
.
onPointerMove
,
this
);
this
.
A
.
off
(
"pointerup"
,
this
.
onPointerUp
,
this
);
this
.
A
.
off
(
"pointerupoutside"
,
this
.
onPointerUp
,
this
);
}
}
src/pages/GamePage/Level/LevelConfig.ts
View file @
5b67b667
...
@@ -13,6 +13,7 @@ import { Level13 } from "@/pages/GamePage/Level/Level13.ts";
...
@@ -13,6 +13,7 @@ import { Level13 } from "@/pages/GamePage/Level/Level13.ts";
import
{
Level14
}
from
"@/pages/GamePage/Level/Level14.ts"
;
import
{
Level14
}
from
"@/pages/GamePage/Level/Level14.ts"
;
import
{
Level15
}
from
"@/pages/GamePage/Level/Level15.ts"
;
import
{
Level15
}
from
"@/pages/GamePage/Level/Level15.ts"
;
import
{
Level18
}
from
"@/pages/GamePage/Level/Level18.ts"
;
import
{
Level18
}
from
"@/pages/GamePage/Level/Level18.ts"
;
import
{
Level19
}
from
"@/pages/GamePage/Level/Level19.ts"
;
import
{
Level20
}
from
"@/pages/GamePage/Level/Level20.ts"
;
import
{
Level20
}
from
"@/pages/GamePage/Level/Level20.ts"
;
import
{
Level21
}
from
"@/pages/GamePage/Level/Level21.ts"
;
import
{
Level21
}
from
"@/pages/GamePage/Level/Level21.ts"
;
import
{
Level22
}
from
"@/pages/GamePage/Level/Level22.ts"
;
import
{
Level22
}
from
"@/pages/GamePage/Level/Level22.ts"
;
...
@@ -38,7 +39,7 @@ export const LevelArr = [
...
@@ -38,7 +39,7 @@ export const LevelArr = [
{
cls
:
Level14
,
tip
:
`移动笼子罩住小鸭子`
},
// 16
{
cls
:
Level14
,
tip
:
`移动笼子罩住小鸭子`
},
// 16
{
cls
:
Level14
,
tip
:
`别忘了,人是高等动物哦`
},
// 17
{
cls
:
Level14
,
tip
:
`别忘了,人是高等动物哦`
},
// 17
{
cls
:
Level18
,
tip
:
`移开乌云露出太阳<br/>让冰块融化`
},
{
cls
:
Level18
,
tip
:
`移开乌云露出太阳<br/>让冰块融化`
},
{
cls
:
Level1
4
,
tip
:
`将冰箱放大至能够装下长颈鹿`
},
// 19
{
cls
:
Level1
9
,
tip
:
`将冰箱放大至能够装下长颈鹿`
},
{
cls
:
Level20
,
tip
:
`别忘了把题目也装进箱子里`
},
{
cls
:
Level20
,
tip
:
`别忘了把题目也装进箱子里`
},
{
cls
:
Level21
,
tip
:
`移动鸡蛋,碰一碰便知`
},
{
cls
:
Level21
,
tip
:
`移动鸡蛋,碰一碰便知`
},
{
cls
:
Level22
,
tip
:
`移开圣诞老人的衣服看看`
},
{
cls
:
Level22
,
tip
:
`移开圣诞老人的衣服看看`
},
...
...
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