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
4478a425
Commit
4478a425
authored
Feb 05, 2020
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
da001d6e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
440 additions
and
267 deletions
+440
-267
FesRedBombShowAni.ts
egret/src/something/anisCall/FesRedBombShowAni.ts
+46
-16
FestivalEle.ts
egret/src/something/class/FestivalEle.ts
+109
-251
FestivalEle3.ts
egret/src/something/class/FestivalEle3.ts
+285
-0
No files found.
egret/src/something/anisCall/FesRedBombShowAni.ts
View file @
4478a425
...
...
@@ -5,19 +5,19 @@ import { RecoverName } from "../enum/RecoverName";
export
class
FesRedBombShowAni
extends
egret
.
DisplayObjectContainer
{
// 红包
constructor
()
{
super
();
var
textureDown
:
egret
.
Texture
=
RES
.
getRes
(
"fesRedBombSta1_png"
);
var
down
=
new
egret
.
Bitmap
(
textureDown
);
down
.
x
=
-
textureDown
.
textureWidth
/
2
;
down
.
y
=
-
textureDown
.
textureHeight
/
2
;
this
.
addChild
(
down
);
var
textureUp
:
egret
.
Texture
=
RES
.
getRes
(
"xingxingbi_png"
);
var
up
=
new
egret
.
Bitmap
(
textureUp
);
up
.
x
=
-
textureUp
.
textureWidth
/
2
;
//-89
up
.
y
=
-
100
;
this
.
addChild
(
up
);
}
//
constructor() {
//
super();
//
var textureDown: egret.Texture = RES.getRes("fesRedBombSta1_png");
//
var down = new egret.Bitmap(textureDown);
//
down.x = -textureDown.textureWidth / 2;
//
down.y = -textureDown.textureHeight / 2;
//
this.addChild(down);
//
var textureUp: egret.Texture = RES.getRes("xingxingbi_png");
//
var up = new egret.Bitmap(textureUp);
//
up.x = -textureUp.textureWidth / 2; //-89
//
up.y = -100;
//
this.addChild(up);
//
}
// 铃铛
// constructor() {
...
...
@@ -29,20 +29,50 @@ export class FesRedBombShowAni extends egret.DisplayObjectContainer {
// this.addChild(down);
// }
// 情人节巧克力
constructor
()
{
super
()
var
textureDown
:
egret
.
Texture
=
RES
.
getRes
(
"chocolateFour_png"
);
var
down
=
new
egret
.
Bitmap
(
textureDown
);
down
.
x
=
-
textureDown
.
textureWidth
/
2
;
down
.
y
=
-
textureDown
.
textureHeight
/
2
;
this
.
addChild
(
down
);
}
// play(position: number[], callback: Function) {
// this.scaleX = this.scaleY = 0.29;
// this.x = position[0];
// this.y = position[1];
// egret.Tween.get(this)
// .wait(200)
// .to({ scaleX: 1, scaleY: 1 }, 500, egret.Ease.backOut)
// .wait(500)
// .to({ scaleX: 0.29, scaleY: 0.29 }, 500, egret.Ease.backInOut)
// .call(() => {
// if (this.parent) this.parent.removeChild(this);
// Pool.recover(RecoverName.FESREDBOMBSHOW_ANI, this);
// callback()
// })
// }
//情人节巧克力
play
(
position
:
number
[],
callback
:
Function
)
{
this
.
scaleX
=
this
.
scaleY
=
0.29
;
this
.
scaleX
=
this
.
scaleY
=
1
;
this
.
x
=
position
[
0
];
this
.
y
=
position
[
1
];
egret
.
Tween
.
get
(
this
)
.
wait
(
200
)
.
to
({
scaleX
:
1
,
scaleY
:
1
},
500
,
egret
.
Ease
.
backOut
)
.
to
({
scaleX
:
3
,
scaleY
:
3
},
500
,
egret
.
Ease
.
backOut
)
.
wait
(
500
)
.
to
({
scaleX
:
0.29
,
scaleY
:
0.29
},
500
,
egret
.
Ease
.
backInOut
)
.
to
({
scaleX
:
1
,
scaleY
:
1
},
500
,
egret
.
Ease
.
backInOut
)
.
call
(()
=>
{
if
(
this
.
parent
)
this
.
parent
.
removeChild
(
this
);
Pool
.
recover
(
RecoverName
.
FESREDBOMBSHOW_ANI
,
this
);
callback
()
})
}
}
\ No newline at end of file
egret/src/something/class/FestivalEle.ts
View file @
4478a425
import
{
ElementType
}
from
"../enum/ElementType"
;
//三种状态的图片,剩三种了
const
images
=
{
2
:
"ele"
+
ElementType
.
FESTIVALELE_BIG
+
"_png"
,
1
:
"eggStatus1_png"
,
0
:
"eggStatus0_png"
}
import
{
Tool
}
from
"../Tool"
;
//缓存svga数据
let
redbombFlowerVideo
;
//存下用过的mv,
let
pool
=
[];
/**
* 节日元素
*
* 情人节元素
*/
export
class
FestivalEle
extends
egret
.
DisplayObjectContainer
{
/**
...
...
@@ -23,271 +21,131 @@ export class FestivalEle extends egret.DisplayObjectContainer {
return
this
.
_statusNum
}
set
statusNum
(
value
:
number
)
{
if
(
value
>=
0
)
{
//播放原来的动画
let
child
=
this
.
$children
[
this
.
_statusNum
];
child
[
"play"
](()
=>
{
//切换
this
.
toggleStatus
(
value
);
})
this
.
_statusNum
=
value
;
//花瓣动画,结构修改时要改
// if (this.parent &&//父级是Element
// this.parent.parent &&//是elementContainer
// this.parent.parent.parent &&//是mainScene
// this.parent.parent.parent["elementContainer"]//偷懒判断,存在,如果mainScene修改。。。
// ) {
// createRedbombFlower(this.)
// }
var
count
=
0
;
let
parent
=
this
.
parent
;
while
(
parent
)
{
if
(
++
count
>=
3
)
{
if
(
parent
[
"elementContainer"
])
createRedbombFlower
(
parent
)
break
}
else
{
//不用动画
parent
=
parent
.
parent
;
}
}
if
(
value
<
0
)
{
this
.
_statusNum
=
0
;
this
.
isActive
=
true
;
}
else
{
this
.
_statusNum
=
value
;
switch
(
value
)
{
case
0
:
//显示1和2
ani
(
this
[
"mark"
+
1
]);
ani
(
this
[
"mark"
+
2
]);
break
;
case
1
:
//显示0和3
ani
(
this
[
"mark"
+
0
]);
ani
(
this
[
"mark"
+
3
]);
break
;
case
2
:
//都隐藏
for
(
var
i
=
0
;
i
<
4
;
i
++
)
this
[
"mark"
+
i
].
visible
=
false
;
break
;
}
}
}
constructor
(
n
:
number
=
2
)
{
super
();
var
status3
=
new
Status3
();
this
.
addChild
(
status3
);
var
status2
=
new
Status2
();
this
.
addChild
(
status2
);
var
status1
=
new
Status1
();
this
.
addChild
(
status1
);
//巧克力
var
tc
:
egret
.
Texture
=
RES
.
getRes
(
"chocolateFour_png"
);
var
bg
:
egret
.
Bitmap
=
new
egret
.
Bitmap
(
tc
)
bg
.
x
=
-
tc
.
textureWidth
/
2
;
bg
.
y
=
-
tc
.
textureHeight
/
2
;
this
.
addChild
(
bg
);
var
x1
=
tc
.
textureWidth
/
4
-
tc
.
textureWidth
/
2
;
var
x2
=
tc
.
textureWidth
/
4
*
3
-
tc
.
textureWidth
/
2
;
var
y1
=
tc
.
textureHeight
/
4
-
tc
.
textureHeight
/
2
;
var
y2
=
tc
.
textureHeight
/
4
*
3
-
tc
.
textureHeight
/
2
;
//四个位置
var
pp
=
[
[
x1
,
y1
],
[
x2
,
y1
],
[
x1
,
y2
],
[
x2
,
y2
]
]
//四个
for
(
var
i
=
0
;
i
<
4
;
i
++
)
{
var
t
:
egret
.
Texture
=
RES
.
getRes
(
"chocolateMark"
+
i
+
"_png"
);
var
b
=
new
egret
.
Bitmap
(
t
);
b
.
anchorOffsetX
=
t
.
textureWidth
/
2
;
b
.
anchorOffsetY
=
t
.
textureHeight
/
2
;
b
.
x
=
pp
[
i
][
0
];
b
.
y
=
pp
[
i
][
1
];
this
.
addChild
(
b
);
this
[
"mark"
+
i
]
=
b
;
b
.
visible
=
false
;
}
this
.
toggleStatus
(
n
);
this
.
isActive
=
false
;
this
.
_statusNum
=
n
;
//加载svga
if
(
!
redbombFlowerVideo
)
{
var
svgaParser
=
new
window
[
"SVGA"
].
Parser
();
svgaParser
.
load
(
resPath
+
'resource/assets/svgas/redbombFlower.svga'
,
(
videoItem
)
=>
{
redbombFlowerVideo
=
videoItem
;
})
}
}
reset
(
n
:
number
=
2
)
{
this
.
toggleStatus
(
n
)
;
for
(
var
i
=
0
;
i
<
4
;
i
++
)
this
[
"mark"
+
i
].
visible
=
false
;
this
.
isActive
=
false
;
this
.
_statusNum
=
n
;
}
toggleStatus
(
index
:
number
)
{
for
(
var
i
=
0
;
i
<
this
.
$children
.
length
;
i
++
)
{
var
child
=
this
.
$children
[
i
];
if
(
i
==
index
)
{
child
.
visible
=
true
;
//重置状态
child
[
"reset"
]();
}
else
{
child
.
visible
=
false
;
}
}
}
}
//第一种状态
class
Status1
extends
egret
.
DisplayObjectContainer
{
upImage
:
egret
.
Bitmap
;
constructor
()
{
super
();
var
textureDown
:
egret
.
Texture
=
RES
.
getRes
(
"fesRedBombSta1_png"
)
var
down
=
new
egret
.
Bitmap
(
textureDown
);
down
.
x
=
-
textureDown
.
textureWidth
/
2
;
down
.
y
=
-
textureDown
.
textureHeight
/
2
;
this
.
addChild
(
down
);
var
textureUp
:
egret
.
Texture
=
RES
.
getRes
(
"xingxingbi_png"
);
var
up
=
new
egret
.
Bitmap
(
textureUp
);
up
.
anchorOffsetX
=
textureUp
.
textureWidth
/
2
;
up
.
anchorOffsetY
=
textureUp
.
textureHeight
/
2
;
up
.
y
=
textureUp
.
textureHeight
/
2
-
100
;
this
.
addChild
(
up
);
this
.
upImage
=
up
;
this
.
scaleX
=
this
.
scaleY
=
0.29
;
}
reset
()
{
this
.
upImage
.
scaleX
=
this
.
upImage
.
scaleY
=
1
;
}
play
(
callback
:
Function
)
{
egret
.
Tween
.
get
(
this
.
upImage
)
.
to
({
scaleX
:
1.8
,
scaleY
:
1.8
},
240
)
.
call
(()
=>
{
callback
();
})
}
function
ani
(
b
:
egret
.
Bitmap
)
{
b
.
visible
=
true
;
b
.
alpha
=
0
;
b
.
scaleX
=
b
.
scaleY
=
1
;
b
.
rotation
=
-
90
;
egret
.
Tween
.
get
(
b
)
.
to
({
scaleX
:
0.33
,
scaleY
:
0.33
,
alpha
:
1
},
700
,
egret
.
Ease
.
backOut
)
egret
.
Tween
.
get
(
b
)
.
to
({
rotation
:
0
},
700
,
egret
.
Ease
.
backOut
)
}
const
status2Cfg
=
[
{
"name"
:
"fesRedCap"
,
"x"
:
-
7
,
"y"
:
-
6
,
"width"
:
251
,
"height"
:
104
},
{
"name"
:
"fesRedSmallLight"
,
"x"
:
-
7
,
"y"
:
-
14
,
"width"
:
249
,
"height"
:
159
},
{
"name"
:
"fesRedUp"
,
"x"
:
-
2
,
"y"
:
52
,
"width"
:
237
,
"height"
:
185
},
{
"name"
:
"fesRedDown"
,
"x"
:
-
2
,
"y"
:
0
,
"width"
:
237
,
"height"
:
237
}
]
//第二种状态
class
Status2
extends
egret
.
DisplayObjectContainer
{
light
:
egret
.
Bitmap
;
fesRedCap
:
egret
.
Bitmap
constructor
()
{
super
();
this
.
scaleX
=
this
.
scaleY
=
0.29
for
(
var
i
=
status2Cfg
.
length
-
1
;
i
>=
0
;
i
--
)
{
var
bitmap
=
new
egret
.
Bitmap
(
RES
.
getRes
(
status2Cfg
[
i
].
name
+
"_png"
));
bitmap
.
x
=
status2Cfg
[
i
].
x
-
237
/
2
;
bitmap
.
y
=
status2Cfg
[
i
].
y
-
237
/
2
;
this
.
addChild
(
bitmap
);
if
(
status2Cfg
[
i
].
name
==
"fesRedSmallLight"
)
{
this
.
light
=
bitmap
}
else
if
(
status2Cfg
[
i
].
name
==
"fesRedCap"
)
{
this
.
fesRedCap
=
bitmap
;
}
}
}
reset
()
{
this
.
fesRedCap
.
scaleY
=
1
;
this
.
light
.
alpha
=
1
;
egret
.
Tween
.
get
(
this
.
light
,
{
loop
:
true
})
.
to
({
alpha
:
0
},
450
)
.
to
({
alpha
:
1
},
450
)
}
play
(
callback
:
Function
)
{
this
.
light
.
alpha
=
0
;
egret
.
Tween
.
removeTweens
(
this
.
light
);
this
.
fesRedCap
.
scaleY
=
1
;
egret
.
Tween
.
get
(
this
.
fesRedCap
)
.
to
({
scaleY
:
0.1
},
180
)
.
call
(()
=>
{
callback
();
})
}
//暂时只有一个就用40,和mainscene里的festivalIndex保持一致
//.索引修改时,或者多个时要修改
function
createRedbombFlower
(
con
,
index
:
number
=
40
)
{
if
(
!
redbombFlowerVideo
)
return
;
//创建一个
let
mv
=
pool
.
shift
();
if
(
!
mv
)
{
mv
=
new
window
[
"SVGA"
].
EgretMovieClip
(
redbombFlowerVideo
);
mv
.
lockStep
=
true
;
mv
.
stop
();
}
var
p
=
Tool
.
getPositionByIndex
(
index
);
mv
.
x
=
p
[
0
]
-
redbombFlowerVideo
.
videoSize
.
width
/
2
;
mv
.
y
=
p
[
1
]
-
redbombFlowerVideo
.
videoSize
.
height
/
2
;
con
.
addChild
(
mv
);
mv
.
gotoAndPlay
(
1
,
true
);
setTimeout
(()
=>
{
if
(
mv
.
parent
)
{
mv
.
parent
.
removeChild
(
mv
);
pool
.
push
(
mv
);
}
},
redbombFlowerVideo
.
frames
/
redbombFlowerVideo
.
FPS
*
1000
)
}
const
status3Cfg
=
[
{
"name"
:
"fesRedUp"
,
"x"
:
0
,
"y"
:
52
,
"width"
:
237
,
"height"
:
185
},
{
"name"
:
"tinyRedMid"
,
"x"
:
86
,
"y"
:
60
,
"width"
:
74
,
"height"
:
90
},
{
"name"
:
"tinyRedLeft"
,
"x"
:
22
,
"y"
:
5
,
"width"
:
116
,
"height"
:
132
},
{
"name"
:
"tinyRedRight"
,
"x"
:
123
,
"y"
:
14
,
"width"
:
89
,
"height"
:
106
},
{
"name"
:
"fesRedDown"
,
"x"
:
0
,
"y"
:
0
,
"width"
:
237
,
"height"
:
237
}
]
class
Status3
extends
egret
.
DisplayObjectContainer
{
midRed
:
egret
.
Bitmap
;
leftRed
:
egret
.
Bitmap
;
rightRed
:
egret
.
Bitmap
;
constructor
()
{
super
();
this
.
scaleX
=
this
.
scaleY
=
0.29
for
(
var
i
=
status3Cfg
.
length
-
1
;
i
>=
0
;
i
--
)
{
var
config
=
status3Cfg
[
i
];
var
bitmap
=
new
egret
.
Bitmap
(
RES
.
getRes
(
config
.
name
+
"_png"
));
bitmap
.
x
=
config
.
x
-
237
/
2
;
bitmap
.
y
=
config
.
y
-
237
/
2
;
this
.
addChild
(
bitmap
);
if
(
config
.
name
==
"tinyRedMid"
)
{
this
.
midRed
=
bitmap
;
}
else
if
(
config
.
name
==
"tinyRedLeft"
)
{
this
.
leftRed
=
bitmap
;
}
else
if
(
config
.
name
==
"tinyRedRight"
)
{
this
.
rightRed
=
bitmap
;
}
}
}
reset
()
{
egret
.
Tween
.
removeTweens
(
this
.
leftRed
);
egret
.
Tween
.
removeTweens
(
this
.
rightRed
);
egret
.
Tween
.
removeTweens
(
this
.
midRed
);
var
offset
=
237
/
2
//动画出来,然后循环
this
.
leftRed
.
x
=
22
+
40
-
offset
;
this
.
leftRed
.
y
=
5
+
100
-
offset
;
egret
.
Tween
.
get
(
this
.
leftRed
)
.
to
({
x
:
22
-
3
-
offset
,
y
:
5
-
8
-
offset
},
150
)
.
to
({
x
:
22
-
offset
,
y
:
5
-
offset
},
50
)
this
.
rightRed
.
x
=
123
-
7
-
offset
;
this
.
rightRed
.
y
=
14
+
100
-
offset
;
egret
.
Tween
.
get
(
this
.
rightRed
)
.
to
({
x
:
123
+
3
-
offset
,
y
:
14
-
8
-
offset
},
150
)
.
to
({
x
:
123
-
offset
,
y
:
14
-
offset
},
50
)
this
.
midRed
.
x
=
86
-
7
-
offset
;
this
.
midRed
.
y
=
60
+
80
-
offset
;
egret
.
Tween
.
get
(
this
.
midRed
)
.
to
({
x
:
86
+
3
-
offset
,
y
:
60
-
8
-
offset
},
150
)
.
to
({
x
:
86
-
offset
,
y
:
60
-
offset
},
50
)
.
call
(()
=>
{
//循环动画
this
.
leftRed
.
x
=
22
-
offset
;
this
.
leftRed
.
y
=
5
-
offset
;
egret
.
Tween
.
get
(
this
.
leftRed
,
{
loop
:
true
})
.
to
({
x
:
22
+
2
-
offset
,
y
:
5
+
5
-
offset
},
150
)
.
to
({
x
:
22
-
6
-
offset
,
y
:
5
-
14
-
offset
},
150
)
.
to
({
x
:
22
-
offset
,
y
:
5
-
offset
},
100
)
.
wait
(
500
);
this
.
rightRed
.
x
=
123
-
offset
;
this
.
rightRed
.
y
=
14
-
offset
;
egret
.
Tween
.
get
(
this
.
rightRed
,
{
loop
:
true
})
.
to
({
x
:
123
-
2
-
offset
,
y
:
14
+
5
-
offset
},
150
)
.
to
({
x
:
123
+
6
-
offset
,
y
:
14
-
14
-
offset
},
150
)
.
to
({
x
:
123
-
offset
,
y
:
14
-
offset
},
100
)
.
wait
(
500
);
this
.
midRed
.
x
=
86
-
offset
;
this
.
midRed
.
y
=
60
-
offset
;
egret
.
Tween
.
get
(
this
.
midRed
,
{
loop
:
true
})
.
to
({
x
:
86
-
2
-
offset
,
y
:
60
+
5
-
offset
},
150
)
.
to
({
x
:
86
+
6
-
offset
,
y
:
60
-
14
-
offset
},
150
)
.
to
({
x
:
86
-
offset
,
y
:
60
-
offset
},
100
)
.
wait
(
500
);
})
}
play
(
callback
:
Function
)
{
}
}
\ No newline at end of file
egret/src/something/class/FestivalEle3.ts
0 → 100644
View file @
4478a425
/**
* 节日元素
* 原始红包炸弹备份
*/
export
class
FestivalEle
extends
egret
.
DisplayObjectContainer
{
/**
* 是否要分裂了
*/
isActive
:
boolean
;
/**
* 状态变化 2 1 0 再往后,可分裂
*/
private
_statusNum
:
number
;
get
statusNum
()
{
return
this
.
_statusNum
}
set
statusNum
(
value
:
number
)
{
if
(
value
>=
0
)
{
//播放原来的动画
let
child
=
this
.
$children
[
this
.
_statusNum
];
child
[
"play"
](()
=>
{
//切换
this
.
toggleStatus
(
value
);
})
this
.
_statusNum
=
value
;
}
else
{
//不用动画
this
.
_statusNum
=
0
;
this
.
isActive
=
true
;
}
}
constructor
(
n
:
number
=
2
)
{
super
();
var
status3
=
new
Status3
();
this
.
addChild
(
status3
);
var
status2
=
new
Status2
();
this
.
addChild
(
status2
);
var
status1
=
new
Status1
();
this
.
addChild
(
status1
);
this
.
toggleStatus
(
n
);
this
.
isActive
=
false
;
this
.
_statusNum
=
n
;
}
reset
(
n
:
number
=
2
)
{
this
.
toggleStatus
(
n
);
this
.
isActive
=
false
;
this
.
_statusNum
=
n
;
}
toggleStatus
(
index
:
number
)
{
for
(
var
i
=
0
;
i
<
this
.
$children
.
length
;
i
++
)
{
var
child
=
this
.
$children
[
i
];
if
(
i
==
index
)
{
child
.
visible
=
true
;
//重置状态
child
[
"reset"
]();
}
else
{
child
.
visible
=
false
;
}
}
}
}
//第一种状态
class
Status1
extends
egret
.
DisplayObjectContainer
{
upImage
:
egret
.
Bitmap
;
constructor
()
{
super
();
var
textureDown
:
egret
.
Texture
=
RES
.
getRes
(
"fesRedBombSta1_png"
)
var
down
=
new
egret
.
Bitmap
(
textureDown
);
down
.
x
=
-
textureDown
.
textureWidth
/
2
;
down
.
y
=
-
textureDown
.
textureHeight
/
2
;
this
.
addChild
(
down
);
var
textureUp
:
egret
.
Texture
=
RES
.
getRes
(
"xingxingbi_png"
);
var
up
=
new
egret
.
Bitmap
(
textureUp
);
up
.
anchorOffsetX
=
textureUp
.
textureWidth
/
2
;
up
.
anchorOffsetY
=
textureUp
.
textureHeight
/
2
;
up
.
y
=
textureUp
.
textureHeight
/
2
-
100
;
this
.
addChild
(
up
);
this
.
upImage
=
up
;
this
.
scaleX
=
this
.
scaleY
=
0.29
;
}
reset
()
{
this
.
upImage
.
scaleX
=
this
.
upImage
.
scaleY
=
1
;
}
play
(
callback
:
Function
)
{
egret
.
Tween
.
get
(
this
.
upImage
)
.
to
({
scaleX
:
1.8
,
scaleY
:
1.8
},
240
)
.
call
(()
=>
{
callback
();
})
}
}
const
status2Cfg
=
[
{
"name"
:
"fesRedCap"
,
"x"
:
-
7
,
"y"
:
-
6
,
"width"
:
251
,
"height"
:
104
},
{
"name"
:
"fesRedSmallLight"
,
"x"
:
-
7
,
"y"
:
-
14
,
"width"
:
249
,
"height"
:
159
},
{
"name"
:
"fesRedUp"
,
"x"
:
-
2
,
"y"
:
52
,
"width"
:
237
,
"height"
:
185
},
{
"name"
:
"fesRedDown"
,
"x"
:
-
2
,
"y"
:
0
,
"width"
:
237
,
"height"
:
237
}
]
//第二种状态
class
Status2
extends
egret
.
DisplayObjectContainer
{
light
:
egret
.
Bitmap
;
fesRedCap
:
egret
.
Bitmap
constructor
()
{
super
();
this
.
scaleX
=
this
.
scaleY
=
0.29
for
(
var
i
=
status2Cfg
.
length
-
1
;
i
>=
0
;
i
--
)
{
var
bitmap
=
new
egret
.
Bitmap
(
RES
.
getRes
(
status2Cfg
[
i
].
name
+
"_png"
));
bitmap
.
x
=
status2Cfg
[
i
].
x
-
237
/
2
;
bitmap
.
y
=
status2Cfg
[
i
].
y
-
237
/
2
;
this
.
addChild
(
bitmap
);
if
(
status2Cfg
[
i
].
name
==
"fesRedSmallLight"
)
{
this
.
light
=
bitmap
}
else
if
(
status2Cfg
[
i
].
name
==
"fesRedCap"
)
{
this
.
fesRedCap
=
bitmap
;
}
}
}
reset
()
{
this
.
fesRedCap
.
scaleY
=
1
;
this
.
light
.
alpha
=
1
;
egret
.
Tween
.
get
(
this
.
light
,
{
loop
:
true
})
.
to
({
alpha
:
0
},
450
)
.
to
({
alpha
:
1
},
450
)
}
play
(
callback
:
Function
)
{
this
.
light
.
alpha
=
0
;
egret
.
Tween
.
removeTweens
(
this
.
light
);
this
.
fesRedCap
.
scaleY
=
1
;
egret
.
Tween
.
get
(
this
.
fesRedCap
)
.
to
({
scaleY
:
0.1
},
180
)
.
call
(()
=>
{
callback
();
})
}
}
const
status3Cfg
=
[
{
"name"
:
"fesRedUp"
,
"x"
:
0
,
"y"
:
52
,
"width"
:
237
,
"height"
:
185
},
{
"name"
:
"tinyRedMid"
,
"x"
:
86
,
"y"
:
60
,
"width"
:
74
,
"height"
:
90
},
{
"name"
:
"tinyRedLeft"
,
"x"
:
22
,
"y"
:
5
,
"width"
:
116
,
"height"
:
132
},
{
"name"
:
"tinyRedRight"
,
"x"
:
123
,
"y"
:
14
,
"width"
:
89
,
"height"
:
106
},
{
"name"
:
"fesRedDown"
,
"x"
:
0
,
"y"
:
0
,
"width"
:
237
,
"height"
:
237
}
]
class
Status3
extends
egret
.
DisplayObjectContainer
{
midRed
:
egret
.
Bitmap
;
leftRed
:
egret
.
Bitmap
;
rightRed
:
egret
.
Bitmap
;
constructor
()
{
super
();
this
.
scaleX
=
this
.
scaleY
=
0.29
for
(
var
i
=
status3Cfg
.
length
-
1
;
i
>=
0
;
i
--
)
{
var
config
=
status3Cfg
[
i
];
var
bitmap
=
new
egret
.
Bitmap
(
RES
.
getRes
(
config
.
name
+
"_png"
));
bitmap
.
x
=
config
.
x
-
237
/
2
;
bitmap
.
y
=
config
.
y
-
237
/
2
;
this
.
addChild
(
bitmap
);
if
(
config
.
name
==
"tinyRedMid"
)
{
this
.
midRed
=
bitmap
;
}
else
if
(
config
.
name
==
"tinyRedLeft"
)
{
this
.
leftRed
=
bitmap
;
}
else
if
(
config
.
name
==
"tinyRedRight"
)
{
this
.
rightRed
=
bitmap
;
}
}
}
reset
()
{
egret
.
Tween
.
removeTweens
(
this
.
leftRed
);
egret
.
Tween
.
removeTweens
(
this
.
rightRed
);
egret
.
Tween
.
removeTweens
(
this
.
midRed
);
var
offset
=
237
/
2
//动画出来,然后循环
this
.
leftRed
.
x
=
22
+
40
-
offset
;
this
.
leftRed
.
y
=
5
+
100
-
offset
;
egret
.
Tween
.
get
(
this
.
leftRed
)
.
to
({
x
:
22
-
3
-
offset
,
y
:
5
-
8
-
offset
},
150
)
.
to
({
x
:
22
-
offset
,
y
:
5
-
offset
},
50
)
this
.
rightRed
.
x
=
123
-
7
-
offset
;
this
.
rightRed
.
y
=
14
+
100
-
offset
;
egret
.
Tween
.
get
(
this
.
rightRed
)
.
to
({
x
:
123
+
3
-
offset
,
y
:
14
-
8
-
offset
},
150
)
.
to
({
x
:
123
-
offset
,
y
:
14
-
offset
},
50
)
this
.
midRed
.
x
=
86
-
7
-
offset
;
this
.
midRed
.
y
=
60
+
80
-
offset
;
egret
.
Tween
.
get
(
this
.
midRed
)
.
to
({
x
:
86
+
3
-
offset
,
y
:
60
-
8
-
offset
},
150
)
.
to
({
x
:
86
-
offset
,
y
:
60
-
offset
},
50
)
.
call
(()
=>
{
//循环动画
this
.
leftRed
.
x
=
22
-
offset
;
this
.
leftRed
.
y
=
5
-
offset
;
egret
.
Tween
.
get
(
this
.
leftRed
,
{
loop
:
true
})
.
to
({
x
:
22
+
2
-
offset
,
y
:
5
+
5
-
offset
},
150
)
.
to
({
x
:
22
-
6
-
offset
,
y
:
5
-
14
-
offset
},
150
)
.
to
({
x
:
22
-
offset
,
y
:
5
-
offset
},
100
)
.
wait
(
500
);
this
.
rightRed
.
x
=
123
-
offset
;
this
.
rightRed
.
y
=
14
-
offset
;
egret
.
Tween
.
get
(
this
.
rightRed
,
{
loop
:
true
})
.
to
({
x
:
123
-
2
-
offset
,
y
:
14
+
5
-
offset
},
150
)
.
to
({
x
:
123
+
6
-
offset
,
y
:
14
-
14
-
offset
},
150
)
.
to
({
x
:
123
-
offset
,
y
:
14
-
offset
},
100
)
.
wait
(
500
);
this
.
midRed
.
x
=
86
-
offset
;
this
.
midRed
.
y
=
60
-
offset
;
egret
.
Tween
.
get
(
this
.
midRed
,
{
loop
:
true
})
.
to
({
x
:
86
-
2
-
offset
,
y
:
60
+
5
-
offset
},
150
)
.
to
({
x
:
86
+
6
-
offset
,
y
:
60
-
14
-
offset
},
150
)
.
to
({
x
:
86
-
offset
,
y
:
60
-
offset
},
100
)
.
wait
(
500
);
})
}
play
(
callback
:
Function
)
{
}
}
\ 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