Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
wildfirecode13
xiaoxiaole
Commits
a1c0fc85
Commit
a1c0fc85
authored
Jun 02, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
樱花暂存
parent
87904b64
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
113 additions
and
24 deletions
+113
-24
MainScene.ts
egret/src/mainScene/MainScene.ts
+102
-13
elementEffect.ts
egret/src/mainScene/elementEffect.ts
+3
-0
Element.ts
egret/src/something/class/Element.ts
+8
-11
No files found.
egret/src/mainScene/MainScene.ts
View file @
a1c0fc85
...
...
@@ -445,6 +445,13 @@ export default class MainScene extends Scene {
//樱花
//当前关卡的所有樱花
cherryData
:
Array
<
Array
<
number
>>
=
[];
//本次激活需要消除的樱花
freeCherryData
:
Array
<
number
>
=
[];
//已消除樱花
amoveCherryData
:
Array
<
number
>
=
[];
//等待樱花
waitCherry
=
false
;
constructor
(){
super
();
window
[
'gm'
]
=
this
.
gm
;
...
...
@@ -3168,8 +3175,15 @@ export default class MainScene extends Scene {
}
}
}
//樱花绽放,放在fallAllPormise里
//樱花绽放
var
amove
=
this
.
checkFaCherry
();
if
(
!
amove
){
console
.
log
(
"樱花未消除,等待消除"
);
this
.
waitCherry
=
true
;
return
;
}
else
{
console
.
log
(
"樱花消除完毕,自动掉落"
);
}
//没有可消除元素,执行掉落,
// setTimeout(() => {
await
wait
(
200
);
...
...
@@ -7457,8 +7471,9 @@ export default class MainScene extends Scene {
console
.
log
(
"1消除樱花----------------------"
,
idx
);
var
lat
=
this
.
lattices
[
idx
];
var
ele
=
this
.
lattices
[
idx
].
element
;
let
pro1
=
ele
.
activeCherry
();
this
.
fallAllPormise
.
push
(
pro1
);
ele
.
activeCherry
();
this
.
playCherryAni
(
idx
);
this
.
addFreeCherryData
(
idx
);
var
nearidxs
:
Array
<
{
forback
:
string
,
...
...
@@ -7474,15 +7489,57 @@ export default class MainScene extends Scene {
// }, 200);
// })
// this.fallAllPormise.push(pro2);
for
(
let
i
=
0
;
i
<
nearidxs
.
length
;
i
++
){
let
nidx
=
nearidxs
[
i
].
idx
;
let
nlat
=
this
.
lattices
[
nidx
];
let
nele
=
nlat
.
element
;
if
(
nele
&&
nele
.
type
==
ElementType
.
cherry
&&
nele
.
activeStatus
==
0
){
this
.
activeCherry
(
nidx
);
}
}
setTimeout
(()
=>
{
for
(
let
i
=
0
;
i
<
nearidxs
.
length
;
i
++
){
let
nidx
=
nearidxs
[
i
].
idx
;
let
nlat
=
this
.
lattices
[
nidx
];
let
nele
=
nlat
.
element
;
if
(
nele
&&
nele
.
type
==
ElementType
.
cherry
&&
nele
.
activeStatus
==
0
){
this
.
activeCherry
(
nidx
);
}
}
},
300
);
}
//樱花动画
playCherryAni
(
idx
:
number
){
var
oneani
=
new
eui
.
Image
();
var
texture
=
RES
.
getRes
(
"ele46_png"
);
oneani
.
texture
=
texture
;
var
p
=
Tool
.
getPositionByIndex
(
idx
);
oneani
.
anchorOffsetX
=
texture
.
textureWidth
/
2
;
oneani
.
anchorOffsetY
=
texture
.
textureHeight
/
2
;
oneani
.
x
=
p
[
0
];
oneani
.
y
=
p
[
1
];
this
.
effectContainer
.
addChild
(
oneani
);
console
.
log
(
"樱花动画"
);
egret
.
Tween
.
get
(
oneani
)
.
to
({
alpha
:
0
,
scaleX
:
2
,
scaleY
:
2
},
800
)
.
call
(()
=>
{
var
lat
=
this
.
lattices
[
idx
];
var
ele
=
lat
.
element
;
ele
.
dieCherry
();
this
.
elementContainer
.
removeChild
(
ele
);
if
(
this
.
amoveCherryData
.
indexOf
(
idx
)
==-
1
){
this
.
amoveCherryData
.
push
(
idx
);
if
(
this
.
eliminatedElements
.
indexOf
(
idx
)
==-
1
){
this
.
eliminatedElements
.
push
(
idx
);
}
if
(
this
.
emptys
.
indexOf
(
idx
)
==-
1
){
this
.
emptys
.
push
(
idx
);
}
var
amove
=
this
.
checkFaCherry
();
if
(
amove
&&
this
.
waitCherry
){
this
.
waitCherry
=
false
;
console
.
log
(
"樱花移除完毕,手动消除掉落"
)
this
.
eliminate
();
}
}
})
}
//获取相邻樱花
getNearCherry
(
idx
:
number
){
...
...
@@ -7528,4 +7585,36 @@ export default class MainScene extends Scene {
isz
&&
this
.
mapupContainer
.
removeChild
(
isz
);
}
}
addFreeCherryData
(
idx
:
number
){
var
icheryidx
:
number
;
for
(
var
i
=
0
;
i
<
this
.
cherryData
.
length
;
i
++
){
var
icherrydata
=
this
.
cherryData
[
i
];
if
(
icherrydata
.
indexOf
(
idx
)
!=-
1
){
icheryidx
=
i
;
break
;
}
}
var
pcherrydata
=
this
.
cherryData
[
icheryidx
];
for
(
var
j
=
0
;
j
<
pcherrydata
.
length
;
j
++
){
var
pcheryidx
=
pcherrydata
[
j
];
if
(
this
.
freeCherryData
.
indexOf
(
pcheryidx
)
==-
1
){
this
.
freeCherryData
.
push
(
pcheryidx
);
}
}
}
checkFaCherry
(){
var
amove
:
boolean
=
true
;
for
(
var
i
=
0
;
i
<
this
.
freeCherryData
.
length
;
i
++
){
var
iidx
=
this
.
freeCherryData
[
i
];
if
(
this
.
amoveCherryData
.
indexOf
(
iidx
)
==-
1
){
amove
=
false
;
break
;
}
}
return
amove
;
}
}
\ No newline at end of file
egret/src/mainScene/elementEffect.ts
0 → 100644
View file @
a1c0fc85
export
class
elementEffect
{
}
\ No newline at end of file
egret/src/something/class/Element.ts
View file @
a1c0fc85
...
...
@@ -1006,6 +1006,7 @@ export class Element extends eui.Component {
* @param type 只应该是基础元素和特殊元素
*/
reset
(
type
:
ElementType
)
{
this
.
activeStatus
=
0
;
this
.
effectType
=
null
;
this
.
_isMonsterJelly
=
false
;
this
.
_isNeb
=
false
;
...
...
@@ -1318,16 +1319,12 @@ export class Element extends eui.Component {
activeStatus
:
number
=
0
;
//0未激活,1绽放中,2,结束
activeCherry
(){
this
.
activeStatus
=
1
;
return
new
Promise
(
res
=>
{
egret
.
Tween
.
get
(
this
.
showImage
)
.
to
({
alpha
:
0
},
300
)
.
call
(
function
(){
this
.
activeStatus
=
2
;
res
();
},
null
);
})
this
.
showImage
.
alpha
=
0
;
}
//樱花消失
dieCherry
(){
this
.
activeStatus
=
2
;
}
}
\ 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