Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
comparetree
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
comparetree
Commits
b1c207ea
Commit
b1c207ea
authored
Jun 13, 2021
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
流程完成部分
parent
04f41b74
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
10653 additions
and
316 deletions
+10653
-316
.gitignore
.gitignore
+2
-1
form.component.css
form/src/app/form/form.component.css
+110
-19
form.component.html
form/src/app/form/form.component.html
+281
-27
form.component.ts
form/src/app/form/form.component.ts
+179
-50
yarn.lock
form/yarn.lock
+9845
-0
data.js
play/assets/scene/scene/data.js
+1
-1
gameManager.js
play/assets/scene/scene/gameManager.js
+208
-214
pg.js
play/assets/scene/scene/pg.js
+4
-2
scene.js
play/assets/scene/scene/scene.js
+23
-2
No files found.
.gitignore
View file @
b1c207ea
...
@@ -7,4 +7,5 @@
...
@@ -7,4 +7,5 @@
/publish/publish/android
/publish/publish/android
/publish/publish/ios
/publish/publish/ios
/publish/publish/*.zip
/publish/publish/*.zip
/node_modules
/node_modules
\ No newline at end of file
/.vscode
\ No newline at end of file
form/src/app/form/form.component.css
View file @
b1c207ea
@import
'../style/common_mixin.css'
;
@import
'../style/common_mixin.css'
;
.model-content
{
.model-content
{
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
/* display: flex; */
/* justify-content: flex-start; */
/* align-items: flex-start; */
/* flex-wrap: wrap; */
}
.item-box
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
flex-direction
:
column
;
padding
:
10px
;
padding-bottom
:
2vw
;
padding-top
:
3vw
;
}
}
.radioPaire
{
.pic-sound-box
{
float
:
left
;
width
:
50%
;
margin
:
3px
;
display
:
flex
;
border-style
:
dashed
;
flex-direction
:
column
;
border-color
:
#000
;
}
border-width
:
1px
;
.add-btn-box
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
height
:
20vw
;
padding
:
10px
;
padding-top
:
5vw
;
}
}
.border
{
.border
{
width
:
450px
;
height
:
450px
;
border-radius
:
20px
;
border-radius
:
20px
;
border-style
:
dashed
;
border-style
:
dashed
;
padding
:
20px
;
text-align
:
center
;
margin
:
20px
;
float
:
left
;
/*width: 500px; */
margin-left
:
10px
;
/*//border-radius: 20px;*/
margin-bottom
:
10px
;
/*//border-width: 2px;*/
/*//border-color: #000000;*/
}
}
.group-title
{
.border-lite
{
width
:
100%
;
border
:
2px
dashed
#ddd
;
}
border-radius
:
0.5rem
;
.group-item
{
width
:
100%
;
display
:
flex
;
justify-content
:
flex-start
;
align-items
:
flex-start
;
flex-wrap
:
wrap
;
padding
:
10px
;
padding
:
10px
;
margin
:
10px
;
}
}
.box-dbt-0
{
border
:
1px
solid
gray
;
width
:
100%
;
/* text-align: center; */
border-top-left-radius
:
25px
;
border-top-right-radius
:
25px
;
border-bottom
:
0px
;
}
.box-dbt-1
{
border
:
1px
solid
gray
;
width
:
100%
;
text-align
:
left
;
border-bottom-left-radius
:
25px
;
border-bottom-right-radius
:
25px
;
}
.box-dbt-2
{
margin-left
:
25%
;
width
:
50%
;
height
:
100px
;
text-align
:
center
;
}
.box-lbt-0
{
border
:
1px
solid
gray
;
width
:
100%
;
text-align
:
center
;
border-left
:
0px
;
border-right
:
0px
;
}
.box-lbt-1
{
border
:
1px
0px
0px
0px
solid
gray
;
width
:
100%
;
text-align
:
left
;
}
.box-lbt-2
{
border
:
1px
0px
0px
0px
solid
gray
;
margin-left
:
25%
;
width
:
50%
;
height
:
100px
;
text-align
:
center
;
}
.error-message
{
border
:
1px
solid
gray
;
margin-top
:
1%
;
width
:
100%
;
height
:
100px
;
background-color
:
#fff
;
border-radius
:
15px
;
text-align
:
center
;
box-shadow
:
0px
0px
5px
2px
#888888
;
overflow
:
hidden
;
}
\ No newline at end of file
form/src/app/form/form.component.html
View file @
b1c207ea
This diff is collapsed.
Click to expand it.
form/src/app/form/form.component.ts
View file @
b1c207ea
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
,
ChangeDetectorRef
}
from
'
@angular/core
'
;
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
}
from
'
@angular/core
'
;
import
{
JsonPipe
}
from
'
@angular/common
'
;
@
Component
({
@
Component
({
...
@@ -9,106 +8,236 @@ import { JsonPipe } from '@angular/common';
...
@@ -9,106 +8,236 @@ import { JsonPipe } from '@angular/common';
})
})
export
class
FormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
export
class
FormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
// 储存数据用
picArr
=
[];
saveKey
=
"
test_001
"
;
_item
:
any
;
// 储存对象
KEY
=
'
hw_006
'
;
item
;
errs
=
[]
;
constructor
(
private
appRef
:
ApplicationRef
,
private
changeDetectorRef
:
ChangeDetectorRef
)
{
// @Input()
set
item
(
item
)
{
this
.
_item
=
item
;
// this.init();
}
}
get
item
()
{
createShell
()
{
return
this
.
_item
;
this
.
item
.
wordList
.
push
({
word
:
''
,
audio
:
''
,
backWord
:
''
,
backWordAudio
:
''
,
});
this
.
save
();
}
}
removeShell
(
idx
)
{
@
Output
()
this
.
item
.
wordList
.
splice
(
idx
,
1
);
update
=
new
EventEmitter
();
this
.
save
();
constructor
(
private
appRef
:
ApplicationRef
)
{
}
}
ngOnInit
()
{
ngOnInit
()
{
this
.
item
=
{};
this
.
item
=
{};
this
.
item
.
contentObj
=
{};
// 获取存储的数据
const
getData
=
(
<
any
>
window
).
courseware
.
getData
;
(
<
any
>
window
).
courseware
.
getData
((
data
)
=>
{
getData
((
data
)
=>
{
if
(
data
)
{
if
(
data
)
{
this
.
item
=
data
;
this
.
item
=
data
;
}
else
{
this
.
item
=
{};
}
if
(
!
this
.
item
.
contentObj
)
{
this
.
item
.
contentObj
=
{};
}
}
console
.
log
(
'
~data:
'
,
data
);
this
.
init
();
this
.
init
();
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
this
.
refresh
();
},
this
.
saveKey
);
},
this
.
KEY
);
}
// this.initData();
}
ngOnChanges
()
{
ngOnChanges
()
{
}
}
ngOnDestroy
()
{
ngOnDestroy
()
{
}
}
init
()
{
init
()
{
//在卡片组之上需要增加 两个组 0根->picArr 1题组->testlet 2页面->page 3卡片对->itemData
if
(
this
.
item
.
contentObj
.
picArr
)
{
this
.
picArr
=
this
.
item
.
contentObj
.
picArr
;
this
.
check
();
}
else
{
this
.
picArr
=
this
.
getDefaultPicArr
();
this
.
item
.
contentObj
.
picArr
=
this
.
picArr
;
}
console
.
log
(
'
item:
'
,
this
.
item
);
}
cardItemData
()
{
return
{
cardId
:
""
,
title
:
""
,
pic_url
:
""
,
audio_url
:
""
,
};
}
getDefaultPicArr
()
{
let
arr
=
[];
let
biaoti
=
{
title
:
""
,
child
:
[]
};
let
zhulei
=
{
title
:
""
,
child
:
[]
};
for
(
let
m
=
0
;
m
<
2
;
m
++
)
{
let
fenlei
=
{
title
:
""
,
child
:
[]
};
let
sonlei
=
{
title
:
""
,
child
:
[]
};
let
item
=
this
.
cardItemData
();
sonlei
.
child
.
push
(
item
);
fenlei
.
child
.
push
(
sonlei
);
zhulei
.
child
.
push
(
fenlei
);
}
biaoti
.
child
.
push
(
zhulei
);
arr
.
push
(
biaoti
);
return
arr
;
}
initData
()
{
}
}
/**
* 储存图片数据
* @param e
*/
onImageUploadSuccess
(
e
,
key
)
{
this
.
item
[
key
]
=
e
.
url
;
onImageUploadSuccessByItem
(
e
,
item
)
{
item
.
pic_url
=
e
.
url
;
this
.
save
();
this
.
save
();
}
}
/**
onAudioUploadSuccessByItem
(
e
,
item
)
{
* 储存音频数据
item
.
audio_url
=
e
.
url
;
* @param e
*/
onAudioUploadSuccess
(
e
,
key
)
{
this
.
item
[
key
]
=
e
.
url
;
this
.
save
();
this
.
save
();
}
}
onWordAudioUploadSuccess
(
e
,
idx
)
{
//添加一对
this
.
item
.
wordList
[
idx
].
audio
=
e
.
url
;
addItem
(
a
,
b
,
c
,
d
)
{
//最多4个
if
(
this
.
picArr
[
a
].
child
[
b
].
child
[
c
].
child
[
d
].
child
.
length
<
4
)
{
let
item
=
this
.
cardItemData
();
this
.
picArr
[
a
].
child
[
b
].
child
[
c
].
child
[
d
].
child
.
push
(
item
);
this
.
saveItem
();
}
}
deleteItem
(
a
,
b
,
c
,
d
,
e
)
{
if
(
e
!==
-
1
)
{
this
.
picArr
[
a
].
child
[
b
].
child
[
c
].
child
[
d
].
child
.
splice
(
e
,
1
);
}
this
.
save
();
}
//添加一页
addSon
(
a
,
b
,
c
)
{
let
length
=
this
.
picArr
[
a
].
child
[
b
].
child
[
0
].
child
.
length
+
this
.
picArr
[
a
].
child
[
b
].
child
[
1
].
child
.
length
;
if
(
length
<
6
){
let
cla
=
{
title
:
""
,
child
:
[]
};
for
(
let
i
=
0
;
i
<
1
;
i
++
)
{
let
item
=
this
.
cardItemData
();
cla
.
child
.
push
(
item
);
}
this
.
picArr
[
a
].
child
[
b
].
child
[
c
].
child
.
push
(
cla
);
this
.
save
();
}
}
deleteSon
(
a
,
b
,
c
,
d
)
{
if
(
d
!==
-
1
)
{
this
.
picArr
[
a
].
child
[
b
].
child
[
c
].
child
.
splice
(
d
,
1
);
}
this
.
save
();
this
.
save
();
}
}
onBackWordAudioUploadSuccess
(
e
,
idx
)
{
this
.
item
.
wordList
[
idx
].
backWordAudio
=
e
.
url
;
//选择圆圈
radioClick
(
it
,
radioValue
)
{
it
.
radioValue
=
radioValue
;
this
.
saveItem
();
}
saveItem
()
{
console
.
log
(
'
in saveItem
'
);
// this.update.emit(this.item);
this
.
save
();
this
.
save
();
}
}
/**
check
()
{
* 储存数据
if
(
1
)
return
;
*/
if
(
!
this
.
picArr
)
return
;
let
picArr
=
this
.
picArr
;
function
tia
(
info
)
{
let
str
=
""
;
if
(
info
.
radioValue
==
"
A
"
)
{
if
(
!
info
.
title
)
str
+=
"
,图片
"
;
}
else
if
(
info
.
radioValue
==
"
B
"
)
{
if
(
!
info
.
pic_url
)
str
+=
"
,图片
"
;
}
else
if
(
info
.
radioValue
==
"
C
"
)
{
if
(
!
info
.
audio_url
)
str
+=
"
,音频
"
;
}
else
{
str
+=
"
卡片
"
}
if
(
str
)
str
+=
"
未上传
"
return
str
;
}
this
.
errs
.
length
=
0
;
for
(
let
m
=
0
;
m
<
picArr
.
length
;
m
++
)
{
for
(
let
n
=
0
;
n
<
picArr
[
m
].
length
;
n
++
)
{
if
(
picArr
[
m
][
n
].
length
<
2
)
{
this
.
errs
.
push
(
`星-
${
m
+
1
}
页-
${
n
+
1
}
卡片少于2个`
);
}
for
(
let
i
=
0
;
i
<
picArr
[
m
][
n
].
length
;
i
++
)
{
let
item
=
picArr
[
m
][
n
][
i
];
let
left
=
item
.
left
;
let
right
=
item
.
right
;
let
code0
=
tia
(
left
);
let
code1
=
tia
(
right
);
if
(
code0
)
this
.
errs
.
push
(
`星-
${
m
+
1
}
页-
${
n
+
1
}
第
${
i
+
1
}
个卡片 左侧
${
code0
}
`
);
if
(
code1
)
this
.
errs
.
push
(
`星-
${
m
+
1
}
页-
${
n
+
1
}
第
${
i
+
1
}
个卡片 右侧
${
code1
}
`
);
}
}
}
console
.
log
(
"
this.errs
"
);
console
.
log
(
this
.
errs
);
console
.
log
(
"
-------------------------
"
);
}
save
()
{
save
()
{
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
saveKey
);
//触发一次检测
// this.item.picArr;
// this.message.create("error", `This is a message of error`);
this
.
check
();
this
.
refresh
(
);
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
KEY
);
console
.
log
(
'
this.item =
'
+
JSON
.
stringify
(
this
.
item
));
console
.
log
(
'
this.item =
'
+
JSON
.
stringify
(
this
.
item
));
this
.
refresh
();
}
}
/**
* 刷新 渲染页面
*/
refresh
()
{
refresh
()
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
appRef
.
tick
();
this
.
appRef
.
tick
();
},
1
);
},
1
);
}
}
}
}
\ No newline at end of file
form/yarn.lock
0 → 100644
View file @
b1c207ea
This diff is collapsed.
Click to expand it.
play/assets/scene/scene/data.js
View file @
b1c207ea
function
retData
()
{
function
retData
()
{
// let item = {"contentObj":{"picArr":[[[{"cardId":"","left":{"title":"boy1","pic_url":"http://staging-teach.cdn.ireadabc.com/1baedb0b31dc5503e65e114ce21940ab.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/495324991838775e49e3ca6593d432c9.mp3","radioValue":"C"},"right":{"title":"food","pic_url":"http://staging-teach.cdn.ireadabc.com/38117778476574c7ef8b445cf24d6eb5.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/495324991838775e49e3ca6593d432c9.mp3","radioValue":"A"},"radioValue":"B"},{"cardId":"","left":{"title":"boy2","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/17cc0e2a383e4632147dc495a1397915.mp3","radioValue":"C"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/21373528a7f38575e871de1d8e5a9671.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/17cc0e2a383e4632147dc495a1397915.mp3","radioValue":"B"},"radioValue":"E"}],[{"cardId":"","left":{"title":"girl1","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/205722475ccaca6233b2f28e635405ca.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/5d099c38000b804241f7dc1286b17457.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/205722475ccaca6233b2f28e635405ca.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"girl2","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/0b6ef24f15c6d8ad7bf27cc913445ebf.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/0abab9a26d537ebf1835a2ed8430162e.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/0b6ef24f15c6d8ad7bf27cc913445ebf.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"girl3","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/b2c170f84b85dddf554b5c837d1d6e30.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/5f34d4100a6ecb187fd715c99e917fc8.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/b2c170f84b85dddf554b5c837d1d6e30.mp3","radioValue":"B"},"radioValue":"D"}]],[[{"cardId":"","left":{"title":"rabbit","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/a7bd7c4de71319db5b6b0b60f0957e21.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/fe229e6b32f385fb8fe5eb9ec5843c66.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/a7bd7c4de71319db5b6b0b60f0957e21.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"cat","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/6c8dcd159d4f05bc93838cc47d3895f4.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/9c5fa50efd7a004f24ea7fcbcf81080e.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/6c8dcd159d4f05bc93838cc47d3895f4.mp3","radioValue":"B"},"radioValue":"A"},{"cardId":"","left":{"title":"coffe","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/3d0fea61d5d97f3caf04a9b738a0291b.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/9d114554c4760ff35f1ff5479504a531.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/a7bd7c4de71319db5b6b0b60f0957e21.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"tea","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/448291140d0b780c0278a14bf49277cb.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/bf26f92e4f0557ad70ac27006855dae9.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/6c8dcd159d4f05bc93838cc47d3895f4.mp3","radioValue":"B"},"radioValue":"D"}]],[[{"cardId":"","left":{"title":"cool","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/0e67aa701df18cbb5581ffb81ffa7836.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/38117778476574c7ef8b445cf24d6eb5.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/4c0379bc0f3bd0722874b2e11fb35336.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"big eye","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/fe226bc303f03ea994cb9a93d1620284.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/21373528a7f38575e871de1d8e5a9671.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/b985b71cd2f3c2d31e45992e4ae69d7f.mp3","radioValue":"B"},"radioValue":"A"},{"cardId":"","left":{"title":"cute","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/84c7b82de1a09da792237a174ebe071b.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/5d099c38000b804241f7dc1286b17457.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/7c1d1540233b6d050eae8215679104a8.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"shuai","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/9e799e7e86cd50c6699ca0e859c8aa1f.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/338dbee896e1fa8869495c84c603c33f.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/9a6b3177ab53ba75bcf293df1065bb64.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"big m","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/495324991838775e49e3ca6593d432c9.mp3","radioValue":"C"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/0abab9a26d537ebf1835a2ed8430162e.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/17cc0e2a383e4632147dc495a1397915.mp3","radioValue":"B"},"radioValue":"E"}]]]}}
// let item = {"contentObj":{"picArr":[[[{"cardId":"","left":{"title":"boy1","pic_url":"http://staging-teach.cdn.ireadabc.com/1baedb0b31dc5503e65e114ce21940ab.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/495324991838775e49e3ca6593d432c9.mp3","radioValue":"C"},"right":{"title":"food","pic_url":"http://staging-teach.cdn.ireadabc.com/38117778476574c7ef8b445cf24d6eb5.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/495324991838775e49e3ca6593d432c9.mp3","radioValue":"A"},"radioValue":"B"},{"cardId":"","left":{"title":"boy2","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/17cc0e2a383e4632147dc495a1397915.mp3","radioValue":"C"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/21373528a7f38575e871de1d8e5a9671.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/17cc0e2a383e4632147dc495a1397915.mp3","radioValue":"B"},"radioValue":"E"}],[{"cardId":"","left":{"title":"girl1","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/205722475ccaca6233b2f28e635405ca.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/5d099c38000b804241f7dc1286b17457.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/205722475ccaca6233b2f28e635405ca.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"girl2","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/0b6ef24f15c6d8ad7bf27cc913445ebf.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/0abab9a26d537ebf1835a2ed8430162e.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/0b6ef24f15c6d8ad7bf27cc913445ebf.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"girl3","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/b2c170f84b85dddf554b5c837d1d6e30.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/5f34d4100a6ecb187fd715c99e917fc8.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/b2c170f84b85dddf554b5c837d1d6e30.mp3","radioValue":"B"},"radioValue":"D"}]],[[{"cardId":"","left":{"title":"rabbit","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/a7bd7c4de71319db5b6b0b60f0957e21.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/fe229e6b32f385fb8fe5eb9ec5843c66.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/a7bd7c4de71319db5b6b0b60f0957e21.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"cat","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/6c8dcd159d4f05bc93838cc47d3895f4.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/9c5fa50efd7a004f24ea7fcbcf81080e.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/6c8dcd159d4f05bc93838cc47d3895f4.mp3","radioValue":"B"},"radioValue":"A"},{"cardId":"","left":{"title":"coffe","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/3d0fea61d5d97f3caf04a9b738a0291b.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/9d114554c4760ff35f1ff5479504a531.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/a7bd7c4de71319db5b6b0b60f0957e21.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"tea","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/448291140d0b780c0278a14bf49277cb.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/bf26f92e4f0557ad70ac27006855dae9.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/6c8dcd159d4f05bc93838cc47d3895f4.mp3","radioValue":"B"},"radioValue":"D"}]],[[{"cardId":"","left":{"title":"cool","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/0e67aa701df18cbb5581ffb81ffa7836.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/38117778476574c7ef8b445cf24d6eb5.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/4c0379bc0f3bd0722874b2e11fb35336.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"big eye","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/fe226bc303f03ea994cb9a93d1620284.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/21373528a7f38575e871de1d8e5a9671.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/b985b71cd2f3c2d31e45992e4ae69d7f.mp3","radioValue":"B"},"radioValue":"A"},{"cardId":"","left":{"title":"cute","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/84c7b82de1a09da792237a174ebe071b.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/5d099c38000b804241f7dc1286b17457.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/7c1d1540233b6d050eae8215679104a8.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"shuai","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/9e799e7e86cd50c6699ca0e859c8aa1f.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/338dbee896e1fa8869495c84c603c33f.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/9a6b3177ab53ba75bcf293df1065bb64.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"big m","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/495324991838775e49e3ca6593d432c9.mp3","radioValue":"C"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/0abab9a26d537ebf1835a2ed8430162e.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/17cc0e2a383e4632147dc495a1397915.mp3","radioValue":"B"},"radioValue":"E"}]]]}}
let
item
=
{
"
contentObj
"
:{
"
picArr
"
:[[[{
"
cardId
"
:
""
,
"
left
"
:{
"
title
"
:
"
11
"
,
"
pic_url
"
:
""
,
"
audio_url
"
:
""
,
"
radioValue
"
:
"
A
"
},
"
right
"
:{
"
title
"
:
"
11-1
"
,
"
pic_url
"
:
""
,
"
audio_url
"
:
""
,
"
radioValue
"
:
"
A
"
},
"
radioValue
"
:
"
C
"
},{
"
cardId
"
:
""
,
"
left
"
:{
"
title
"
:
"
22
"
,
"
pic_url
"
:
""
,
"
audio_url
"
:
""
,
"
radioValue
"
:
"
A
"
},
"
right
"
:{
"
title
"
:
"
22-1
"
,
"
pic_url
"
:
""
,
"
audio_url
"
:
""
,
"
radioValue
"
:
"
A
"
},
"
radioValue
"
:
"
C
"
}]]]}
}
let
item
=
{
"
contentObj
"
:
{
"
picArr
"
:
[{
"
title
"
:
"
title
"
,
"
child
"
:
[{
"
title
"
:
"
main
"
,
"
child
"
:
[{
"
title
"
:
"
sub1
"
,
"
child
"
:
[{
"
title
"
:
"
son11
"
,
"
child
"
:
[{
"
cardId
"
:
""
,
"
title
"
:
"
aa
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/88b1cd55a3e2ff70447331078c0e2941.png
"
,
"
audio_url
"
:
""
},
{
"
cardId
"
:
""
,
"
title
"
:
"
bb
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/26524d3fa6a060d80664b40cfb6105f6.png
"
,
"
audio_url
"
:
""
},
{
"
cardId
"
:
""
,
"
title
"
:
"
cc
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/0cd859af88f946a66313cc06e4628fd2.png
"
,
"
audio_url
"
:
""
},
{
"
cardId
"
:
""
,
"
title
"
:
"
dd
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/021d3b3904cb6e675286ac8fcb60da2b.png
"
,
"
audio_url
"
:
""
}]
},
{
"
title
"
:
"
son12
"
,
"
child
"
:
[{
"
cardId
"
:
""
,
"
title
"
:
"
a2
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/1c897715153af629e0aa1bfbf54472a4.png
"
,
"
audio_url
"
:
""
},
{
"
cardId
"
:
""
,
"
title
"
:
"
b2
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/756083716a8ab9f2b6b66331e659845d.png
"
,
"
audio_url
"
:
""
},
{
"
cardId
"
:
""
,
"
title
"
:
"
c2
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/6c13e8f14b294ca866205633b9f44891.png
"
,
"
audio_url
"
:
""
},
{
"
cardId
"
:
""
,
"
title
"
:
"
d2
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/b3f29929c06d1af57bb6eb08d3f5b0d0.png
"
,
"
audio_url
"
:
""
}]
},
{
"
title
"
:
"
son13
"
,
"
child
"
:
[{
"
cardId
"
:
""
,
"
title
"
:
"
a3
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/88b1cd55a3e2ff70447331078c0e2941.png
"
,
"
audio_url
"
:
""
},
{
"
cardId
"
:
""
,
"
title
"
:
"
b3
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/26524d3fa6a060d80664b40cfb6105f6.png
"
,
"
audio_url
"
:
""
},
{
"
cardId
"
:
""
,
"
title
"
:
"
c3
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/88b1cd55a3e2ff70447331078c0e2941.png
"
,
"
audio_url
"
:
""
},
{
"
cardId
"
:
""
,
"
title
"
:
"
d3
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/26524d3fa6a060d80664b40cfb6105f6.png
"
,
"
audio_url
"
:
""
}]
}]
},
{
"
title
"
:
"
sub2
"
,
"
child
"
:
[{
"
title
"
:
"
son21
"
,
"
child
"
:
[{
"
cardId
"
:
""
,
"
title
"
:
"
q1
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/fde35aaec618529b0b2b6cb3a18d1f85.png
"
,
"
audio_url
"
:
""
},
{
"
cardId
"
:
""
,
"
title
"
:
"
w1
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/0cd859af88f946a66313cc06e4628fd2.png
"
,
"
audio_url
"
:
""
},
{
"
cardId
"
:
""
,
"
title
"
:
"
e1
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/021d3b3904cb6e675286ac8fcb60da2b.png
"
,
"
audio_url
"
:
""
}]
},
{
"
title
"
:
"
son22
"
,
"
child
"
:
[{
"
cardId
"
:
""
,
"
title
"
:
"
q2
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/756083716a8ab9f2b6b66331e659845d.png
"
,
"
audio_url
"
:
""
},
{
"
cardId
"
:
""
,
"
title
"
:
"
q3
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/6e9fec092bc8d547be4ad9fd5e01acf1.png
"
,
"
audio_url
"
:
""
}]
},
{
"
title
"
:
"
son23
"
,
"
child
"
:
[{
"
cardId
"
:
""
,
"
title
"
:
"
q4
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/b0f3c1a415015b254692a5d536b5b3fa.png
"
,
"
audio_url
"
:
""
},
{
"
cardId
"
:
""
,
"
title
"
:
"
w4
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/cfa80b631a57638fd27cdef0d5aa2c2d.png
"
,
"
audio_url
"
:
""
}]
}]
}]
}]
}]
}
}
return
item
;
return
item
;
}
}
export
const
itemData
=
retData
();
export
const
itemData
=
retData
();
\ No newline at end of file
play/assets/scene/scene/gameManager.js
View file @
b1c207ea
This diff is collapsed.
Click to expand it.
play/assets/scene/scene/pg.js
View file @
b1c207ea
...
@@ -73,7 +73,7 @@ pg.view = {
...
@@ -73,7 +73,7 @@ pg.view = {
if
(
node
.
net_url
==
res
)
return
;
if
(
node
.
net_url
==
res
)
return
;
let
w
=
node
.
width
;
let
w
=
node
.
width
;
let
h
=
node
.
height
;
let
h
=
node
.
height
;
node
.
active
=
false
;
//
//
node.active = false;//
pg
.
load
.
loadNetImg
(
res
).
then
((
texture
)
=>
{
pg
.
load
.
loadNetImg
(
res
).
then
((
texture
)
=>
{
if
(
!
cc
.
isValid
(
node
))
return
log
.
i
(
"
节点已销毁
"
);
if
(
!
cc
.
isValid
(
node
))
return
log
.
i
(
"
节点已销毁
"
);
let
nw
=
node
.
width
=
texture
.
width
;
let
nw
=
node
.
width
=
texture
.
width
;
...
@@ -91,7 +91,9 @@ pg.view = {
...
@@ -91,7 +91,9 @@ pg.view = {
node
.
width
=
b
*
nw
;
node
.
width
=
b
*
nw
;
node
.
height
=
b
*
nh
;
node
.
height
=
b
*
nh
;
}
}
node
.
active
=
true
;
node
.
scaleX
=
node
.
parent
.
scaleX
;
node
.
scaleY
=
node
.
parent
.
scaleY
;
// node.active = true;
resolve
({
w
:
nw
,
h
:
nh
});
resolve
({
w
:
nw
,
h
:
nh
});
})
})
})
})
...
...
play/assets/scene/scene/scene.js
View file @
b1c207ea
...
@@ -259,6 +259,17 @@ cc.Class({
...
@@ -259,6 +259,17 @@ cc.Class({
this
.
_boxItems
.
push
(
sonClone
);
this
.
_boxItems
.
push
(
sonClone
);
}
}
},
},
setSuccessItemPos
(
box
,
item
)
{
//判断当前item应该放在哪里
let
itemA
=
box
.
data
.
id
%
100
-
1
;
//坐标x
let
itemB
=
box
.
data
.
success
.
length
-
1
;
//坐标y
let
x
=
-
480
;
//-290
let
addX
=
190
;
let
y
=
0
;
let
addY
=
-
40
;
item
.
x
=
x
+
addX
*
itemA
;
item
.
y
=
y
+
addY
*
itemB
;
},
initItems
()
{
initItems
()
{
//刷新子类
//刷新子类
let
son
=
pg
.
view
.
find
(
this
,
"
items/item
"
);
let
son
=
pg
.
view
.
find
(
this
,
"
items/item
"
);
...
@@ -332,6 +343,8 @@ cc.Class({
...
@@ -332,6 +343,8 @@ cc.Class({
pg
.
view
.
setString
(
txt
,
data
.
txt
);
pg
.
view
.
setString
(
txt
,
data
.
txt
);
pg
.
view
.
setString
(
pg
.
view
.
find
(
success
,
"
txt
"
),
data
.
txt
);
pg
.
view
.
setString
(
pg
.
view
.
find
(
success
,
"
txt
"
),
data
.
txt
);
pg
.
view
.
setNetImg
(
icon
,
data
.
img
);
pg
.
view
.
setNetImg
(
pg
.
view
.
find
(
success
,
"
icon
"
),
data
.
img
);
switch
(
item
.
moveState
)
{
switch
(
item
.
moveState
)
{
case
1
:
case
1
:
...
@@ -373,6 +386,8 @@ cc.Class({
...
@@ -373,6 +386,8 @@ cc.Class({
item
.
on
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,
this
.
onCancelItem
,
this
);
item
.
on
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,
this
.
onCancelItem
,
this
);
},
},
onStartItem
(
touch
)
{
onStartItem
(
touch
)
{
let
item
=
touch
.
target
;
if
(
item
.
moveState
==
2
)
return
;
//判断是否是在原地并没有到处移动
//判断是否是在原地并没有到处移动
this
.
_startPos
=
cc
.
v2
(
touch
.
target
.
x
,
touch
.
target
.
y
);
this
.
_startPos
=
cc
.
v2
(
touch
.
target
.
x
,
touch
.
target
.
y
);
...
@@ -386,6 +401,7 @@ cc.Class({
...
@@ -386,6 +401,7 @@ cc.Class({
//3.失败效果--
//3.失败效果--
onEndItem
(
touch
)
{
onEndItem
(
touch
)
{
let
item
=
touch
.
target
;
let
item
=
touch
.
target
;
if
(
item
.
moveState
==
2
)
return
;
let
touchPos
=
touch
.
getLocation
();
let
touchPos
=
touch
.
getLocation
();
//判断是否是在原地并没有到处移动
//判断是否是在原地并没有到处移动
if
(
this
.
checkCollider
({
if
(
this
.
checkCollider
({
...
@@ -415,6 +431,9 @@ cc.Class({
...
@@ -415,6 +431,9 @@ cc.Class({
if
(
successed
)
{
if
(
successed
)
{
item
.
moveState
=
2
;
item
.
moveState
=
2
;
this
.
updateItem
(
item
);
this
.
updateItem
(
item
);
box
.
data
.
success
.
push
(
item
);
this
.
setSuccessItemPos
(
box
,
item
);
//检测是否全部完成
}
else
{
}
else
{
item
.
moveState
=
3
;
item
.
moveState
=
3
;
this
.
updateItem
(
item
);
this
.
updateItem
(
item
);
...
@@ -423,15 +442,15 @@ cc.Class({
...
@@ -423,15 +442,15 @@ cc.Class({
this
.
moveItem
(
item
,
this
.
_startPos
);
this
.
moveItem
(
item
,
this
.
_startPos
);
},
100
);
},
100
);
}
}
}
else
{
}
else
{
this
.
moveItem
(
item
,
this
.
_startPos
);
this
.
moveItem
(
item
,
this
.
_startPos
);
}
}
},
},
onMoveItem
(
touch
)
{
onMoveItem
(
touch
)
{
let
item
=
touch
.
target
;
if
(
item
.
moveState
==
2
)
return
;
//获取到的location是 当前点击的位置 而不是按钮原本应该所在的位置。
//获取到的location是 当前点击的位置 而不是按钮原本应该所在的位置。
let
touchPos
=
touch
.
getLocation
();
let
touchPos
=
touch
.
getLocation
();
let
item
=
touch
.
target
;
//判断是否是在原地并没有到处移动
//判断是否是在原地并没有到处移动
if
(
this
.
checkCollider
({
if
(
this
.
checkCollider
({
x
:
touchPos
.
x
-
1280
/
2
,
x
:
touchPos
.
x
-
1280
/
2
,
...
@@ -450,6 +469,8 @@ cc.Class({
...
@@ -450,6 +469,8 @@ cc.Class({
touch
.
target
.
y
=
touchPos
.
y
-
720
/
2
;
touch
.
target
.
y
=
touchPos
.
y
-
720
/
2
;
},
},
onCancelItem
(
touch
)
{
onCancelItem
(
touch
)
{
let
item
=
touch
.
target
;
if
(
item
.
moveState
==
2
)
return
;
//碰撞失败退回原位置
//碰撞失败退回原位置
touch
.
target
.
x
=
this
.
_startPos
.
x
;
touch
.
target
.
x
=
this
.
_startPos
.
x
;
touch
.
target
.
y
=
this
.
_startPos
.
y
;
touch
.
target
.
y
=
this
.
_startPos
.
y
;
...
...
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