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
80fa00a4
Commit
80fa00a4
authored
Apr 23, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化炮台
parent
251bce34
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
337 additions
and
309 deletions
+337
-309
MainScene.ts
egret/src/mainScene/MainScene.ts
+315
-301
Element.ts
egret/src/something/class/Element.ts
+16
-8
RecoverName.ts
egret/src/something/enum/RecoverName.ts
+6
-0
No files found.
egret/src/mainScene/MainScene.ts
View file @
80fa00a4
...
@@ -161,6 +161,7 @@ let svgaParser;
...
@@ -161,6 +161,7 @@ let svgaParser;
//三个toast和bonusTime
//三个toast和bonusTime
const
movieClips
:
any
=
{};
const
movieClips
:
any
=
{};
let
cannoblockdata
:
any
=
null
;
let
cannomvdata
:
any
=
null
;
let
cannomvdata
:
any
=
null
;
let
cannofire1mvdata
:
any
=
null
;
let
cannofire1mvdata
:
any
=
null
;
let
cannolightmvdata
:
any
=
null
;
let
cannolightmvdata
:
any
=
null
;
...
@@ -297,7 +298,11 @@ export default class MainScene extends Scene {
...
@@ -297,7 +298,11 @@ export default class MainScene extends Scene {
private
stepNumber
:
StepNumber
;
private
stepNumber
:
StepNumber
;
//新增炮台,地图上所有的炮台
//新增炮台,地图上所有的炮台
cannoArr
:
Array
<
{
idx
:
number
,
ele
:
Element
}
>
=
[];
// cannoArr:Array<{idx:number,ele:Element}> = [];
//本地图炮台总数
cannonums
:
number
=
0
;
//新增调整
cannoidxArr
:
Array
<
number
>
=
[];
//每个炮台对应的特效
//每个炮台对应的特效
cannoEffect
:
Array
<
any
>
=
[];
cannoEffect
:
Array
<
any
>
=
[];
//准备发射的炮台
//准备发射的炮台
...
@@ -423,7 +428,9 @@ export default class MainScene extends Scene {
...
@@ -423,7 +428,9 @@ export default class MainScene extends Scene {
this
.
lollipopMark
=
false
;
this
.
lollipopMark
=
false
;
this
.
hasEliminatedElements
=
new
Array
();
this
.
hasEliminatedElements
=
new
Array
();
this
.
scoreAnis
=
new
Array
();
this
.
scoreAnis
=
new
Array
();
this
.
cannoArr
=
new
Array
();
// this.cannoArr = new Array();
this
.
cannonums
=
0
;
this
.
cannoidxArr
=
new
Array
();
this
.
cannoEffect
=
new
Array
();
this
.
cannoEffect
=
new
Array
();
this
.
readyCannoArr
=
new
Array
();
this
.
readyCannoArr
=
new
Array
();
this
.
fireteamCannoArr
=
new
Array
();
this
.
fireteamCannoArr
=
new
Array
();
...
@@ -550,8 +557,6 @@ export default class MainScene extends Scene {
...
@@ -550,8 +557,6 @@ export default class MainScene extends Scene {
var
svgas
=
[
"amazing"
,
"great"
,
"wonderful"
,
"bonusTime"
];
var
svgas
=
[
"amazing"
,
"great"
,
"wonderful"
,
"bonusTime"
];
//如果有节日的加
//如果有节日的加
if
(
this
.
festivalTarget
)
svgas
.
push
(
"redBombLight"
);
if
(
this
.
festivalTarget
)
svgas
.
push
(
"redBombLight"
);
//到时候用炮台石头的替换todo
svgas
.
push
(
"cannoblock"
);
for
(
let
i
=
0
;
i
<
svgas
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
svgas
.
length
;
i
++
)
{
if
(
movieClips
[
svgas
[
i
]])
continue
;
if
(
movieClips
[
svgas
[
i
]])
continue
;
...
@@ -560,8 +565,6 @@ export default class MainScene extends Scene {
...
@@ -560,8 +565,6 @@ export default class MainScene extends Scene {
svgaParser
.
load
(
resPath
+
'resource/assets/svgas/'
+
svgas
[
i
]
+
".svga"
,
(
videoItem
)
=>
{
svgaParser
.
load
(
resPath
+
'resource/assets/svgas/'
+
svgas
[
i
]
+
".svga"
,
(
videoItem
)
=>
{
var
mv
=
new
window
[
"SVGA"
].
EgretMovieClip
(
videoItem
);
var
mv
=
new
window
[
"SVGA"
].
EgretMovieClip
(
videoItem
);
mv
.
lockStep
=
true
;
mv
.
lockStep
=
true
;
if
(
svgas
[
i
]
==
"cannoblock"
){
}
if
(
svgas
[
i
]
!=
"bonusTime"
)
{
if
(
svgas
[
i
]
!=
"bonusTime"
)
{
mv
.
x
=
(
750
-
520
)
/
2
;
mv
.
x
=
(
750
-
520
)
/
2
;
mv
.
y
=
500
;
mv
.
y
=
500
;
...
@@ -590,20 +593,26 @@ export default class MainScene extends Scene {
...
@@ -590,20 +593,26 @@ export default class MainScene extends Scene {
cannomvdata
=
videoItem
;
cannomvdata
=
videoItem
;
})
})
}
}
//炮台石头
if
(
cannoblockdata
){
}
else
{
svgaParser
.
load
(
resPath
+
'resource/assets/svgas/cannoblock.svga'
,(
videoItem
)
=>
{
cannoblockdata
=
videoItem
;
})
}
}
}
/**
/**
* 一个炮台有三个附属动画
* 一个炮台有三个附属动画
*/
*/
initCannoSvgas
(
arr
:
Array
<
{
idx
:
number
,
ele
:
Element
}
>
){
initCannoSvgas
(
icanno
:
Element
,
icannobianhao
:
number
){
var
resPath
=
getResPath
();
var
resPath
=
getResPath
();
this
.
cannoEffect
=
new
Array
();
if
(
!
svgaParser
)
svgaParser
=
new
window
[
"SVGA"
].
Parser
();
if
(
!
svgaParser
)
svgaParser
=
new
window
[
"SVGA"
].
Parser
();
var
svgas
=
[
"cannofire1"
,
"cannolight"
,
"cannoparticle"
];
//新增大炮的动画
var
svgas
=
[
"cannofire1"
,
"cannolight"
];
//,"cannoparticle"];//新增大炮的动画
let
icannoidx
=
icanno
.
index
;
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
){
let
icanno
:
Element
=
arr
[
i
].
ele
;
let
icannodir
:
forwardDirection
=
icanno
.
_cannoDir
;
let
icannodir
:
forwardDirection
=
icanno
.
_cannoDir
;
let
icannolpos
=
Tool
.
getPositionByIndex
(
arr
[
i
].
idx
);
let
icannolpos
=
Tool
.
getPositionByIndex
(
icanno
idx
);
let
icannowpos
=
this
.
elementContainer
.
localToGlobal
(
icannolpos
[
0
],
icannolpos
[
1
]);
let
icannowpos
=
this
.
elementContainer
.
localToGlobal
(
icannolpos
[
0
],
icannolpos
[
1
]);
let
icannobox
:
eui
.
Group
=
new
eui
.
Group
;
let
icannobox
:
eui
.
Group
=
new
eui
.
Group
;
...
@@ -615,11 +624,10 @@ export default class MainScene extends Scene {
...
@@ -615,11 +624,10 @@ export default class MainScene extends Scene {
icannobox
.
anchorOffsetY
=
icannoboxhei
/
2
;
icannobox
.
anchorOffsetY
=
icannoboxhei
/
2
;
let
effectobj
=
{};
let
effectobj
=
{};
this
.
cannoEffect
[
i
]
=
effectobj
;
this
.
cannoEffect
[
icannobianhao
]
=
effectobj
;
this
.
cannoEffect
[
i
][
"box"
]
=
icannobox
;
this
.
cannoEffect
[
icannobianhao
][
"box"
]
=
icannobox
;
this
.
effectContainer
.
addChild
(
icannobox
);
this
.
addChild
(
icannobox
);
icannobox
.
x
=
icannowpos
.
x
;
icannobox
.
x
=
icannowpos
.
x
;
icannobox
.
y
=
icannowpos
.
y
;
icannobox
.
y
=
icannowpos
.
y
;
let
roanum
=
Tool
.
getCannoRoaByDir
(
icannodir
);
let
roanum
=
Tool
.
getCannoRoaByDir
(
icannodir
);
...
@@ -629,16 +637,25 @@ export default class MainScene extends Scene {
...
@@ -629,16 +637,25 @@ export default class MainScene extends Scene {
for
(
let
j
=
0
;
j
<
svgas
.
length
;
j
++
){
for
(
let
j
=
0
;
j
<
svgas
.
length
;
j
++
){
let
jsvgname
=
svgas
[
j
];
let
jsvgname
=
svgas
[
j
];
let
mvdata
:
any
;
let
mvdata
:
any
;
let
mv
:
any
;
if
(
jsvgname
==
"cannofire1"
){
if
(
jsvgname
==
"cannofire1"
){
mvdata
=
cannofire1mvdata
;
mvdata
=
cannofire1mvdata
;
mv
=
Pool
.
takeOut
(
RecoverName
.
CANNOFIRE
);
}
else
if
(
jsvgname
==
"cannolight"
){
}
else
if
(
jsvgname
==
"cannolight"
){
mvdata
=
cannolightmvdata
;
mvdata
=
cannolightmvdata
;
mv
=
Pool
.
takeOut
(
RecoverName
.
CANNOLIGHT
);
}
else
if
(
jsvgname
==
"cannoparticle"
){
}
else
if
(
jsvgname
==
"cannoparticle"
){
console
.
error
(
"新特效大炮不再使用particle"
);
mvdata
=
cannoparticlemvdata
;
mvdata
=
cannoparticlemvdata
;
}
}
if
(
mvdata
){
if
(
mvdata
){
let
mv
=
new
window
[
"SVGA"
].
EgretMovieClip
(
mvdata
);
// console.log("复用mvdata,免加载");
this
.
initCannoMv
(
mv
,
jsvgname
,
i
);
if
(
!
mv
){
mv
=
new
window
[
"SVGA"
].
EgretMovieClip
(
mvdata
);
}
else
{
// console.log("复用了炮台动画");
}
this
.
initCannoMv
(
mv
,
jsvgname
,
icannobianhao
);
}
else
{
}
else
{
svgaParser
.
load
(
resPath
+
'resource/assets/svgas/'
+
jsvgname
+
".svga"
,
(
videoItem
)
=>
{
svgaParser
.
load
(
resPath
+
'resource/assets/svgas/'
+
jsvgname
+
".svga"
,
(
videoItem
)
=>
{
let
mv
=
new
window
[
"SVGA"
].
EgretMovieClip
(
videoItem
);
let
mv
=
new
window
[
"SVGA"
].
EgretMovieClip
(
videoItem
);
...
@@ -650,14 +667,13 @@ export default class MainScene extends Scene {
...
@@ -650,14 +667,13 @@ export default class MainScene extends Scene {
}
else
if
(
jsvgname
==
"cannoparticle"
&&!
cannoparticlemvdata
){
}
else
if
(
jsvgname
==
"cannoparticle"
&&!
cannoparticlemvdata
){
cannoparticlemvdata
=
videoItem
;
cannoparticlemvdata
=
videoItem
;
}
}
this
.
initCannoMv
(
mv
,
jsvgname
,
i
);
this
.
initCannoMv
(
mv
,
jsvgname
,
icannobianhao
);
},
function
(
error
){
},
function
(
error
){
console
.
log
(
"炮台svg加载失败"
,
jsvgname
);
console
.
log
(
"炮台svg加载失败"
,
jsvgname
);
})
})
}
}
}
}
}
}
}
/**
/**
* 加载猩猩脚印
* 加载猩猩脚印
*/
*/
...
@@ -711,9 +727,40 @@ export default class MainScene extends Scene {
...
@@ -711,9 +727,40 @@ export default class MainScene extends Scene {
}
}
}
else
if
(
curframe
==
25
){
}
else
if
(
curframe
==
25
){
var
icannoidx
=
target
[
"cannoidx"
];
var
icannoidx
=
target
[
"cannoidx"
];
var
icanno
=
this
.
cannoArr
[
icannoidx
].
ele
;
var
icanno
:
Element
=
this
.
getCannoByBianhao
(
icannoidx
);
if
(
icanno
){
this
.
callBackFireCanno
(
icanno
);
this
.
callBackFireCanno
(
icanno
);
}
else
{
console
.
error
(
"未找到对应大炮,检查"
);
}
}
}
//该遍历之后尽量简化下todo
getCannoByBianhao
(
cannoidx
:
number
):
Element
{
var
canno
:
Element
;
// console.log("获取大炮",cannoidx,this.cannoidxArr);
for
(
var
i
=
0
;
i
<
this
.
cannoidxArr
.
length
;
i
++
){
var
ilattice
=
this
.
lattices
[
this
.
cannoidxArr
[
i
]];
if
(
ilattice
&&
ilattice
.
element
&&
ilattice
.
element
.
type
==
ElementType
.
CANNO
){
var
icannobianhao
=
ilattice
.
element
.
cannobianhao
;
if
(
cannoidx
==
icannobianhao
){
canno
=
ilattice
.
element
;
break
;
}
}
}
}
// for(var i=0;i<this.lattices.length;i++){
// var ilattice = this.lattices[i];
// if(ilattice&&ilattice.element&&ilattice.element.type==ElementType.CANNO){
// var icannobianhao = ilattice.element.cannobianhao;
// if(cannoidx==icannobianhao){
// canno = ilattice.element;
// break;
// }
// }
// }
return
canno
;
}
}
listenCnlight
(
e
){
listenCnlight
(
e
){
var
target
=
e
.
target
;
var
target
=
e
.
target
;
...
@@ -724,9 +771,13 @@ export default class MainScene extends Scene {
...
@@ -724,9 +771,13 @@ export default class MainScene extends Scene {
target
.
parent
.
removeChild
(
target
);
target
.
parent
.
removeChild
(
target
);
}
}
var
icannoidx
=
target
[
"cannoidx"
];
var
icannoidx
=
target
[
"cannoidx"
];
var
icanno
=
this
.
cannoArr
[
icannoidx
].
ele
;
var
icanno
=
this
.
getCannoByBianhao
(
icannoidx
);
if
(
icanno
){
var
anmstat
=
icanno
.
_cannoStat
;
var
anmstat
=
icanno
.
_cannoStat
;
icanno
.
changeMvPlay
(
anmstat
);
icanno
.
changeMvPlay
(
anmstat
);
}
else
{
console
.
error
(
"未找到对应大炮,检查"
);
}
}
}
}
}
listenCnparticle
(
e
){
listenCnparticle
(
e
){
...
@@ -751,6 +802,19 @@ export default class MainScene extends Scene {
...
@@ -751,6 +802,19 @@ export default class MainScene extends Scene {
*/
*/
selectPlayCannoEffect
(
idx
:
number
,
name
:
string
){
selectPlayCannoEffect
(
idx
:
number
,
name
:
string
){
if
(
this
.
cannoEffect
&&
this
.
cannoEffect
[
idx
]
&&
this
.
cannoEffect
[
idx
][
name
]){
if
(
this
.
cannoEffect
&&
this
.
cannoEffect
[
idx
]
&&
this
.
cannoEffect
[
idx
][
name
]){
//当前黑洞仅转移炮台位置,不会调整大炮方向,所以仅仅调整特效box位置即可
var
icanno
=
this
.
getCannoByBianhao
(
idx
);
if
(
icanno
){
let
icannoidx
=
icanno
.
index
;
let
icannodir
:
forwardDirection
=
icanno
.
_cannoDir
;
let
icannolpos
=
Tool
.
getPositionByIndex
(
icannoidx
);
let
icannowpos
=
this
.
elementContainer
.
localToGlobal
(
icannolpos
[
0
],
icannolpos
[
1
]);
this
.
cannoEffect
[
idx
][
"box"
].
x
=
icannowpos
.
x
;
this
.
cannoEffect
[
idx
][
"box"
].
y
=
icannowpos
.
y
;
}
else
{
console
.
error
(
"未找到对应大炮,检查"
);
}
if
(
!
this
.
cannoEffect
[
idx
][
name
].
visible
){
if
(
!
this
.
cannoEffect
[
idx
][
name
].
visible
){
this
.
cannoEffect
[
idx
][
name
].
visible
=
true
;
this
.
cannoEffect
[
idx
][
name
].
visible
=
true
;
}
}
...
@@ -1040,7 +1104,8 @@ export default class MainScene extends Scene {
...
@@ -1040,7 +1104,8 @@ export default class MainScene extends Scene {
//初始化地图元素
//初始化地图元素
initElement
()
{
initElement
()
{
this
.
cannoArr
=
new
Array
();
this
.
cannonums
=
0
;
this
.
cannoEffect
=
new
Array
();
//没有就根据地图格子随机元素
//没有就根据地图格子随机元素
var
elements
=
this
.
chapterData
.
map
.
elements
||
Tool
.
setNumber01
(
this
.
chapterData
.
map
.
lattices
.
slice
());
var
elements
=
this
.
chapterData
.
map
.
elements
||
Tool
.
setNumber01
(
this
.
chapterData
.
map
.
lattices
.
slice
());
//猩猩初始时加入
//猩猩初始时加入
...
@@ -1188,25 +1253,25 @@ export default class MainScene extends Scene {
...
@@ -1188,25 +1253,25 @@ export default class MainScene extends Scene {
canno
.
y
=
p
[
1
];
canno
.
y
=
p
[
1
];
this
.
elementContainer
.
addChild
(
canno
);
this
.
elementContainer
.
addChild
(
canno
);
this
.
lattices
[
i
].
element
=
canno
;
this
.
lattices
[
i
].
element
=
canno
;
this
.
cannoArr
.
push
({
idx
:
i
,
ele
:
canno
});
var
dirType
=
Tool
.
getCannoDir
(
elements
[
i
]);
var
dirType
=
Tool
.
getCannoDir
(
elements
[
i
]);
canno
.
resetToCannoView
(
dirType
,
this
);
canno
.
resetToCannoView
(
dirType
,
this
);
let
cannobianhao
:
number
=
this
.
cannonums
;
//添加大炮
//添加大炮
if
(
cannomvdata
){
if
(
cannomvdata
){
canno
.
createCanno
(
cannomvdata
);
canno
.
createCanno
(
cannomvdata
,
cannobianhao
);
}
else
{
}
else
{
if
(
!
svgaParser
)
svgaParser
=
new
window
[
"SVGA"
].
Parser
();
if
(
!
svgaParser
)
svgaParser
=
new
window
[
"SVGA"
].
Parser
();
svgaParser
.
load
(
resPath
+
'resource/assets/svgas/canno1.svga'
,(
videoItem
)
=>
{
svgaParser
.
load
(
resPath
+
'resource/assets/svgas/canno1.svga'
,(
videoItem
)
=>
{
if
(
!
cannomvdata
){
if
(
!
cannomvdata
){
cannomvdata
=
videoItem
;
cannomvdata
=
videoItem
;
}
}
canno
.
createCanno
(
cannomvdata
);
canno
.
createCanno
(
cannomvdata
,
cannobianhao
);
})
})
}
}
this
.
cannonums
+=
1
;
this
.
cannoidxArr
.
push
(
i
);
//给大炮附加发射等特效
this
.
initCannoSvgas
(
canno
,
cannobianhao
);
break
;
break
;
case
ElementConfigType
.
CANNO_BLOCK
:
case
ElementConfigType
.
CANNO_BLOCK
:
let
canno_block
:
Element
=
Tool
.
getElement
(
ElementType
.
CANNO_BLOCK
);
let
canno_block
:
Element
=
Tool
.
getElement
(
ElementType
.
CANNO_BLOCK
);
...
@@ -1306,7 +1371,6 @@ export default class MainScene extends Scene {
...
@@ -1306,7 +1371,6 @@ export default class MainScene extends Scene {
break
break
}
}
}
}
this
.
initCannoSvgas
(
this
.
cannoArr
);
}
}
havecreate
:
Array
<
number
>
=
[];
havecreate
:
Array
<
number
>
=
[];
//创建猩猩
//创建猩猩
...
@@ -1511,6 +1575,27 @@ export default class MainScene extends Scene {
...
@@ -1511,6 +1575,27 @@ export default class MainScene extends Scene {
this
.
reCoverAllLattice
();
this
.
reCoverAllLattice
();
//回收炮台相关动画
for
(
var
i
=
0
;
i
<
this
.
cannoEffect
.
length
;
i
++
){
var
icannoeffect
=
this
.
cannoEffect
[
i
];
var
icannoeffectfire
=
icannoeffect
[
'cannofire1'
];
var
icannoeffectlight
=
icannoeffect
[
'cannolight'
];
if
(
icannoeffectfire
){
if
(
icannoeffectfire
.
parent
){
icannoeffectfire
.
parent
.
removeChild
(
icannoeffectfire
);
}
icannoeffectfire
.
removeEventListener
(
egret
.
Event
.
ENTER_FRAME
,
this
.
listenCnfire
,
this
);
Pool
.
recover
(
RecoverName
.
CANNOFIRE
,
icannoeffectfire
);
}
if
(
icannoeffectlight
){
if
(
icannoeffectlight
.
parent
){
icannoeffectlight
.
parent
.
removeChild
(
icannoeffectlight
);
}
icannoeffectlight
.
removeEventListener
(
egret
.
Event
.
ENTER_FRAME
,
this
.
listenCnlight
,
this
);
Pool
.
recover
(
RecoverName
.
CANNOLIGHT
,
icannoeffectlight
);
}
}
this
.
cannoEffect
=
new
Array
();
}
}
onEnterFrame
()
{
onEnterFrame
()
{
...
@@ -1600,13 +1685,6 @@ export default class MainScene extends Scene {
...
@@ -1600,13 +1685,6 @@ export default class MainScene extends Scene {
onTap_quitBtn
()
{
onTap_quitBtn
()
{
PanelCtrl
.
instance
.
show
(
"quit"
,
{
level
:
this
.
chapter
});
PanelCtrl
.
instance
.
show
(
"quit"
,
{
level
:
this
.
chapter
});
}
}
// testchangeShow(num:number){
// var cannoele = this.cannoArr[0].ele;
// var cur = cannoele.cannoMoveClip.currentFrame;
// cur += num*10;
// cannoele.cannoMoveClip.gotoAndStop(cur);
// console.log(cannoele.cannoMoveClip.currentFrame);
// }
onTap_boomBtn
()
{
onTap_boomBtn
()
{
// this.pongoPaiKuang(38);
// this.pongoPaiKuang(38);
// return;
// return;
...
@@ -1779,7 +1857,7 @@ export default class MainScene extends Scene {
...
@@ -1779,7 +1857,7 @@ export default class MainScene extends Scene {
}
}
//新大炮充能
//新大炮充能
var
pcannostatArr
=
new
Array
();
var
pcannostatArr
=
new
Array
();
for
(
var
np
=
0
;
np
<
this
.
canno
Arr
.
length
;
np
++
){
for
(
var
np
=
0
;
np
<
this
.
canno
nums
;
np
++
){
var
pcannodata
=
{
var
pcannodata
=
{
ineffect
:
false
,
ineffect
:
false
,
addnum
:
0
,
addnum
:
0
,
...
@@ -2642,7 +2720,7 @@ export default class MainScene extends Scene {
...
@@ -2642,7 +2720,7 @@ export default class MainScene extends Scene {
pcannostatArr
=
data
;
pcannostatArr
=
data
;
}
else
{
}
else
{
pcannostatArr
=
new
Array
();
pcannostatArr
=
new
Array
();
for
(
var
p
=
0
;
p
<
this
.
canno
Arr
.
length
;
p
++
){
for
(
var
p
=
0
;
p
<
this
.
canno
nums
;
p
++
){
var
pcannodata
=
{
var
pcannodata
=
{
ineffect
:
false
,
ineffect
:
false
,
addnum
:
0
,
addnum
:
0
,
...
@@ -2696,7 +2774,7 @@ export default class MainScene extends Scene {
...
@@ -2696,7 +2774,7 @@ export default class MainScene extends Scene {
npadd
=
npaddnum
;
npadd
=
npaddnum
;
}
}
}
}
var
npcanno
=
this
.
cannoArr
[
np
].
ele
;
var
npcanno
=
this
.
getCannoByBianhao
(
np
)
;
for
(
var
ap
=
0
;
ap
<
npadd
;
ap
++
){
for
(
var
ap
=
0
;
ap
<
npadd
;
ap
++
){
var
lastpcannostatnum
:
number
=
npcanno
.
_cannoStat
var
lastpcannostatnum
:
number
=
npcanno
.
_cannoStat
npcanno
.
addOneCannoStat
();
npcanno
.
addOneCannoStat
();
...
@@ -2822,14 +2900,15 @@ export default class MainScene extends Scene {
...
@@ -2822,14 +2900,15 @@ export default class MainScene extends Scene {
//炮台充能发射
//炮台充能发射
var
emitcanno
:
Element
;
var
emitcanno
:
Element
;
if
(
this
.
readyCannoArr
.
length
>
0
){
if
(
this
.
readyCannoArr
.
length
>
0
){
// var readyCannoIdx = this.readyCannoArr[0];
// emitcanno = this.cannoArr[readyCannoIdx].ele;
this
.
fireteamCannoArr
=
new
Array
();
this
.
fireteamCannoArr
=
new
Array
();
for
(
var
p
=
0
;
p
<
this
.
readyCannoArr
.
length
;
p
++
){
for
(
var
p
=
0
;
p
<
this
.
readyCannoArr
.
length
;
p
++
){
var
preadyCannoIdx
=
this
.
readyCannoArr
[
p
];
var
preadyCannoIdx
=
this
.
readyCannoArr
[
p
];
var
pemitcanno
=
this
.
cannoArr
[
preadyCannoIdx
].
ele
;
var
pemitcanno
=
this
.
getCannoByBianhao
(
preadyCannoIdx
);
if
(
pemitcanno
){
this
.
fireCanno
(
pemitcanno
);
this
.
fireCanno
(
pemitcanno
);
}
else
{
console
.
error
(
"未找到对应大炮,检查"
);
}
}
}
return
;
return
;
}
}
...
@@ -3012,79 +3091,20 @@ export default class MainScene extends Scene {
...
@@ -3012,79 +3091,20 @@ export default class MainScene extends Scene {
//大炮发射
//大炮发射
fireCanno
(
canno
:
Element
){
fireCanno
(
canno
:
Element
){
// var cannodir = canno._cannoDir;
// var cannorow = canno.row;
// var cannocol = canno.column;
// var cannoFireArr:number[] = new Array();
// if(cannodir==forwardDirection.left){
// for(var i=cannocol;i>=0;i--){
// var iemitidx = Tool.rcToIndex(cannorow,i);
// cannoFireArr.push(iemitidx);
// }
// }else if(cannodir==forwardDirection.up){
// for(var i=cannorow;i>=0;i--){
// var iemitidx = Tool.rcToIndex(i,cannocol);
// cannoFireArr.push(iemitidx);
// }
// }else if(cannodir==forwardDirection.right){
// for(var i=cannocol;i<Tool.colNum;i++){
// var iemitidx = Tool.rcToIndex(cannorow,i);
// cannoFireArr.push(iemitidx);
// }
// }else if(cannodir==forwardDirection.down){
// for(var i=cannorow;i<Tool.rowNum;i++){
// var iemitidx = Tool.rcToIndex(i,cannocol);
// cannoFireArr.push(iemitidx);
// }
// }
// //特效消除猩猩--炮弹
// var lockPongoArr:Array<{idx:number,part:string}> = new Array();
// for(var j=0;j<cannoFireArr.length;j++){
// var jemitidx = cannoFireArr[j];
// var lat = this.lattices[jemitidx];
// var caneliminate = Tool.judgeEliminate(lat);
// var iscannoblock = Tool.judgeIscannoBlock(lat);
// if(lat&&(caneliminate||iscannoblock)){
// if(this.eliminatedElements.indexOf(jemitidx)==-1){
// this.eliminatedElements.push(jemitidx);
// }
// //加分
// if(iscannoblock){
// // console.log("炮台石头消除");
// break;
// }
// }
// //提前消除了,需要修改成炮台的消除时消除
// if(lat&&lat.element){
// var isbreak = this.solveOneTxPgEle(lat.element.row,lat.element.column,lockPongoArr);
// }
// }
canno
.
fireCanno
();
canno
.
fireCanno
();
// var cannoidx = canno.index;
// var cannoarridx = this.getCannoArrByIdx(cannoidx);
// this.selectPlayCannoEffect(cannoarridx,"cannoparticle");
// setTimeout(()=>{
// this.eliminate();
// this.readyCannoArr.shift();
// canno.resetCannoStat();
// },200);
// this.solvePongoEle(lockPongoArr);
}
}
getCannoArrByIdx
(
cannoidx
:
number
){
getCannoArrByIdx
(
cannoidx
:
number
){
var
arridx
:
number
=
0
;
var
arridx
:
number
=
0
;
for
(
var
i
=
0
;
i
<
this
.
cannoArr
.
length
;
i
++
){
for
(
var
i
=
0
;
i
<
this
.
cannonums
;
i
++
){
var
icannoidx
=
this
.
cannoArr
[
i
].
idx
;
var
icanno
=
this
.
getCannoByBianhao
(
i
);
if
(
icanno
){
var
icannoidx
=
icanno
.
index
;
if
(
icannoidx
==
cannoidx
){
if
(
icannoidx
==
cannoidx
){
arridx
=
i
;
arridx
=
i
;
break
;
break
;
}
}
}
}
}
return
arridx
;
return
arridx
;
}
}
/**
/**
...
@@ -3151,30 +3171,16 @@ export default class MainScene extends Scene {
...
@@ -3151,30 +3171,16 @@ export default class MainScene extends Scene {
this
.
eliminate
();
this
.
eliminate
();
for
(
var
i
=
0
;
i
<
this
.
readyCannoArr
.
length
;
i
++
){
for
(
var
i
=
0
;
i
<
this
.
readyCannoArr
.
length
;
i
++
){
var
preadyCannoIdx
=
this
.
readyCannoArr
[
i
];
var
preadyCannoIdx
=
this
.
readyCannoArr
[
i
];
var
pemitcanno
=
this
.
cannoArr
[
preadyCannoIdx
].
ele
;
var
pemitcanno
=
this
.
getCannoByBianhao
(
preadyCannoIdx
);
if
(
pemitcanno
){
pemitcanno
.
resetCannoStat
();
pemitcanno
.
resetCannoStat
();
}
else
{
console
.
error
(
"未找到对应大炮,检查"
);
}
}
}
this
.
readyCannoArr
=
new
Array
();
this
.
readyCannoArr
=
new
Array
();
this
.
fireteamCannoArr
=
new
Array
();
this
.
fireteamCannoArr
=
new
Array
();
}
}
// this.readyCannoArr.shift();
// canno.resetCannoStat();
// if(this.readyCannoArr.length==1){
// this.eliminate();
// }
// let cannoidx = canno.index;
// // setTimeout(()=>{
// for(let i=0;i<this.readyCannoArr.length;i++){
// let ireadycannoidx = this.cannoArr[this.readyCannoArr[i]].idx;
// if(ireadycannoidx==cannoidx){
// this.readyCannoArr.splice(i,1);
// break;
// }
// }
// canno.resetCannoStat();
// // },150)
}
}
checkAllBlock
()
{
checkAllBlock
()
{
// this.lattices.filter(item => item.block).forEach((item) => {
// this.lattices.filter(item => item.block).forEach((item) => {
...
@@ -4895,8 +4901,14 @@ export default class MainScene extends Scene {
...
@@ -4895,8 +4901,14 @@ export default class MainScene extends Scene {
removeCannoBlock
(
index
:
number
){
removeCannoBlock
(
index
:
number
){
this
.
removeOperation
(
index
);
this
.
removeOperation
(
index
);
//炮台石头的动效
//炮台石头的动效
var
blockmv
=
movieClips
[
"cannoblock"
];
var
blockmv
=
Pool
.
takeOut
(
RecoverName
.
CANNOBLOCKANI
);
//movieClips["cannoblock"];
if
(
!
blockmv
){
blockmv
=
new
window
[
"SVGA"
].
EgretMovieClip
(
cannoblockdata
);
}
else
{
// console.log("复用炮台石头");
}
if
(
blockmv
){
if
(
blockmv
){
blockmv
.
addEventListener
(
egret
.
Event
.
COMPLETE
,
this
.
playBlockComp
,
this
);
var
blpos
=
Tool
.
getPositionByIndex
(
index
);
var
blpos
=
Tool
.
getPositionByIndex
(
index
);
var
bwpos
=
this
.
elementContainer
.
localToGlobal
(
blpos
[
0
],
blpos
[
1
]);
var
bwpos
=
this
.
elementContainer
.
localToGlobal
(
blpos
[
0
],
blpos
[
1
]);
var
blockwid
=
112
;
var
blockwid
=
112
;
...
@@ -4908,6 +4920,14 @@ export default class MainScene extends Scene {
...
@@ -4908,6 +4920,14 @@ export default class MainScene extends Scene {
blockmv
.
gotoAndPlay
(
1
,
1
);
blockmv
.
gotoAndPlay
(
1
,
1
);
}
}
}
}
playBlockComp
(
e
){
e
.
target
.
stop
();
if
(
e
.
target
.
parent
){
e
.
target
.
removeEventListener
(
egret
.
Event
.
COMPLETE
,
this
.
playBlockComp
,
this
);
e
.
target
.
parent
.
removeChild
(
e
.
target
);
Pool
.
recover
(
RecoverName
.
CANNOBLOCKANI
,
e
.
target
);
}
}
/**
/**
* 猩猩的移除
* 猩猩的移除
*/
*/
...
@@ -5003,31 +5023,6 @@ export default class MainScene extends Scene {
...
@@ -5003,31 +5023,6 @@ export default class MainScene extends Scene {
//置空格子的element,
//置空格子的element,
this
.
lattices
[
index
].
element
=
null
;
this
.
lattices
[
index
].
element
=
null
;
//返回下,有地方要用
//返回下,有地方要用
//炮台充能
// console.log("消除元素类型",eletype,eleffectype);
// for(let p=0;p<this.cannoArr.length;p++){
// let pcannoidx = this.cannoArr[p].idx;
// var isnext = Tool.checkNebByidx(pcannoidx,index);
// if(isnext&&Tool.judgeChosen(ele)){
// var pcannoele = this.cannoArr[p].ele;
// var lastpcannostatnum:number = pcannoele._cannoStat
// pcannoele.addOneCannoStat();
// var newpcannostatnum:number = pcannoele._cannoStat
// if(newpcannostatnum>lastpcannostatnum){
// // console.log('炮台充能------'+p,lastpcannostatnum,newpcannostatnum);
// this.selectPlayCannoEffect(p,"cannolight");
// }
// var pcannostat = pcannoele.checkCannoStat();
// if(pcannostat){
// if(this.readyCannoArr.indexOf(p)==-1){
// this.readyCannoArr.push(p);
// }
// }
// }
// }
//消除
//消除
return
ele
return
ele
...
@@ -5113,7 +5108,9 @@ export default class MainScene extends Scene {
...
@@ -5113,7 +5108,9 @@ export default class MainScene extends Scene {
//相邻加
//相邻加
addCannoStatByNext
(
cannoid
:
number
,
eleidx
:
number
){
addCannoStatByNext
(
cannoid
:
number
,
eleidx
:
number
){
if
(
!
this
.
lattices
[
eleidx
]
||
!
this
.
lattices
[
eleidx
].
element
)
return
false
;
if
(
!
this
.
lattices
[
eleidx
]
||
!
this
.
lattices
[
eleidx
].
element
)
return
false
;
var
cannoidx
:
number
=
this
.
cannoArr
[
cannoid
].
idx
;
var
canno
=
this
.
getCannoByBianhao
(
cannoid
);
if
(
canno
){
var
cannoidx
:
number
=
canno
.
index
;
var
isnext
=
Tool
.
checkNebByidx
(
cannoidx
,
eleidx
);
var
isnext
=
Tool
.
checkNebByidx
(
cannoidx
,
eleidx
);
var
ele
=
this
.
lattices
[
eleidx
].
element
;
var
ele
=
this
.
lattices
[
eleidx
].
element
;
if
(
isnext
&&
Tool
.
judgeChosen
(
ele
)){
if
(
isnext
&&
Tool
.
judgeChosen
(
ele
)){
...
@@ -5121,15 +5118,22 @@ export default class MainScene extends Scene {
...
@@ -5121,15 +5118,22 @@ export default class MainScene extends Scene {
}
else
{
}
else
{
return
false
;
return
false
;
}
}
}
else
{
console
.
error
(
"未找到对应大炮,检查"
);
return
false
;
}
}
}
//横向特效加
//横向特效加
addCannoStatByHor
(
cannoid
:
number
,
row
:
number
,
col
:
number
){
addCannoStatByHor
(
cannoid
:
number
,
row
:
number
,
col
:
number
){
var
cannoidx
:
number
=
this
.
cannoArr
[
cannoid
].
idx
;
var
canno
=
this
.
getCannoByBianhao
(
cannoid
);
var
addhor
:
boolean
=
false
;
if
(
canno
){
var
cannoidx
:
number
=
canno
.
index
;
var
cannorc
=
Tool
.
indexToRc
(
cannoidx
);
var
cannorc
=
Tool
.
indexToRc
(
cannoidx
);
var
cannorow
=
cannorc
[
0
];
var
cannorow
=
cannorc
[
0
];
var
cannocol
=
cannorc
[
1
];
var
cannocol
=
cannorc
[
1
];
var
addhor
:
boolean
=
false
;
if
(
cannocol
>
col
){
if
(
cannocol
>
col
){
for
(
var
i
=
col
;
i
<
Tool
.
colNum
;
i
++
){
for
(
var
i
=
col
;
i
<
Tool
.
colNum
;
i
++
){
var
eleidx
=
Tool
.
rcToIndex
(
row
,
i
);
var
eleidx
=
Tool
.
rcToIndex
(
row
,
i
);
...
@@ -5181,16 +5185,22 @@ export default class MainScene extends Scene {
...
@@ -5181,16 +5185,22 @@ export default class MainScene extends Scene {
addhor
=
true
;
addhor
=
true
;
}
}
}
}
}
else
{
console
.
error
(
"未找到对应大炮,检查"
);
}
return
addhor
;
return
addhor
;
}
}
//竖向特效加
//竖向特效加
addCannoStatByVer
(
cannoid
:
number
,
row
:
number
,
col
:
number
){
addCannoStatByVer
(
cannoid
:
number
,
row
:
number
,
col
:
number
){
var
cannoidx
:
number
=
this
.
cannoArr
[
cannoid
].
idx
;
var
canno
=
this
.
getCannoByBianhao
(
cannoid
);
var
addver
:
boolean
=
false
;
if
(
canno
){
var
cannoidx
:
number
=
canno
.
index
;
var
cannorc
=
Tool
.
indexToRc
(
cannoidx
);
var
cannorc
=
Tool
.
indexToRc
(
cannoidx
);
var
cannorow
=
cannorc
[
0
];
var
cannorow
=
cannorc
[
0
];
var
cannocol
=
cannorc
[
1
];
var
cannocol
=
cannorc
[
1
];
var
addver
:
boolean
=
false
;
if
(
cannorow
>
row
){
if
(
cannorow
>
row
){
for
(
var
i
=
row
;
i
<
Tool
.
rowNum
;
i
++
){
for
(
var
i
=
row
;
i
<
Tool
.
rowNum
;
i
++
){
var
eleidx
=
Tool
.
rcToIndex
(
i
,
col
);
var
eleidx
=
Tool
.
rcToIndex
(
i
,
col
);
...
@@ -5242,6 +5252,10 @@ export default class MainScene extends Scene {
...
@@ -5242,6 +5252,10 @@ export default class MainScene extends Scene {
addver
=
true
;
addver
=
true
;
}
}
}
}
}
else
{
console
.
error
(
"未找到对应大炮,检查"
);
}
return
addver
;
return
addver
;
}
}
...
...
egret/src/something/class/Element.ts
View file @
80fa00a4
...
@@ -563,6 +563,7 @@ export class Element extends eui.Component {
...
@@ -563,6 +563,7 @@ export class Element extends eui.Component {
// }
// }
return
true
;
return
true
;
}
}
//此处回收
addDisable
(){
addDisable
(){
if
(
this
.
inPongoPart
&&
this
.
inPongoPart
==
"tl"
){
if
(
this
.
inPongoPart
&&
this
.
inPongoPart
==
"tl"
){
if
(
this
.
pongoMoveClip
&&
this
.
pongoMoveClip
.
parent
){
if
(
this
.
pongoMoveClip
&&
this
.
pongoMoveClip
.
parent
){
...
@@ -576,6 +577,15 @@ export class Element extends eui.Component {
...
@@ -576,6 +577,15 @@ export class Element extends eui.Component {
}
}
egret
.
ticker
.
$stopTick
(
this
.
update
,
this
);
egret
.
ticker
.
$stopTick
(
this
.
update
,
this
);
}
}
if
(
this
.
cannoMoveClip
){
if
(
this
.
cannoMoveClip
.
parent
){
this
.
cannoMoveClip
.
parent
.
removeChild
(
this
.
cannoMoveClip
);
}
this
.
cannoMoveClip
.
removeEventListener
(
egret
.
Event
.
ENTER_FRAME
,
this
.
toFrameAni
,
this
);
Pool
.
recover
(
RecoverName
.
CANNO
,
this
.
cannoMoveClip
);
this
.
cannoMoveClip
=
null
;
}
}
}
...
@@ -883,18 +893,16 @@ export class Element extends eui.Component {
...
@@ -883,18 +893,16 @@ export class Element extends eui.Component {
this
.
addChild
(
this
.
festivalEle
)
this
.
addChild
(
this
.
festivalEle
)
}
}
}
}
//大炮编号
cannobianhao
:
number
;
//添加炮台
//添加炮台
createCanno
(
videoItem
:
any
){
createCanno
(
videoItem
:
any
,
cannobianhao
:
number
){
this
.
cannobianhao
=
cannobianhao
;
if
(
this
.
type
==
ElementType
.
CANNO
&&
videoItem
){
if
(
this
.
type
==
ElementType
.
CANNO
&&
videoItem
){
this
.
cannoMoveClip
=
Pool
.
takeOut
(
RecoverName
.
CANNO
);
if
(
this
.
cannoMoveClip
){
if
(
this
.
cannoMoveClip
){
if
(
this
.
cannoMoveClip
.
parent
){
this
.
cannoMoveClip
.
parent
.
removeChild
(
this
.
cannoMoveClip
);
}
this
.
initCannoMoveClidp
();
this
.
initCannoMoveClidp
();
return
;
}
else
{
}
else
{
this
.
cannoMoveClip
=
new
window
[
"SVGA"
].
EgretMovieClip
(
videoItem
);
this
.
cannoMoveClip
=
new
window
[
"SVGA"
].
EgretMovieClip
(
videoItem
);
this
.
initCannoMoveClidp
();
this
.
initCannoMoveClidp
();
}
}
...
...
egret/src/something/enum/RecoverName.ts
View file @
80fa00a4
...
@@ -84,4 +84,10 @@ export enum RecoverName {
...
@@ -84,4 +84,10 @@ export enum RecoverName {
ICE_BLOCK
=
'ICE_BLOCK'
,
ICE_BLOCK
=
'ICE_BLOCK'
,
DARK_ICE_BLOCK
=
'DARK_ICE_BLOCK'
,
DARK_ICE_BLOCK
=
'DARK_ICE_BLOCK'
,
//部分动画的
CANNOBLOCKANI
=
'CANNOBLOCKANI'
,
//炮台石头破碎
CANNO
=
'CANNO'
,
//炮台
CANNOFIRE
=
'CANNOFIRE'
,
//炮台发射
CANNOLIGHT
=
'CANNOLIGHT'
//炮台聚能
}
}
\ 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