Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hy04_pinci
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
hy04_pinci
Commits
7e914c05
Commit
7e914c05
authored
Jun 16, 2023
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
流程结束
parent
99131e78
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1684 additions
and
1875 deletions
+1684
-1875
hy01_danci.fire
assets/hy01_danci/scene/hy01_danci.fire
+1598
-1816
hy01_danci.ts
assets/hy01_danci/scene/hy01_danci.ts
+71
-47
defaultData_hy01_danci.ts
assets/hy01_danci/script/defaultData_hy01_danci.ts
+15
-12
No files found.
assets/hy01_danci/scene/hy01_danci.fire
View file @
7e914c05
This diff is collapsed.
Click to expand it.
assets/hy01_danci/scene/hy01_danci.ts
View file @
7e914c05
...
...
@@ -43,9 +43,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
private
list
:
Array
<
{
type
,
text
,
right
,
imgage
,
duration
,
content
,
audio
}
>
;
private
recordFlag
:
boolean
;
//录音模式
// 单词列表
private
word
_l
ist
:
Array
<
object
>
;
private
word
DataL
ist
:
Array
<
object
>
;
// 当前第几个
private
cur
_i
ndex
:
number
=
0
;
private
cur
I
ndex
:
number
=
0
;
initData
()
{
// 所有全局变量 默认都是null
this
.
_cantouch
=
true
;
...
...
@@ -54,43 +54,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
list
=
data
.
questions
[
0
].
options
;
this
.
layers
=
[];
this
.
word_list
=
[
{
word
:
'
bight
'
,
answer
:
[
'
bigg
'
,
'
h
'
,
"
t
"
],
isRight
:
false
,
},
{
word
:
'
Bight
'
,
answer
:
[
'
rig
'
,
'
hb
'
,
"
a
"
],
isRight
:
false
,
},
{
word
:
'
Cight
'
,
answer
:
[
'
rig
'
,
'
hb
'
,
"
c
"
],
isRight
:
false
,
},
{
word
:
'
Dight
'
,
answer
:
[
'
rig
'
,
'
hd
'
,
"
d
"
],
isRight
:
false
,
},
{
word
:
'
Eight
'
,
answer
:
[
'
rig
'
,
'
he
'
,
"
f
"
],
isRight
:
false
,
},
{
word
:
'
Hight
'
,
answer
:
[
'
rig
'
,
'
ht
'
,
"
h
"
],
isRight
:
false
,
},
{
word
:
'
Iight
'
,
answer
:
[
'
rig
'
,
'
hh
'
,
"
s
"
],
isRight
:
false
,
},
{
word
:
'
KighT
'
,
answer
:
[
'
rig
'
,
'
h
'
,
"
t
"
],
isRight
:
false
,
},
]
this
.
wordDataList
=
data
.
questions
.
map
(
question
=>
{
return
{
img
:
question
.
image
,
audio
:
question
.
audio
,
type
:
question
.
type
,
// img
answer
:
question
.
letterList
.
map
(
letter
=>
letter
.
text
)
}
})
console
.
log
(
data
);
}
private
layer_record
:
cc
.
Node
;
...
...
@@ -125,10 +97,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 校验是否正确
checkIsRight
()
{
console
.
log
(
this
.
cur
_i
ndex
+
1
<
SceneComponent
.
Word_List_Len
);
console
.
log
(
this
.
cur
I
ndex
+
1
<
SceneComponent
.
Word_List_Len
);
if
((
this
.
cur
_i
ndex
+
1
)
<
SceneComponent
.
Word_List_Len
)
{
this
.
cur
_i
ndex
++
if
((
this
.
cur
I
ndex
+
1
)
<
SceneComponent
.
Word_List_Len
)
{
this
.
cur
I
ndex
++
this
.
showWord
()
}
...
...
@@ -138,17 +110,67 @@ export default class SceneComponent extends MyCocosSceneComponent {
private
wordBgList
:
Array
<
cc
.
Node
>
;
private
wordList
:
Array
<
cc
.
Node
>
;
private
get
CurrentWord
():
any
{
return
this
.
wordDataList
[
this
.
curIndex
];
}
nextWord
()
{
let
success
=
true
;
for
(
let
idx
in
this
.
successGroupIds
)
{
if
(
!
this
.
successGroupIds
[
idx
])
success
=
false
;
}
if
(
!
success
)
return
;
this
.
scheduleOnce
(()
=>
{
pg
.
event
.
once
(
'
layer_right_show_excellent_end
'
,
()
=>
{
this
.
curIndex
++
;
if
(
!
this
.
CurrentWord
)
{
alert
(
"
游戏结束画面暂无
"
)
}
else
{
this
.
showWord
();
}
})
pg
.
event
.
emit
(
'
layer_right_show_excellent
'
)
},
0.2
)
}
//单词的展示
showWord
()
{
this
.
wordBgList
=
[];
this
.
wordList
=
[];
this
.
successGroupIds
=
{};
pg
.
view
.
removChildren
(
this
.
word_area
)
this
.
initWordBg
();
this
.
initWord
();
this
.
initQuestion
();
}
private
layer_question
:
cc
.
Node
;
initQuestion
()
{
this
.
layer_question
=
pg
.
view
.
find
(
this
,
'
layer_question
'
);
let
img
=
pg
.
view
.
find
(
this
.
layer_question
,
'
img
'
);
pg
.
view
.
setNetImg
(
img
,
this
.
CurrentWord
.
img
,
{
w
:
230
,
h
:
230
})
let
img_voice
=
pg
.
view
.
find
(
this
.
layer_question
,
'
img_voice
'
);
img_voice
.
active
=
this
.
CurrentWord
.
type
!=
"
img
"
;
pg
.
view
.
touchOn
(
img_voice
,
this
.
onTouchVoice
,
this
);
}
private
audioId
;
onTouchVoice
()
{
if
(
this
.
audioId
)
{
pg
.
event
.
emit
(
'
img_voice_play_voice_end
'
)
pg
.
audio
.
stopAudio
(
this
.
audioId
)
this
.
audioId
=
null
;
}
else
{
pg
.
event
.
emit
(
'
img_voice_play_voice_start
'
)
pg
.
audio
.
playAudioByUrl
(
this
.
CurrentWord
.
audio
,
()
=>
{
pg
.
event
.
emit
(
'
img_voice_play_voice_end
'
)
this
.
audioId
=
null
;
},
(
audioId
)
=>
{
this
.
audioId
=
audioId
;
})
}
}
initWordBg
()
{
let
curWord
=
this
.
word_list
[
this
.
cur_index
];
let
ansArr
=
curWord
[
'
answer
'
];
let
ansArr
=
this
.
CurrentWord
.
answer
;
let
count
=
-
1
;
ansArr
.
forEach
((
ans
,
i
)
=>
{
// 长度大于一需要做拆分
...
...
@@ -157,6 +179,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
count
++
;
let
child
=
this
.
getWordBgNodeByStr
(
str
);
child
.
data
=
{
count
:
count
,
group
:
i
,
index
:
m
}
this
.
successGroupIds
[
`
${
i
}
`
]
=
false
;
let
pos
=
this
.
getWordBgPosByAns
(
ansArr
,
child
.
data
)
child
.
x
=
pos
.
x
;
child
.
y
=
pos
.
y
;
...
...
@@ -166,8 +189,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
});
}
initWord
()
{
let
curWord
=
this
.
word_list
[
this
.
cur_index
];
let
ansArr
=
curWord
[
'
answer
'
];
let
ansArr
=
this
.
CurrentWord
.
answer
;
let
itemPrefab
=
pg
.
view
.
find
(
this
.
layer_word
,
'
item
'
);
let
count
=
-
1
;
ansArr
.
forEach
((
ans
,
i
)
=>
{
...
...
@@ -325,8 +347,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
nd
.
x
+=
delta
.
x
;
nd
.
y
+=
delta
.
y
;
})
}
private
successGroupIds
;
onTouchEnd
(
event
)
{
let
node
=
event
.
target
;
this
.
stopCurrentItemAni
();
...
...
@@ -344,9 +366,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
target
=
targets
.
find
(
tr
=>
tr
.
data
.
index
==
item
.
data
.
index
);
this
.
wordToWordBg
(
item
,
target
);
})
this
.
successGroupIds
[
`
${
groupId
}
`
]
=
true
;
node
.
off
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onTouchStart
,
this
);
node
.
off
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
this
.
onTouchMove
,
this
);
node
.
off
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onTouchEnd
,
this
);
this
.
nextWord
();
}
else
{
let
subX
=
node
.
x
-
node
.
orgPos
.
x
;
let
subY
=
node
.
y
-
node
.
orgPos
.
y
;
...
...
assets/hy01_danci/script/defaultData_hy01_danci.ts
View file @
7e914c05
export
const
defaultData
=
{
"
recordFlag
"
:
true
,
"
title
"
:
"
test
"
,
"
questionText
"
:
""
,
"
questionTextAudio
"
:
""
,
"
questions
"
:
[
export
const
defaultData
=
{
"
onlineFlg
"
:
false
,
"
title
"
:
"
钓鱼大作战
"
,
"
questionText
"
:
""
,
"
questionTextAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/e422c682ff3304a532937db64573caa4.mp3
"
,
"
questions
"
:
[
{
"
questionAudio
"
:
""
,
"
duration
"
:
120
,
"
options
"
:
[
{
"
type
"
:
"
img_audio
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/875862129c75a075b3d710f541258a00.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/43839adb578c7e01456748b8a176a0c3_l.mp3
"
,
"
text
"
:
""
,
"
duration
"
:
10
,
"
content
"
:
"
egg
"
,
"
right
"
:
false
},
{
"
type
"
:
"
img_txt_audio
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/011cf423d6fd8760e810644ca6070e34.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/43839adb578c7e01456748b8a176a0c3_l.mp3
"
,
"
text
"
:
"
hammer
"
,
"
duration
"
:
10
,
"
content
"
:
"
hammer
"
,
"
right
"
:
false
},
{
"
type
"
:
"
img_txt_audio
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/befdc1801d93fd95b3a8ee7c7a2d2d05.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/43839adb578c7e01456748b8a176a0c3_l.mp3
"
,
"
text
"
:
"
clound
"
,
"
duration
"
:
10
,
"
content
"
:
"
clound
"
,
"
right
"
:
false
,
"
audioName
"
:
"
敲碎蛋的声音.mp3
"
}]
}],
"
bgAudio
"
:
""
,
"
bgAudioName
"
:
""
,
"
audioName
"
:
""
"
type
"
:
"
img
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/710feaeb43f2b610cfe6946de05c3567.png
"
,
"
audio
"
:
""
,
"
text
"
:
""
,
"
right
"
:
false
,
"
letterList
"
:
[{
"
text
"
:
"
c
"
},
{
"
text
"
:
"
a
"
},
{
"
text
"
:
"
p
"
},
{
"
text
"
:
"
able
"
}]
},
{
"
questionAudio
"
:
""
,
"
duration
"
:
120
,
"
type
"
:
"
imgVideo
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/cd639cafcc9ce2d23c85815bbf6539ee.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/48c425442c9d555e7f1226b81d4b8fa6_l.mp3
"
,
"
text
"
:
""
,
"
right
"
:
false
,
"
letterList
"
:
[{
"
text
"
:
"
g
"
},
{
"
text
"
:
"
o
"
},
{
"
text
"
:
"
o
"
},
{
"
text
"
:
"
d
"
}],
"
audioName
"
:
"
曾志豪 - 小游戏音乐Ⅱ.mp3
"
}
],
"
bgAudio
"
:
""
,
"
bgAudioName
"
:
""
,
"
audioName
"
:
""
}
// {
// "recordFlag": true,
...
...
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