Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
DuibaGameTemplate
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
钱根
DuibaGameTemplate
Commits
dd309b42
Commit
dd309b42
authored
Sep 05, 2021
by
Master Q
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
游戏引导添加
parent
a2d5c03d
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
130 additions
and
8 deletions
+130
-8
guidance4-1.png
resource/GameScene/guidance4-1.png
+0
-0
guidance4-2.png
resource/GameScene/guidance4-2.png
+0
-0
guidance4-3.png
resource/GameScene/guidance4-3.png
+0
-0
guidance5-0.png
resource/GameScene/guidance5-0.png
+0
-0
guidance5-1.png
resource/GameScene/guidance5-1.png
+0
-0
guidance5-2.png
resource/GameScene/guidance5-2.png
+0
-0
guidance5-3.png
resource/GameScene/guidance5-3.png
+0
-0
guidance5-t.png
resource/GameScene/guidance5-t.png
+0
-0
res.json
resource/res.json
+1
-1
ResJson.ts
src/ResJson.ts
+1
-1
Tools.ts
src/Tools.ts
+6
-1
UI.ts
src/UI.ts
+9
-0
GameScene.ts
src/scenes/GameScene/GameScene.ts
+113
-5
No files found.
resource/GameScene/guidance4-1.png
0 → 100644
View file @
dd309b42
7.55 KB
resource/GameScene/guidance4-2.png
0 → 100644
View file @
dd309b42
4.35 KB
resource/GameScene/guidance4-3.png
0 → 100644
View file @
dd309b42
12.4 KB
resource/GameScene/guidance5-0.png
0 → 100644
View file @
dd309b42
16 KB
resource/GameScene/guidance5-1.png
0 → 100644
View file @
dd309b42
2.91 KB
resource/GameScene/guidance5-2.png
0 → 100644
View file @
dd309b42
8.2 KB
resource/GameScene/guidance5-3.png
0 → 100644
View file @
dd309b42
9.52 KB
resource/GameScene/guidance5-t.png
0 → 100644
View file @
dd309b42
4 KB
resource/res.json
View file @
dd309b42
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
"name"
:
"GameEle"
"name"
:
"GameEle"
},
},
{
{
"keys"
:
"GameScene-back.png,extra_scene.png,mission-goal.png,title-back.png"
,
"keys"
:
"GameScene-back.png,extra_scene.png,
guidance4-1.png,guidance4-2.png,guidance4-3.png,guidance5-0.png,guidance5-1.png,guidance5-2.png,guidance5-3.png,guidance5-t.png,
mission-goal.png,title-back.png"
,
"name"
:
"GameScene"
"name"
:
"GameScene"
},
},
{
{
...
...
src/ResJson.ts
View file @
dd309b42
...
@@ -5,7 +5,7 @@ export const ResJson = {
...
@@ -5,7 +5,7 @@ export const ResJson = {
"name"
:
"GameEle"
"name"
:
"GameEle"
},
},
{
{
"keys"
:
"GameScene-back.png,extra_scene.png,mission-goal.png,title-back.png"
,
"keys"
:
"GameScene-back.png,extra_scene.png,
guidance4-1.png,guidance4-2.png,guidance4-3.png,guidance5-0.png,guidance5-1.png,guidance5-2.png,guidance5-3.png,guidance5-t.png,
mission-goal.png,title-back.png"
,
"name"
:
"GameScene"
"name"
:
"GameScene"
},
},
{
{
...
...
src/Tools.ts
View file @
dd309b42
...
@@ -319,9 +319,14 @@ export class Tools {
...
@@ -319,9 +319,14 @@ export class Tools {
* 位图字每次都写太烦了
* 位图字每次都写太烦了
* @param name
* @param name
*/
*/
public
static
getNumTextures
(
name
:
string
):
{
[
key
:
number
]:
FYGE
.
Texture
}
{
public
static
getNumTextures
(
name
:
string
,
extrakv
):
{
[
key
:
number
]:
FYGE
.
Texture
}
{
var
arr
=
{}
var
arr
=
{}
for
(
var
i
=
0
;
i
<=
9
;
i
++
)
arr
[
i
]
=
RES
.
getRes
(
name
+
i
+
".png"
)
for
(
var
i
=
0
;
i
<=
9
;
i
++
)
arr
[
i
]
=
RES
.
getRes
(
name
+
i
+
".png"
)
if
(
extrakv
)
{
for
(
var
k
in
extrakv
)
{
arr
[
k
]
=
RES
.
getRes
(
extrakv
[
k
])
}
}
return
arr
return
arr
}
}
...
...
src/UI.ts
View file @
dd309b42
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
* Copyright © 2021 haiyoucuv. All rights reserved.
* Copyright © 2021 haiyoucuv. All rights reserved.
*/
*/
import
{
RES
}
from
"../module/RES"
;
import
{
RES
}
from
"../module/RES"
;
import
{
Tools
}
from
"./Tools"
;
import
Container
=
FYGE
.
Container
;
import
Container
=
FYGE
.
Container
;
import
Button
=
FYGE
.
Button
;
import
Button
=
FYGE
.
Button
;
import
MouseEvent
=
FYGE
.
MouseEvent
;
import
MouseEvent
=
FYGE
.
MouseEvent
;
...
@@ -160,4 +161,12 @@ export default class UI {
...
@@ -160,4 +161,12 @@ export default class UI {
parent
&&
parent
.
addChild
(
lottie
);
parent
&&
parent
.
addChild
(
lottie
);
return
lottie
;
return
lottie
;
}
}
public
static
BitmapText
(
parent
:
Container
,
name
:
string
,
extra
:
any
,
text
:
string
,
x
:
number
=
0
,
y
:
number
=
0
)
{
var
arrTextures
=
Tools
.
getNumTextures
(
name
,
extra
)
const
bitText
=
new
FYGE
.
BitmapText
(
arrTextures
)
bitText
.
text
=
text
bitText
.
x
=
x
bitText
.
y
=
y
}
}
}
src/scenes/GameScene/GameScene.ts
View file @
dd309b42
...
@@ -8,6 +8,7 @@ import CountDownComp from "../../components/CountDownComp";
...
@@ -8,6 +8,7 @@ import CountDownComp from "../../components/CountDownComp";
import
MoonCake
from
"../../components/MoonCake"
;
import
MoonCake
from
"../../components/MoonCake"
;
import
{
randomNum
,
throttle
}
from
"../../utils/utils"
;
import
{
randomNum
,
throttle
}
from
"../../utils/utils"
;
import
Blade
from
"../../components/Blade"
;
import
Blade
from
"../../components/Blade"
;
import
{
RES
}
from
"../../../module/RES"
;
const
MouseEvent
=
FYGE
.
MouseEvent
const
MouseEvent
=
FYGE
.
MouseEvent
const
{
Engine
,
Render
,
Runner
,
Composite
,
Bodies
,
World
,
Composites
}
=
Matter
const
{
Engine
,
Render
,
Runner
,
Composite
,
Bodies
,
World
,
Composites
}
=
Matter
...
@@ -57,10 +58,6 @@ export default class GameScene extends Scene {
...
@@ -57,10 +58,6 @@ export default class GameScene extends Scene {
UI
.
Sp
(
missionGoal
,
'mission-goal.png'
)
UI
.
Sp
(
missionGoal
,
'mission-goal.png'
)
// 初始化分数
// 初始化分数
this
.
score
=
0
this
.
score
=
0
var
sceneTitle
=
UI
.
Ctn
(
sceneContainer
,
layers
.
stageWidth
/
2
-
120
,
30
)
UI
.
Sp
(
sceneTitle
,
'title-back.png'
)
UI
.
Txt
(
sceneTitle
,
'本关目标: 100'
,
26
,
'#ffe8af'
,
FYGE
.
TEXT_ALIGN
.
CENTER
,
240
,
0
,
22
)
// var t = UI.Txt(this, '123123', 28)
// var t = UI.Txt(this, '123123', 28)
// t.x = layers.stageOffsetX
// t.x = layers.stageOffsetX
...
@@ -92,7 +89,118 @@ export default class GameScene extends Scene {
...
@@ -92,7 +89,118 @@ export default class GameScene extends Scene {
this
.
initGame
()
this
.
initGame
()
}
}
initGame
()
{
// 引导文案
onShowGuidance4
()
{
return
new
Promise
((
resolve
)
=>
{
var
cnt
=
UI
.
Ctn
(
this
.
sceneContainer
)
var
t1
=
UI
.
Sp
(
cnt
,
'guidance4-1.png'
,
layers
.
stageWidth
/
2
,
200
)
t1
.
anchorTexture
.
set
(
0.5
,
0.5
)
t1
.
alpha
=
0
var
t2
=
UI
.
Sp
(
cnt
,
'guidance4-2.png'
,
layers
.
stageWidth
/
2
,
300
)
t2
.
anchorTexture
.
set
(
0.5
,
0.5
)
t2
.
alpha
=
0
var
t3
=
UI
.
Sp
(
cnt
,
'guidance4-3.png'
,
layers
.
stageWidth
/
2
,
400
)
t3
.
anchorTexture
.
set
(
0.5
,
0.5
)
t3
.
alpha
=
0
FYGE
.
Tween
.
get
(
t1
)
.
to
({
alpha
:
1
},
600
)
.
wait
(
400
)
.
call
(()
=>
{
FYGE
.
Tween
.
get
(
t2
)
.
set
({
scaleX
:
1.4
,
scaleY
:
1.4
})
.
to
({
scaleX
:
1
,
scaleY
:
1
,
alpha
:
1
},
500
)
.
to
({
scaleX
:
.
9
,
scaleY
:
.
9
},
200
)
.
to
({
scaleX
:
1
,
scaleY
:
1
},
100
)
.
call
(()
=>
{
FYGE
.
Tween
.
get
(
t3
)
.
to
({
alpha
:
1
},
500
)
.
wait
(
1000
)
.
call
(()
=>
{
FYGE
.
Tween
.
get
(
cnt
)
.
to
({
alpha
:
0
},
500
)
.
call
(()
=>
{
cnt
.
destroy
()
resolve
(
null
)
})
})
})
})
})
}
onShowGuidance5
()
{
return
new
Promise
((
r
)
=>
{
var
sceneTitle
=
UI
.
Ctn
(
this
.
sceneContainer
,
layers
.
stageWidth
/
2
-
120
,
30
)
UI
.
Sp
(
sceneTitle
,
'title-back.png'
)
UI
.
Txt
(
sceneTitle
,
'本关目标: 100'
,
26
,
'#ffe8af'
,
FYGE
.
TEXT_ALIGN
.
CENTER
,
240
,
0
,
22
)
sceneTitle
.
anchorY
=
sceneTitle
.
height
/
2
sceneTitle
.
anchorX
=
sceneTitle
.
width
/
2
sceneTitle
.
alpha
=
0
var
cnt
=
UI
.
Ctn
(
this
.
scoreContainer
,
-
170
)
var
t
=
UI
.
Sp
(
cnt
,
'guidance5-t.png'
,
layers
.
stageWidth
/
2
,
150
)
t
.
anchorTexture
.
set
(.
5
,
.
5
)
t
.
alpha
=
0
var
number
=
UI
.
Sp
(
cnt
,
'guidance5-3.png'
,
layers
.
stageWidth
/
2
,
320
)
number
.
anchorTexture
.
set
(.
5
,
.
5
)
number
.
alpha
=
0
var
_y
=
number
.
y
FYGE
.
Tween
.
get
(
sceneTitle
)
.
set
({
scaleX
:
.
4
,
scaleY
:
.
4
})
.
to
({
scaleX
:
1
,
scaleY
:
1
,
alpha
:
1
},
500
)
.
call
(()
=>
{
FYGE
.
Tween
.
get
(
t
)
.
set
({
scaleX
:
1.4
,
scaleY
:
1.4
})
.
to
({
scaleX
:
1
,
scaleY
:
1
,
alpha
:
1
},
600
)
.
wait
(
300
)
.
call
(()
=>
{
FYGE
.
Tween
.
get
(
number
)
.
set
({
y
:
_y
+
150
})
.
to
({
y
:
_y
,
alpha
:
1
},
300
,
FYGE
.
Ease
.
quadInOut
)
.
wait
(
600
)
.
to
({
alpha
:
0
},
100
)
.
call
(()
=>
{
number
.
texture
=
RES
.
getRes
(
'guidance5-2.png'
)
FYGE
.
Tween
.
get
(
number
)
.
set
({
y
:
_y
+
150
,
alpha
:
0
})
.
to
({
y
:
_y
,
alpha
:
1
},
300
,
FYGE
.
Ease
.
quadInOut
)
.
wait
(
600
)
.
to
({
alpha
:
0
},
100
)
.
call
(()
=>
{
number
.
texture
=
RES
.
getRes
(
'guidance5-1.png'
)
FYGE
.
Tween
.
get
(
number
)
.
set
({
y
:
_y
+
150
,
alpha
:
0
})
.
to
({
y
:
_y
,
alpha
:
1
},
300
,
FYGE
.
Ease
.
quadInOut
)
.
wait
(
600
)
.
to
({
alpha
:
0
},
100
)
.
call
(()
=>
{
number
.
texture
=
RES
.
getRes
(
'guidance5-0.png'
)
FYGE
.
Tween
.
get
(
number
)
.
set
({
scaleX
:
.
3
,
scaleY
:
.
3
,
alpha
:
1
})
.
to
({
scaleX
:
1.2
,
scaleY
:
1.2
},
500
,
FYGE
.
Ease
.
quadInOut
)
.
to
({
scaleX
:
1
,
scaleY
:
1
},
200
,
FYGE
.
Ease
.
quadInOut
)
.
wait
(
500
)
.
to
({
alpha
:
0
},
100
)
.
call
(()
=>
{
cnt
.
destroy
()
r
(
null
)
})
})
})
})
})
})
})
}
async
initGame
()
{
// await this.onShowGuidance4()
await
this
.
onShowGuidance5
()
this
.
blade
=
this
.
addChild
(
new
Blade
());
this
.
blade
=
this
.
addChild
(
new
Blade
());
this
.
gennerateMoonCakes
()
this
.
gennerateMoonCakes
()
...
...
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