Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dfzx_cocos_trace_letter
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
dfzx_cocos_trace_letter
Commits
c3534108
Commit
c3534108
authored
Jun 11, 2021
by
LMZ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加星组件
parent
ed971814
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
2421 additions
and
1383 deletions
+2421
-1383
prefab.meta
play/assets/ET_07/prefab.meta
+12
-0
icon_bigstar.png
play/assets/ET_07/prefab/icon_bigstar.png
+0
-0
icon_bigstar.png.meta
play/assets/ET_07/prefab/icon_bigstar.png.meta
+36
-0
star.js
play/assets/ET_07/prefab/star.js
+189
-0
star.js.meta
play/assets/ET_07/prefab/star.js.meta
+9
-0
star.png
play/assets/ET_07/prefab/star.png
+0
-0
star.png.meta
play/assets/ET_07/prefab/star.png.meta
+36
-0
star_bg.png
play/assets/ET_07/prefab/star_bg.png
+0
-0
star_bg.png.meta
play/assets/ET_07/prefab/star_bg.png.meta
+36
-0
ET_07.fire
play/assets/ET_07/scene/ET_07.fire
+1974
-1378
ET_07.js
play/assets/ET_07/scene/ET_07.js
+128
-4
services.json
play/settings/services.json
+1
-1
No files found.
play/assets/ET_07/prefab.meta
0 → 100644
View file @
c3534108
{
"ver": "1.1.2",
"uuid": "d71fec49-d10a-4ab0-83ba-566cb24eb864",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
play/assets/ET_07/prefab/icon_bigstar.png
0 → 100644
View file @
c3534108
14.5 KB
play/assets/ET_07/prefab/icon_bigstar.png.meta
0 → 100644
View file @
c3534108
{
"ver": "2.3.5",
"uuid": "4299270d-b4f6-4303-84e8-fddac2429500",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 278,
"height": 275,
"platformSettings": {},
"subMetas": {
"icon_bigstar": {
"ver": "1.0.4",
"uuid": "ccd63de1-62c7-436e-a540-e4a1522afb37",
"rawTextureUuid": "4299270d-b4f6-4303-84e8-fddac2429500",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 278,
"height": 275,
"rawWidth": 278,
"rawHeight": 275,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
play/assets/ET_07/prefab/star.js
0 → 100644
View file @
c3534108
// Learn cc.Class:
// - https://docs.cocos.com/creator/manual/en/scripting/class.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
{
getSprNode
}
from
"
../script/util
"
;
cc
.
Class
({
extends
:
cc
.
Component
,
properties
:
{
context
:
{
set
:
function
(
ctx
)
{
this
.
_ctx
=
ctx
;
},
},
count
:
{
set
:
function
(
count
)
{
this
.
_count
=
count
;
this
.
setStarCount
();
},
}
// foo: {
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start
()
{
},
setStarCount
()
{
console
.
log
(
'
set Star Count
'
);
let
disH
=
80
;
// let disScale = 1;
// if (this._count > 5) {
// disH = (400 / gArr.length);
// disScale = 5 / gArr.length;
// }
for
(
let
i
=
0
;
i
<
this
.
_count
;
i
++
)
{
const
starBg
=
this
.
getSprNode
(
"
img/star_bg
"
)
starBg
.
y
=
-
i
*
disH
;
this
.
node
.
addChild
(
starBg
);
}
},
setContext
(
ctx
)
{
},
getSprNode
(
resName
)
{
const
sf
=
cc
.
find
(
resName
,
this
.
node
).
getComponent
(
cc
.
Sprite
).
spriteFrame
;
const
node
=
new
cc
.
Node
();
node
.
addComponent
(
cc
.
Sprite
).
spriteFrame
=
sf
;
return
node
;
},
bigStarArr
:
null
,
initStar
()
{
const
gArr
=
this
.
data
.
groupArr
;
if
(
gArr
.
length
<=
1
)
{
return
;
}
this
.
cleanStar
();
this
.
bigStarArr
=
[];
let
baseX
=
this
.
canvas
.
width
/
2
-
80
*
this
.
_mapScaleMin
;
let
baseY
=
this
.
canvas
.
height
/
2
-
80
*
this
.
_mapScaleMin
;
let
disH
=
80
*
this
.
_mapScaleMin
;
let
disScale
=
1
;
if
(
gArr
.
length
>
5
)
{
disH
=
(
400
/
gArr
.
length
)
*
this
.
_mapScaleMin
;
disScale
=
5
/
gArr
.
length
;
}
for
(
let
i
=
0
;
i
<
gArr
.
length
;
i
++
)
{
const
starBg
=
getSprNode
(
'
star_bg
'
);
this
.
canvas
.
addChild
(
starBg
,
10
);
starBg
.
x
=
baseX
;
starBg
.
y
=
baseY
-
i
*
disH
;
starBg
.
scale
=
disScale
;
const
starTop
=
getSprNode
(
'
star
'
);
starBg
.
addChild
(
starTop
);
starTop
.
active
=
false
;
starBg
.
star
=
starTop
;
const
starBig
=
getSprNode
(
'
icon_bigstar
'
);
starTop
.
addChild
(
starBig
);
starBig
.
angle
=
-
90
;
starBg
.
starBig
=
starBig
;
this
.
bigStarArr
.
push
(
starBg
);
}
console
.
log
(
"
bigStarArr:
"
,
this
.
bigStarArr
);
},
cleanStar
()
{
if
(
this
.
bigStarArr
&&
this
.
bigStarArr
.
length
>
0
)
{
for
(
let
i
=
0
;
i
<
this
.
bigStarArr
.
length
;
i
++
)
{
this
.
bigStarArr
[
i
].
removeFromParent
();
}
}
},
showBigStar
()
{
if
(
!
this
.
bigStarArr
||
this
.
bigStarArr
.
length
<=
0
)
{
// this.checkGameEnd();
return
;
}
const
bigStarBg
=
this
.
bigStarArr
[
this
.
curGroupIndex
];
const
starBig
=
bigStarBg
.
starBig
;
starBig
.
scale
=
1
;
const
star
=
bigStarBg
.
star
;
star
.
active
=
true
;
star
.
scaleX
=
0.7
/
bigStarBg
.
scale
;
star
.
scaleY
=
1
/
bigStarBg
.
scale
;
star
.
angle
=
90
;
const
canvas
=
cc
.
find
(
'
Canvas
'
);
const
startPos
=
exchangeNodePos
(
star
.
parent
,
canvas
,
cc
.
v2
(
0
,
-
canvas
.
height
/
2
));
const
middlePos
=
exchangeNodePos
(
star
.
parent
,
canvas
,
cc
.
v2
(
0
,
-
canvas
.
height
/
4
));
star
.
x
=
startPos
.
x
;
star
.
y
=
startPos
.
y
-
starBig
.
height
;
console
.
log
(
'
middlePos =
'
+
JSON
.
stringify
(
middlePos
));
const
time
=
1
;
cc
.
tween
(
star
)
.
to
(
0.3
,
{
y
:
middlePos
.
y
+
80
},
{
easing
:
'
quadOut
'
})
.
to
(
0.1
,
{
y
:
middlePos
.
y
+
40
,
scaleX
:
1.2
/
bigStarBg
.
scale
,
scaleY
:
0.8
/
bigStarBg
.
scale
},
{
easing
:
'
quadOut
'
})
.
to
(
0.1
,
{
y
:
middlePos
.
y
,
scaleX
:
1
/
bigStarBg
.
scale
,
scaleY
:
1
/
bigStarBg
.
scale
},
{
easing
:
'
quadOut
'
})
.
delay
(
0.1
)
.
to
(
0.8
,
{
angle
:
-
720
,
scale
:
1
})
.
start
();
cc
.
tween
(
star
)
.
delay
(
0.6
)
.
to
(
0.8
,
{
x
:
0
},
{
easing
:
'
quadIn
'
})
.
start
();
cc
.
tween
(
star
)
.
delay
(
0.6
)
.
to
(
0.8
,
{
y
:
0
},
{
easing
:
'
quadOut
'
})
.
start
();
cc
.
tween
(
starBig
)
.
delay
(
0.6
)
.
to
(
0.8
,
{
scale
:
0
},
{
easing
:
'
quadOut
'
})
.
call
(()
=>
{
// this.checkGameEnd();
// playAudio(this.starCountClip);
})
.
start
();
// playAudio(this.bigStarClip);
},
// update (dt) {},
});
play/assets/ET_07/prefab/star.js.meta
0 → 100644
View file @
c3534108
{
"ver": "1.0.8",
"uuid": "32976a36-161a-4930-b42a-2fd31a4d0a3f",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
play/assets/ET_07/prefab/star.png
0 → 100644
View file @
c3534108
3.61 KB
play/assets/ET_07/prefab/star.png.meta
0 → 100644
View file @
c3534108
{
"ver": "2.3.5",
"uuid": "ee225dd9-d55a-46df-88c9-c31a8f5ceb12",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 62,
"height": 69,
"platformSettings": {},
"subMetas": {
"star": {
"ver": "1.0.4",
"uuid": "64a927a4-0f15-4b66-a95d-41fcec8243ba",
"rawTextureUuid": "ee225dd9-d55a-46df-88c9-c31a8f5ceb12",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 62,
"height": 69,
"rawWidth": 62,
"rawHeight": 69,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
play/assets/ET_07/prefab/star_bg.png
0 → 100644
View file @
c3534108
3.28 KB
play/assets/ET_07/prefab/star_bg.png.meta
0 → 100644
View file @
c3534108
{
"ver": "2.3.5",
"uuid": "5c2c9b56-223f-48ca-8e0f-b66bd5427b63",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 62,
"height": 69,
"platformSettings": {},
"subMetas": {
"star_bg": {
"ver": "1.0.4",
"uuid": "1d74e51f-7f37-44a5-958f-85d300b3d086",
"rawTextureUuid": "5c2c9b56-223f-48ca-8e0f-b66bd5427b63",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 1.5,
"trimX": 0,
"trimY": 0,
"width": 62,
"height": 66,
"rawWidth": 62,
"rawHeight": 69,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
play/assets/ET_07/scene/ET_07.fire
View file @
c3534108
This diff is collapsed.
Click to expand it.
play/assets/ET_07/scene/ET_07.js
View file @
c3534108
...
...
@@ -2,6 +2,7 @@ import { defaultData } from "../script/defaultData";
import
{
asyncDelay
,
jelly
}
from
"
../script/utils
"
;
import
{
letterData
,
letterWidthData
}
from
"
../script/letterPointData
"
;
import
BgManager
from
"
../script/BgManager
"
;
import
{
exchangeNodePos
,
getSprNode
}
from
"
../script/util
"
;
cc
.
Class
({
extends
:
cc
.
Component
,
...
...
@@ -135,8 +136,11 @@ cc.Class({
},
getDefaultData
()
{
console
.
log
(
"
defaultData =
"
+
defaultData
);
return
defaultData
;
return
{
"
groupArr
"
:[{
"
questionArr
"
:[{
"
questionType
"
:
"
text
"
,
"
answerType
"
:
"
text
"
,
"
answerArr
"
:[],
"
letter
"
:
"
A
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/f51e3fedc88aa69a99f6ef579f7de047.mp3
"
},{
"
questionType
"
:
"
text
"
,
"
answerType
"
:
"
text
"
,
"
answerArr
"
:[],
"
letter
"
:
"
b
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/fbe2f23b9eb191a9330f99800e0d54d5.mp3
"
},{
"
questionType
"
:
"
text
"
,
"
answerType
"
:
"
text
"
,
"
answerArr
"
:[],
"
letter
"
:
"
cc
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/263d9cbaef7fbf251f9e3703130fb763.mp3
"
},{
"
questionType
"
:
"
text
"
,
"
answerType
"
:
"
text
"
,
"
answerArr
"
:[],
"
letter
"
:
"
dd
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/4edd6cd36d36dd5a16348db81044bda7.mp3
"
}]},{
"
questionArr
"
:[{
"
questionType
"
:
"
text
"
,
"
answerType
"
:
"
text
"
,
"
answerArr
"
:[],
"
letter
"
:
"
bb
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/9fd01e4dc5e9c0c583d81b4bbe984342.mp3
"
},{
"
questionType
"
:
"
text
"
,
"
answerType
"
:
"
text
"
,
"
answerArr
"
:[],
"
letter
"
:
"
c
"
}]},{
"
questionArr
"
:[{
"
questionType
"
:
"
text
"
,
"
answerType
"
:
"
text
"
,
"
answerArr
"
:[],
"
letter
"
:
"
d
"
},{
"
questionType
"
:
"
text
"
,
"
answerType
"
:
"
text
"
,
"
answerArr
"
:[],
"
letter
"
:
"
ee
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/28a42e3e77e023c8118624bb8351e7b2.mp3
"
},{
"
questionType
"
:
"
text
"
,
"
answerType
"
:
"
text
"
,
"
answerArr
"
:[],
"
letter
"
:
"
F
"
}]}],
"
style
"
:
"
UK
"
,
"
batch
"
:
"
one
"
};
// console.log("defaultData = " + defaultData);
// return defaultData;
},
preloadItem
()
{
...
...
@@ -182,7 +186,10 @@ cc.Class({
},
letterPosList
:
null
,
curGroupIndex
:
null
,
initData
()
{
this
.
curGroupIndex
=
0
;
// this._writingIdx = 0;
// this.letterPosList = {};
// for (const key in letterData) {
...
...
@@ -200,6 +207,12 @@ cc.Class({
letter
:
null
,
initView
()
{
this
.
initBg
();
this
.
initStar
();
// setTimeout(() => {
// this.showBigStar();
// }, 2000);
// this.debugMode = this.data.debugMode;
// this.debugMode = true;
// this.setLetter(this.data.letter);
...
...
@@ -215,8 +228,119 @@ cc.Class({
mapScaleMax
:
this
.
_mapScaleMax
,
});
const
bgLayer
=
cc
.
find
(
"
Canvas/bgLayer
"
);
const
bg
=
this
.
bgManager
.
getNext
();
this
.
canvas
.
addChild
(
bg
);
bgLayer
.
addChild
(
bg
);
},
initStar
()
{
const
starNode
=
cc
.
find
(
"
Canvas/starNode
"
);
console
.
log
(
"
starNode:
"
,
starNode
);
const
script
=
starNode
.
getComponent
(
"
star
"
)
script
.
count
=
6
;
},
bigStarArr
:
null
,
_initStar
()
{
const
gArr
=
this
.
data
.
groupArr
;
if
(
gArr
.
length
<=
1
)
{
return
;
}
this
.
cleanStar
();
this
.
bigStarArr
=
[];
let
baseX
=
this
.
canvas
.
width
/
2
-
80
*
this
.
_mapScaleMin
;
let
baseY
=
this
.
canvas
.
height
/
2
-
80
*
this
.
_mapScaleMin
;
let
disH
=
80
*
this
.
_mapScaleMin
;
let
disScale
=
1
;
if
(
gArr
.
length
>
5
)
{
disH
=
(
400
/
gArr
.
length
)
*
this
.
_mapScaleMin
;
disScale
=
5
/
gArr
.
length
;
}
for
(
let
i
=
0
;
i
<
gArr
.
length
;
i
++
)
{
const
starBg
=
getSprNode
(
'
star_bg
'
);
this
.
canvas
.
addChild
(
starBg
,
10
);
starBg
.
x
=
baseX
;
starBg
.
y
=
baseY
-
i
*
disH
;
starBg
.
scale
=
disScale
;
const
starTop
=
getSprNode
(
'
star
'
);
starBg
.
addChild
(
starTop
);
starTop
.
active
=
false
;
starBg
.
star
=
starTop
;
const
starBig
=
getSprNode
(
'
icon_bigstar
'
);
starTop
.
addChild
(
starBig
);
starBig
.
angle
=
-
90
;
starBg
.
starBig
=
starBig
;
this
.
bigStarArr
.
push
(
starBg
);
}
console
.
log
(
"
bigStarArr:
"
,
this
.
bigStarArr
);
},
cleanStar
()
{
if
(
this
.
bigStarArr
&&
this
.
bigStarArr
.
length
>
0
)
{
for
(
let
i
=
0
;
i
<
this
.
bigStarArr
.
length
;
i
++
)
{
this
.
bigStarArr
[
i
].
removeFromParent
();
}
}
},
showBigStar
()
{
if
(
!
this
.
bigStarArr
||
this
.
bigStarArr
.
length
<=
0
)
{
// this.checkGameEnd();
return
;
}
const
bigStarBg
=
this
.
bigStarArr
[
this
.
curGroupIndex
];
const
starBig
=
bigStarBg
.
starBig
;
starBig
.
scale
=
1
;
const
star
=
bigStarBg
.
star
;
star
.
active
=
true
;
star
.
scaleX
=
0.7
/
bigStarBg
.
scale
;
star
.
scaleY
=
1
/
bigStarBg
.
scale
;
star
.
angle
=
90
;
const
canvas
=
cc
.
find
(
'
Canvas
'
);
const
startPos
=
exchangeNodePos
(
star
.
parent
,
canvas
,
cc
.
v2
(
0
,
-
canvas
.
height
/
2
));
const
middlePos
=
exchangeNodePos
(
star
.
parent
,
canvas
,
cc
.
v2
(
0
,
-
canvas
.
height
/
4
));
star
.
x
=
startPos
.
x
;
star
.
y
=
startPos
.
y
-
starBig
.
height
;
console
.
log
(
'
middlePos =
'
+
JSON
.
stringify
(
middlePos
));
const
time
=
1
;
cc
.
tween
(
star
)
.
to
(
0.3
,
{
y
:
middlePos
.
y
+
80
},
{
easing
:
'
quadOut
'
})
.
to
(
0.1
,
{
y
:
middlePos
.
y
+
40
,
scaleX
:
1.2
/
bigStarBg
.
scale
,
scaleY
:
0.8
/
bigStarBg
.
scale
},
{
easing
:
'
quadOut
'
})
.
to
(
0.1
,
{
y
:
middlePos
.
y
,
scaleX
:
1
/
bigStarBg
.
scale
,
scaleY
:
1
/
bigStarBg
.
scale
},
{
easing
:
'
quadOut
'
})
.
delay
(
0.1
)
.
to
(
0.8
,
{
angle
:
-
720
,
scale
:
1
})
.
start
();
cc
.
tween
(
star
)
.
delay
(
0.6
)
.
to
(
0.8
,
{
x
:
0
},
{
easing
:
'
quadIn
'
})
.
start
();
cc
.
tween
(
star
)
.
delay
(
0.6
)
.
to
(
0.8
,
{
y
:
0
},
{
easing
:
'
quadOut
'
})
.
start
();
cc
.
tween
(
starBig
)
.
delay
(
0.6
)
.
to
(
0.8
,
{
scale
:
0
},
{
easing
:
'
quadOut
'
})
.
call
(()
=>
{
// this.checkGameEnd();
// playAudio(this.starCountClip);
})
.
start
();
// playAudio(this.bigStarClip);
},
setLetter
(
letter
)
{
...
...
play/settings/services.json
View file @
c3534108
{
"game"
:
{
"name"
:
"
UNKNOW GAME
"
,
"name"
:
"
未知游戏
"
,
"appid"
:
"UNKNOW"
}
}
\ No newline at end of file
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