Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
op_input
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
op_input
Commits
d7bbb9c5
Commit
d7bbb9c5
authored
Aug 22, 2022
by
yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
f58e6b5c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
20 deletions
+32
-20
op_input.ts
assets/op_input/scene/op_input.ts
+32
-20
No files found.
assets/op_input/scene/op_input.ts
View file @
d7bbb9c5
...
@@ -56,10 +56,14 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
...
@@ -56,10 +56,14 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
@
property
(
cc
.
Node
)
@
property
(
cc
.
Node
)
goodJob
:
cc
.
Node
=
null
;
goodJob
:
cc
.
Node
=
null
;
private
audioId
;
private
wordAudioId
;
initData
()
{
initData
()
{
Game
.
getIns
().
init
(
this
.
data
);
Game
.
getIns
().
init
(
this
.
data
);
Game
.
getIns
().
reset
();
Game
.
getIns
().
reset
();
this
.
wordItams
=
[];
this
.
wordItams
=
[];
this
.
audioId
=
-
1
;
}
}
initView
()
{
initView
()
{
this
.
startGame
();
this
.
startGame
();
...
@@ -73,7 +77,6 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
...
@@ -73,7 +77,6 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
pg
.
event
.
on
(
"
gameOver
"
,
()
=>
{
this
.
gameOver
()
})
pg
.
event
.
on
(
"
gameOver
"
,
()
=>
{
this
.
gameOver
()
})
}
}
private
onCat
()
{
private
onCat
()
{
cc
.
audioEngine
.
stopAll
();
let
data
=
Game
.
getIns
().
getCurrentPage
();
let
data
=
Game
.
getIns
().
getCurrentPage
();
let
audioUrl
=
""
;
let
audioUrl
=
""
;
if
(
data
.
page
%
2
==
0
)
{
if
(
data
.
page
%
2
==
0
)
{
...
@@ -81,15 +84,23 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
...
@@ -81,15 +84,23 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
}
else
{
}
else
{
audioUrl
=
Game
.
getIns
().
waitAudio
;
audioUrl
=
Game
.
getIns
().
waitAudio
;
}
}
if
(
this
.
audioId
>=
0
)
cc
.
audioEngine
.
stopEffect
(
this
.
audioId
);
this
.
setMaoAni
(
"
begin
"
);
this
.
setMaoAni
(
"
begin
"
);
pg
.
audio
.
playAudioByUrl
(
audioUrl
).
then
(()
=>
{
pg
.
audio
.
playAudioByUrl
(
audioUrl
,
(
id
)
=>
{
this
.
audioId
=
id
;
}).
then
(()
=>
{
this
.
setMaoAni
(
"
normal
"
);
this
.
setMaoAni
(
"
normal
"
);
});
});
}
}
private
onWordAudio
()
{
private
onWordAudio
()
{
let
data
=
Game
.
getIns
().
getCurrentPage
();
let
data
=
Game
.
getIns
().
getCurrentPage
();
cc
.
audioEngine
.
stopAll
();
if
(
this
.
wordAudioId
>=
0
)
cc
.
audioEngine
.
stopEffect
(
this
.
wordAudioId
);
pg
.
audio
.
playAudioByUrl
(
data
.
wordAudio
);
this
.
setMaoAni
(
"
begin
"
);
pg
.
audio
.
playAudioByUrl
(
data
.
wordAudio
,
(
id
)
=>
{
this
.
wordAudioId
=
id
;
}).
then
(()
=>
{
this
.
setMaoAni
(
"
normal
"
);
});
}
}
//根据两点获取距离
//根据两点获取距离
private
getDistance
(
p1
,
p2
)
{
private
getDistance
(
p1
,
p2
)
{
...
@@ -123,6 +134,7 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
...
@@ -123,6 +134,7 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
pg
.
audio
.
playAudioByUrl
(
audioUrl
).
then
(()
=>
{
pg
.
audio
.
playAudioByUrl
(
audioUrl
).
then
(()
=>
{
this
.
setMaoAni
(
"
normal
"
);
this
.
setMaoAni
(
"
normal
"
);
});;
});;
this
.
progressBar
.
getComponent
(
cc
.
ProgressBar
).
progress
=
0
;
this
.
nextPage
();
this
.
nextPage
();
}
}
nextPage
()
{
nextPage
()
{
...
@@ -131,7 +143,6 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
...
@@ -131,7 +143,6 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
//自动创建卡片
//自动创建卡片
this
.
createCrads
(
data
);
this
.
createCrads
(
data
);
this
.
showTop
(
data
);
this
.
showTop
(
data
);
// this.progressBar.getComponent(cc.ProgressBar).progress = 0;
}
}
private
showTop
(
data
)
{
private
showTop
(
data
)
{
let
img
=
cc
.
find
(
"
tips/img
"
,
this
.
node
);
let
img
=
cc
.
find
(
"
tips/img
"
,
this
.
node
);
...
@@ -303,26 +314,27 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
...
@@ -303,26 +314,27 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
private
roundOver
()
{
private
roundOver
()
{
if
(
this
.
checkRoundOver
())
{
if
(
this
.
checkRoundOver
())
{
this
.
word_layout
.
active
=
false
;
this
.
word_layout
.
active
=
false
;
this
.
word_layout
.
removeAllChildren
();
cc
.
tween
(
this
.
nor_label
).
to
(
0.1
,
{
opacity
:
255
}).
start
();
cc
.
tween
(
this
.
nor_label
).
to
(
0.1
,
{
opacity
:
255
}).
start
();
let
data
=
Game
.
getIns
().
getCurrentPage
();
let
data
=
Game
.
getIns
().
getCurrentPage
();
pg
.
audio
.
playAudioByUrl
(
data
.
wordAudio
).
then
(
async
()
=>
{
pg
.
audio
.
playAudioByUrl
(
data
.
wordAudio
).
then
(()
=>
{
let
pro
=
this
.
progressBar
.
getComponent
(
cc
.
ProgressBar
);
let
pro
=
this
.
progressBar
.
getComponent
(
cc
.
ProgressBar
);
let
add
=
Game
.
getIns
().
addPage
();
let
p
=
Game
.
getIns
().
page
/
Game
.
getIns
().
getTotalPageNum
();
if
(
add
)
{
cc
.
tween
(
pro
).
to
(
1
,
{
progress
:
p
}).
delay
(
1
).
call
(()
=>
{
await
pg
.
time
.
delay
(
1
);
let
add
=
Game
.
getIns
().
addPage
();
this
.
nextPage
()
if
(
add
)
{
}
else
{
this
.
nextPage
()
if
(
Game
.
getIns
().
roundCount
==
1
)
{
Game
.
getIns
().
roundCount
=
2
;
Game
.
getIns
().
page
=
1
;
cc
.
tween
(
pro
).
to
(
1
,
{
progress
:
1
}).
delay
(
1
).
call
(()
=>
{
this
.
startGame
();
}).
start
();
}
else
{
}
else
{
this
.
goodJob
.
active
=
true
;
if
(
Game
.
getIns
().
roundCount
==
1
)
{
this
.
gameOver
();
Game
.
getIns
().
roundCount
=
2
;
Game
.
getIns
().
page
=
1
;
this
.
startGame
();
}
else
{
this
.
goodJob
.
active
=
true
;
this
.
gameOver
();
}
}
}
}
}
).
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