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
ea080f98
Commit
ea080f98
authored
Mar 28, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整炮台动画
parent
8cfdbb00
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
195 additions
and
55 deletions
+195
-55
MainScene.ts
egret/src/mainScene/MainScene.ts
+127
-14
Tool.ts
egret/src/something/Tool.ts
+15
-0
Chapter22.ts
egret/src/something/chapters/Chapter22.ts
+2
-2
Element.ts
egret/src/something/class/Element.ts
+51
-39
No files found.
egret/src/mainScene/MainScene.ts
View file @
ea080f98
...
...
@@ -270,6 +270,8 @@ export default class MainScene extends Scene {
//新增炮台,地图上所有的炮台
cannoArr
:
Array
<
{
idx
:
number
,
ele
:
Element
}
>
=
[];
//每个炮台对应的特效
cannoEffect
:
Array
<
any
>
=
[];
//准备发射的炮台
readyCannoArr
:
number
[]
=
[];
get
steps
():
number
{
...
...
@@ -411,7 +413,6 @@ export default class MainScene extends Scene {
var
svgas
=
[
"amazing"
,
"great"
,
"wonderful"
,
"bonusTime"
];
//如果有节日的加
if
(
this
.
festivalTarget
)
svgas
.
push
(
"redBombLight"
);
svgas
.
push
(...[
"canno"
,
"cannofire"
,
"cannolight"
,
"cannoparticle"
]);
//新增大炮的动画
for
(
let
i
=
0
;
i
<
svgas
.
length
;
i
++
)
{
if
(
movieClips
[
svgas
[
i
]])
continue
;
...
...
@@ -428,7 +429,7 @@ export default class MainScene extends Scene {
let
fun
;
mv
.
addEventListener
(
egret
.
Event
.
COMPLETE
,
fun
=
function
(
e
)
{
e
.
target
.
stop
()
if
(
e
.
target
.
parent
&&
mvname
!=
"canno"
)
{
if
(
e
.
target
.
parent
)
{
e
.
target
.
parent
.
removeChild
(
e
.
target
)
}
},
this
)
...
...
@@ -438,6 +439,101 @@ export default class MainScene extends Scene {
})
}
}
/**
* 一个炮台有三个附属动画
*/
initCannoSvgas
(
arr
:
Array
<
{
idx
:
number
,
ele
:
Element
}
>
){
var
resPath
=
getResPath
();
this
.
cannoEffect
=
new
Array
();
if
(
!
svgaParser
)
svgaParser
=
new
window
[
"SVGA"
].
Parser
();
var
svgas
=
[
"cannofire"
,
"cannolight"
,
"cannoparticle"
];
//新增大炮的动画
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
){
let
icanno
:
Element
=
arr
[
i
].
ele
;
var
icannodir
:
forwardDirection
=
icanno
.
_cannoDir
;
var
icannolpos
=
Tool
.
getPositionByIndex
(
arr
[
i
].
idx
);
var
icannowpos
=
this
.
elementContainer
.
localToGlobal
(
icannolpos
[
0
],
icannolpos
[
1
]);
let
icannobox
:
eui
.
Group
=
new
eui
.
Group
;
let
icannoboxwid
:
number
=
116
;
let
icannoboxhei
:
number
=
116
;
icannobox
.
width
=
icannoboxwid
;
icannobox
.
height
=
icannoboxhei
;
icannobox
.
anchorOffsetX
=
icannoboxwid
/
2
;
icannobox
.
anchorOffsetY
=
icannoboxhei
/
2
;
let
effectobj
=
{};
this
.
cannoEffect
[
i
]
=
effectobj
;
this
.
cannoEffect
[
i
][
"box"
]
=
icannobox
;
this
.
addChild
(
icannobox
);
icannobox
.
x
=
icannowpos
.
x
;
icannobox
.
y
=
icannowpos
.
y
;
var
roanum
=
Tool
.
getCannoRoaByDir
(
icannodir
);
// console.log("icannobox旋转朝向",roanum);
icannobox
.
touchEnabled
=
false
;
icannobox
.
touchThrough
=
true
;
icannobox
.
rotation
=
roanum
;
for
(
let
j
=
0
;
j
<
svgas
.
length
;
j
++
){
let
jsvgname
=
svgas
[
j
];
svgaParser
.
load
(
resPath
+
'resource/assets/svgas/'
+
jsvgname
+
".svga"
,
(
videoItem
)
=>
{
var
mv
=
new
window
[
"SVGA"
].
EgretMovieClip
(
videoItem
);
mv
.
lockStep
=
true
;
if
(
jsvgname
==
"cannofire"
){
// console.log("cannofire",mv);
mv
.
x
=
icannoboxwid
-
6
;
mv
.
y
=
-
icannoboxhei
*
3
/
2
;
mv
.
rotation
=
90
;
}
else
if
(
jsvgname
==
"cannolight"
){
var
mvwidth
=
400
;
var
mvheight
=
400
;
mv
.
x
=
(
icannoboxwid
-
mvwidth
)
/
2
;
mv
.
y
=
(
icannoboxhei
-
mvheight
)
/
2
;
}
else
if
(
jsvgname
==
"cannoparticle"
){
mv
.
x
=
icannoboxwid
;
mv
.
y
=
-
icannoboxhei
/
2
;
mv
.
rotation
=
90
;
}
mv
.
stop
();
// mv.gotoAndPlay(1,true);
let
fun
;
mv
.
addEventListener
(
egret
.
Event
.
COMPLETE
,
fun
=
function
(
e
){
e
.
target
.
stop
();
e
.
target
.
visible
=
false
;
if
(
jsvgname
==
"cannofire"
){
//炮弹光波完毕,执行消除
// console.log("光波发射完毕,执行消除");
this
.
callBackFireCanno
(
icanno
);
}
else
if
(
jsvgname
==
"cannoparticle"
){
console
.
log
(
"发射充能光波"
);
this
.
selectPlayCannoEffect
(
i
,
"cannofire"
);
}
},
this
);
// mv.gotoAndStop(100);
this
.
cannoEffect
[
i
][
jsvgname
]
=
mv
;
// if(jsvgname=="cannofire"){
icannobox
.
addChild
(
this
.
cannoEffect
[
i
][
jsvgname
]);
// }
this
.
cannoEffect
[
i
][
jsvgname
].
visible
=
false
;
// console.log("初始"+i+"炮台"+jsvgname+"特效");
},
function
(
error
){
console
.
log
(
"炮台svg加载失败"
,
jsvgname
);
})
}
}
}
/**
* 播放炮台动画
*/
selectPlayCannoEffect
(
idx
:
number
,
name
:
string
){
if
(
!
this
.
cannoEffect
[
idx
][
name
].
visible
){
this
.
cannoEffect
[
idx
][
name
].
visible
=
true
;
}
this
.
cannoEffect
[
idx
][
name
].
stop
();
// this.cannoEffect[idx][name].gotoAndStop(1);
console
.
error
(
"炮台特效播放"
,
idx
,
name
)
this
.
cannoEffect
[
idx
][
name
].
gotoAndPlay
(
1
);
}
//初始化界面ui,,道具弄在这里s
initUi
()
{
...
...
@@ -887,6 +983,8 @@ export default class MainScene extends Scene {
idx
:
i
,
ele
:
canno
});
var
dirType
=
Tool
.
getCannoDir
(
elements
[
i
]);
canno
.
resetToCannoView
(
dirType
);
break
;
case
ElementConfigType
.
CANNO_BLOCK
:
let
canno_block
:
Element
=
Tool
.
getElement
(
ElementType
.
CANNO_BLOCK
);
...
...
@@ -901,8 +999,8 @@ export default class MainScene extends Scene {
break
}
}
console
.
log
(
"关卡大炮配置"
,
this
.
cannoArr
);
this
.
initCannoSvgas
(
this
.
cannoArr
);
//
console.log("关卡大炮配置",this.cannoArr);
}
//重置基础元素及特效类型
...
...
@@ -915,11 +1013,10 @@ export default class MainScene extends Scene {
const
baseElement
=
elements
[
i
];
const
isCandyEle
=
elementConfig
==
ElementConfigType
.
CANDY
;
const
isMonsterEle
=
elementConfig
==
ElementConfigType
.
MONSTER
;
const
isCanno
=
Tool
.
IsCanno
(
elementConfig
);
//不是基础元素,跳过,
if
(
!
Tool
.
judgeBaseEle
(
this
.
lattices
[
i
])
&&
!
isCandyEle
&&
!
isMonsterEle
&&
!
isCanno
)
continue
;
if
(
!
Tool
.
judgeBaseEle
(
this
.
lattices
[
i
])
&&
!
isCandyEle
&&
!
isMonsterEle
)
continue
;
//是0,跳过
if
(
!
baseElement
&&
!
isCandyEle
&&
!
isMonsterEle
&&
!
isCanno
)
continue
if
(
!
baseElement
&&
!
isCandyEle
&&
!
isMonsterEle
)
continue
const
ele
:
Element
=
this
.
lattices
[
i
].
element
;
if
(
isCandyEle
)
{
//糖果元素
...
...
@@ -937,10 +1034,6 @@ export default class MainScene extends Scene {
}
ele
.
resetToMonsterView
(
elementMonsterResMap
[
ele
.
type
]);
}
else
if
(
isCanno
){
//是炮台
var
dirType
=
Tool
.
getCannoDir
(
elementConfig
);
ele
.
resetToCannoView
(
dirType
);
}
else
{
//解析elements[i];
var
arr
:
number
[]
=
Tool
.
returnTO
(
elements
[
i
]);
...
...
@@ -2424,8 +2517,10 @@ export default class MainScene extends Scene {
}
}
}
canno
.
fireCanno
();
var
cannoarridx
=
this
.
getCannoArrByIdx
(
canno
);
this
.
selectPlayCannoEffect
(
cannoarridx
,
"cannoparticle"
);
// setTimeout(()=>{
// this.eliminate();
...
...
@@ -2433,6 +2528,18 @@ export default class MainScene extends Scene {
// canno.resetCannoStat();
// },200);
}
getCannoArrByIdx
(
canno
:
Element
){
var
cannoidx
=
canno
.
index
;
var
arridx
:
number
=
0
;
for
(
var
i
=
0
;
i
<
this
.
cannoArr
.
length
;
i
++
){
var
icannoidx
=
this
.
cannoArr
[
i
].
idx
;
if
(
icannoidx
==
cannoidx
){
arridx
=
i
;
break
;
}
}
return
arridx
;
}
/**
* 炮台发射完毕,开始炮台消除
*/
...
...
@@ -3660,12 +3767,18 @@ export default class MainScene extends Scene {
//返回下,有地方要用
//炮台充能
for
(
var
p
=
0
;
p
<
this
.
cannoArr
.
length
;
p
++
){
var
pcannoidx
=
this
.
cannoArr
[
p
].
idx
;
for
(
let
p
=
0
;
p
<
this
.
cannoArr
.
length
;
p
++
){
let
pcannoidx
=
this
.
cannoArr
[
p
].
idx
;
var
isnext
=
Tool
.
checkNebByidx
(
pcannoidx
,
index
);
if
(
isnext
){
var
pcannoele
=
this
.
cannoArr
[
p
].
ele
;
var
lastpcannostatnum
:
number
=
pcannoele
.
_cannoStat
pcannoele
.
addOneCannoStat
();
var
newpcannostatnum
:
number
=
pcannoele
.
_cannoStat
if
(
newpcannostatnum
>
lastpcannostatnum
){
console
.
log
(
'发射充能光波'
,
lastpcannostatnum
,
newpcannostatnum
);
this
.
selectPlayCannoEffect
(
p
,
"cannolight"
);
}
var
pcannostat
=
pcannoele
.
checkCannoStat
();
if
(
pcannostat
){
if
(
this
.
readyCannoArr
.
indexOf
(
p
)
==-
1
){
...
...
egret/src/something/Tool.ts
View file @
ea080f98
...
...
@@ -1249,4 +1249,19 @@ export class Tool {
console
.
error
(
"未定义跑跳"
);
}
}
//炮台的旋转朝向
public
static
getCannoRoaByDir
(
cannodir
:
forwardDirection
){
var
roaidx
:
number
;
if
(
cannodir
==
forwardDirection
.
left
){
roaidx
=
0
;
}
else
if
(
cannodir
==
forwardDirection
.
up
){
roaidx
=
1
;
}
else
if
(
cannodir
==
forwardDirection
.
right
){
roaidx
=
2
;
}
else
if
(
cannodir
==
forwardDirection
.
down
){
roaidx
=
3
;
}
var
roanum
=
[
-
90
,
0
,
90
,
180
][
roaidx
];
return
roanum
;
}
}
\ No newline at end of file
egret/src/something/chapters/Chapter22.ts
View file @
ea080f98
...
...
@@ -40,7 +40,7 @@ export const Chapters22: ChapterData[] = [
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
0
,
1
,
1
,
19
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
21
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
...
...
@@ -53,7 +53,7 @@ export const Chapters22: ChapterData[] = [
0
,
20
,
10
,
20
,
0
,
20
,
10
,
20
,
0
,
20
,
10
,
20
,
10
,
20
,
10
,
20
,
10
,
20
,
20
,
10
,
20
,
20
,
10
,
20
,
20
,
10
,
20
,
0
,
20
,
10
,
20
,
10
,
20
,
10
,
20
,
0
,
0
,
20
,
10
,
14
,
11
,
20
,
10
,
20
,
0
,
0
,
0
,
20
,
10
,
20
,
10
,
20
,
0
,
0
,
0
,
0
,
0
,
20
,
10
,
20
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
20
,
0
,
0
,
0
,
0
,
...
...
egret/src/something/class/Element.ts
View file @
ea080f98
...
...
@@ -45,7 +45,7 @@ export class Element extends eui.Component {
fishCanEliFlag
:
boolean
;
cannoMoveClip
:
any
;
cannoCnClip
:
any
;
//
cannoCnClip:any;
cannoStat
:
number
[]
=
[
1
,
61
,
121
,
181
,
241
,
361
];
//尝试设置碰撞状态,如果之前被特效集中,那么可以设置碰撞状态。碰撞状态之后可以准备消除。
...
...
@@ -197,7 +197,7 @@ export class Element extends eui.Component {
}
_cannoDir
:
forwardDirection
;
private
_cannoStat
:
number
=
0
;
_cannoStat
:
number
=
0
;
resetToCannoView
(
cannodir
:
forwardDirection
){
this
.
_cannoDir
=
cannodir
;
this
.
resetCannoStat
();
...
...
@@ -206,17 +206,22 @@ export class Element extends eui.Component {
// this.showImage.y = 0;
// this.showImage.anchorOffsetX = this.showImage.width / 2;
// this.showImage.anchorOffsetY = this.showImage.height / 2;
var
roaidx
:
number
;
if
(
cannodir
==
forwardDirection
.
left
){
roaidx
=
0
;
}
else
if
(
cannodir
==
forwardDirection
.
up
){
roaidx
=
1
;
}
else
if
(
cannodir
==
forwardDirection
.
right
){
roaidx
=
2
;
}
else
if
(
cannodir
==
forwardDirection
.
down
){
roaidx
=
3
;
}
this
.
cannobox
.
rotation
=
[
-
90
,
0
,
90
,
180
][
roaidx
];
// var roaidx:number;
// if(cannodir==forwardDirection.left){
// roaidx = 0;
// }else if(cannodir==forwardDirection.up){
// roaidx = 1;
// }else if(cannodir==forwardDirection.right){
// roaidx = 2;
// }else if(cannodir==forwardDirection.down){
// roaidx = 3;
// }
// this.cannobox.rotation = [-90,0,90,180][roaidx];
var
roanum
=
Tool
.
getCannoRoaByDir
(
cannodir
);
this
.
cannobox
.
rotation
=
roanum
;
}
changeShowCannoStat
(){
this
.
cannolab
.
text
=
this
.
_cannoStat
+
""
;
...
...
@@ -226,19 +231,25 @@ export class Element extends eui.Component {
if
(
this
.
cannoMoveClip
){
var
endframe
:
number
;
var
curframe
:
number
=
this
.
cannoMoveClip
.
currentFrame
;
this
.
cannoMoveClip
.
gotoAndPlay
(
curframe
,
true
);
if
(
_stat
==
0
){
curframe
=
0
;
endframe
=
1
;
}
else
if
(
_stat
==
1
){
curframe
=
61
;
endframe
=
121
;
}
else
if
(
_stat
==
2
){
curframe
=
121
endframe
=
181
;
}
else
if
(
_stat
==
3
){
curframe
=
181
;
endframe
=
241
;
}
else
if
(
_stat
==
4
){
curframe
=
241
;
endframe
=
361
;
}
// this.changeShowCanno(curframe,endframe);
// this.cannoMoveClip.gotoAndPlay(curframe,true);
this
.
cannoMoveClip
.
gotoAndPlay
(
curframe
,
1
);
this
.
stopFrame
=
endframe
;
}
}
...
...
@@ -267,7 +278,7 @@ export class Element extends eui.Component {
if
(
this
.
_cannoStat
>
3
){
this
.
_cannoStat
=
3
;
}
else
{
//充能动画
this
.
cannoCnClip
.
gotoAndPlay
(
1
,
true
);
//
this.cannoCnClip.gotoAndPlay(1,true);
}
this
.
changeShowCannoStat
();
}
...
...
@@ -511,13 +522,13 @@ export class Element extends eui.Component {
return
;
}
if
(
!
svgaParser
)
svgaParser
=
new
window
[
"SVGA"
].
Parser
();
var
svgas
=
[
"canno"
,
"cannofire"
,
"cannoparticle"
,
"cannolight"
];
var
svgas
=
[
"canno"
]
//
,"cannofire","cannoparticle","cannolight"];
for
(
let
i
=
0
;
i
<
svgas
.
length
;
i
++
){
let
mvname
=
svgas
[
i
];
svgaParser
.
load
(
resPath
+
'resource/assets/svgas/'
+
mvname
+
'.svga'
,(
videoItem
)
=>
{
if
(
mvname
==
"canno"
){
this
.
cannoMoveClip
=
new
window
[
"SVGA"
].
EgretMovieClip
(
videoItem
);
this
.
cannoMoveClip
.
lockStep
=
true
;
//
this.cannoMoveClip.lockStep = true;
var
mvwidth
=
102
;
var
mvheight
=
116
;
this
.
cannoMoveClip
.
x
=
(
this
.
cannoboxwid
-
mvwidth
)
/
2
;
...
...
@@ -525,20 +536,21 @@ export class Element extends eui.Component {
this
.
cannobox
.
addChild
(
this
.
cannoMoveClip
);
this
.
cannoMoveClip
.
gotoAndStop
(
1
);
this
.
cannoMoveClip
.
addEventListener
(
egret
.
Event
.
ENTER_FRAME
,
this
.
toFrameAni
,
this
);
}
else
if
(
mvname
==
"cannolight"
){
this
.
cannoCnClip
=
new
window
[
"SVGA"
].
EgretMovieClip
(
videoItem
);
this
.
cannoCnClip
.
lockStep
=
true
;
var
mvwidth
=
400
;
var
mvheight
=
400
;
this
.
cannoCnClip
.
x
=
(
this
.
cannoboxwid
-
mvwidth
)
/
2
;
this
.
cannoCnClip
.
y
=
(
this
.
cannoboxhei
-
mvheight
)
/
2
;
this
.
cannobox
.
addChild
(
this
.
cannoCnClip
);
this
.
cannoCnClip
.
gotoAndStop
(
1
);
this
.
cannoCnClip
.
addEventListener
(
egret
.
Event
.
COMPLETE
,
this
.
addOnePower
,
this
);
console
.
log
(
"光圈cannocnClip"
,
this
.
cannoCnClip
);
}
else
if
(
mvname
==
"cannoparticle"
){
}
// else if(mvname=="cannolight"){
// this.cannoCnClip = new window["SVGA"].EgretMovieClip(videoItem);
// this.cannoCnClip.lockStep = true;
// var mvwidth = 400;
// var mvheight = 400;
// this.cannoCnClip.x = (this.cannoboxwid-mvwidth)/2;
// this.cannoCnClip.y = (this.cannoboxhei-mvheight)/2;
// this.cannobox.addChild(this.cannoCnClip);
// this.cannoCnClip.gotoAndStop(1);
// this.cannoCnClip.addEventListener(egret.Event.COMPLETE,this.addOnePower,this);
// console.log("光圈cannocnClip",this.cannoCnClip);
// }else if(mvname=="cannoparticle"){
// }
});
}
}
...
...
@@ -552,17 +564,17 @@ export class Element extends eui.Component {
if
(
curframe
>=
this
.
stopFrame
){
this
.
cannoMoveClip
.
gotoAndStop
(
this
.
stopFrame
);
if
(
this
.
stopFrame
==
361
){
console
.
log
(
"炮台发射完毕"
);
//
console.log("炮台发射完毕");
}
}
}
/**
* 光圈充能动画
*/
addOnePower
(){
console
.
log
(
"一次光圈充能"
);
this
.
cannoCnClip
.
gotoAndStop
(
1
);
}
/
/ /
**
// * 光圈充能动画,现放在mainscene
//
*/
//
addOnePower(){
//
console.log("一次光圈充能");
//
this.cannoCnClip.gotoAndStop(1);
//
}
/**
* 替换资源时,同时修改
* @param source
...
...
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