Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
APP02001
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
APP02001
Commits
bbe9220d
Commit
bbe9220d
authored
Dec 26, 2022
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 兼容多剧本
parent
914e24ee
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
240 additions
and
492 deletions
+240
-492
APP02001.fire
assets/APP02001/scene/APP02001.fire
+215
-429
APP02001.ts
assets/APP02001/scene/APP02001.ts
+1
-6
page1.ts
assets/APP02001/scene/page1.ts
+15
-6
defaultData.ts
assets/APP02001/script/defaultData.ts
+9
-51
No files found.
assets/APP02001/scene/APP02001.fire
View file @
bbe9220d
This diff is collapsed.
Click to expand it.
assets/APP02001/scene/APP02001.ts
View file @
bbe9220d
...
...
@@ -8,13 +8,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
addPreloadImage
()
{
// TODO 根据自己的配置预加载图片资源
this
.
_imageResList
.
push
({
url
:
this
.
data
.
pic_url
});
this
.
_imageResList
.
push
({
url
:
this
.
data
.
pic_url_2
});
}
addPreloadAudio
()
{
// TODO 根据自己的配置预加载音频资源
this
.
_audioResList
.
push
({
url
:
this
.
data
.
audio_url
});
}
addPreloadAnima
()
{
...
...
@@ -52,10 +49,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
});
}
toPage1
(
testData
=
null
)
{
testData
=
{
left
:
this
.
data
.
left
,
right
:
this
.
data
.
right
};
this
.
page1
.
active
=
true
;
this
.
page1
.
getComponent
(
'
page1
'
).
setData
(
t
estD
ata
)
this
.
page1
.
getComponent
(
'
page1
'
).
setData
(
t
his
.
d
ata
)
}
playLocalAudio
(
audioName
)
{
...
...
assets/APP02001/scene/page1.ts
View file @
bbe9220d
...
...
@@ -12,7 +12,7 @@ export default class NewClass extends cc.Component {
private
list
:
Array
<
{
img
,
name
,
id
}
>
;
//TODO:入口方法
public
setData
(
val
)
{
this
.
list
=
[
val
.
left
,
val
.
right
]
;
this
.
list
=
val
;
this
.
initView
();
}
//TODO:点击事件
...
...
@@ -25,14 +25,25 @@ export default class NewClass extends cc.Component {
}
private
layout
:
cc
.
Node
;
private
item
:
cc
.
Node
;
onLoad
()
{
this
.
item
=
this
.
node
.
getChildByName
(
"
item
"
);
this
.
item
.
active
=
false
;
this
.
layout
=
this
.
node
.
getChildByName
(
"
layout
"
);
}
initView
()
{
let
children
=
this
.
layout
.
children
;
this
.
list
.
forEach
((
data
,
index
)
=>
{
let
item
=
children
[
index
];
if
(
this
.
list
.
length
<
3
)
{
this
.
layout
=
this
.
node
.
getChildByName
(
"
layout
"
);
this
.
layout
.
width
=
this
.
list
.
length
==
2
?
880
:
440
;
}
else
{
let
scrollview
=
this
.
node
.
getChildByName
(
"
scrollview
"
);
let
view
=
scrollview
.
getChildByName
(
"
view
"
);
this
.
layout
=
view
.
getChildByName
(
"
content
"
);
}
this
.
list
.
forEach
((
data
)
=>
{
let
item
=
cc
.
instantiate
(
this
.
item
);
this
.
updateItem
(
item
,
data
);
this
.
layout
.
addChild
(
item
)
})
}
updateItem
(
item
:
any
,
data
)
{
...
...
@@ -45,8 +56,6 @@ export default class NewClass extends cc.Component {
title
.
getComponent
(
cc
.
Label
).
string
=
data
.
name
;
item
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onTouchItem
,
this
);
}
setNetImg
(
item
,
url
,
{
w
,
h
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
!
item
)
return
console
.
log
(
"
图片更换失败,传入了错误的item
"
);
...
...
assets/APP02001/script/defaultData.ts
View file @
bbe9220d
// 新剧本地图页
export
const
defaultData
=
{
//左右两个
left
:
{
export
const
defaultData
=
[
{
img
:
'
http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg
'
,
name
:
'
小红帽历险记
'
,
id
:
1234
,
},
right
:
{
},{
img
:
'
http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg
'
,
name
:
'
大红帽历险记
'
,
id
:
1235
,
},
//固定3个
eventList
:
[{
},{
img
:
'
http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg
'
,
name
:
'
小红帽历险记
'
,
totalIcon
:
0
,
locked
:
false
,
id
:
1234
,
},
{
img
:
'
http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg
'
,
name
:
'
中红帽历险记
'
,
totalIcon
:
100
,
locked
:
false
,
name
:
'
三红帽历险记
'
,
id
:
1235
,
},
{
img
:
'
http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg
'
,
name
:
'
大红帽历险记
'
,
totalIcon
:
100
,
locked
:
true
,
id
:
1236
,
}],
//游戏列表
gameList
:
[{
},{
img
:
'
http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg
'
,
name
:
'
小红帽历险记1
'
,
locked
:
false
,
id
:
1231
,
},
{
img
:
'
http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg
'
,
name
:
'
小红帽历险记2
'
,
locked
:
false
,
id
:
1232
,
},
{
img
:
'
http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg
'
,
name
:
'
小红帽历险记3
'
,
locked
:
false
,
id
:
1233
,
},
{
img
:
'
http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg
'
,
name
:
'
小红帽历险记4
'
,
locked
:
false
,
id
:
1234
,
},
{
img
:
'
http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg
'
,
name
:
'
小红帽历险记5
'
,
locked
:
false
,
name
:
'
四红帽历险记
'
,
id
:
1235
,
}],
}
},
]
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