Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
ns16_mole
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
ns16_mole
Commits
0184c1c6
Commit
0184c1c6
authored
Oct 17, 2022
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug修改完成
parent
abe78598
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
899 additions
and
420 deletions
+899
-420
layout_info_ns16.ts
assets/ns16_mole/scene/game/layout_info_ns16.ts
+20
-0
layout_mole.ts
assets/ns16_mole/scene/game/layout_mole.ts
+54
-21
ns16_mole.fire
assets/ns16_mole/scene/ns16_mole.fire
+768
-374
ns16_mole.ts
assets/ns16_mole/scene/ns16_mole.ts
+18
-21
GameNS16.ts
assets/ns16_mole/scene/tool/GameNS16.ts
+14
-1
pg.ts
assets/ns16_mole/scene/tool/pg.ts
+9
-0
defaultData.ts
assets/ns16_mole/script/defaultData.ts
+10
-3
round.ttf
assets/ns16_mole/字体/round.ttf
+0
-0
round.ttf.meta
assets/ns16_mole/字体/round.ttf.meta
+6
-0
No files found.
assets/ns16_mole/scene/game/layout_info_ns16.ts
View file @
0184c1c6
...
...
@@ -24,7 +24,9 @@ export default class NewClass extends cc.Component {
// LIFE-CYCLE CALLBACKS:
playBgm
:
boolean
;
onLoad
()
{
this
.
playBgm
=
true
;
this
.
initView
();
this
.
initEvent
();
}
...
...
@@ -44,14 +46,20 @@ export default class NewClass extends cc.Component {
this
.
playLaba
();
});
this
.
btn_laba
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
playLaba
,
this
);
this
.
btn_music
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onTouchMusic
,
this
);
}
private
gameStart
()
{
if
(
this
.
playBgm
)
{
pg
.
audio
.
playBgmByUrl
(
Game
.
getIns
().
bgm
);
}
this
.
countDown
=
Game
.
getIns
().
getCurrentPage
().
duration
;
}
private
bg_round
:
cc
.
Node
;
private
btn_music
:
cc
.
Node
;
private
initView
()
{
this
.
btn_laba
=
cc
.
find
(
"
btn_laba
"
,
this
.
node
);
this
.
bg_round
=
cc
.
find
(
"
bg_round
"
,
this
.
node
);
this
.
btn_music
=
pg
.
view
.
find
(
this
,
'
btn_music
'
);
}
private
showRound
()
{
pg
.
view
.
visible
(
this
.
bg_round
,
true
);
...
...
@@ -62,6 +70,18 @@ export default class NewClass extends cc.Component {
.
call
(()
=>
{
pg
.
event
.
emit
(
"
game_start
"
);
})
.
start
();
}
onTouchMusic
()
{
if
(
cc
.
audioEngine
.
isMusicPlaying
())
{
cc
.
audioEngine
.
pauseMusic
();
this
.
playBgm
=
false
;
pg
.
view
.
visible
(
pg
.
view
.
find
(
this
.
btn_music
,
'
off
'
),
true
);
}
else
{
this
.
playBgm
=
true
;
cc
.
audioEngine
.
resumeMusic
();
pg
.
audio
.
playBgmByUrl
(
Game
.
getIns
().
bgm
);
pg
.
view
.
visible
(
pg
.
view
.
find
(
this
.
btn_music
,
'
off
'
),
false
);
}
}
private
intervalId
;
private
playing
:
boolean
;
...
...
assets/ns16_mole/scene/game/layout_mole.ts
View file @
0184c1c6
...
...
@@ -46,9 +46,11 @@ export default class NewClass extends cc.Component {
private
list
:
Option
[];
private
fishs
:
cc
.
Node
[];
private
holes
:
Array
<
any
>
;
private
right
:
Array
<
Option
>
;
gameStart
()
{
//游戏开始。允许出鱼
let
page
=
Game
.
getIns
().
getCurrentPage
();
this
.
right
=
[];
this
.
data
=
page
;
let
list
=
page
.
optionList
.
concat
();
list
=
JSON
.
parse
(
JSON
.
stringify
(
list
));
...
...
@@ -169,6 +171,7 @@ export default class NewClass extends cc.Component {
mouse_right
.
active
=
false
;
mouse_wrong
.
active
=
false
;
this
.
playLocalAudio
(
'
out
'
);
cc
.
Tween
.
stopAllByTarget
(
mouse_normal
);
cc
.
tween
(
mouse_normal
).
to
(
1
,
{
y
:
endPos
.
y
}).
delay
(
3
).
to
(
1
,
{
y
:
startPos
.
y
}).
call
(()
=>
{
item
.
data
=
null
}).
start
();
...
...
@@ -199,18 +202,24 @@ export default class NewClass extends cc.Component {
}
//开始点击 点击角色
async
onTouchItemNormal
(
item
,
isRobot
)
{
if
(
this
.
touching
)
return
;
// this.touching = true;
let
data
=
item
.
data
;
if
(
!
data
)
return
;
if
(
data
.
touching
)
return
;
if
(
this
.
right
.
some
(
op
=>
op
.
id
==
data
.
id
))
return
;
data
.
touching
=
true
;
let
mouse_normal
=
pg
.
view
.
find
(
item
,
"
mask/mouse_normal
"
);
let
mouse_right
=
pg
.
view
.
find
(
item
,
"
mask/mouse_right
"
);
let
mouse_wrong
=
pg
.
view
.
find
(
item
,
"
mask/mouse_wrong
"
);
// 点击之后判断对错。
Game
.
getIns
().
state
=
GAME_STATE
.
OVER
;
this
.
stopAllAni
();
if
(
data
.
right
)
{
this
.
playLocalAudio
(
'
right
'
);
this
.
right
.
push
(
data
);
let
isOver
=
this
.
right
.
length
>=
Game
.
getIns
().
getCurrentPageRight
()
if
(
isOver
)
{
Game
.
getIns
().
state
=
GAME_STATE
.
OVER
;
this
.
stopAllAni
();
}
mouse_normal
.
active
=
false
;
mouse_right
.
active
=
true
;
mouse_wrong
.
active
=
false
;
...
...
@@ -218,14 +227,29 @@ export default class NewClass extends cc.Component {
if
(
isRobot
)
{
this
.
robotAddOne
();
}
let
startPos
=
cc
.
v2
(
10
,
-
114
);
this
.
playAddOne
(
item
).
then
(()
=>
{
if
(
isOver
)
{
this
.
scaleTo0
();
}
else
{
let
orgPos
=
cc
.
v2
(
mouse_right
);
cc
.
tween
(
mouse_normal
).
to
(
0.5
,
{
y
:
startPos
.
y
}).
call
(()
=>
{
}).
start
();
cc
.
tween
(
mouse_right
).
delay
(
1.5
).
to
(
0.5
,
{
y
:
startPos
.
y
}).
call
(()
=>
{
mouse_right
.
x
=
orgPos
.
x
;
mouse_right
.
y
=
orgPos
.
y
;
mouse_right
.
active
=
false
;
item
.
data
.
touching
=
false
;
item
.
data
=
null
}).
start
();
}
if
(
isRobot
)
{
Game
.
getIns
().
robot
.
addScore
();
}
else
{
Game
.
getIns
().
player
.
addScore
();
}
if
(
isOver
)
{
return
pg
.
event
.
emit
(
"
game_time_over
"
);
}
})
}
else
{
this
.
playLocalAudio
(
'
error
'
);
...
...
@@ -233,20 +257,27 @@ export default class NewClass extends cc.Component {
mouse_right
.
active
=
false
;
mouse_wrong
.
active
=
true
;
let
startPos
=
cc
.
v2
(
10
,
-
114
);
let
nodes
=
this
.
node
.
children
.
filter
(
item
=>
item
.
data
);
nodes
.
forEach
(
node
=>
{
cc
.
tween
(
pg
.
view
.
find
(
node
,
"
mask/mouse_normal
"
)).
to
(
0.5
,
{
y
:
startPos
.
y
}).
call
(()
=>
{
let
orgPos
=
cc
.
v2
(
mouse_wrong
);
cc
.
tween
(
mouse_normal
).
to
(
0.5
,
{
y
:
startPos
.
y
}).
call
(()
=>
{
// item.data = null
}).
start
();
cc
.
tween
(
mouse_wrong
).
delay
(
1.5
).
to
(
0.5
,
{
y
:
startPos
.
y
}).
call
(()
=>
{
mouse_wrong
.
x
=
orgPos
.
x
;
mouse_wrong
.
y
=
orgPos
.
y
;
mouse_wrong
.
active
=
false
;
item
.
data
.
touching
=
false
;
item
.
data
=
null
}).
start
();
})
this
.
scheduleOnce
(()
=>
{
if
(
isRobot
)
{
Game
.
getIns
().
robot
.
addError
();
}
else
{
Game
.
getIns
().
player
.
addError
();
}
return
pg
.
event
.
emit
(
"
game_time_over
"
);
},
2
)
// this.scheduleOnce(() => {
// // if (this.right >= Game.getIns().getCurrentPageRight()) {
// // return pg.event.emit("game_time_over");
// // }
// }, 1)
}
}
async
onTouchItem
(
e
)
{
...
...
@@ -276,7 +307,9 @@ export default class NewClass extends cc.Component {
}
}
getMouse
()
{
return
this
.
list
[
Math
.
floor
(
Math
.
random
()
*
this
.
list
.
length
)]
let
list
=
this
.
list
.
filter
(
li
=>
this
.
right
.
every
(
op
=>
op
.
id
!=
li
.
id
))
list
=
JSON
.
parse
(
JSON
.
stringify
(
list
));
return
list
[
Math
.
floor
(
Math
.
random
()
*
list
.
length
)]
}
getEmptyHole
()
{
let
list
=
this
.
node
.
children
.
filter
(
item
=>
!
item
.
data
);
...
...
assets/ns16_mole/scene/ns16_mole.fire
View file @
0184c1c6
This diff is collapsed.
Click to expand it.
assets/ns16_mole/scene/ns16_mole.ts
View file @
0184c1c6
...
...
@@ -113,18 +113,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
.
call
(()
=>
{
pg
.
event
.
emit
(
"
show_round_action
"
);
vs
.
active
=
false
;
}).
start
();
}
private
showGameOver
()
{
let
gameover
=
cc
.
find
(
"
gameover
"
,
this
.
node
);
gameover
.
scale
=
3
;
gameover
.
active
=
true
;
this
.
playLocalAudio
(
"
gameover
"
);
cc
.
tween
(
gameover
).
to
(
0.3
,
{
scale
:
1
})
.
delay
(
2
)
.
call
(()
=>
{
gameover
.
active
=
false
;
//发送给上端最后的数据
// alert("game_finish")
let
player
=
{
right
:
Game
.
getIns
().
player
.
score
,
error
:
Game
.
getIns
().
player
.
error
}
let
robot
=
{
right
:
Game
.
getIns
().
robot
.
score
,
error
:
Game
.
getIns
().
robot
.
error
}
let
player
=
{
right
:
Game
.
getIns
().
player
.
score
,
error
:
Game
.
getIns
().
player
.
error
,
stone
:
Math
.
floor
(
10
*
Game
.
getIns
().
player
.
score
/
Game
.
getIns
().
total
)
}
let
robot
=
{
right
:
Game
.
getIns
().
robot
.
score
,
error
:
Game
.
getIns
().
robot
.
error
,
stone
:
Math
.
floor
(
10
*
Game
.
getIns
().
robot
.
score
/
Game
.
getIns
().
total
)
}
let
totalNumber
=
Game
.
getIns
().
totalNumber
;
if
(
Game
.
getIns
().
singleGame
)
{
onHomeworkFinish
({
player
,
totalNumber
})
...
...
@@ -133,7 +131,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
this
.
log
(
"
player:
"
+
JSON
.
stringify
(
player
));
this
.
log
(
"
totalNumber:
"
+
totalNumber
)
}).
start
();
}
playLocalAudio
(
audioName
)
{
...
...
assets/ns16_mole/scene/tool/GameNS16.ts
View file @
0184c1c6
...
...
@@ -109,9 +109,11 @@ export default class Game {
private
data
:
any
;
private
lists
:
Array
<
Item
>
public
player
:
Player
;
public
robot
:
Robot
;
public
state
:
GAME_STATE
;
public
totalNumber
:
number
;
public
bgm
:
string
;
constructor
()
{
this
.
start
=
false
;
...
...
@@ -133,6 +135,7 @@ export default class Game {
this
.
title
=
data
.
title
;
this
.
start
=
false
;
this
.
lists
=
[];
this
.
bgm
=
data
.
bgAudio
;
this
.
data
=
data
.
questions
;
}
public
start
:
boolean
;
...
...
@@ -166,7 +169,13 @@ export default class Game {
}
return
true
;
}
get
total
()
{
let
m
=
0
;
this
.
lists
.
forEach
(
ques
=>
{
m
+=
ques
.
optionList
.
filter
(
op
=>
op
.
right
).
length
;
})
return
m
;
}
getDataByPage
(
page
):
Item
{
if
(
!
this
.
lists
)
return
null
;
...
...
@@ -177,6 +186,10 @@ export default class Game {
let
page
=
this
.
page
;
return
this
.
lists
.
filter
(
li
=>
li
.
page
==
page
)[
0
]
}
getCurrentPageRight
()
{
let
page
=
this
.
getCurrentPage
();
return
page
.
optionList
.
filter
(
op
=>
op
.
right
).
length
;
}
getTotalPageNum
()
{
return
this
.
lists
.
length
;
}
...
...
assets/ns16_mole/scene/tool/pg.ts
View file @
0184c1c6
...
...
@@ -482,6 +482,15 @@ let pg = {
}
},
audio
:
{
playBgmByUrl
(
audio_url
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
!
audio_url
)
return
resolve
(
0
);
cc
.
assetManager
.
loadRemote
(
audio_url
,
(
err
,
audioClip
:
any
)
=>
{
const
audioId
=
cc
.
audioEngine
.
playMusic
(
audioClip
,
true
);
resolve
(
audioId
);
});
});
},
playAudioByUrl
(
audio_url
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
!
audio_url
)
return
resolve
(
0
);
...
...
assets/ns16_mole/script/defaultData.ts
View file @
0184c1c6
...
...
@@ -18,9 +18,16 @@ export const defaultData =
"
type
"
:
"
txt
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/7432c9bfa754a4c9db54132308e8ce1f_l.mp3
"
,
"
text
"
:
"
xfuw
"
,
"
right
"
:
false
,
"
audioName
"
:
"
冒出.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/274d8965edafabf1e8d1a01400db82b7_l.mp3
"
,
"
text
"
:
"
head
"
,
"
right
"
:
true
,
"
audioName
"
:
"
错误.mp3
"
},
{
"
type
"
:
"
img
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/fc1d670c1a3461136506195e3e9e3797.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/7432c9bfa754a4c9db54132308e8ce1f_l.mp3
"
,
"
text
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
冒出.mp3
"
}],
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/274d8965edafabf1e8d1a01400db82b7_l.mp3
"
,
"
text
"
:
"
head
"
,
"
right
"
:
true
,
"
audioName
"
:
"
错误.mp3
"
},
{
"
type
"
:
"
img
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/fc1d670c1a3461136506195e3e9e3797.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/7432c9bfa754a4c9db54132308e8ce1f_l.mp3
"
,
"
text
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
冒出.mp3
"
}],
"
questionImg
"
:
"
http://staging-teach.cdn.ireadabc.com/317ef6895381d2f926a0d444326a5995.png
"
,
"
audioName
"
:
"
胜利.mp3
"
},
{
"
questionAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/26e6e997562503a98918fadab7e7b6c2_l.mp3
"
,
"
duration
"
:
120
,
"
options
"
:
[{
"
type
"
:
"
img
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/fea420e83bd2ba03d014c279de780599.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/7432c9bfa754a4c9db54132308e8ce1f_l.mp3
"
,
"
text
"
:
""
,
"
right
"
:
true
,
"
audioName
"
:
"
冒出.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/274d8965edafabf1e8d1a01400db82b7_l.mp3
"
,
"
text
"
:
"
eye
"
,
"
right
"
:
true
,
"
audioName
"
:
"
错误.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/f03e207cb6808b17c1510b230a70bb1d_l.mp3
"
,
"
text
"
:
"
fffsxz
"
,
"
right
"
:
false
,
"
audioName
"
:
"
加分.mp3
"
},
{
"
type
"
:
"
img
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/01247e69d70b995da41e6b7e2000b540.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610_l.mp3
"
,
"
text
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
按钮.mp3
"
}],
"
questionImg
"
:
"
http://staging-teach.cdn.ireadabc.com/fea420e83bd2ba03d014c279de780599.png
"
,
"
audioName
"
:
"
失败.mp3
"
}],
"
audioName
"
:
"
头像移动.mp3
"
,
"
bgAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/93bb9ed985cff104879f4b4fa6ace4ea_l.mp3
"
"
audioName
"
:
"
头像移动.mp3
"
,
"
bgAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/93bb9ed985cff104879f4b4fa6ace4ea_l.mp3
"
}
\ No newline at end of file
assets/ns16_mole/字体/round.ttf
0 → 100644
View file @
0184c1c6
File added
assets/ns16_mole/字体/round.ttf.meta
0 → 100644
View file @
0184c1c6
{
"ver": "1.1.0",
"uuid": "8909837d-207b-4df3-9cd5-0197049059ed",
"subMetas": {}
}
\ No newline at end of file
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