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
85ea6811
Commit
85ea6811
authored
Aug 23, 2022
by
yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
题目随机
parent
d7bbb9c5
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
210 additions
and
1278 deletions
+210
-1278
Game.ts
assets/op_input/scene/Game.ts
+12
-4
op_input.fire
assets/op_input/scene/op_input.fire
+168
-1246
op_input.ts
assets/op_input/scene/op_input.ts
+30
-28
No files found.
assets/op_input/scene/Game.ts
View file @
85ea6811
...
...
@@ -88,13 +88,21 @@ export default class Game {
this
.
page
=
1
;
this
.
start
=
true
;
this
.
lists
=
[];
let
arr
=
[];
for
(
let
i
=
0
;
i
<
this
.
data
.
length
;
i
++
)
{
let
data
=
this
.
data
[
i
];
this
.
lists
.
push
(
new
Item
(
data
,
i
));
arr
.
push
(
new
Item
(
data
,
i
));
}
this
.
lists
.
sort
(
function
()
{
return
(
0.5
-
Math
.
random
());
});
let
page
=
arr
[
0
].
page
;
do
{
arr
.
sort
(()
=>
Math
.
random
()
-
0.5
);
}
while
(
arr
[
0
].
page
==
page
);
arr
.
forEach
((
item
,
idx
)
=>
{
item
.
page
=
idx
+
1
;
this
.
lists
.
push
(
item
);
})
}
checkSuccess
(
arr
:
Option
[])
{
let
data
=
this
.
getCurrentPage
();
...
...
assets/op_input/scene/op_input.fire
View file @
85ea6811
This diff is collapsed.
Click to expand it.
assets/op_input/scene/op_input.ts
View file @
85ea6811
...
...
@@ -259,9 +259,8 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
itemBg
.
errorCount
++
;
if
(
itemBg
.
errorCount
>=
3
)
{
this
.
errorThere
(
target
,
itemBg
);
this
.
playLocalAudio
(
"
right
"
).
then
(()
=>
{
this
.
roundOver
();
});
this
.
playLocalAudio
(
"
right
"
);
this
.
roundOver
();
}
else
{
this
.
playLocalAudio
(
"
error
"
);
this
.
moveError
(
target
,
data
);
...
...
@@ -277,9 +276,8 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
let
line
=
cc
.
find
(
"
line
"
,
item
);
word
.
active
=
true
;
line
.
active
=
false
;
this
.
playLocalAudio
(
"
right
"
).
then
(()
=>
{
this
.
roundOver
();
});
this
.
playLocalAudio
(
"
right
"
);
this
.
roundOver
();
}
private
moveError
(
target
,
data
)
{
this
.
op_layout
.
children
.
forEach
((
item
)
=>
{
...
...
@@ -313,29 +311,33 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
}
private
roundOver
()
{
if
(
this
.
checkRoundOver
())
{
this
.
word_layout
.
active
=
false
;
this
.
word_layout
.
removeAllChildren
();
cc
.
tween
(
this
.
nor_label
).
to
(
0.1
,
{
opacity
:
255
}).
start
();
let
data
=
Game
.
getIns
().
getCurrentPage
();
pg
.
audio
.
playAudioByUrl
(
data
.
wordAudio
).
then
(()
=>
{
let
pro
=
this
.
progressBar
.
getComponent
(
cc
.
ProgressBar
);
let
p
=
Game
.
getIns
().
page
/
Game
.
getIns
().
getTotalPageNum
();
cc
.
tween
(
pro
).
to
(
1
,
{
progress
:
p
}).
delay
(
1
).
call
(()
=>
{
let
add
=
Game
.
getIns
().
addPage
();
if
(
add
)
{
this
.
nextPage
()
}
else
{
if
(
Game
.
getIns
().
roundCount
==
1
)
{
Game
.
getIns
().
roundCount
=
2
;
Game
.
getIns
().
page
=
1
;
this
.
startGame
();
}
else
{
this
.
goodJob
.
active
=
true
;
this
.
gameOver
();
}
}
cc
.
tween
(
this
.
nor_label
)
.
delay
(
0.5
).
call
(()
=>
{
this
.
word_layout
.
active
=
false
;
this
.
word_layout
.
removeAllChildren
();
})
.
to
(
0.1
,
{
opacity
:
255
}).
delay
(
0.5
).
call
(()
=>
{
let
data
=
Game
.
getIns
().
getCurrentPage
();
pg
.
audio
.
playAudioByUrl
(
data
.
wordAudio
).
then
(()
=>
{
let
pro
=
this
.
progressBar
.
getComponent
(
cc
.
ProgressBar
);
let
p
=
Game
.
getIns
().
page
/
Game
.
getIns
().
getTotalPageNum
();
cc
.
tween
(
pro
).
to
(
1
,
{
progress
:
p
}).
delay
(
1
).
call
(()
=>
{
let
add
=
Game
.
getIns
().
addPage
();
if
(
add
)
{
this
.
nextPage
()
}
else
{
if
(
Game
.
getIns
().
roundCount
==
1
)
{
Game
.
getIns
().
roundCount
=
2
;
Game
.
getIns
().
page
=
1
;
this
.
startGame
();
}
else
{
this
.
goodJob
.
active
=
true
;
this
.
gameOver
();
}
}
}).
start
();
})
}).
start
();
})
}
}
private
checkRoundOver
()
{
...
...
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