Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sn19_read
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
sn19_read
Commits
3b8bf5a6
Commit
3b8bf5a6
authored
Nov 17, 2023
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
背景适配
parent
b3a9e6f0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
330 additions
and
45 deletions
+330
-45
ResizeAuto_sn19_read.ts
assets/sn19_read/scene/ResizeAuto_sn19_read.ts
+145
-0
ResizeAuto_sn19_read.ts.meta
assets/sn19_read/scene/ResizeAuto_sn19_read.ts.meta
+9
-0
pg_sn19_read.ts
assets/sn19_read/scene/pg_sn19_read.ts
+61
-0
sn19_read.fire
assets/sn19_read/scene/sn19_read.fire
+12
-19
sn19_read.ts
assets/sn19_read/scene/sn19_read.ts
+98
-25
defaultData_sn19_read.ts
assets/sn19_read/script/defaultData_sn19_read.ts
+5
-1
No files found.
assets/sn19_read/scene/ResizeAuto_sn19_read.ts
0 → 100644
View file @
3b8bf5a6
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
pg
from
"
./pg_sn19_read
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
ResizeAuto
extends
cc
.
Component
{
@
property
r_width
:
number
=
1
@
property
r_height
:
number
=
1
@
property
r_top
:
number
=
0
@
property
r_bottom
:
number
=
0
@
property
p_left
:
number
=
0
@
property
p_right
:
number
=
0
@
property
p_top
:
number
=
0
@
property
p_bottom
:
number
=
0
@
property
noHead
:
number
=
0
@
property
debug
:
number
=
0
// LIFE-CYCLE CALLBACKS:
private
resizeScaleX
;
private
resizeScaleY
;
private
posX
;
private
posY
;
private
nodeWidth
;
private
nodeHeight
;
private
nodeX
;
private
nodeY
;
onLoad
()
{
let
{
scaleX
,
posX
,
scaleY
,
posY
}
=
pg
.
screen
.
winBlackArea
();
this
.
resizeScaleX
=
scaleX
;
this
.
resizeScaleY
=
scaleY
;
this
.
posX
=
posX
;
this
.
posY
=
posY
;
let
{
width
,
height
,
x
,
y
}
=
this
.
node
;
this
.
nodeWidth
=
width
;
this
.
nodeHeight
=
height
;
this
.
nodeX
=
x
;
this
.
nodeY
=
y
;
}
start
()
{
this
.
resize
();
}
onDestroy
()
{
}
resize
()
{
if
(
!
this
.
resizeScaleX
&&
!
this
.
nodeWidth
)
{
console
.
warn
(
"
手动调用此方法时,不能再onLoad中使用
"
);
return
;
}
this
.
resizeHeight
();
this
.
resizeWidth
();
}
//高屏幕适配
resizeHeight
()
{
if
(
this
.
resizeScaleY
<=
1.05
)
return
;
let
scaleY
=
this
.
resizeScaleY
;
let
posY
=
this
.
posY
;
let
nodeWidth
=
this
.
nodeWidth
;
let
nodeHeight
=
this
.
nodeHeight
;
let
nodeX
=
this
.
nodeX
;
let
nodeY
=
this
.
nodeY
;
if
(
this
.
debug
==
1
)
{
pg
.
logger
.
d
(
"
断点调试点
"
);
}
//宽度拉伸
if
(
this
.
r_width
==
1
)
{
this
.
node
.
width
=
nodeWidth
*
scaleY
;
}
//高度拉升
if
(
this
.
r_height
==
1
)
{
this
.
node
.
height
=
nodeHeight
*
scaleY
;
}
//动态上移
if
(
this
.
p_top
>
0
)
{
if
(
this
.
p_top
==
1
)
this
.
p_top
=
0.5
;
this
.
node
.
y
=
nodeY
+
posY
/
2
*
this
.
p_top
}
//动态下移
if
(
this
.
p_bottom
>
0
)
{
if
(
this
.
p_bottom
==
1
)
this
.
p_bottom
=
0.5
;
this
.
node
.
y
=
nodeY
-
posY
/
2
*
this
.
p_bottom
}
}
//长屏幕适配
resizeWidth
()
{
if
(
this
.
resizeScaleX
<=
1.05
)
return
;
let
resizeScaleX
=
this
.
resizeScaleX
;
let
posX
=
this
.
posX
;
let
nodeWidth
=
this
.
nodeWidth
;
let
nodeHeight
=
this
.
nodeHeight
;
let
nodeX
=
this
.
nodeX
;
let
nodeY
=
this
.
nodeY
;
if
(
this
.
debug
==
1
)
{
pg
.
logger
.
d
(
"
断点调试点
"
);
}
//宽度拉伸
if
(
this
.
r_width
==
1
)
{
this
.
node
.
width
=
nodeWidth
*
resizeScaleX
;
}
//高度拉升
if
(
this
.
r_height
==
1
)
{
this
.
node
.
height
=
nodeHeight
*
resizeScaleX
;
//高度拉伸后,图片顶部齐边【坐标下移】 y坐标下移
if
(
this
.
r_top
==
1
)
{
this
.
node
.
y
=
nodeY
-
nodeHeight
*
(
resizeScaleX
-
1
)
/
2
;
}
//高度拉伸后,图片底部齐边【坐标上移】 y坐标上移
if
(
this
.
r_bottom
==
1
)
{
this
.
node
.
y
=
nodeY
+
nodeHeight
*
(
resizeScaleX
-
1
)
/
2
;
}
}
//如果是刘海屏,减去对应的刘海屏的宽度
let
lhpSize
=
{
top
:
0
,
bottom
:
0
};
if
(
!
this
.
noHead
&&
posX
!=
0
)
lhpSize
=
{
top
:
44
*
1.5
,
bottom
:
34
*
1.5
};
//动态左移
if
(
this
.
p_left
==
1
)
{
this
.
node
.
x
=
nodeX
-
posX
/
2
+
lhpSize
.
top
;
}
//动态右移
if
(
this
.
p_right
==
1
)
{
this
.
node
.
x
=
nodeX
+
posX
/
2
-
lhpSize
.
bottom
;
}
}
}
assets/sn19_read/scene/ResizeAuto_sn19_read.ts.meta
0 → 100644
View file @
3b8bf5a6
{
"ver": "1.0.8",
"uuid": "79098fb5-a7de-4cc7-a32f-58ca68556b2b",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/sn19_read/scene/pg_sn19_read.ts
View file @
3b8bf5a6
interface
BlackArea
{
scaleX
:
number
;
scaleY
:
number
;
posX
:
number
;
posY
:
number
;
moveX
:
number
;
moveY
:
number
;
}
class
Screen
{
static
instance
;
static
getIns
():
Screen
{
if
(
!
Screen
.
instance
)
{
Screen
.
instance
=
new
Screen
();
}
return
Screen
.
instance
;
}
winSize
():
cc
.
Size
{
return
cc
.
view
.
getCanvasSize
();
}
designSize
():
cc
.
Size
{
return
cc
.
view
.
getDesignResolutionSize
();
}
winBlackArea
():
BlackArea
{
//0.设计尺寸
let
baseSize
=
cc
.
size
(
this
.
designSize
().
width
,
this
.
designSize
().
height
);
//1.获取屏幕尺寸
// let canvasSize = cc.sys.getSafeAreaRect();
let
canvasSize
=
cc
.
view
.
getCanvasSize
();
//2.将屏幕宽高 以高度对齐的方式 换算出场景 宽度
let
sumSizeW
=
cc
.
size
(
canvasSize
.
width
*
baseSize
.
height
/
canvasSize
.
height
,
baseSize
.
height
)
//3.计算场景宽度与设计宽度比率
let
scaleX
=
sumSizeW
.
width
/
baseSize
.
width
;
//高屏幕适配
if
(
scaleX
<=
1
)
{
let
sumSizeY
=
cc
.
size
(
baseSize
.
width
,
canvasSize
.
height
*
(
baseSize
.
width
/
canvasSize
.
width
))
let
scaleY
=
sumSizeY
.
height
/
baseSize
.
height
;
let
posY
=
sumSizeY
.
height
-
baseSize
.
height
;
return
{
scaleX
:
1
,
posX
:
0
,
moveX
:
0
,
scaleY
:
scaleY
,
posY
:
posY
,
moveY
:
-
posY
/
2
}
}
else
{
let
posX
=
sumSizeW
.
width
-
baseSize
.
width
;
//需要拓展的宽度缩放比
return
{
scaleX
:
scaleX
,
posX
:
posX
,
moveX
:
-
posX
/
2
,
scaleY
:
1
,
posY
:
0
,
moveY
:
0
};
}
}
}
class
Emitter
{
class
Emitter
{
static
instance
;
static
instance
;
static
getInstance
()
{
static
getInstance
()
{
...
@@ -718,6 +778,7 @@ let pg = {
...
@@ -718,6 +778,7 @@ let pg = {
return
event
;
return
event
;
}
}
},
},
screen
:
Screen
.
getIns
(),
event
:
Emitter
.
getInstance
()
event
:
Emitter
.
getInstance
()
};
};
export
default
pg
;
export
default
pg
;
...
...
assets/sn19_read/scene/sn19_read.fire
View file @
3b8bf5a6
...
@@ -427,31 +427,24 @@
...
@@ -427,31 +427,24 @@
"_id": "584qeG0k9IfrhLzNSAoSOF"
"_id": "584qeG0k9IfrhLzNSAoSOF"
},
},
{
{
"__type__": "
cc.Widget
",
"__type__": "
79098+1p95Mx6MvWMpoVWsr
",
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 6
"__id__": 6
},
},
"_enabled": true,
"_enabled": true,
"alignMode": 1,
"r_width": 1,
"_target": null,
"r_height": 1,
"_alignFlags": 45,
"r_top": 1,
"_left": 0,
"r_bottom": 1,
"_right": 0,
"p_left": 0,
"_top": 0,
"p_right": 0,
"_bottom": 0,
"p_top": 0,
"_verticalCenter": 0,
"p_bottom": 0,
"_horizontalCenter": 0,
"noHead": 0,
"_isAbsLeft": true,
"debug": 0,
"_isAbsRight": true,
"_id": "15sIfrQ8pIgJUH+TnoiRem"
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 1920,
"_originalHeight": 1080,
"_id": "d8xDZnDTJJ3b870mrQFPdh"
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
...
...
assets/sn19_read/scene/sn19_read.ts
View file @
3b8bf5a6
...
@@ -58,7 +58,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -58,7 +58,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
public
layer_item_little
:
cc
.
Node
=
null
;
public
layer_item_little
:
cc
.
Node
=
null
;
_cantouch
=
null
;
_cantouch
=
null
;
private
list
:
Array
<
{
rightPlay
,
type
,
text
,
right
,
imgage
,
duration
,
content
,
audio
,
npcAudio
,
npcPlay
}
>
;
private
list
:
Array
<
{
recorded
:
boolean
;
rightPlay
,
type
,
text
,
right
,
imgage
,
duration
,
content
,
audio
,
npcAudio
,
npcPlay
}
>
;
private
recordFlag
:
number
;
//录音模式
private
recordFlag
:
number
;
//录音模式
private
score
:
number
;
private
score
:
number
;
private
scoreList
:
Array
<
number
>
;
private
scoreList
:
Array
<
number
>
;
...
@@ -78,6 +80,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -78,6 +80,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
layers
=
[];
this
.
layers
=
[];
this
.
readyNext
=
false
;
this
.
readyNext
=
false
;
this
.
readyTime
=
99999
;
this
.
readyTime
=
99999
;
this
.
setTotalCount
(
this
.
list
)
}
}
private
layers
:
Array
<
cc
.
Node
>
;
private
layers
:
Array
<
cc
.
Node
>
;
...
@@ -91,8 +94,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -91,8 +94,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
layout_item
.
removeAllChildren
();
this
.
layout_item
.
removeAllChildren
();
}
}
initListener
()
{
initListener
()
{
pg
.
view
.
touchOn
(
this
.
btn_last
,
this
.
preLayer
,
this
);
pg
.
view
.
touchOn
(
this
.
btn_last
,
this
.
lastPage
,
this
);
pg
.
view
.
touchOn
(
this
.
btn_next
,
this
.
next
Layer
,
this
);
pg
.
view
.
touchOn
(
this
.
btn_next
,
this
.
next
Page
,
this
);
pg
.
view
.
touchOn
(
pg
.
view
.
find
(
this
.
btn_record
,
'
bg
'
),
this
.
onTouchRecord
,
this
);
pg
.
view
.
touchOn
(
pg
.
view
.
find
(
this
.
btn_record
,
'
bg
'
),
this
.
onTouchRecord
,
this
);
pg
.
view
.
touchOn
(
this
.
btn_record
,
this
.
onTouchRecord
,
this
);
pg
.
view
.
touchOn
(
this
.
btn_record
,
this
.
onTouchRecord
,
this
);
pg
.
view
.
touchOn
(
this
.
img_npc
,
this
.
onPlayNpc
,
this
);
pg
.
view
.
touchOn
(
this
.
img_npc
,
this
.
onPlayNpc
,
this
);
...
@@ -220,6 +223,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -220,6 +223,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
showRecordHide
()
{
showRecordHide
()
{
this
.
showRecordWaitEnd
();
this
.
showRecordWaitEnd
();
this
.
showRecordEnd
();
this
.
showNpcAudioPlayEnd
();
this
.
readyNext
=
false
;
this
.
readyNext
=
false
;
this
.
readyTime
=
999999
;
this
.
readyTime
=
999999
;
this
.
img_npc
.
active
=
false
;
this
.
img_npc
.
active
=
false
;
...
@@ -270,6 +275,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -270,6 +275,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
private
recordAudioId
:
any
;
private
recordAudioId
:
any
;
async
showRecorAudioPlay
()
{
async
showRecorAudioPlay
()
{
if
(
!
this
.
recordAudio
)
return
;
if
(
!
this
.
recordAudio
)
return
;
this
.
CurrentData
.
recorded
=
true
;
this
.
touchForbid
=
false
this
.
touchForbid
=
false
this
.
readyNext
=
false
;
this
.
readyNext
=
false
;
this
.
readyTime
=
999999
;
this
.
readyTime
=
999999
;
...
@@ -357,6 +363,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -357,6 +363,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
if
(
this
.
CurrentData
.
npcPlay
)
{
if
(
this
.
CurrentData
.
npcPlay
)
{
return
resolve
(
''
);
return
resolve
(
''
);
}
}
if
(
!
this
.
CurrentData
&&
!
this
.
CurrentData
.
npcAudio
)
{
return
resolve
(
''
);
}
this
.
CurrentData
.
npcPlay
=
true
;
this
.
CurrentData
.
npcPlay
=
true
;
this
.
ani_npc
.
active
=
true
;
this
.
ani_npc
.
active
=
true
;
this
.
img_npc
.
active
=
false
;
this
.
img_npc
.
active
=
false
;
...
@@ -372,6 +381,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -372,6 +381,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
});
});
}
}
showNpcAudioPlayEnd
()
{
showNpcAudioPlayEnd
()
{
this
.
ani_npc
.
active
=
false
;
this
.
img_npc
.
active
=
false
;
if
(
this
.
npcAudioId
)
{
if
(
this
.
npcAudioId
)
{
cc
.
audioEngine
.
stopEffect
(
this
.
npcAudioId
)
cc
.
audioEngine
.
stopEffect
(
this
.
npcAudioId
)
this
.
npcAudioId
=
null
;
this
.
npcAudioId
=
null
;
...
@@ -436,7 +447,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -436,7 +447,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
if
(
!
this
.
recording
)
return
;
if
(
!
this
.
recording
)
return
;
this
.
showRecordEnd
();
this
.
showRecordEnd
();
let
testData
=
{
let
testData
=
{
"
text
"
:
"
Yes, there is.Yes, there is.Yes, there is.Yes, there is.Yes, there is.Yes, there is.Yes, there is.
"
,
"
text
"
:
"
"
,
//Yes, there is.Yes, there is.Yes, there is.Yes, there is.Yes, there is.Yes, there is.Yes, there is.
"
audioUrl
"
:
"
https://staging-teach.cdn.ireadabc.com/6ee3ccaa831a884f02c6a75c6f647cb5.wav
"
"
audioUrl
"
:
"
https://staging-teach.cdn.ireadabc.com/6ee3ccaa831a884f02c6a75c6f647cb5.wav
"
}
}
if
(
!
courseware
)
return
this
.
recrodEnd
(
testData
)
if
(
!
courseware
)
return
this
.
recrodEnd
(
testData
)
...
@@ -458,6 +469,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -458,6 +469,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
tip
.
opacity
=
255
;
tip
.
opacity
=
255
;
cc
.
Tween
.
stopAllByTarget
(
tip
)
cc
.
Tween
.
stopAllByTarget
(
tip
)
cc
.
tween
(
tip
).
delay
(
0.8
).
to
(
0.5
,
{
opacity
:
0
}).
start
();
cc
.
tween
(
tip
).
delay
(
0.8
).
to
(
0.5
,
{
opacity
:
0
}).
start
();
this
.
showRecordHide
();
this
.
scheduleOnce
(()
=>
{
this
.
showRecordWait
();
},
0.5
)
return
;
return
;
}
}
this
.
showRecorAudioPlay
();
this
.
showRecorAudioPlay
();
...
@@ -536,39 +551,94 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -536,39 +551,94 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
startGame
();
this
.
startGame
();
}
}
// sendData() {
// return new Promise(res => {
// if (!cc.find('middleLayer')) return;
// let upData: any = {
// word_count: this.data.word_count || 0,
// sentence_count: this.data.sentence_count || 0,
// zi_count: this.data.zi_count || 0,
// score: this.score,
// };
// let recordList = pg.hw.getRecord();
// if (recordList && recordList.length > 0) {
// upData.recordList = recordList
// }
// const middleLayer = cc.find('middleLayer').getComponent('middleLayer');
// console.log('upload->' + JSON.stringify(upData))
// middleLayer.onHomeworkFinish(upData, () => {
// res('');
// })
// })
// }
// gameOver() {
// console.warn("gameOver")
// this.sendData().then(() => {
// })
// this.scheduleOnce(() => {
// pg.event.once('layer_ending_touch_replay', () => {
// this.replay();
// })
// if (!cc.find('middleLayer')) return;
// const middleLayer = cc.find('middleLayer').getComponent('middleLayer');
// middleLayer.saveGolds(this.score); // 保存金币数量;num 是获得金币的数量,数字类型;
// middleLayer.goNextPage(); // 跳转到下一页
// }, 0.5)
// }
private
rightCount
:
number
;
private
errorCount
:
number
;
private
totalCount
:
number
;
addRightCount
()
{
if
(
!
this
.
rightCount
)
this
.
rightCount
=
0
;
this
.
rightCount
++
;
}
addErrorCount
()
{
if
(
!
this
.
errorCount
)
this
.
errorCount
=
0
;
this
.
errorCount
++
;
}
setTotalCount
(
val
)
{
this
.
totalCount
=
val
;
}
sendData
()
{
sendData
()
{
return
new
Promise
(
res
=>
{
return
new
Promise
(
res
=>
{
if
(
!
cc
.
find
(
'
middleLayer
'
))
return
;
if
(
!
this
.
totalCount
)
this
.
totalCount
=
this
.
rightCount
+
this
.
errorCount
;
if
(
!
this
.
totalCount
)
console
.
error
(
'
未设置总计数
'
);
if
(
this
.
totalCount
&&
!
this
.
rightCount
&&
!
this
.
errorCount
)
{
this
.
rightCount
=
this
.
totalCount
;
this
.
errorCount
=
0
;
}
let
upData
:
any
=
{
let
upData
:
any
=
{
word_count
:
this
.
data
.
word_count
||
0
,
right_count
:
this
.
rightCount
||
0
,
sentence_count
:
this
.
data
.
sentence_count
||
0
,
wrong_count
:
this
.
errorCount
||
0
,
zi_count
:
this
.
data
.
zi_count
||
0
,
total_count
:
this
.
totalCount
||
0
,
score
:
this
.
score
,
};
};
upData
.
score
=
upData
.
right_count
||
0
;
let
recordList
=
pg
.
hw
.
getRecord
();
let
recordList
=
pg
.
hw
.
getRecord
();
if
(
recordList
&&
recordList
.
length
>
0
)
{
if
(
recordList
&&
recordList
.
length
>
0
)
{
upData
.
re
cordLis
t
=
recordList
upData
.
re
sul
t
=
recordList
}
}
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
).
getComponent
(
'
middleLayer
'
);
console
.
log
(
'
upload->
'
+
JSON
.
stringify
(
upData
))
console
.
log
(
'
upload->
'
+
JSON
.
stringify
(
upData
))
if
(
!
cc
.
find
(
'
middleLayer
'
))
return
;
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
).
getComponent
(
'
middleLayer
'
);
middleLayer
.
onHomeworkFinish
(
upData
,
()
=>
{
middleLayer
.
onHomeworkFinish
(
upData
,
()
=>
{
res
(
''
);
res
(
''
);
})
})
})
})
}
}
gameOver
()
{
gameOver
()
{
console
.
warn
(
"
gameOver
"
)
this
.
sendData
().
then
(()
=>
{
this
.
sendData
().
then
(()
=>
{
})
this
.
scheduleOnce
(()
=>
{
pg
.
event
.
once
(
'
layer_ending_touch_replay
'
,
()
=>
{
this
.
replay
();
})
if
(
!
cc
.
find
(
'
middleLayer
'
))
return
;
if
(
!
cc
.
find
(
'
middleLayer
'
))
return
;
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
).
getComponent
(
'
middleLayer
'
);
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
middleLayer
.
saveGolds
(
this
.
score
);
// 保存金币数量;num 是获得金币的数量,数字类型;
if
(
middleLayer
)
{
middleLayer
.
goNextPage
();
// 跳转到下一页
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
},
0.5
)
middleLayerComponent
.
goNextPage
();
return
;
}
else
{
console
.
log
(
"
[onFinish] middleLayer not found
"
)
}
})
}
}
createLayer
()
{
createLayer
()
{
...
@@ -595,6 +665,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -595,6 +665,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
updateLayer
(
layer
,
data
,
i
)
{
updateLayer
(
layer
,
data
,
i
)
{
if
(
!
layer
||
!
data
)
return
;
if
(
!
layer
||
!
data
)
return
;
if
(
!
pg
.
view
.
find
(
layer
,
"
btn_voice
"
))
return
;
// 根据数据来渲染
// 根据数据来渲染
let
label_round
=
pg
.
view
.
find
(
layer
,
'
label_round
'
)
let
label_round
=
pg
.
view
.
find
(
layer
,
'
label_round
'
)
let
itemBg1
=
pg
.
view
.
find
(
layer
,
'
bg_1
'
)
let
itemBg1
=
pg
.
view
.
find
(
layer
,
'
bg_1
'
)
...
@@ -648,16 +719,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -648,16 +719,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
move
=
touchPoint
.
clone
().
subtract
(
startPoint
);
let
move
=
touchPoint
.
clone
().
subtract
(
startPoint
);
console
.
log
(
move
.
toString
());
console
.
log
(
move
.
toString
());
if
(
move
.
x
<
-
10
)
{
if
(
move
.
x
<
-
10
)
{
this
.
touchForbid
=
true
;
console
.
log
(
"
nextPage
"
)
console
.
log
(
"
nextPage
"
)
this
.
nextPage
();
this
.
nextPage
();
}
else
if
(
move
.
x
>
10
)
{
}
else
if
(
move
.
x
>
10
)
{
this
.
touchForbid
=
true
;
console
.
log
(
"
lastPage
"
)
console
.
log
(
"
lastPage
"
)
this
.
lastPage
();
this
.
lastPage
();
}
}
}
}
lastPage
()
{
lastPage
()
{
if
(
this
.
touchForbid
)
return
;
this
.
touchForbid
=
true
;
if
(
!
this
.
LastData
)
{
if
(
!
this
.
LastData
)
{
this
.
scheduleOnce
(()
=>
{
this
.
scheduleOnce
(()
=>
{
this
.
touchForbid
=
false
;
this
.
touchForbid
=
false
;
...
@@ -670,7 +741,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -670,7 +741,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc
.
tween
(
tip
).
delay
(
0.8
).
to
(
0.5
,
{
opacity
:
0
}).
start
();
cc
.
tween
(
tip
).
delay
(
0.8
).
to
(
0.5
,
{
opacity
:
0
}).
start
();
return
;
return
;
}
}
if
(
this
.
recording
)
{
if
(
this
.
recording
||
!
this
.
CurrentData
.
recorded
)
{
this
.
scheduleOnce
(()
=>
{
this
.
scheduleOnce
(()
=>
{
this
.
touchForbid
=
false
;
this
.
touchForbid
=
false
;
},
0.1
)
},
0.1
)
...
@@ -688,6 +759,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -688,6 +759,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
preLayer
();
this
.
preLayer
();
}
}
nextPage
()
{
nextPage
()
{
if
(
this
.
touchForbid
)
return
;
this
.
touchForbid
=
true
;
if
(
!
this
.
NextData
)
{
if
(
!
this
.
NextData
)
{
this
.
scheduleOnce
(()
=>
{
this
.
scheduleOnce
(()
=>
{
this
.
touchForbid
=
false
;
this
.
touchForbid
=
false
;
...
@@ -700,7 +773,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -700,7 +773,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc
.
tween
(
tip
).
delay
(
0.8
).
to
(
0.5
,
{
opacity
:
0
}).
start
();
cc
.
tween
(
tip
).
delay
(
0.8
).
to
(
0.5
,
{
opacity
:
0
}).
start
();
return
;
return
;
}
}
if
(
this
.
recording
)
{
if
(
this
.
recording
||
!
this
.
CurrentData
.
recorded
)
{
this
.
scheduleOnce
(()
=>
{
this
.
scheduleOnce
(()
=>
{
this
.
touchForbid
=
false
;
this
.
touchForbid
=
false
;
},
0.1
)
},
0.1
)
...
...
assets/sn19_read/script/defaultData_sn19_read.ts
View file @
3b8bf5a6
...
@@ -28,7 +28,11 @@ export const defaultData =
...
@@ -28,7 +28,11 @@ export const defaultData =
npcAudio
:
"
http://staging-teach.cdn.ireadabc.com/7f617b30a5eb2a090234920500f9c7ce_l.mp3
"
,
npcAudio
:
"
http://staging-teach.cdn.ireadabc.com/7f617b30a5eb2a090234920500f9c7ce_l.mp3
"
,
npcAudioName
:
"
right_sn17_danci.mp3
"
npcAudioName
:
"
right_sn17_danci.mp3
"
},
{
},
{
"
type
"
:
"
img_txt_audio
"
,
"
imageBig
"
:
1
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/ef1e6f871b37ad482e268809e91d20b7.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/5f4e4c72671607bb35d1ecd1d291f238_l.mp3
"
,
"
text
"
:
""
,
"
duration
"
:
10
,
"
content
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
excellent_dg10_ty.mp3
"
"
type
"
:
"
img_txt_audio
"
,
"
imageBig
"
:
1
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/ef1e6f871b37ad482e268809e91d20b7.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/5f4e4c72671607bb35d1ecd1d291f238_l.mp3
"
,
"
text
"
:
""
,
"
duration
"
:
10
,
"
content
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
excellent_dg10_ty.mp3
"
}]
}]
}],
}],
"
bgAudio
"
:
""
,
"
bgAudioName
"
:
""
,
"
audioName
"
:
""
,
"
npcTitle
"
:
"
test
"
,
"
bgAudio
"
:
""
,
"
bgAudioName
"
:
""
,
"
audioName
"
:
""
,
"
npcTitle
"
:
"
test
"
,
...
...
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