Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sn02_danci
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
sn02_danci
Commits
87641bc8
Commit
87641bc8
authored
Sep 10, 2023
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理数据
parent
dc1f732b
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
619 additions
and
504 deletions
+619
-504
hy04_pinci.fire
assets/hy04_pinci/scene/hy04_pinci.fire
+538
-441
hy04_pinci.ts
assets/hy04_pinci/scene/hy04_pinci.ts
+65
-61
defaultData_hy04_pinci.ts
assets/hy04_pinci/script/defaultData_hy04_pinci.ts
+3
-2
form.component.html
form/src/app/form/form.component.html
+12
-0
form.component.ts
form/src/app/form/form.component.ts
+1
-0
No files found.
assets/hy04_pinci/scene/hy04_pinci.fire
View file @
87641bc8
This diff is collapsed.
Click to expand it.
assets/hy04_pinci/scene/hy04_pinci.ts
View file @
87641bc8
...
@@ -12,8 +12,8 @@ enum WORD_TYPE {
...
@@ -12,8 +12,8 @@ enum WORD_TYPE {
LINE
LINE
}
}
const
DefaultPos
=
{
const
DefaultPos
=
{
Word
:
cc
.
v2
(
0
,
-
4
3
0
),
Word
:
cc
.
v2
(
0
,
-
4
1
0
),
WordBg
:
cc
.
v2
(
0
,
-
1
6
0
)
WordBg
:
cc
.
v2
(
0
,
-
1
5
0
)
}
}
@
ccclass
@
ccclass
export
default
class
SceneComponent
extends
MyCocosSceneComponent
{
export
default
class
SceneComponent
extends
MyCocosSceneComponent
{
...
@@ -25,18 +25,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -25,18 +25,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
addPreloadAudio
()
{
addPreloadAudio
()
{
// TODO 根据自己的配置预加载音频资源
// TODO 根据自己的配置预加载音频资源
let
audios
=
[];
//
let audios = [];
function
checkAudio
(
obj
)
{
//
function checkAudio(obj) {
for
(
let
idx
in
obj
)
{
//
for (let idx in obj) {
if
(
typeof
obj
[
idx
]
==
"
object
"
)
{
//
if (typeof obj[idx] == "object") {
checkAudio
(
obj
[
idx
]);
//
checkAudio(obj[idx]);
}
else
if
(
typeof
obj
[
idx
]
==
"
string
"
)
{
//
} else if (typeof obj[idx] == "string") {
if
(
obj
[
idx
].
indexOf
(
"
.mp3
"
)
>
-
1
)
audios
.
push
(
obj
[
idx
]);
//
if (obj[idx].indexOf(".mp3") > -1) audios.push(obj[idx]);
}
//
}
}
//
}
}
//
}
checkAudio
(
this
.
data
)
//
checkAudio(this.data)
this
.
_audioResList
=
audios
;
//
this._audioResList = audios;
}
}
addPreloadAnima
()
{
addPreloadAnima
()
{
...
@@ -77,10 +77,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -77,10 +77,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
private
wordDataList
:
Array
<
any
>
;
private
wordDataList
:
Array
<
any
>
;
// 当前第几个
// 当前第几个
private
curIndex
:
number
;
private
curIndex
:
number
;
private
showKuang
:
boolean
;
initData
()
{
initData
()
{
// 所有全局变量 默认都是null
// 所有全局变量 默认都是null
this
.
_cantouch
=
true
;
this
.
_cantouch
=
true
;
let
data
=
this
.
data
;
let
data
=
this
.
data
;
this
.
showKuang
=
this
.
data
.
showKuang
==
1
;
this
.
recordFlag
=
data
.
recordFlag
;
this
.
recordFlag
=
data
.
recordFlag
;
this
.
list
=
data
.
questions
[
0
].
options
;
this
.
list
=
data
.
questions
[
0
].
options
;
this
.
layers
=
[];
this
.
layers
=
[];
...
@@ -164,8 +167,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -164,8 +167,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
private
wordList
:
Array
<
cc
.
Node
>
;
private
wordList
:
Array
<
cc
.
Node
>
;
private
get
CurrentWord
():
any
{
private
get
CurrentWord
():
any
{
// 默认播放当前音频
// 默认播放当前音频
// let audio_url = this.wordDataList[this.curIndex].audio
// if (audio_url) pg.audio.playAudioByUrl(audio_url)
return
this
.
wordDataList
[
this
.
curIndex
];
return
this
.
wordDataList
[
this
.
curIndex
];
}
}
nextWord
()
{
nextWord
()
{
...
@@ -175,8 +176,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -175,8 +176,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
if
(
!
success
)
return
;
if
(
!
success
)
return
;
this
.
scheduleOnce
(()
=>
{
this
.
scheduleOnce
(()
=>
{
pg
.
event
.
once
(
'
layer_right_show_excellent_end
'
,
()
=>
{
pg
.
event
.
once
(
'
layer_coin_show_coin_end
'
,
()
=>
{
this
.
curIndex
++
;
this
.
curIndex
++
;
if
(
!
this
.
CurrentWord
)
{
if
(
!
this
.
CurrentWord
)
{
// alert("游戏结束画面暂无")
// alert("游戏结束画面暂无")
...
@@ -184,11 +183,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -184,11 +183,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
else
{
}
else
{
this
.
showWord
();
this
.
showWord
();
}
}
})
// 动画回调
// pg.event.once('layer_right_show_excellent_end', () => {
pg
.
event
.
emit
(
'
layer_coin_show_coin
'
,
3
)
//1 2 3硬币数量
// pg.event.once('layer_coin_show_coin_end', () => {
})
// this.curIndex++;
pg
.
event
.
emit
(
'
layer_right_show_excellent
'
)
// if (!this.CurrentWord) {
},
0.2
)
// // alert("游戏结束画面暂无")
// this.gameOver();
// } else {
// this.showWord();
// }
// }) // 动画回调
// pg.event.emit('layer_coin_show_coin', 3) //1 2 3硬币数量
// })
// pg.event.emit('layer_right_show_excellent')
},
0.6
)
}
}
//单词的展示
//单词的展示
showWord
()
{
showWord
()
{
...
@@ -262,7 +270,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -262,7 +270,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
ansStrArr
=
ans
.
split
(
''
);
let
ansStrArr
=
ans
.
split
(
''
);
ansStrArr
.
forEach
((
str
,
m
)
=>
{
ansStrArr
.
forEach
((
str
,
m
)
=>
{
count
++
;
count
++
;
let
child
=
this
.
getWordBgNodeByStr
(
str
,
scale
);
let
child
=
this
.
getWordBgNodeByStr
(
str
);
child
.
data
=
{
count
:
count
,
group
:
group
,
index
:
m
,
value
:
str
}
child
.
data
=
{
count
:
count
,
group
:
group
,
index
:
m
,
value
:
str
}
this
.
successGroupIds
[
`
${
i
}
`
]
=
!
str
.
trim
();
this
.
successGroupIds
[
`
${
i
}
`
]
=
!
str
.
trim
();
let
pos
=
this
.
getWordBgPosByAns
(
ansArr
.
map
(
ans
=>
ans
.
text
),
[
str
],
child
.
data
)
let
pos
=
this
.
getWordBgPosByAns
(
ansArr
.
map
(
ans
=>
ans
.
text
),
[
str
],
child
.
data
)
...
@@ -316,7 +324,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -316,7 +324,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
arr
=
[];
let
arr
=
[];
ansStrArr
.
forEach
((
str
,
m
)
=>
{
ansStrArr
.
forEach
((
str
,
m
)
=>
{
count
++
;
count
++
;
let
child
=
this
.
getWordNodeByStr
(
str
,
1
);
let
child
=
this
.
getWordNodeByStr
(
str
);
child
.
data
=
{
group
:
group
,
index
:
m
,
count
:
count
,
value
:
str
};
child
.
data
=
{
group
:
group
,
index
:
m
,
count
:
count
,
value
:
str
};
let
pos
=
this
.
getWordPosByAns
(
ansArr
.
map
(
ans
=>
ans
.
text
),
[
str
],
child
.
data
);
let
pos
=
this
.
getWordPosByAns
(
ansArr
.
map
(
ans
=>
ans
.
text
),
[
str
],
child
.
data
);
child
.
x
=
pos
.
x
;
child
.
x
=
pos
.
x
;
...
@@ -406,55 +414,51 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -406,55 +414,51 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
getWordNodeWidth
(
type
,
str
)
{
getWordNodeWidth
(
type
,
str
)
{
// str = str.trim();
return
220
;
// // if (!str) return 0;
// const reg = /^[A-Z]+$/;
// const lower = str;//str.toLowerCase()
// if (type === WORD_TYPE.TOUCH) {
// let prefabNode = reg.test(str) ? pg.view.find(this.upper_word, `${lower}`) : pg.view.find(this.lower_word, `${lower}`)
// return prefabNode.width + 20;
// } else {
// let prefabNode = reg.test(str) ? pg.view.find(this.upper_shadow, `${lower}`) : pg.view.find(this.lower_shadow, `${lower}`);
// return prefabNode.width + 30;
// }
return
170
;
}
}
getWordNodeByStr
(
str
,
scale
)
{
getWordNodeByStr
(
str
)
{
str
=
str
.
trim
();
str
=
str
.
trim
();
const
reg
=
/^
[
A-Z
]
+$/
;
const
reg
=
/^
[
A-Z
]
+$/
;
const
lower
=
str
;
//str.toLowerCase()
const
lower
=
str
;
let
wordNode
=
pg
.
view
.
find
(
this
.
layer_word
,
'
word
'
);
let
wordNode
=
pg
.
view
.
find
(
this
.
layer_word
,
'
word
'
);
let
item
=
pg
.
view
.
clone
(
wordNode
);
let
item
=
pg
.
view
.
clone
(
wordNode
);
let
prefabNode
=
reg
.
test
(
str
)
?
pg
.
view
.
find
(
this
.
upper_word
,
`
${
lower
}
`
)
:
pg
.
view
.
find
(
this
.
lower_word
,
`
${
lower
}
`
)
let
prefabNode
=
reg
.
test
(
str
)
?
pg
.
view
.
find
(
this
.
upper_word
,
`
${
lower
}
`
)
:
pg
.
view
.
find
(
this
.
lower_word
,
`
${
lower
}
`
)
let
child
=
pg
.
view
.
clone
(
prefabNode
)
let
child
=
pg
.
view
.
clone
(
prefabNode
)
pg
.
view
.
visible
(
pg
.
view
.
find
(
item
,
'
kuang
'
),
false
)
child
.
x
=
0
;
child
.
x
=
0
;
child
.
y
=
0
;
child
.
y
=
0
;
child
.
width
*=
scale
;
child
.
height
*=
scale
;
child
.
active
=
true
;
child
.
active
=
true
;
let
width
=
this
.
getItemWordWidth
(
WORD_TYPE
.
TOUCH
,
[
str
])
let
width
=
this
.
getItemWordWidth
(
WORD_TYPE
.
TOUCH
,
[
str
])
item
.
x
=
0
;
item
.
x
=
0
;
item
.
y
=
0
;
item
.
y
=
0
;
item
.
width
=
width
;
item
.
width
=
width
;
item
.
width
*=
scale
;
item
.
height
*=
scale
;
item
.
active
=
true
;
item
.
active
=
true
;
item
.
getChildByName
(
"
icon
"
).
addChild
(
child
);
item
.
getChildByName
(
"
icon
"
).
addChild
(
child
);
return
item
;
return
item
;
}
}
getWordBgNodeByStr
(
str
,
scale
)
{
getWordBgNodeByStr
(
str
)
{
str
=
str
.
trim
();
str
=
str
.
trim
();
const
reg
=
/^
[
A-Z
]
+$/
;
const
reg
=
/^
[
A-Z
]
+$/
;
const
lower
=
str
;
//str.toLowerCase()
const
lower
=
str
;
let
prefabNode
=
reg
.
test
(
str
)
?
pg
.
view
.
find
(
this
.
upper_shadow
,
`
${
lower
}
`
)
:
pg
.
view
.
find
(
this
.
lower_shadow
,
`
${
lower
}
`
);
let
wordNode
=
pg
.
view
.
find
(
this
.
layer_word
,
'
word
'
);
let
item
=
pg
.
view
.
clone
(
wordNode
);
let
prefabNode
=
reg
.
test
(
str
)
?
pg
.
view
.
find
(
this
.
upper_shadow
,
`
${
lower
}
`
)
:
pg
.
view
.
find
(
this
.
lower_shadow
,
`
${
lower
}
`
)
let
child
=
pg
.
view
.
clone
(
prefabNode
)
let
child
=
pg
.
view
.
clone
(
prefabNode
)
child
.
opacity
=
100
;
child
.
active
=
true
child
.
x
=
0
;
child
.
x
=
0
;
child
.
y
=
0
;
child
.
y
=
0
;
child
.
width
*=
scale
;
child
.
active
=
true
;
child
.
height
*=
scale
;
let
width
=
this
.
getItemWordWidth
(
WORD_TYPE
.
TOUCH
,
[
str
])
return
child
;
item
.
x
=
0
;
item
.
y
=
0
;
item
.
width
=
width
;
item
.
active
=
true
;
item
.
getChildByName
(
"
icon
"
).
addChild
(
child
);
if
(
this
.
showKuang
)
{
pg
.
view
.
visible
(
child
,
false
)
}
else
{
pg
.
view
.
visible
(
pg
.
view
.
find
(
item
,
'
kuang
'
),
this
.
showKuang
)
}
return
item
;
}
}
getWordBgByGroup
(
group
)
{
getWordBgByGroup
(
group
)
{
return
this
.
wordBgList
.
filter
(
item
=>
{
return
this
.
wordBgList
.
filter
(
item
=>
{
...
@@ -540,7 +544,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -540,7 +544,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
nodes
=
node
.
data
;
let
nodes
=
node
.
data
;
let
targets
=
this
.
getWordBgByGroup
(
groupId
);
let
targets
=
this
.
getWordBgByGroup
(
groupId
);
nodes
.
forEach
(
item
=>
{
nodes
.
forEach
(
item
=>
{
let
dt
=
item
.
data
;
let
target
=
targets
.
find
(
tr
=>
tr
.
data
.
index
==
item
.
data
.
index
);
let
target
=
targets
.
find
(
tr
=>
tr
.
data
.
index
==
item
.
data
.
index
);
this
.
wordToWordBg
(
item
,
target
);
this
.
wordToWordBg
(
item
,
target
);
})
})
...
@@ -568,9 +571,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -568,9 +571,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
candys
.
getComponent
(
Candy
).
showAni
().
then
(()
=>
{
candys
.
getComponent
(
Candy
).
showAni
().
then
(()
=>
{
cc
.
tween
(
light
).
to
(
1
,
{
opacity
:
0
}).
start
();
cc
.
tween
(
light
).
to
(
1
,
{
opacity
:
0
}).
start
();
})
})
cc
.
tween
(
node
).
to
(
0.2
,
{
x
:
target
.
x
,
y
:
target
.
y
,
scale
:
0.85
})
cc
.
tween
(
node
)
.
to
(
0.2
,
{
x
:
target
.
x
,
y
:
target
.
y
,
scale
:
1
})
.
call
(()
=>
{
.
call
(()
=>
{
target
.
active
=
false
;
//
target.active = false;
}).
start
();
}).
start
();
}
}
startCurrentItemAni
()
{
startCurrentItemAni
()
{
...
...
assets/hy04_pinci/script/defaultData_hy04_pinci.ts
View file @
87641bc8
...
@@ -5,13 +5,14 @@ export const defaultData =
...
@@ -5,13 +5,14 @@ export const defaultData =
"
title
"
:
""
,
"
title
"
:
""
,
"
questionText
"
:
""
,
"
questionText
"
:
""
,
"
questionTextAudio
"
:
""
,
"
questionTextAudio
"
:
""
,
"
showKuang
"
:
1
,
"
questions
"
:
[
"
questions
"
:
[
{
{
"
questionAudio
"
:
""
,
"
questionAudio
"
:
""
,
"
duration
"
:
120
,
"
duration
"
:
120
,
"
type
"
:
"
img
"
,
"
type
"
:
"
img
Video
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/e184e067fc931d55fce93c9937a26c51.png
"
,
//
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/e184e067fc931d55fce93c9937a26c51.png
"
,
//
"
audio
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/172fad3743476ac9c668eb8a82d5eca1_l.mp3
"
,
"
text
"
:
""
,
"
text
"
:
""
,
"
right
"
:
false
,
"
right
"
:
false
,
//magical golden stick
//magical golden stick
...
...
form/src/app/form/form.component.html
View file @
87641bc8
...
@@ -99,6 +99,18 @@
...
@@ -99,6 +99,18 @@
<span
style=
"font-size: 20px;"
>
掌握字数:
</span>
<span
style=
"font-size: 20px;"
>
掌握字数:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
zi_count
"
(
blur
)="
save
()"
>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
zi_count
"
(
blur
)="
save
()"
>
<div>
<nz-radio-group
[(
ngModel
)]="
item
.
showKuang
"
(
ngModelChange
)="
ngChange
()"
>
<label
nz-radio
nzValue=
"img"
>
<span
[
style
]="{
color:item
.
showKuang=
='1'
?
'#
169BD5
'
:
'#
000
'}"
>
不显示字母
</span>
</label>
<label
nz-radio
nzValue=
"imgVideo"
>
<span
[
style
]="{
color:item
.
showKuang=
='2'
?
'#
169BD5
'
:
'#
000
'}"
>
显示字母
</span>
</label>
</nz-radio-group>
</div>
</div>
</div>
<div
style=
"margin: 20px;width: 1000px;"
>
<div
style=
"margin: 20px;width: 1000px;"
>
...
...
form/src/app/form/form.component.ts
View file @
87641bc8
...
@@ -25,6 +25,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
...
@@ -25,6 +25,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
word_count
:
'
0
'
,
word_count
:
'
0
'
,
sentence_count
:
'
0
'
,
sentence_count
:
'
0
'
,
zi_count
:
'
0
'
,
zi_count
:
'
0
'
,
showKuang
:
'
1
'
,
audioName
:
""
audioName
:
""
};
};
isVisible
=
false
;
isVisible
=
false
;
...
...
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