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
49695d25
Commit
49695d25
authored
Oct 30, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
1e3d8902
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
32 deletions
+84
-32
MainScene.ts
egret/src/mainScene/MainScene.ts
+10
-2
HairballGreyDisAni.ts
egret/src/something/anis/HairballGreyDisAni.ts
+72
-29
Ani.ts
egret/src/something/class/Ani.ts
+2
-1
No files found.
egret/src/mainScene/MainScene.ts
View file @
49695d25
...
@@ -163,6 +163,8 @@ export default class MainScene extends Scene {
...
@@ -163,6 +163,8 @@ export default class MainScene extends Scene {
oneStepScore
:
number
;
oneStepScore
:
number
;
//果冻有消除的标记;
//果冻有消除的标记;
jellyBrokenMark
:
boolean
;
jellyBrokenMark
:
boolean
;
//有毛球消失的动画时,延迟掉落时间
hairballBrokenMark
:
boolean
;
/**
/**
* 判断连通的状态
* 判断连通的状态
* 1表示存在小列连通到大列,从右往左遍历
* 1表示存在小列连通到大列,从右往左遍历
...
@@ -1708,13 +1710,15 @@ export default class MainScene extends Scene {
...
@@ -1708,13 +1710,15 @@ export default class MainScene extends Scene {
this
.
eliminate
();
this
.
eliminate
();
},
200
)
},
200
)
}
else
{
}
else
{
//没有可消除元素,执行掉落
//没有可消除元素,执行掉落,又加定制,因为毛球的消失动画比较长 650ms,用500
var
time
=
this
.
hairballBrokenMark
?
500
:
200
;
this
.
hairballBrokenMark
=
false
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
fall
(()
=>
{
this
.
fall
(()
=>
{
//掉落停止回调
//掉落停止回调
this
.
fallCallback
();
this
.
fallCallback
();
});
});
},
200
)
},
time
)
}
}
}
}
/**
/**
...
@@ -2049,6 +2053,8 @@ export default class MainScene extends Scene {
...
@@ -2049,6 +2053,8 @@ export default class MainScene extends Scene {
ele
.
setState
(
StateType
.
HAIRBALLGREY
,
false
)
ele
.
setState
(
StateType
.
HAIRBALLGREY
,
false
)
//算个数
//算个数
this
.
goElementTarget
(
ElementType
.
HAIRBALLGREY
,
[
ele
.
x
,
ele
.
y
]);
this
.
goElementTarget
(
ElementType
.
HAIRBALLGREY
,
[
ele
.
x
,
ele
.
y
]);
//标记有毛球消失
this
.
hairballBrokenMark
=
true
}
}
//有黑色毛球的,一次眩晕,两次消失
//有黑色毛球的,一次眩晕,两次消失
else
if
(
ele
.
hasState
(
StateType
.
HAIRBALLGREY
))
{
else
if
(
ele
.
hasState
(
StateType
.
HAIRBALLGREY
))
{
...
@@ -2065,6 +2071,8 @@ export default class MainScene extends Scene {
...
@@ -2065,6 +2071,8 @@ export default class MainScene extends Scene {
ele
.
setState
(
StateType
.
HAIRBALLBLACK
,
false
)
ele
.
setState
(
StateType
.
HAIRBALLBLACK
,
false
)
//算个数
//算个数
this
.
goElementTarget
(
ElementType
.
HAIRBALLBLACK
,
[
ele
.
x
,
ele
.
y
]);
this
.
goElementTarget
(
ElementType
.
HAIRBALLBLACK
,
[
ele
.
x
,
ele
.
y
]);
//标记有毛球消失
this
.
hairballBrokenMark
=
true
}
}
}
}
//如果有特效,存下
//如果有特效,存下
...
...
egret/src/something/anis/HairballGreyDisAni.ts
View file @
49695d25
import
{
Ani
}
from
"../class/Ani"
;
import
{
Ani
}
from
"../class/Ani"
;
import
{
ImageAni
}
from
"../class/ImageAni"
;
import
{
ImageAni
}
from
"../class/ImageAni"
;
/**
const
offsetX
=
71
/
2
;
* 待写
const
offsetY
=
62
/
2
;
* 毛球消失动效
*/
export
class
HairballGreyDisAni
extends
Ani
{
/**
* 图片
*/
showImage
:
ImageAni
;
constructor
()
{
super
();
this
.
aniName
=
"HairballGreyDisAni"
;
var
arr
=
[]
for
(
var
i
=
1
;
i
<=
19
;
i
++
)
{
arr
.
push
(
"eleDis"
+
i
+
"_png"
);
}
this
.
showImage
=
new
ImageAni
(
arr
);
this
.
addChild
(
this
.
showImage
)
}
play
()
{
//重置图片
this
.
showImage
.
currentFrame
=
0
;
this
.
showImage
.
source
=
this
.
showImage
.
sourceAll
[
0
];
this
.
showImage
.
play
(()
=>
{
this
.
recover
();
})
}
}
/**
/**
* 碎片位置参数
* 碎片位置参数
...
@@ -112,4 +86,73 @@ const config = [
...
@@ -112,4 +86,73 @@ const config = [
"width"
:
65
,
"width"
:
65
,
"height"
:
23
"height"
:
23
}
}
]
]
\ No newline at end of file
/**
* 毛球消失动效
*/
export
class
HairballGreyDisAni
extends
Ani
{
pieces
:
egret
.
Bitmap
[];
upBg
:
egret
.
Bitmap
;
constructor
()
{
super
();
this
.
aniName
=
"HairballGreyDisAni"
;
this
.
pieces
=
[]
for
(
var
i
=
0
;
i
<
config
.
length
;
i
++
)
{
var
bitmap
=
new
egret
.
Bitmap
(
RES
.
getRes
(
config
[
i
].
name
+
"_png"
))
this
.
addChild
(
bitmap
)
this
.
pieces
.
push
(
bitmap
);
}
this
.
upBg
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"hairballDisBg_png"
));
this
.
upBg
.
anchorOffsetX
=
offsetX
;
this
.
upBg
.
anchorOffsetY
=
offsetY
;
this
.
addChild
(
this
.
upBg
);
this
.
reset
();
}
private
reset
()
{
for
(
var
i
=
0
;
i
<
config
.
length
;
i
++
)
{
this
.
pieces
[
i
].
x
=
config
[
i
].
x
-
offsetX
;
this
.
pieces
[
i
].
y
=
config
[
i
].
y
-
offsetY
;
this
.
pieces
[
i
].
alpha
=
1
;
}
this
.
upBg
.
scaleX
=
this
.
upBg
.
scaleY
=
1
;
this
.
upBg
.
alpha
=
1
;
}
play
()
{
//重置
this
.
reset
();
//动画,完了要调this.recover()
egret
.
Tween
.
get
(
this
.
upBg
)
.
to
({
scaleX
:
1.5
,
scaleY
:
1.5
},
150
)
egret
.
Tween
.
get
(
this
.
upBg
)
.
wait
(
50
)
.
to
({
alpha
:
0
},
100
)
.
call
(()
=>
{
//碎片掉落
for
(
let
i
=
0
;
i
<
config
.
length
;
i
++
)
{
let
p
=
this
.
pieces
[
i
];
let
y
=
config
[
i
].
y
;
egret
.
Tween
.
get
(
p
)
.
wait
(
i
*
30
)
.
to
({
y
:
y
+
6
},
200
);
egret
.
Tween
.
get
(
p
)
.
wait
(
i
*
30
+
150
)
.
to
({
alpha
:
0
},
50
)
.
call
(()
=>
{
if
(
i
==
config
.
length
-
1
){
this
.
recover
();
}
})
}
})
}
}
egret/src/something/class/Ani.ts
View file @
49695d25
...
@@ -2,8 +2,9 @@ import { Pool } from "../Pool";
...
@@ -2,8 +2,9 @@ import { Pool } from "../Pool";
/**
/**
* 动效的基类,包含一些固定方法
* 动效的基类,包含一些固定方法
* play无参数,不需要回调
* play无参数,不需要回调
,只播放一次
* 有自动回收方法recover
* 有自动回收方法recover
* 子类必须重写aniName,否则回收会出问题
*/
*/
export
class
Ani
extends
egret
.
DisplayObjectContainer
{
export
class
Ani
extends
egret
.
DisplayObjectContainer
{
/**
/**
...
...
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