Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MRBR04
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
MRBR04
Commits
c353b819
Commit
c353b819
authored
Apr 27, 2022
by
yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图片调整
parent
8a86a238
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
774 additions
and
478 deletions
+774
-478
cocos_generator.fire
assets/cocos_generator/scene/cocos_generator.fire
+565
-385
cocos_generator.ts
assets/cocos_generator/scene/cocos_generator.ts
+51
-18
defaultData.ts
assets/cocos_generator/script/defaultData.ts
+158
-75
No files found.
assets/cocos_generator/scene/cocos_generator.fire
View file @
c353b819
This diff is collapsed.
Click to expand it.
assets/cocos_generator/scene/cocos_generator.ts
View file @
c353b819
...
@@ -53,7 +53,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -53,7 +53,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
ani_flower
=
cc
.
find
(
"
particle_star
"
,
this
.
node
);
this
.
ani_flower
=
cc
.
find
(
"
particle_star
"
,
this
.
node
);
this
.
rightClip
=
cc
.
find
(
'
Canvas/res/audio/right
'
).
getComponent
(
cc
.
AudioSource
).
clip
;
this
.
rightClip
=
cc
.
find
(
'
Canvas/res/audio/right
'
).
getComponent
(
cc
.
AudioSource
).
clip
;
this
.
wrongClip
=
cc
.
find
(
'
Canvas/res/audio/wrong
'
).
getComponent
(
cc
.
AudioSource
).
clip
;
this
.
wrongClip
=
cc
.
find
(
'
Canvas/res/audio/wrong
'
).
getComponent
(
cc
.
AudioSource
).
clip
;
pg
.
event
.
emit
(
"
mouse_num
"
,
1
);
pg
.
event
.
emit
(
"
mouse_num
"
,
this
.
data
.
item
.
group
.
length
);
this
.
updateRound
();
this
.
updateRound
();
this
.
showGame
();
this
.
showGame
();
...
@@ -254,8 +254,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -254,8 +254,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
private
updateRound
()
{
private
updateRound
()
{
let
label_round
=
cc
.
find
(
"
bg/page/lable
"
,
this
.
node
);
let
label_round
=
cc
.
find
(
"
bg/page/lable
"
,
this
.
node
);
// label_round.getComponent(cc.Label).string = (this._drawIndex + 1)
+ "/" + this.data.item.group.length;
label_round
.
getComponent
(
cc
.
Label
).
string
=
this
.
_drawIndex
+
"
/
"
+
this
.
data
.
item
.
group
.
length
;
label_round
.
getComponent
(
cc
.
Label
).
string
=
"
1/1
"
;
//
label_round.getComponent(cc.Label).string = "1/1";
}
}
private
showGame
()
{
private
showGame
()
{
...
@@ -288,6 +288,29 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -288,6 +288,29 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
return
item
;
return
item
;
}
}
private
getHeadSize
(
type
)
{
let
size
=
{};
if
(
this
.
upArr
.
length
==
5
)
{
if
(
type
==
1
)
{
size
=
{
w
:
50
,
h
:
50
}
}
else
{
size
=
{
w
:
400
,
h
:
60
}
}
}
else
if
(
this
.
upArr
.
length
==
4
)
{
if
(
type
==
1
)
{
size
=
{
w
:
90
,
h
:
90
}
}
else
{
size
=
{
w
:
255
,
h
:
80
}
}
}
else
if
(
this
.
upArr
.
length
==
3
)
{
if
(
type
==
1
)
{
size
=
{
w
:
120
,
h
:
115
}
}
else
{
size
=
{
w
:
255
,
h
:
120
}
}
}
return
size
;
}
private
showLayout
()
{
private
showLayout
()
{
let
data
=
this
.
data
.
item
.
group
;
let
data
=
this
.
data
.
item
.
group
;
let
lift
=
cc
.
find
(
"
lift
"
,
this
.
node
);
let
lift
=
cc
.
find
(
"
lift
"
,
this
.
node
);
...
@@ -298,20 +321,28 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -298,20 +321,28 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
upArr
.
forEach
((
item
)
=>
{
this
.
upArr
.
forEach
((
item
)
=>
{
if
(
item
.
type
==
1
)
{
if
(
item
.
type
==
1
)
{
let
textItem
=
this
.
getItemNode
(
1
);
let
textItem
=
this
.
getItemNode
(
1
);
this
.
initTextItem
(
textItem
,
item
);
let
size
=
this
.
getHeadSize
(
1
);
this
.
initTextItem
(
textItem
,
item
,
1
);
textItem
.
parent
=
lift
;
}
else
if
(
item
.
type
==
0
)
{
let
textItem
=
this
.
getItemNode
(
1
);
let
size
=
this
.
getHeadSize
(
1
);
this
.
initPicItem
(
textItem
,
item
,
size
);
textItem
.
parent
=
lift
;
textItem
.
parent
=
lift
;
}
else
if
(
item
.
type
==
2
)
{
this
.
initPicItem
(
item
,
lift
);
}
}
});
});
this
.
downArr
.
forEach
((
item
)
=>
{
this
.
downArr
.
forEach
((
item
)
=>
{
if
(
item
.
type
==
1
)
{
if
(
item
.
type
==
1
)
{
let
textItem
=
this
.
getItemNode
(
2
);
let
textItem
=
this
.
getItemNode
(
2
);
let
size
=
this
.
getHeadSize
(
2
);
this
.
initTextItem
(
textItem
,
item
);
this
.
initTextItem
(
textItem
,
item
);
textItem
.
parent
=
right
;
textItem
.
parent
=
right
;
}
else
if
(
item
.
type
==
2
)
{
}
else
if
(
item
.
type
==
0
)
{
this
.
initPicItem
(
item
,
right
);
let
textItem
=
this
.
getItemNode
(
2
);
let
size
=
this
.
getHeadSize
(
2
);
this
.
initPicItem
(
textItem
,
item
,
size
);
textItem
.
parent
=
right
;
}
}
});
});
}
}
...
@@ -350,12 +381,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -350,12 +381,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
}
}
private
initTextItem
(
item
,
data
)
{
private
initTextItem
(
item
,
data
,
type
=
2
)
{
item
.
data
=
data
;
item
.
data
=
data
;
let
img_laba02
=
item
.
getChildByName
(
"
img_close
"
);
let
img_laba02
=
item
.
getChildByName
(
"
img_close
"
);
let
desc
=
item
.
getChildByName
(
"
desc
"
);
let
desc
=
item
.
getChildByName
(
"
desc
"
);
desc
.
getComponent
(
cc
.
Label
).
string
=
data
.
text
;
desc
.
getComponent
(
cc
.
Label
).
string
=
data
.
text
;
if
(
type
==
1
&&
item
.
width
-
desc
.
width
>
10
)
{
setTimeout
(()
=>
{
item
.
width
=
desc
.
width
+
30
;
},
30
);
}
item
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
()
=>
{
item
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
()
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
checkLing
();
this
.
checkLing
();
...
@@ -372,16 +407,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -372,16 +407,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
item
.
x
=
0
;
item
.
x
=
0
;
}
}
private
initPicItem
(
data
,
content
)
{
private
initPicItem
(
item
,
data
,
size
)
{
let
item
;
item
=
cc
.
instantiate
(
cc
.
find
(
"
items/type4
"
,
this
.
node
));
item
.
data
=
data
;
item
.
data
=
data
;
let
img_laba02
=
item
.
getChildByName
(
"
img_close
"
);
let
img_laba02
=
item
.
getChildByName
(
"
img_close
"
);
let
desc
=
item
.
getChildByName
(
"
desc
"
);
let
desc
=
item
.
getChildByName
(
"
desc
"
);
let
head
=
item
.
getChildByName
(
"
head
"
);
let
head
=
item
.
getChildByName
(
"
head
"
);
pg
.
view
.
setNetImg
(
head
,
data
.
pic_url
,
{
w
:
145
,
h
:
125
}
);
pg
.
view
.
setNetImg
(
head
,
data
.
pic_url
,
size
);
if
(
desc
)
desc
.
getComponent
(
cc
.
Label
).
string
=
data
.
text
;
//
if (desc) desc.getComponent(cc.Label).string = data.text;
item
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
()
=>
{
item
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
()
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -396,8 +429,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -396,8 +429,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
item
.
audioClip
=
audioClip
;
item
.
audioClip
=
audioClip
;
});
});
}
}
item
.
y
=
0
;
item
.
x
=
0
;
item
.
parent
=
content
;
}
}
private
checkLing
()
{
private
checkLing
()
{
...
@@ -507,8 +539,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -507,8 +539,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
30
30
);
);
this
.
_drawIndex
++
;
this
.
_drawIndex
++
;
this
.
updateRound
();
pg
.
event
.
emit
(
"
mouse_add
"
);
if
(
this
.
_drawIndex
>=
this
.
data
.
item
.
group
.
length
)
{
if
(
this
.
_drawIndex
>=
this
.
data
.
item
.
group
.
length
)
{
pg
.
event
.
emit
(
"
mouse_add
"
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
let
mouse_end
=
pg
.
view
.
find
(
this
,
"
mouse_end
"
);
let
mouse_end
=
pg
.
view
.
find
(
this
,
"
mouse_end
"
);
mouse_end
.
active
=
true
;
mouse_end
.
active
=
true
;
...
...
assets/cocos_generator/script/defaultData.ts
View file @
c353b819
...
@@ -4,83 +4,166 @@
...
@@ -4,83 +4,166 @@
// "text": "This is a test label.",
// "text": "This is a test label.",
// "audio_url": "http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3"
// "audio_url": "http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3"
// }
// }
export
const
defaultData
=
{
export
const
defaultData
=
{
"
aniEnter
"
:
{
"
aniEnter
"
:
{
"
skeJsonData
"
:
{},
"
skeJsonData
"
:
{},
"
texJsonData
"
:
{},
"
texJsonData
"
:
{},
"
texPngData
"
:
{},
"
texPngData
"
:
{},
"
audioUrl
"
:
"
http://staging-teach.cdn.ireadabc.com/526624b47ba5e46f698add9e152a4b4e.mp3
"
,
"
audioUrl
"
:
null
,
"
time
"
:
1
"
time
"
:
1
},
},
"
item
"
:
{
"
item
"
:
{
"
group
"
:
[{
"
group
"
:
[{
"
up
"
:
{
"
up
"
:
{
"
type
"
:
1
,
"
type
"
:
1
,
"
pic_url
"
:
""
,
"
pic_url
"
:
""
,
"
text
"
:
"
1
"
,
"
text
"
:
"
1fdshkdshfksdhkfhdskdsk
"
,
"
audio_url
"
:
""
"
audio_url
"
:
""
},
},
"
down
"
:
{
"
down
"
:
{
"
type
"
:
1
,
"
type
"
:
1
,
"
pic_url
"
:
""
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/6689e11c1646fba838a51c212b7770d2.png
"
,
"
text
"
:
"
第三位发送到
"
,
"
text
"
:
"
第三位发送到
"
,
"
audio_url
"
:
""
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/71348a317c47ec2a0b3056b0d7ca2e99.mp3
"
}
}
},
{
},
{
"
up
"
:
{
"
up
"
:
{
"
type
"
:
1
,
"
type
"
:
0
,
"
pic_url
"
:
""
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/e359730cf593c396a58e020333026fac.png
"
,
"
text
"
:
"
2
"
,
"
text
"
:
"
2
"
,
"
audio_url
"
:
""
"
audio_url
"
:
""
},
},
"
down
"
:
{
"
down
"
:
{
"
type
"
:
1
,
"
type
"
:
1
,
"
pic_url
"
:
""
,
"
pic_url
"
:
""
,
"
text
"
:
"
4534543
"
,
"
text
"
:
"
4534543
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/526624b47ba5e46f698add9e152a4b4e.mp3
"
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/526624b47ba5e46f698add9e152a4b4e.mp3
"
}
}
},
{
},
{
"
up
"
:
{
"
up
"
:
{
"
type
"
:
1
,
"
type
"
:
0
,
"
pic_url
"
:
""
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/bcc13bb8f504b17ee9d07d8f5204b12f.png
"
,
"
text
"
:
"
3
"
,
"
text
"
:
"
2
"
,
"
audio_url
"
:
""
"
audio_url
"
:
""
},
},
"
down
"
:
{
"
down
"
:
{
"
type
"
:
1
,
"
type
"
:
1
,
"
pic_url
"
:
""
,
"
pic_url
"
:
""
,
"
text
"
:
"
萨大师赛所
"
,
"
text
"
:
"
萨大师赛所
"
,
"
audio_url
"
:
""
"
audio_url
"
:
""
}
}
},
{
},
"
up
"
:
{
// {
"
type
"
:
1
,
// "up": {
"
pic_url
"
:
""
,
// "type": 0,
"
text
"
:
"
4
"
,
// "pic_url": "http://staging-teach.cdn.ireadabc.com/b84efeac2d0bc3f32f1dffb6734aeea6.png",
"
audio_url
"
:
""
// "text": "4",
},
// "audio_url": ""
"
down
"
:
{
// },
"
type
"
:
1
,
// "down": {
"
pic_url
"
:
""
,
// "type": 1,
"
text
"
:
"
那边不谷歌包
"
,
// "pic_url": "",
"
audio_url
"
:
""
// "text": "那边不谷歌包",
}
// "audio_url": "http://staging-teach.cdn.ireadabc.com/9df3f14bc88bcffc49b6717c40428ed8.mp3"
},
{
// }
"
up
"
:
{
// },
"
type
"
:
1
,
// {
"
pic_url
"
:
""
,
// "up": {
"
text
"
:
"
5
"
,
// "type": 0,
"
audio_url
"
:
""
// "pic_url": "http://staging-teach.cdn.ireadabc.com/ce43980b533f674f9debe6ce9cae7b8d.png",
},
// "text": "5",
"
down
"
:
{
// "audio_url": ""
"
type
"
:
1
,
// },
"
pic_url
"
:
""
,
// "down": {
"
text
"
:
"
5345344343
"
,
// "type": 1,
"
audio_url
"
:
""
// "pic_url": "",
}
// "text": "5345344343",
}
// "audio_url": ""
],
// }
"
title
"
:
"
电话客服劵花费
"
,
// }
"
audio_title
"
:
"
http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610.mp3
"
],
"
title
"
:
"
电话客服劵花费
"
,
"
audio_title
"
:
"
http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610.mp3
"
}
}
}
}
// {
// "aniEnter": {
// "skeJsonData": {},
// "texJsonData": {},
// "texPngData": {},
// "audioUrl": "http://staging-teach.cdn.ireadabc.com/526624b47ba5e46f698add9e152a4b4e.mp3",
// "time": 1
// },
// "item": {
// "group": [{
// "up": {
// "type": 1,
// "pic_url": "",
// "text": "1",
// "audio_url": ""
// },
// "down": {
// "type": 1,
// "pic_url": "",
// "text": "第三位发送到",
// "audio_url": ""
// }
// }, {
// "up": {
// "type": 1,
// "pic_url": "",
// "text": "2",
// "audio_url": ""
// },
// "down": {
// "type": 1,
// "pic_url": "",
// "text": "4534543",
// "audio_url": "http://staging-teach.cdn.ireadabc.com/526624b47ba5e46f698add9e152a4b4e.mp3"
// }
// }, {
// "up": {
// "type": 1,
// "pic_url": "",
// "text": "3",
// "audio_url": ""
// },
// "down": {
// "type": 1,
// "pic_url": "",
// "text": "萨大师赛所",
// "audio_url": ""
// }
// }, {
// "up": {
// "type": 1,
// "pic_url": "",
// "text": "4",
// "audio_url": ""
// },
// "down": {
// "type": 1,
// "pic_url": "",
// "text": "那边不谷歌包",
// "audio_url": ""
// }
// }, {
// "up": {
// "type": 1,
// "pic_url": "",
// "text": "5",
// "audio_url": ""
// },
// "down": {
// "type": 1,
// "pic_url": "",
// "text": "5345344343",
// "audio_url": ""
// }
// }
// ],
// "title": "电话客服劵花费",
// "audio_title": "http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610.mp3"
// }
// }
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