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
45987816
Commit
45987816
authored
May 26, 2025
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
11
parent
7bcd9d58
Changes
30
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
101 additions
and
35 deletions
+101
-35
game.ts
mock/game.ts
+2
-2
LevelBase.ts
src/pages/GamePage/Components/LevelBase.ts
+7
-0
Game.ts
src/pages/GamePage/Game.ts
+34
-2
GamePage.tsx
src/pages/GamePage/GamePage.tsx
+3
-4
Level1.ts
src/pages/GamePage/Level/Level1.ts
+1
-0
Level10.ts
src/pages/GamePage/Level/Level10.ts
+1
-0
Level11.ts
src/pages/GamePage/Level/Level11.ts
+1
-0
Level12.ts
src/pages/GamePage/Level/Level12.ts
+1
-0
Level13.ts
src/pages/GamePage/Level/Level13.ts
+1
-0
Level14.ts
src/pages/GamePage/Level/Level14.ts
+1
-0
Level15.ts
src/pages/GamePage/Level/Level15.ts
+1
-0
Level16.ts
src/pages/GamePage/Level/Level16.ts
+1
-0
Level17.ts
src/pages/GamePage/Level/Level17.ts
+4
-1
Level18.ts
src/pages/GamePage/Level/Level18.ts
+1
-0
Level19.ts
src/pages/GamePage/Level/Level19.ts
+1
-0
Level2.ts
src/pages/GamePage/Level/Level2.ts
+1
-0
Level20.ts
src/pages/GamePage/Level/Level20.ts
+1
-0
Level21.ts
src/pages/GamePage/Level/Level21.ts
+1
-0
Level22.ts
src/pages/GamePage/Level/Level22.ts
+1
-0
Level23.ts
src/pages/GamePage/Level/Level23.ts
+1
-0
Level24.ts
src/pages/GamePage/Level/Level24.ts
+25
-24
Level25.ts
src/pages/GamePage/Level/Level25.ts
+3
-2
Level3.ts
src/pages/GamePage/Level/Level3.ts
+1
-0
Level4.ts
src/pages/GamePage/Level/Level4.ts
+1
-0
Level5.ts
src/pages/GamePage/Level/Level5.ts
+1
-0
Level6.ts
src/pages/GamePage/Level/Level6.ts
+1
-0
Level7.ts
src/pages/GamePage/Level/Level7.ts
+1
-0
Level8.ts
src/pages/GamePage/Level/Level8.ts
+1
-0
Level9.ts
src/pages/GamePage/Level/Level9.ts
+1
-0
gameStore.ts
src/store/gameStore.ts
+1
-0
No files found.
mock/game.ts
View file @
45987816
...
@@ -10,10 +10,10 @@ export default [
...
@@ -10,10 +10,10 @@ export default [
message
:
"message"
,
message
:
"message"
,
data
:
AESEncrypt
(
JSON
.
stringify
({
data
:
AESEncrypt
(
JSON
.
stringify
({
recordId
:
"recordId"
,
recordId
:
"recordId"
,
countdownSeconds
:
1
8
0
,
countdownSeconds
:
10
,
remainTipTimes
:
3
,
remainTipTimes
:
3
,
}),
"7A2F4B8D1E6C3905"
,
"cDOiBC1n2QrkAY2P"
),
}),
"7A2F4B8D1E6C3905"
,
"cDOiBC1n2QrkAY2P"
),
data
:
"TtL6pvFMpXEajymGe7uOoiD0iaAnxxtuOFqvG+Vo0R4qzJQlb+eQneEkPKv+nNsXKJHVe/hfKTQAMj6FuC2Ltg=="
//
data: "TtL6pvFMpXEajymGe7uOoiD0iaAnxxtuOFqvG+Vo0R4qzJQlb+eQneEkPKv+nNsXKJHVe/hfKTQAMj6FuC2Ltg=="
}
}
},
},
},
},
...
...
src/pages/GamePage/Components/LevelBase.ts
View file @
45987816
...
@@ -6,6 +6,13 @@ export abstract class LevelBase extends Base {
...
@@ -6,6 +6,13 @@ export abstract class LevelBase extends Base {
abstract
level
:
number
;
abstract
level
:
number
;
qs
:
Sprite
;
qs
:
Sprite
;
setPauseCd
:
(
pause
:
boolean
)
=>
void
;
constructor
(
setPauseCd
)
{
super
();
this
.
setPauseCd
=
setPauseCd
;
}
onLoad
()
{
onLoad
()
{
this
.
qs
=
this
.
addChild
(
new
Sprite
(
Assets
.
get
(
`level
${
this
.
level
}
/qs.png`
)));
this
.
qs
=
this
.
addChild
(
new
Sprite
(
Assets
.
get
(
`level
${
this
.
level
}
/qs.png`
)));
this
.
qs
.
anchor
.
set
(
0.5
);
this
.
qs
.
anchor
.
set
(
0.5
);
...
...
src/pages/GamePage/Game.ts
View file @
45987816
...
@@ -37,6 +37,13 @@ export class Game extends Base {
...
@@ -37,6 +37,13 @@ export class Game extends Base {
level
:
LevelBase
=
null
;
level
:
LevelBase
=
null
;
pauseCd
:
boolean
=
false
;
setPauseCd
=
(
pause
:
boolean
)
=>
{
this
.
pauseCd
=
pause
;
};
onLoad
()
{
onLoad
()
{
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
);
...
@@ -45,22 +52,45 @@ export class Game extends Base {
...
@@ -45,22 +52,45 @@ export class Game extends Base {
globalEvent
.
on
(
GameEvent
.
NextLevel
,
this
.
nextLevel
,
this
);
globalEvent
.
on
(
GameEvent
.
NextLevel
,
this
.
nextLevel
,
this
);
this
.
nextLevel
();
this
.
nextLevel
();
this
.
startCd
();
}
gameOver
()
{
this
.
eventMode
=
"none"
;
this
.
interactive
=
this
.
interactiveChildren
=
false
;
}
}
nextLevel
()
{
intervalId
:
number
=
null
;
startCd
()
{
this
.
intervalId
=
window
.
setInterval
(()
=>
{
if
(
this
.
pauseCd
)
return
;
const
newCd
=
gameStore
.
gameInfo
.
cd
-=
1
;
if
(
newCd
<=
0
)
{
clearInterval
(
this
.
intervalId
);
this
.
gameOver
();
return
;
}
},
1000
);
}
nextLevel
()
{
gameStore
.
gameInfo
.
levelIndex
++
;
gameStore
.
gameInfo
.
levelIndex
++
;
const
{
levelIndex
,
levelIdxArr
}
=
gameStore
.
gameInfo
;
const
{
levelIndex
,
levelIdxArr
}
=
gameStore
.
gameInfo
;
if
(
levelIndex
>
0
)
{
if
(
levelIndex
>
0
)
{
if
(
levelIndex
>=
LevelArr
.
length
)
{
if
(
levelIndex
>=
LevelArr
.
length
)
{
clearInterval
(
this
.
intervalId
);
gameStore
.
submit
(
LevelArr
.
length
);
gameStore
.
submit
(
LevelArr
.
length
);
return
;
return
;
}
else
{
}
else
{
gameStore
.
gameInfo
.
cd
=
gameStore
.
gameInfo
.
countdownSeconds
;
gameStore
.
middleSubmit
(
levelIndex
);
gameStore
.
middleSubmit
(
levelIndex
);
}
}
}
else
{
gameStore
.
gameInfo
.
cd
=
gameStore
.
gameInfo
.
countdownSeconds
;
}
}
if
(
levelIndex
>=
levelIdxArr
.
length
)
{
if
(
levelIndex
>=
levelIdxArr
.
length
)
{
...
@@ -76,7 +106,7 @@ export class Game extends Base {
...
@@ -76,7 +106,7 @@ export class Game extends Base {
const
{
cls
}
=
LevelArr
[
levelIdx
];
const
{
cls
}
=
LevelArr
[
levelIdx
];
this
.
level
=
this
.
addChild
(
new
cls
());
this
.
level
=
this
.
addChild
(
new
cls
(
this
.
setPauseCd
));
// this.level = this.addChild(new Level25());
// this.level = this.addChild(new Level25());
}
}
...
@@ -89,5 +119,7 @@ export class Game extends Base {
...
@@ -89,5 +119,7 @@ export class Game extends Base {
}
}
onDestroy
()
{
onDestroy
()
{
super
.
onDestroy
();
clearInterval
(
this
.
intervalId
);
}
}
}
}
src/pages/GamePage/GamePage.tsx
View file @
45987816
...
@@ -22,6 +22,7 @@ import TipPanel from "@/panels/TipPanel/TipPanel.tsx";
...
@@ -22,6 +22,7 @@ import TipPanel from "@/panels/TipPanel/TipPanel.tsx";
import
{
LevelArr
}
from
"@/pages/GamePage/Level/LevelConfig.ts"
;
import
{
LevelArr
}
from
"@/pages/GamePage/Level/LevelConfig.ts"
;
import
ExitPop
from
'@/components/exitPop/exitPop'
;
import
ExitPop
from
'@/components/exitPop/exitPop'
;
import
{
_throttle
}
from
"@/utils/utils.ts"
;
import
{
_throttle
}
from
"@/utils/utils.ts"
;
import
{
GameEvent
,
globalEvent
}
from
"@/pages/GamePage/GameEvent.ts"
;
export
function
getApp
():
Application
{
export
function
getApp
():
Application
{
return
window
[
"__app"
];
return
window
[
"__app"
];
...
@@ -93,7 +94,6 @@ class GamePage extends React.Component<any, any> {
...
@@ -93,7 +94,6 @@ class GamePage extends React.Component<any, any> {
this
.
app
.
ticker
.
add
(
this
.
onUpdate
);
this
.
app
.
ticker
.
add
(
this
.
onUpdate
);
this
.
game
=
app
.
stage
.
addChild
(
new
Game
());
this
.
game
=
app
.
stage
.
addChild
(
new
Game
());
}
}
onUpdate
=
(
time
:
Ticker
)
=>
{
onUpdate
=
(
time
:
Ticker
)
=>
{
...
@@ -124,8 +124,7 @@ class GamePage extends React.Component<any, any> {
...
@@ -124,8 +124,7 @@ class GamePage extends React.Component<any, any> {
})
})
render
()
{
render
()
{
const
{}
=
store
.
indexData
;
const
{
levelIndex
,
levelIdxArr
,
cd
}
=
gameStore
.
gameInfo
;
const
{
levelIndex
,
levelIdxArr
}
=
gameStore
.
gameInfo
;
const
titleSrc
=
new
URL
(
const
titleSrc
=
new
URL
(
`../../assets/GamePage/title/title
${(
levelIndex
+
1
)
||
1
}
.png?x-oss-process=image/format,webp`
,
`../../assets/GamePage/title/title
${(
levelIndex
+
1
)
||
1
}
.png?x-oss-process=image/format,webp`
,
...
@@ -136,7 +135,7 @@ class GamePage extends React.Component<any, any> {
...
@@ -136,7 +135,7 @@ class GamePage extends React.Component<any, any> {
<
canvas
className=
{
styles
.
gameCanvas
}
ref=
{
(
el
)
=>
this
.
gameCanvas
=
el
}
/>
<
canvas
className=
{
styles
.
gameCanvas
}
ref=
{
(
el
)
=>
this
.
gameCanvas
=
el
}
/>
<
div
className=
{
styles
.
cd
}
>
180
s
</
div
>
<
div
className=
{
styles
.
cd
}
>
{
cd
}
s
</
div
>
<
img
src=
{
titleSrc
}
className=
{
styles
.
title
}
/>
<
img
src=
{
titleSrc
}
className=
{
styles
.
title
}
/>
<
Button
className=
{
`${styles.tipBtn} md14`
}
onClick=
{
this
.
clickTip
}
/>
<
Button
className=
{
`${styles.tipBtn} md14`
}
onClick=
{
this
.
clickTip
}
/>
<
Button
className=
{
`${styles.backBtn} md13`
}
onClick=
{
this
.
clickBack
}
/>
<
Button
className=
{
`${styles.backBtn} md13`
}
onClick=
{
this
.
clickBack
}
/>
...
...
src/pages/GamePage/Level/Level1.ts
View file @
45987816
...
@@ -52,6 +52,7 @@ export class Level1 extends LevelBase {
...
@@ -52,6 +52,7 @@ export class Level1 extends LevelBase {
const
wait
=
2000
;
const
wait
=
2000
;
if
(
isRight
)
{
if
(
isRight
)
{
this
.
setPauseCd
(
true
);
this
.
right
.
visible
=
true
;
this
.
right
.
visible
=
true
;
this
.
right
.
position
.
set
(
item
.
x
+
dp
,
item
.
y
+
dp
);
this
.
right
.
position
.
set
(
item
.
x
+
dp
,
item
.
y
+
dp
);
Tween
.
get
(
this
.
error
)
Tween
.
get
(
this
.
error
)
...
...
src/pages/GamePage/Level/Level10.ts
View file @
45987816
...
@@ -67,6 +67,7 @@ export class Level10 extends LevelBase {
...
@@ -67,6 +67,7 @@ export class Level10 extends LevelBase {
&&
ny
>=
865
&&
ny
>=
865
&&
ny
<=
940
&&
ny
<=
940
)
{
)
{
this
.
setPauseCd
(
true
);
this
.
setTouchEnable
(
false
);
this
.
setTouchEnable
(
false
);
Tween
.
get
(
this
.
B
).
to
({
alpha
:
0
},
444
,
Ease
.
quadInOut
);
Tween
.
get
(
this
.
B
).
to
({
alpha
:
0
},
444
,
Ease
.
quadInOut
);
Tween
.
get
(
this
.
D
).
to
({
alpha
:
0
},
444
,
Ease
.
quadInOut
);
Tween
.
get
(
this
.
D
).
to
({
alpha
:
0
},
444
,
Ease
.
quadInOut
);
...
...
src/pages/GamePage/Level/Level11.ts
View file @
45987816
...
@@ -117,6 +117,7 @@ export class Level11 extends LevelBase {
...
@@ -117,6 +117,7 @@ export class Level11 extends LevelBase {
// 防止重复触发
// 防止重复触发
if
(
this
.
right
.
alpha
>
0
)
return
;
if
(
this
.
right
.
alpha
>
0
)
return
;
this
.
setPauseCd
(
true
);
this
.
setTouchEnable
(
false
);
this
.
setTouchEnable
(
false
);
Tween
.
get
(
this
.
right
)
Tween
.
get
(
this
.
right
)
...
...
src/pages/GamePage/Level/Level12.ts
View file @
45987816
...
@@ -204,6 +204,7 @@ export class Level12 extends LevelBase {
...
@@ -204,6 +204,7 @@ export class Level12 extends LevelBase {
// 设置right的位置
// 设置right的位置
this
.
right
.
position
.
set
(
rightX
,
rightY
);
this
.
right
.
position
.
set
(
rightX
,
rightY
);
this
.
setPauseCd
(
true
);
// 显示right图标并完成通关
// 显示right图标并完成通关
Tween
.
get
(
this
.
right
)
Tween
.
get
(
this
.
right
)
.
to
({
alpha
:
1
},
444
,
Ease
.
quadInOut
)
.
to
({
alpha
:
1
},
444
,
Ease
.
quadInOut
)
...
...
src/pages/GamePage/Level/Level13.ts
View file @
45987816
...
@@ -73,6 +73,7 @@ export class Level13 extends LevelBase {
...
@@ -73,6 +73,7 @@ export class Level13 extends LevelBase {
cx
<
10
||
cx
>
410
cx
<
10
||
cx
>
410
||
cy
<
480
||
cy
>
900
||
cy
<
480
||
cy
>
900
)
{
)
{
this
.
setPauseCd
(
true
);
this
.
setTouchEnable
(
false
);
this
.
setTouchEnable
(
false
);
Tween
.
get
(
this
.
right
)
Tween
.
get
(
this
.
right
)
.
to
({
alpha
:
1
},
444
,
Ease
.
quadInOut
)
.
to
({
alpha
:
1
},
444
,
Ease
.
quadInOut
)
...
...
src/pages/GamePage/Level/Level14.ts
View file @
45987816
...
@@ -95,6 +95,7 @@ export class Level14 extends LevelBase {
...
@@ -95,6 +95,7 @@ export class Level14 extends LevelBase {
&&
ny
>=
930
&&
ny
>=
930
&&
ny
<=
1120
&&
ny
<=
1120
)
{
)
{
this
.
setPauseCd
(
true
);
this
.
setTouchEnable
(
false
);
this
.
setTouchEnable
(
false
);
Tween
.
get
(
this
.
A
)
Tween
.
get
(
this
.
A
)
.
to
({
x
:
484
,
y
:
1040
},
444
,
Ease
.
quadInOut
)
.
to
({
x
:
484
,
y
:
1040
},
444
,
Ease
.
quadInOut
)
...
...
src/pages/GamePage/Level/Level15.ts
View file @
45987816
...
@@ -117,6 +117,7 @@ export class Level15 extends LevelBase {
...
@@ -117,6 +117,7 @@ export class Level15 extends LevelBase {
.
intersects
(
new
Rectangle
(
180
,
840
,
37
,
55
));
.
intersects
(
new
Rectangle
(
180
,
840
,
37
,
55
));
if
(
isIns
)
{
if
(
isIns
)
{
this
.
setPauseCd
(
true
);
this
.
setTouchEnable
(
false
);
this
.
setTouchEnable
(
false
);
this
.
target
.
eventMode
=
"none"
;
this
.
target
.
eventMode
=
"none"
;
this
.
target
.
interactive
=
false
;
this
.
target
.
interactive
=
false
;
...
...
src/pages/GamePage/Level/Level16.ts
View file @
45987816
...
@@ -62,6 +62,7 @@ export class Level16 extends LevelBase {
...
@@ -62,6 +62,7 @@ export class Level16 extends LevelBase {
&&
ny
>=
920
&&
ny
>=
920
&&
ny
<=
1034
&&
ny
<=
1034
)
{
)
{
this
.
setPauseCd
(
true
);
this
.
setTouchEnable
(
false
);
this
.
setTouchEnable
(
false
);
// Tween.get(this.B).to({ alpha: 0 }, 444, Ease.quadInOut);
// Tween.get(this.B).to({ alpha: 0 }, 444, Ease.quadInOut);
Tween
.
get
(
this
.
A
)
Tween
.
get
(
this
.
A
)
...
...
src/pages/GamePage/Level/Level17.ts
View file @
45987816
...
@@ -66,7 +66,10 @@ export class Level17 extends LevelBase {
...
@@ -66,7 +66,10 @@ export class Level17 extends LevelBase {
!
item
.
findFlag
&&
this
.
findNum
++
;
!
item
.
findFlag
&&
this
.
findNum
++
;
item
.
alpha
=
1
;
item
.
alpha
=
1
;
item
.
findFlag
=
true
;
item
.
findFlag
=
true
;
if
(
this
.
findNum
==
10
)
globalEvent
.
emit
(
GameEvent
.
NextLevel
);
if
(
this
.
findNum
==
10
)
{
this
.
setPauseCd
(
true
);
globalEvent
.
emit
(
GameEvent
.
NextLevel
);
}
})
})
}
}
})
})
...
...
src/pages/GamePage/Level/Level18.ts
View file @
45987816
...
@@ -82,6 +82,7 @@ export class Level18 extends LevelBase {
...
@@ -82,6 +82,7 @@ export class Level18 extends LevelBase {
(
c1x
<
-
125
||
c1x
>
350
||
c1y
<
595
||
c1y
>
820
)
(
c1x
<
-
125
||
c1x
>
350
||
c1y
<
595
||
c1y
>
820
)
&&
(
c2x
<
-
125
||
c2x
>
350
||
c2y
<
595
||
c2y
>
820
)
&&
(
c2x
<
-
125
||
c2x
>
350
||
c2y
<
595
||
c2y
>
820
)
)
{
)
{
this
.
setPauseCd
(
true
);
this
.
setTouchEnable
(
false
);
this
.
setTouchEnable
(
false
);
Tween
.
get
(
this
.
ice
).
to
({
alpha
:
0
},
666
,
Ease
.
quadInOut
);
Tween
.
get
(
this
.
ice
).
to
({
alpha
:
0
},
666
,
Ease
.
quadInOut
);
Tween
.
get
(
this
.
ice2
).
wait
(
444
).
to
({
alpha
:
1
},
666
,
Ease
.
quadInOut
);
Tween
.
get
(
this
.
ice2
).
wait
(
444
).
to
({
alpha
:
1
},
666
,
Ease
.
quadInOut
);
...
...
src/pages/GamePage/Level/Level19.ts
View file @
45987816
...
@@ -117,6 +117,7 @@ export class Level19 extends LevelBase {
...
@@ -117,6 +117,7 @@ export class Level19 extends LevelBase {
// 防止重复触发
// 防止重复触发
if
(
this
.
right
.
alpha
>
0
)
return
;
if
(
this
.
right
.
alpha
>
0
)
return
;
this
.
setPauseCd
(
true
);
this
.
setTouchEnable
(
false
);
this
.
setTouchEnable
(
false
);
Tween
.
get
(
this
.
right
)
Tween
.
get
(
this
.
right
)
...
...
src/pages/GamePage/Level/Level2.ts
View file @
45987816
...
@@ -55,6 +55,7 @@ export class Level2 extends LevelBase {
...
@@ -55,6 +55,7 @@ export class Level2 extends LevelBase {
const
wait
=
2000
;
const
wait
=
2000
;
if
(
isRight
)
{
if
(
isRight
)
{
this
.
setPauseCd
(
true
);
this
.
right
.
visible
=
true
;
this
.
right
.
visible
=
true
;
this
.
right
.
position
.
set
(
item
.
x
+
dp
,
item
.
y
+
dp
);
this
.
right
.
position
.
set
(
item
.
x
+
dp
,
item
.
y
+
dp
);
Tween
.
get
(
this
.
error
)
Tween
.
get
(
this
.
error
)
...
...
src/pages/GamePage/Level/Level20.ts
View file @
45987816
...
@@ -107,6 +107,7 @@ export class Level20 extends LevelBase {
...
@@ -107,6 +107,7 @@ export class Level20 extends LevelBase {
&&
!
this
.
C
.
interactive
&&
!
this
.
C
.
interactive
&&
!
this
.
qs
.
interactive
&&
!
this
.
qs
.
interactive
)
{
)
{
this
.
setPauseCd
(
true
);
Tween
.
get
(
this
.
right
)
Tween
.
get
(
this
.
right
)
.
to
({
alpha
:
1
},
666
,
Ease
.
quadInOut
)
.
to
({
alpha
:
1
},
666
,
Ease
.
quadInOut
)
.
wait
(
2000
)
.
wait
(
2000
)
...
...
src/pages/GamePage/Level/Level21.ts
View file @
45987816
...
@@ -71,6 +71,7 @@ export class Level21 extends LevelBase {
...
@@ -71,6 +71,7 @@ export class Level21 extends LevelBase {
.
intersects
(
new
Rectangle
(
bx
+
edge
,
by
+
edge
,
bw
-
edge
*
2
,
bh
-
edge
*
2
));
.
intersects
(
new
Rectangle
(
bx
+
edge
,
by
+
edge
,
bw
-
edge
*
2
,
bh
-
edge
*
2
));
if
(
isIns
)
{
if
(
isIns
)
{
this
.
setPauseCd
(
true
);
this
.
setTouchEnable
(
false
);
this
.
setTouchEnable
(
false
);
this
.
right
.
position
.
set
(
bx
-
30
,
by
-
30
);
this
.
right
.
position
.
set
(
bx
-
30
,
by
-
30
);
Tween
.
get
(
this
.
B
).
to
({
alpha
:
0
},
666
,
Ease
.
quadInOut
);
Tween
.
get
(
this
.
B
).
to
({
alpha
:
0
},
666
,
Ease
.
quadInOut
);
...
...
src/pages/GamePage/Level/Level22.ts
View file @
45987816
...
@@ -78,6 +78,7 @@ export class Level22 extends LevelBase {
...
@@ -78,6 +78,7 @@ export class Level22 extends LevelBase {
(
ax
<
0
||
ax
>
425
||
ay
<
600
||
ay
>
970
)
(
ax
<
0
||
ax
>
425
||
ay
<
600
||
ay
>
970
)
&&
(
bx
<
80
||
bx
>
450
||
by
<
840
||
by
>
1200
)
&&
(
bx
<
80
||
bx
>
450
||
by
<
840
||
by
>
1200
)
)
{
)
{
this
.
setPauseCd
(
true
);
this
.
setTouchEnable
(
false
);
this
.
setTouchEnable
(
false
);
Tween
.
get
(
this
.
right
)
Tween
.
get
(
this
.
right
)
.
to
({
alpha
:
1
},
666
,
Ease
.
quadInOut
)
.
to
({
alpha
:
1
},
666
,
Ease
.
quadInOut
)
...
...
src/pages/GamePage/Level/Level23.ts
View file @
45987816
...
@@ -48,6 +48,7 @@ export class Level23 extends LevelBase {
...
@@ -48,6 +48,7 @@ export class Level23 extends LevelBase {
const
wait
=
2000
;
const
wait
=
2000
;
if
(
isRight
)
{
if
(
isRight
)
{
this
.
setPauseCd
(
true
);
this
.
right
.
visible
=
true
;
this
.
right
.
visible
=
true
;
this
.
right
.
position
.
set
(
item
.
x
+
dp
,
item
.
y
+
dp
);
this
.
right
.
position
.
set
(
item
.
x
+
dp
,
item
.
y
+
dp
);
Tween
.
get
(
this
.
error
)
Tween
.
get
(
this
.
error
)
...
...
src/pages/GamePage/Level/Level24.ts
View file @
45987816
...
@@ -56,7 +56,7 @@ export class Level24 extends LevelBase {
...
@@ -56,7 +56,7 @@ export class Level24 extends LevelBase {
onBallPointerDown
(
e
)
{
onBallPointerDown
(
e
)
{
const
ball
=
e
.
currentTarget
as
Sprite
;
const
ball
=
e
.
currentTarget
as
Sprite
;
console
.
log
(
"开始拖拽球"
,
ball
);
console
.
log
(
"开始拖拽球"
,
ball
);
this
.
dragData
=
{
this
.
dragData
=
{
ball
:
ball
,
ball
:
ball
,
offset
:
{
offset
:
{
...
@@ -64,7 +64,7 @@ export class Level24 extends LevelBase {
...
@@ -64,7 +64,7 @@ export class Level24 extends LevelBase {
y
:
e
.
data
.
global
.
y
-
ball
.
y
y
:
e
.
data
.
global
.
y
-
ball
.
y
}
}
};
};
// 将当前球置于最上层
// 将当前球置于最上层
this
.
setChildIndex
(
ball
,
this
.
children
.
length
-
1
);
this
.
setChildIndex
(
ball
,
this
.
children
.
length
-
1
);
}
}
...
@@ -90,22 +90,22 @@ export class Level24 extends LevelBase {
...
@@ -90,22 +90,22 @@ export class Level24 extends LevelBase {
checkMerge
(
draggedBall
:
Sprite
)
{
checkMerge
(
draggedBall
:
Sprite
)
{
for
(
const
ball
of
this
.
balls
)
{
for
(
const
ball
of
this
.
balls
)
{
if
(
ball
===
draggedBall
)
continue
;
if
(
ball
===
draggedBall
)
continue
;
// 计算两球中心点的距离(由于锚点为默认值,需要加上半径偏移)
// 计算两球中心点的距离(由于锚点为默认值,需要加上半径偏移)
const
draggedCenterX
=
draggedBall
.
x
+
(
draggedBall
.
width
/
2
);
const
draggedCenterX
=
draggedBall
.
x
+
(
draggedBall
.
width
/
2
);
const
draggedCenterY
=
draggedBall
.
y
+
(
draggedBall
.
height
/
2
);
const
draggedCenterY
=
draggedBall
.
y
+
(
draggedBall
.
height
/
2
);
const
ballCenterX
=
ball
.
x
+
(
ball
.
width
/
2
);
const
ballCenterX
=
ball
.
x
+
(
ball
.
width
/
2
);
const
ballCenterY
=
ball
.
y
+
(
ball
.
height
/
2
);
const
ballCenterY
=
ball
.
y
+
(
ball
.
height
/
2
);
const
distance
=
this
.
getDistance
(
const
distance
=
this
.
getDistance
(
{
x
:
draggedCenterX
,
y
:
draggedCenterY
},
{
x
:
draggedCenterX
,
y
:
draggedCenterY
},
{
x
:
ballCenterX
,
y
:
ballCenterY
}
{
x
:
ballCenterX
,
y
:
ballCenterY
}
);
);
// 计算两球的半径
// 计算两球的半径
const
draggedRadius
=
draggedBall
.
width
/
2
;
const
draggedRadius
=
draggedBall
.
width
/
2
;
const
ballRadius
=
ball
.
width
/
2
;
const
ballRadius
=
ball
.
width
/
2
;
// 如果两球接触(距离小于两球半径之和)
// 如果两球接触(距离小于两球半径之和)
if
(
distance
<
draggedRadius
+
ballRadius
)
{
if
(
distance
<
draggedRadius
+
ballRadius
)
{
console
.
log
(
"球碰撞,开始合成"
);
console
.
log
(
"球碰撞,开始合成"
);
...
@@ -121,53 +121,53 @@ export class Level24 extends LevelBase {
...
@@ -121,53 +121,53 @@ export class Level24 extends LevelBase {
const
ball1CenterY
=
ball1
.
y
+
(
ball1
.
height
/
2
);
const
ball1CenterY
=
ball1
.
y
+
(
ball1
.
height
/
2
);
const
ball2CenterX
=
ball2
.
x
+
(
ball2
.
width
/
2
);
const
ball2CenterX
=
ball2
.
x
+
(
ball2
.
width
/
2
);
const
ball2CenterY
=
ball2
.
y
+
(
ball2
.
height
/
2
);
const
ball2CenterY
=
ball2
.
y
+
(
ball2
.
height
/
2
);
const
newCenterX
=
(
ball1CenterX
+
ball2CenterX
)
/
2
;
const
newCenterX
=
(
ball1CenterX
+
ball2CenterX
)
/
2
;
const
newCenterY
=
(
ball1CenterY
+
ball2CenterY
)
/
2
;
const
newCenterY
=
(
ball1CenterY
+
ball2CenterY
)
/
2
;
// 计算新球的大小(使用更小的增长幅度)
// 计算新球的大小(使用更小的增长幅度)
const
scaleIncrease
=
Math
.
min
(
ball1
.
scale
.
x
,
ball2
.
scale
.
x
)
*
0.4
;
// 增长幅度减小为较小球的30%
const
scaleIncrease
=
Math
.
min
(
ball1
.
scale
.
x
,
ball2
.
scale
.
x
)
*
0.4
;
// 增长幅度减小为较小球的30%
const
newScale
=
Math
.
min
(
Math
.
max
(
ball1
.
scale
.
x
,
ball2
.
scale
.
x
)
+
scaleIncrease
,
1.2
);
// 最大限制调整为1.2
const
newScale
=
Math
.
min
(
Math
.
max
(
ball1
.
scale
.
x
,
ball2
.
scale
.
x
)
+
scaleIncrease
,
1.2
);
// 最大限制调整为1.2
// 移除较小的球,保留较大的球作为合成结果
// 移除较小的球,保留较大的球作为合成结果
const
keepBall
=
ball1
.
scale
.
x
>=
ball2
.
scale
.
x
?
ball1
:
ball2
;
const
keepBall
=
ball1
.
scale
.
x
>=
ball2
.
scale
.
x
?
ball1
:
ball2
;
const
removeBall
=
ball1
.
scale
.
x
>=
ball2
.
scale
.
x
?
ball2
:
ball1
;
const
removeBall
=
ball1
.
scale
.
x
>=
ball2
.
scale
.
x
?
ball2
:
ball1
;
// 从balls数组中移除被合成的球
// 从balls数组中移除被合成的球
const
removeIndex
=
this
.
balls
.
indexOf
(
removeBall
);
const
removeIndex
=
this
.
balls
.
indexOf
(
removeBall
);
if
(
removeIndex
>
-
1
)
{
if
(
removeIndex
>
-
1
)
{
this
.
balls
.
splice
(
removeIndex
,
1
);
this
.
balls
.
splice
(
removeIndex
,
1
);
}
}
// 移除被合成的球的事件监听
// 移除被合成的球的事件监听
removeBall
.
off
(
"pointerdown"
,
this
.
onBallPointerDown
,
this
);
removeBall
.
off
(
"pointerdown"
,
this
.
onBallPointerDown
,
this
);
removeBall
.
off
(
"globalpointermove"
,
this
.
onBallPointerMove
,
this
);
removeBall
.
off
(
"globalpointermove"
,
this
.
onBallPointerMove
,
this
);
removeBall
.
off
(
"pointerup"
,
this
.
onBallPointerUp
,
this
);
removeBall
.
off
(
"pointerup"
,
this
.
onBallPointerUp
,
this
);
removeBall
.
off
(
"pointerupoutside"
,
this
.
onBallPointerUp
,
this
);
removeBall
.
off
(
"pointerupoutside"
,
this
.
onBallPointerUp
,
this
);
// 计算新位置(左上角坐标)
// 计算新位置(左上角坐标)
const
newSize
=
378
*
newScale
;
const
newSize
=
378
*
newScale
;
const
newX
=
newCenterX
-
(
newSize
/
2
);
const
newX
=
newCenterX
-
(
newSize
/
2
);
const
newY
=
newCenterY
-
(
newSize
/
2
);
const
newY
=
newCenterY
-
(
newSize
/
2
);
// 播放合成动画
// 播放合成动画
Tween
.
get
(
keepBall
)
Tween
.
get
(
keepBall
)
.
to
({
x
:
newX
,
y
:
newY
,
scaleX
:
newScale
,
scaleY
:
newScale
},
300
,
Ease
.
quadOut
)
.
to
({
x
:
newX
,
y
:
newY
,
scaleX
:
newScale
,
scaleY
:
newScale
},
300
,
Ease
.
quadOut
)
.
call
(()
=>
{
.
call
(()
=>
{
// 移除被合成的球
// 移除被合成的球
this
.
removeChild
(
removeBall
);
this
.
removeChild
(
removeBall
);
// 检查是否通关
// 检查是否通关
this
.
checkWinCondition
();
this
.
checkWinCondition
();
});
});
Tween
.
get
(
removeBall
)
Tween
.
get
(
removeBall
)
.
to
({
alpha
:
0
,
scaleX
:
0
,
scaleY
:
0
},
300
,
Ease
.
quadOut
);
.
to
({
alpha
:
0
,
scaleX
:
0
,
scaleY
:
0
},
300
,
Ease
.
quadOut
);
}
}
checkWinCondition
()
{
checkWinCondition
()
{
console
.
log
(
"检查通关条件,剩余球数:"
,
this
.
balls
.
length
);
console
.
log
(
"检查通关条件,剩余球数:"
,
this
.
balls
.
length
);
// 如果只剩一个球
// 如果只剩一个球
if
(
this
.
balls
.
length
===
1
)
{
if
(
this
.
balls
.
length
===
1
)
{
console
.
log
(
"达到通关条件"
);
console
.
log
(
"达到通关条件"
);
...
@@ -186,19 +186,20 @@ export class Level24 extends LevelBase {
...
@@ -186,19 +186,20 @@ export class Level24 extends LevelBase {
if
(
this
.
right
.
alpha
>
0
)
return
;
if
(
this
.
right
.
alpha
>
0
)
return
;
console
.
log
(
"开始通关动画"
);
console
.
log
(
"开始通关动画"
);
this
.
setPauseCd
(
true
);
this
.
setTouchEnable
(
false
);
this
.
setTouchEnable
(
false
);
// 获取最后一个球
// 获取最后一个球
const
lastBall
=
this
.
balls
[
0
];
const
lastBall
=
this
.
balls
[
0
];
// 计算屏幕中间位置(假设屏幕尺寸为720x1280)
// 计算屏幕中间位置(假设屏幕尺寸为720x1280)
const
screenCenterX
=
360
;
const
screenCenterX
=
360
;
const
screenCenterY
=
940
;
const
screenCenterY
=
940
;
// 计算球移动到屏幕中间时的位置(左上角坐标)
// 计算球移动到屏幕中间时的位置(左上角坐标)
const
ballTargetX
=
screenCenterX
-
(
lastBall
.
width
/
2
);
const
ballTargetX
=
screenCenterX
-
(
lastBall
.
width
/
2
);
const
ballTargetY
=
screenCenterY
-
(
lastBall
.
height
/
2
);
const
ballTargetY
=
screenCenterY
-
(
lastBall
.
height
/
2
);
// 球移动到屏幕中间的动画
// 球移动到屏幕中间的动画
Tween
.
get
(
lastBall
)
Tween
.
get
(
lastBall
)
.
to
({
x
:
ballTargetX
,
y
:
ballTargetY
},
600
,
Ease
.
quadInOut
)
.
to
({
x
:
ballTargetX
,
y
:
ballTargetY
},
600
,
Ease
.
quadInOut
)
...
@@ -206,10 +207,10 @@ export class Level24 extends LevelBase {
...
@@ -206,10 +207,10 @@ export class Level24 extends LevelBase {
// 球到达中间后,计算right的位置(球的右下角)
// 球到达中间后,计算right的位置(球的右下角)
const
rightX
=
lastBall
.
x
+
lastBall
.
width
-
this
.
right
.
width
+
20
;
// 稍微偏移一点
const
rightX
=
lastBall
.
x
+
lastBall
.
width
-
this
.
right
.
width
+
20
;
// 稍微偏移一点
const
rightY
=
lastBall
.
y
+
lastBall
.
height
-
this
.
right
.
height
+
20
;
const
rightY
=
lastBall
.
y
+
lastBall
.
height
-
this
.
right
.
height
+
20
;
// 设置right的位置
// 设置right的位置
this
.
right
.
position
.
set
(
rightX
,
rightY
);
this
.
right
.
position
.
set
(
rightX
,
rightY
);
// 显示right图标并完成通关
// 显示right图标并完成通关
Tween
.
get
(
this
.
right
)
Tween
.
get
(
this
.
right
)
.
to
({
alpha
:
1
},
444
,
Ease
.
quadInOut
)
.
to
({
alpha
:
1
},
444
,
Ease
.
quadInOut
)
...
@@ -222,7 +223,7 @@ export class Level24 extends LevelBase {
...
@@ -222,7 +223,7 @@ export class Level24 extends LevelBase {
onDestroy
()
{
onDestroy
()
{
super
.
onDestroy
();
super
.
onDestroy
();
// 移除所有球的tween动画
// 移除所有球的tween动画
this
.
balls
.
forEach
(
ball
=>
{
this
.
balls
.
forEach
(
ball
=>
{
Tween
.
removeTweens
(
ball
);
Tween
.
removeTweens
(
ball
);
...
@@ -231,7 +232,7 @@ export class Level24 extends LevelBase {
...
@@ -231,7 +232,7 @@ export class Level24 extends LevelBase {
ball
.
off
(
"pointerup"
,
this
.
onBallPointerUp
,
this
);
ball
.
off
(
"pointerup"
,
this
.
onBallPointerUp
,
this
);
ball
.
off
(
"pointerupoutside"
,
this
.
onBallPointerUp
,
this
);
ball
.
off
(
"pointerupoutside"
,
this
.
onBallPointerUp
,
this
);
});
});
Tween
.
removeTweens
(
this
.
right
);
Tween
.
removeTweens
(
this
.
right
);
}
}
}
}
src/pages/GamePage/Level/Level25.ts
View file @
45987816
...
@@ -74,19 +74,20 @@ export class Level25 extends LevelBase {
...
@@ -74,19 +74,20 @@ export class Level25 extends LevelBase {
.
to
({
alpha
:
1
},
3000
)
.
to
({
alpha
:
1
},
3000
)
.
call
(()
=>
{
.
call
(()
=>
{
this
.
gameOver
=
true
;
this
.
gameOver
=
true
;
this
.
mad
.
alpha
=
0
;
this
.
mad
.
alpha
=
0
;
this
.
redFace
.
alpha
=
0
;
this
.
redFace
.
alpha
=
0
;
this
.
wake
.
alpha
=
1
;
this
.
wake
.
alpha
=
1
;
this
.
hideMark
.
alpha
=
0
;
this
.
hideMark
.
alpha
=
0
;
this
.
setPauseCd
(
true
);
Tween
.
get
(
this
.
right
)
Tween
.
get
(
this
.
right
)
.
to
({
alpha
:
1
},
444
,
Ease
.
quadInOut
)
.
to
({
alpha
:
1
},
444
,
Ease
.
quadInOut
)
.
wait
(
2000
)
.
wait
(
2000
)
.
call
(()
=>
{
.
call
(()
=>
{
globalEvent
.
emit
(
GameEvent
.
NextLevel
);
globalEvent
.
emit
(
GameEvent
.
NextLevel
);
});
});
})
})
}
}
...
...
src/pages/GamePage/Level/Level3.ts
View file @
45987816
...
@@ -52,6 +52,7 @@ export class Level3 extends LevelBase {
...
@@ -52,6 +52,7 @@ export class Level3 extends LevelBase {
const
wait
=
2000
;
const
wait
=
2000
;
if
(
isRight
)
{
if
(
isRight
)
{
this
.
setPauseCd
(
true
);
this
.
right
.
visible
=
true
;
this
.
right
.
visible
=
true
;
this
.
right
.
position
.
set
(
item
.
x
+
dp
,
item
.
y
+
dp
);
this
.
right
.
position
.
set
(
item
.
x
+
dp
,
item
.
y
+
dp
);
Tween
.
get
(
this
.
error
)
Tween
.
get
(
this
.
error
)
...
...
src/pages/GamePage/Level/Level4.ts
View file @
45987816
...
@@ -53,6 +53,7 @@ export class Level4 extends LevelBase {
...
@@ -53,6 +53,7 @@ export class Level4 extends LevelBase {
const
wait
=
2000
;
const
wait
=
2000
;
if
(
isRight
)
{
if
(
isRight
)
{
this
.
setPauseCd
(
true
);
this
.
right
.
visible
=
true
;
this
.
right
.
visible
=
true
;
Tween
.
get
(
this
.
error
)
Tween
.
get
(
this
.
error
)
.
wait
(
wait
)
.
wait
(
wait
)
...
...
src/pages/GamePage/Level/Level5.ts
View file @
45987816
...
@@ -99,6 +99,7 @@ export class Level5 extends LevelBase {
...
@@ -99,6 +99,7 @@ export class Level5 extends LevelBase {
&&
ny
>=
1000
&&
ny
>=
1000
&&
ny
<=
1120
&&
ny
<=
1120
)
{
)
{
this
.
setPauseCd
(
true
);
this
.
setTouchEnable
(
false
);
this
.
setTouchEnable
(
false
);
Tween
.
get
(
this
.
A
)
Tween
.
get
(
this
.
A
)
.
to
({
x
:
439
,
y
:
1073
},
444
,
Ease
.
quadInOut
)
.
to
({
x
:
439
,
y
:
1073
},
444
,
Ease
.
quadInOut
)
...
...
src/pages/GamePage/Level/Level6.ts
View file @
45987816
...
@@ -74,6 +74,7 @@ export class Level6 extends LevelBase {
...
@@ -74,6 +74,7 @@ export class Level6 extends LevelBase {
const
{
x
,
y
}
=
this
.
C
;
const
{
x
,
y
}
=
this
.
C
;
if
(
x
>=
80
&&
x
<=
230
&&
y
>=
1030
&&
y
<=
1100
)
{
if
(
x
>=
80
&&
x
<=
230
&&
y
>=
1030
&&
y
<=
1100
)
{
this
.
setPauseCd
(
true
);
this
.
setTouchEnable
(
false
);
this
.
setTouchEnable
(
false
);
Tween
.
get
(
this
.
C
)
Tween
.
get
(
this
.
C
)
.
to
({
x
:
129
,
y
:
1049
},
666
,
Ease
.
quadInOut
);
.
to
({
x
:
129
,
y
:
1049
},
666
,
Ease
.
quadInOut
);
...
...
src/pages/GamePage/Level/Level7.ts
View file @
45987816
...
@@ -33,6 +33,7 @@ export class Level7 extends LevelBase {
...
@@ -33,6 +33,7 @@ export class Level7 extends LevelBase {
}
}
passLevel
()
{
passLevel
()
{
this
.
setPauseCd
(
true
);
this
.
setTouchEnable
(
false
);
this
.
setTouchEnable
(
false
);
getApp
().
stage
.
off
(
"pointerdown"
,
this
.
onPointerDown
,
this
);
getApp
().
stage
.
off
(
"pointerdown"
,
this
.
onPointerDown
,
this
);
getApp
().
stage
.
off
(
"pointerup"
,
this
.
onPointerUp
,
this
);
getApp
().
stage
.
off
(
"pointerup"
,
this
.
onPointerUp
,
this
);
...
...
src/pages/GamePage/Level/Level8.ts
View file @
45987816
...
@@ -53,6 +53,7 @@ export class Level8 extends LevelBase {
...
@@ -53,6 +53,7 @@ export class Level8 extends LevelBase {
const
wait
=
2000
;
const
wait
=
2000
;
if
(
isRight
)
{
if
(
isRight
)
{
this
.
setPauseCd
(
true
);
this
.
right
.
visible
=
true
;
this
.
right
.
visible
=
true
;
Tween
.
get
(
this
.
error
)
Tween
.
get
(
this
.
error
)
.
wait
(
wait
)
.
wait
(
wait
)
...
...
src/pages/GamePage/Level/Level9.ts
View file @
45987816
...
@@ -59,6 +59,7 @@ export class Level9 extends LevelBase {
...
@@ -59,6 +59,7 @@ export class Level9 extends LevelBase {
&&
ny
>=
980
&&
ny
>=
980
&&
ny
<=
1100
&&
ny
<=
1100
)
{
)
{
this
.
setPauseCd
(
true
);
this
.
setTouchEnable
(
false
);
this
.
setTouchEnable
(
false
);
Tween
.
get
(
this
.
A
)
Tween
.
get
(
this
.
A
)
.
to
({
x
:
380
,
y
:
975
},
444
,
Ease
.
quadInOut
)
.
to
({
x
:
380
,
y
:
975
},
444
,
Ease
.
quadInOut
)
...
...
src/store/gameStore.ts
View file @
45987816
...
@@ -20,6 +20,7 @@ class GameStore {
...
@@ -20,6 +20,7 @@ class GameStore {
levelIdxArr
:
[],
levelIdxArr
:
[],
countdownSeconds
:
180
,
countdownSeconds
:
180
,
remainTipTimes
:
0
,
remainTipTimes
:
0
,
cd
:
180
,
}
}
async
start
()
{
async
start
()
{
...
...
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