Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
NS03
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
NS03
Commits
7ea64f87
Commit
7ea64f87
authored
Dec 30, 2021
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自动刷新改手动刷新
parent
3772df25
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
36 deletions
+14
-36
NS03.ts
assets/NS03/scene/NS03.ts
+3
-4
item.ts
assets/NS03/scene/item.ts
+4
-7
items.ts
assets/NS03/scene/items.ts
+0
-7
player.ts
assets/NS03/scene/player.ts
+6
-8
speak.ts
assets/NS03/scene/speak.ts
+0
-6
start.ts
assets/NS03/scene/start.ts
+1
-4
No files found.
assets/NS03/scene/NS03.ts
View file @
7ea64f87
import
{
asyncDelay
,
onHomeworkFinish
}
from
"
../script/util
"
;
import
{
asyncDelay
,
onHomeworkFinish
}
from
"
../script/util
"
;
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
import
pg
from
"
./pg
"
;
import
Game
from
"
./Game
"
;
import
Game
from
"
./Game
"
;
import
{
import
pg
from
"
./pg
"
;
showFireworks
,
import
{
showFireworks
,
}
from
'
../script/utils
'
;
}
from
'
../script/utils
'
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
@@ -74,6 +72,7 @@ export default class NewClass extends MyCocosSceneComponent {
...
@@ -74,6 +72,7 @@ export default class NewClass extends MyCocosSceneComponent {
}
}
private
touchData
:
any
;
private
touchData
:
any
;
onTouchRight
(
data
)
{
onTouchRight
(
data
)
{
pg
.
event
.
emit
(
"
player_point_update
"
);
if
(
Game
.
getIns
().
isRobot
)
{
if
(
Game
.
getIns
().
isRobot
)
{
this
.
onSpeakScueess
();
this
.
onSpeakScueess
();
}
else
{
}
else
{
...
...
assets/NS03/scene/item.ts
View file @
7ea64f87
...
@@ -30,12 +30,6 @@ export default class NewClass extends cc.Component {
...
@@ -30,12 +30,6 @@ export default class NewClass extends cc.Component {
pg
.
view
.
touchOn
(
this
.
panel_text
,
this
.
onPlayerText
,
this
);
pg
.
view
.
touchOn
(
this
.
panel_text
,
this
.
onPlayerText
,
this
);
}
}
start
()
{
// let data = {
// text: "info"
// }
// this.showAni(data);
}
private
data
:
any
;
private
data
:
any
;
private
touched
:
boolean
;
private
touched
:
boolean
;
showAni
(
data
)
{
showAni
(
data
)
{
...
@@ -60,7 +54,9 @@ export default class NewClass extends cc.Component {
...
@@ -60,7 +54,9 @@ export default class NewClass extends cc.Component {
pg
.
view
.
visible
(
this
.
txt
,
false
)
pg
.
view
.
visible
(
this
.
txt
,
false
)
}
}
pg
.
hw
.
playLocalAudio
(
"
appear
"
);
pg
.
hw
.
playLocalAudio
(
"
appear
"
);
cc
.
tween
(
this
.
penguin
).
to
(
0.4
,
{
y
:
190
}).
delay
(
2
).
to
(
0.4
,
{
y
:
-
100
}).
delay
(
0.1
).
call
(()
=>
{
cc
.
tween
(
this
.
penguin
).
to
(
0.4
,
{
y
:
190
}).
delay
(
2
).
call
(()
=>
{
this
.
touched
=
true
;
}).
to
(
0.4
,
{
y
:
-
100
}).
delay
(
0.1
).
call
(()
=>
{
this
.
node
.
parent
=
null
;
this
.
node
.
parent
=
null
;
}).
start
();
}).
start
();
cc
.
tween
(
this
.
panel_text
).
to
(
0.2
,
{
opacity
:
255
}).
delay
(
2.4
).
to
(
0.2
,
{
opacity
:
0
}).
start
();
cc
.
tween
(
this
.
panel_text
).
to
(
0.2
,
{
opacity
:
255
}).
delay
(
2.4
).
to
(
0.2
,
{
opacity
:
0
}).
start
();
...
@@ -126,6 +122,7 @@ export default class NewClass extends cc.Component {
...
@@ -126,6 +122,7 @@ export default class NewClass extends cc.Component {
Game
.
getIns
().
pause
=
true
;
Game
.
getIns
().
pause
=
true
;
//正确
//正确
pg
.
view
.
visible
(
this
.
right
,
true
);
pg
.
view
.
visible
(
this
.
right
,
true
);
pg
.
hw
.
playLocalAudio
(
"
right
"
);
pg
.
view
.
playDBAnimation
(
this
.
right
,
"
newAnimation
"
,
1
);
pg
.
view
.
playDBAnimation
(
this
.
right
,
"
newAnimation
"
,
1
);
data
.
cbSuccess
=
()
=>
{
data
.
cbSuccess
=
()
=>
{
//执行
//执行
...
...
assets/NS03/scene/items.ts
View file @
7ea64f87
...
@@ -23,14 +23,10 @@ export default class NewClass extends cc.Component {
...
@@ -23,14 +23,10 @@ export default class NewClass extends cc.Component {
item
:
cc
.
Node
=
null
;
item
:
cc
.
Node
=
null
;
onLoad
()
{
onLoad
()
{
//开始一个循环定期每过一段时间激活一个
pg
.
event
.
on
(
"
game_start_loop
"
,
()
=>
{
this
.
startLoop
()
})
pg
.
event
.
on
(
"
game_start_loop
"
,
()
=>
{
this
.
startLoop
()
})
}
}
protected
onDestroy
():
void
{
protected
onDestroy
():
void
{
pg
.
event
.
off
(
"
game_start_loop
"
);
pg
.
event
.
off
(
"
game_start_loop
"
);
}
start
()
{
}
}
startLoop
()
{
startLoop
()
{
this
.
lastId
=
[];
this
.
lastId
=
[];
...
@@ -73,7 +69,4 @@ export default class NewClass extends cc.Component {
...
@@ -73,7 +69,4 @@ export default class NewClass extends cc.Component {
//设置item内部内容。
//设置item内部内容。
item
.
getComponent
(
"
item
"
).
showAni
(
data
);
item
.
getComponent
(
"
item
"
).
showAni
(
data
);
}
}
update
(
dt
)
{
}
}
}
assets/NS03/scene/player.ts
View file @
7ea64f87
...
@@ -18,12 +18,14 @@ export default class NewClass extends cc.Component {
...
@@ -18,12 +18,14 @@ export default class NewClass extends cc.Component {
onLoad
()
{
onLoad
()
{
this
.
player
=
pg
.
view
.
find
(
this
,
"
player
"
);
this
.
player
=
pg
.
view
.
find
(
this
,
"
player
"
);
this
.
robot
=
pg
.
view
.
find
(
this
,
"
robot
"
);
this
.
robot
=
pg
.
view
.
find
(
this
,
"
robot
"
);
pg
.
event
.
on
(
"
player_point_update
"
,
(
data
)
=>
{
// pg.event.on("player_point_update", (data) => {
this
.
updatePlayer
();
// })
this
.
updateRobot
();
this
.
updateScore
();
})
}
}
protected
onDestroy
():
void
{
protected
onDestroy
():
void
{
//
pg.event.off("player_point_update");
pg
.
event
.
off
(
"
player_point_update
"
);
}
}
updatePlayer
()
{
updatePlayer
()
{
let
icon_player
=
pg
.
view
.
find
(
this
.
player
,
"
icon_player
"
);
let
icon_player
=
pg
.
view
.
find
(
this
.
player
,
"
icon_player
"
);
...
@@ -42,9 +44,5 @@ export default class NewClass extends cc.Component {
...
@@ -42,9 +44,5 @@ export default class NewClass extends cc.Component {
pg
.
view
.
setString
(
score
,
`
${
Game
.
getIns
().
playerScore
}
:
${
Game
.
getIns
().
robotScore
}
`
);
pg
.
view
.
setString
(
score
,
`
${
Game
.
getIns
().
playerScore
}
:
${
Game
.
getIns
().
robotScore
}
`
);
}
}
update
(
dt
)
{
update
(
dt
)
{
if
(
!
Game
||
!
Game
.
getIns
()
||
!
Game
.
getIns
().
start
)
return
;
this
.
updatePlayer
();
this
.
updateRobot
();
this
.
updateScore
();
}
}
}
}
assets/NS03/scene/speak.ts
View file @
7ea64f87
...
@@ -153,10 +153,4 @@ export default class NewClass extends cc.Component {
...
@@ -153,10 +153,4 @@ export default class NewClass extends cc.Component {
}
}
start
()
{
}
// update (dt) {}
}
}
assets/NS03/scene/start.ts
View file @
7ea64f87
...
@@ -12,9 +12,7 @@ export default class NewClass extends cc.Component {
...
@@ -12,9 +12,7 @@ export default class NewClass extends cc.Component {
let
bg_vs
=
pg
.
view
.
find
(
this
,
"
bg_vs
"
);
let
bg_vs
=
pg
.
view
.
find
(
this
,
"
bg_vs
"
);
pg
.
view
.
touchOn
(
btn_start
,
this
.
onTouchStart
,
this
);
pg
.
view
.
touchOn
(
btn_start
,
this
.
onTouchStart
,
this
);
pg
.
view
.
touchOn
(
btn_restart
,
this
.
onTouchRestart
,
this
);
pg
.
view
.
touchOn
(
btn_restart
,
this
.
onTouchRestart
,
this
);
pg
.
event
.
on
(
"
game_over
"
,
()
=>
{
pg
.
event
.
on
(
"
game_over
"
,
()
=>
{
this
.
onGameOver
();
})
this
.
onGameOver
();
})
}
}
protected
onDestroy
():
void
{
protected
onDestroy
():
void
{
pg
.
event
.
off
(
"
game_over
"
);
pg
.
event
.
off
(
"
game_over
"
);
...
@@ -72,5 +70,4 @@ export default class NewClass extends cc.Component {
...
@@ -72,5 +70,4 @@ export default class NewClass extends cc.Component {
pg
.
view
.
visible
(
panel_gray
,
true
);
pg
.
view
.
visible
(
panel_gray
,
true
);
pg
.
view
.
visible
(
btn_restart
,
true
);
pg
.
view
.
visible
(
btn_restart
,
true
);
}
}
update
(
dt
)
{
}
}
}
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