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
dd80c5fb
Commit
dd80c5fb
authored
Mar 27, 2020
by
wildfirecode
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'hotfix20200330_' into dev
parents
4150daa9
8a5ee75a
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
720 additions
and
96 deletions
+720
-96
index.html
egret/index.html
+1
-1
MainBase.ts
egret/libs/new_wx/MainBase.ts
+2
-0
ele38.png
egret/resource/assets/mainScene/ele38.png
+0
-0
ele39.png
egret/resource/assets/mainScene/ele39.png
+0
-0
canno.svga
egret/resource/assets/svgas/canno.svga
+0
-0
cannofire.svga
egret/resource/assets/svgas/cannofire.svga
+0
-0
cannolight.svga
egret/resource/assets/svgas/cannolight.svga
+0
-0
cannoparticle.svga
egret/resource/assets/svgas/cannoparticle.svga
+0
-0
loading_animals.svga
egret/resource/assets/svgas/loading_animals.svga
+0
-0
MainScene.ts
egret/src/mainScene/MainScene.ts
+353
-56
doSandAI.ts
egret/src/mainScene/doSandAI.ts
+1
-1
Tool.ts
egret/src/something/Tool.ts
+79
-7
Chapter22.ts
egret/src/something/chapters/Chapter22.ts
+92
-0
getChapter.ts
egret/src/something/chapters/getChapter.ts
+1
-1
Element.ts
egret/src/something/class/Element.ts
+137
-2
ElementConfigType.ts
egret/src/something/enum/ElementConfigType.ts
+7
-0
ElementType.ts
egret/src/something/enum/ElementType.ts
+42
-27
MapData.ts
egret/src/something/interface/MapData.ts
+5
-1
No files found.
egret/index.html
View file @
dd80c5fb
...
...
@@ -19,7 +19,7 @@
background-color
:
#000
;
background-size
:
100%
;
background-position
:
center
;
background-image
:
url("https://yun.duiba.com.cn/db_games/activity/game/0
217/startscenebg2
.jpg")
;
background-image
:
url("https://yun.duiba.com.cn/db_games/activity/game/0
327/startscenebg
.jpg")
;
/* background-image: url("https://yun.duiba.com.cn/db_games/activity/game/1565600901/resource/assets/startScene/startscenebg.jpg"); */
padding
:
0
;
border
:
0
;
...
...
egret/libs/new_wx/MainBase.ts
View file @
dd80c5fb
...
...
@@ -307,6 +307,8 @@ export default class MainBase extends eui.UILayer {
}
RES
.
getResAsync
(
"ele34_png"
);
RES
.
getResAsync
(
"ele36_png"
);
RES
.
getResAsync
(
"ele38_png"
);
RES
.
getResAsync
(
"ele39_png"
);
for
(
var
i
=
1
;
i
<=
27
;
i
++
)
{
RES
.
getResAsync
(
"bonusFra"
+
i
+
"_png"
)
}
...
...
egret/resource/assets/mainScene/ele38.png
0 → 100644
View file @
dd80c5fb
3.24 KB
egret/resource/assets/mainScene/ele39.png
0 → 100644
View file @
dd80c5fb
2.37 KB
egret/resource/assets/svgas/canno.svga
0 → 100644
View file @
dd80c5fb
File added
egret/resource/assets/svgas/cannofire.svga
0 → 100644
View file @
dd80c5fb
File added
egret/resource/assets/svgas/cannolight.svga
0 → 100644
View file @
dd80c5fb
File added
egret/resource/assets/svgas/cannoparticle.svga
0 → 100644
View file @
dd80c5fb
File added
egret/resource/assets/svgas/loading_animals.svga
View file @
dd80c5fb
No preview for this file type
egret/src/mainScene/MainScene.ts
View file @
dd80c5fb
...
...
@@ -71,7 +71,8 @@ import {
FiveBaseElementTypes
,
MonsterBaseElementType
,
monsterElementMap
,
submitTran
submitTran
,
forwardDirection
}
from
'../something/enum/ElementType'
;
import
{
isIce
,
isSpecialLattice
,
isSand
,
isBlock
}
from
'../something/enum/LatticeType'
;
import
{
PassType
}
from
'../something/enum/PassType'
;
...
...
@@ -280,6 +281,10 @@ export default class MainScene extends Scene {
private
_steps
:
number
;
private
stepNumber
:
StepNumber
;
//新增炮台,地图上所有的炮台
cannoArr
:
Array
<
{
idx
:
number
,
ele
:
Element
}
>
=
[];
//准备发射的炮台
readyCannoArr
:
number
[]
=
[];
get
steps
():
number
{
return
this
.
_steps
}
...
...
@@ -418,9 +423,13 @@ export default class MainScene extends Scene {
if
(
!
svgaParser
)
svgaParser
=
new
window
[
"SVGA"
].
Parser
();
var
svgas
=
[
"amazing"
,
"great"
,
"wonderful"
,
"bonusTime"
];
//如果有节日的加
if
(
this
.
festivalTarget
)
svgas
.
push
(
"redBombLight"
);
for
(
let
i
=
0
;
i
<
svgas
.
length
;
i
++
)
{
if
(
movieClips
[
svgas
[
i
]])
continue
;
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
;
let
mvname
=
svgas
[
i
];
svgaParser
.
load
(
resPath
+
'resource/assets/svgas/'
+
svgas
[
i
]
+
".svga"
,
(
videoItem
)
=>
{
var
mv
=
new
window
[
"SVGA"
].
EgretMovieClip
(
videoItem
);
mv
.
lockStep
=
true
;
...
...
@@ -432,7 +441,7 @@ export default class MainScene extends Scene {
let
fun
;
mv
.
addEventListener
(
egret
.
Event
.
COMPLETE
,
fun
=
function
(
e
)
{
e
.
target
.
stop
()
if
(
e
.
target
.
parent
)
{
if
(
e
.
target
.
parent
&&
mvname
!=
"canno"
)
{
e
.
target
.
parent
.
removeChild
(
e
.
target
)
}
},
this
)
...
...
@@ -746,6 +755,7 @@ export default class MainScene extends Scene {
//初始化地图元素
initElement
()
{
this
.
cannoArr
=
new
Array
();
//没有就根据地图格子随机元素
var
elements
=
this
.
chapterData
.
map
.
elements
||
Tool
.
setNumber01
(
this
.
chapterData
.
map
.
lattices
.
slice
());
for
(
var
i
=
0
;
i
<
elements
.
length
;
i
++
)
{
...
...
@@ -877,12 +887,35 @@ export default class MainScene extends Scene {
this
.
elementContainer
.
addChild
(
egg
);
this
.
lattices
[
i
].
element
=
egg
;
break
;
case
ElementConfigType
.
CANNO_DIR_TOP
:
case
ElementConfigType
.
CANNO_DIR_BOTTOM
:
case
ElementConfigType
.
CANNO_DIR_LEFT
:
case
ElementConfigType
.
CANNO_DIR_RIGHT
:
let
canno
:
Element
=
Tool
.
getElement
(
ElementType
.
CANNO
);
canno
.
x
=
p
[
0
];
canno
.
y
=
p
[
1
];
this
.
elementContainer
.
addChild
(
canno
);
this
.
lattices
[
i
].
element
=
canno
;
this
.
cannoArr
.
push
({
idx
:
i
,
ele
:
canno
});
break
;
case
ElementConfigType
.
CANNO_BLOCK
:
let
canno_block
:
Element
=
Tool
.
getElement
(
ElementType
.
CANNO_BLOCK
);
canno_block
.
x
=
p
[
0
];
canno_block
.
y
=
p
[
1
];
this
.
elementContainer
.
addChild
(
canno_block
);
this
.
lattices
[
i
].
element
=
canno_block
;
break
;
default
:
//其他标识按空元素记
this
.
emptys
.
push
(
i
);
break
}
}
console
.
log
(
"关卡大炮配置"
,
this
.
cannoArr
);
}
//重置基础元素及特效类型
...
...
@@ -895,10 +928,12 @@ 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
)
continue
;
if
(
!
Tool
.
judgeBaseEle
(
this
.
lattices
[
i
])
&&
!
isCandyEle
&&
!
isMonsterEle
&&
!
isCanno
)
continue
;
//是0,跳过
if
(
!
baseElement
&&
!
isCandyEle
&&
!
isMonsterEle
)
continue
if
(
!
baseElement
&&
!
isCandyEle
&&
!
isMonsterEle
&&
!
isCanno
)
continue
const
ele
:
Element
=
this
.
lattices
[
i
].
element
;
if
(
isCandyEle
)
{
//糖果元素
if
(
baseElement
==
CandyBaseElementType
.
RANDOM
)
{
//如果是随机糖果,目前只有随机糖果
...
...
@@ -913,7 +948,12 @@ export default class MainScene extends Scene {
ele
.
resetType
(
monsterElementMap
[
baseElement
]);
//先重置ele类型
}
ele
.
resetToMonsterView
(
elementMonsterResMap
[
ele
.
type
]);
}
else
{
}
else
if
(
isCanno
){
//是炮台
var
dirType
=
Tool
.
getCannoDir
(
elementConfig
);
ele
.
resetToCannoView
(
dirType
);
}
else
{
//解析elements[i];
var
arr
:
number
[]
=
Tool
.
returnTO
(
elements
[
i
]);
//基础类型,没有就是null,有就-1,对ElementType对应
...
...
@@ -1029,8 +1069,6 @@ export default class MainScene extends Scene {
this
.
soundBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_soundBtnn
,
this
)
this
.
musicBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_musicBtn
,
this
)
this
.
quitBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_quitBtn
,
this
)
}
removeEvents
()
{
...
...
@@ -1198,6 +1236,8 @@ export default class MainScene extends Scene {
var
ele
=
e
.
target
.
parent
if
(
ele
instanceof
Element
&&
// ele.type != ElementType.ROCK &&
ele
.
type
!=
ElementType
.
CANNO
&&
ele
.
type
!=
ElementType
.
CANNO_BLOCK
&&
!
ele
.
hasState
(
StateType
.
BLOCK_LOCK
)
&&
//石门无法消除
ele
.
type
!=
ElementType
.
LOLLIPOP
)
{
this
.
elementContainer
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
fun
,
this
);
...
...
@@ -1254,21 +1294,40 @@ export default class MainScene extends Scene {
var
rc
=
Tool
.
indexToRc
(
index
);
var
p
=
Tool
.
getPositionByIndex
(
index
);
this
.
playAni
(
RecoverName
.
CROSS_ANI
,
p
);
for
(
var
i
=
0
;
i
<
this
.
lattices
.
length
;
i
++
)
{
var
lat
=
this
.
lattices
[
i
];
if
(
Tool
.
judgeEliminate
(
lat
)
&&
(
lat
.
row
==
rc
[
0
]
||
lat
.
column
==
rc
[
1
]))
{
if
(
this
.
eliminatedElements
.
indexOf
(
i
)
==
-
1
)
{
this
.
eliminatedElements
.
push
(
i
);
if
(
this
.
lattices
[
i
].
element
.
type
==
ElementType
.
FISH
)
{
this
.
lattices
[
i
].
element
.
nextFishState
();
}
if
(
Tool
.
judgeHasScore
(
lat
.
element
))
{
// for (var i = 0; i < this.lattices.length; i++) {
// var lat = this.lattices[i];
// if (Tool.judgeEliminate(lat) && (lat.row == rc[0] || lat.column == rc[1])) {
// if (this.eliminatedElements.indexOf(i) == -1) {
// this.eliminatedElements.push(i);
// if (this.lattices[i].element.type == ElementType.FISH) {
// this.lattices[i].element.nextFishState();
// }
// if (Tool.judgeHasScore(lat.element)) {
// //算直线+直线LL
// this.pushScoreAni(baseScore * 1 * effectBaseTimes.LL, Tool.getPositionByIndex(i))
// }
// }
// }
// }
//新增石头阻挡
var
elimitarr
=
this
.
getEliPassCannoStone
(
rc
[
0
],
rc
[
1
]);
for
(
var
j
=
0
;
j
<
elimitarr
.
length
;
j
++
){
var
jelidx
=
elimitarr
[
j
];
var
jlat
=
this
.
lattices
[
jelidx
];
if
(
this
.
eliminatedElements
.
indexOf
(
jelidx
)
==-
1
){
this
.
eliminatedElements
.
push
(
jelidx
);
if
(
jlat
.
element
.
type
==
ElementType
.
FISH
){
jlat
.
element
.
nextFishState
();
}
if
(
Tool
.
judgeHasScore
(
jlat
.
element
)){
//算直线+直线LL
this
.
pushScoreAni
(
baseScore
*
1
*
effectBaseTimes
.
LL
,
Tool
.
getPositionByIndex
(
i
))
}
this
.
pushScoreAni
(
baseScore
*
1
*
effectBaseTimes
.
LL
,
Tool
.
getPositionByIndex
(
jelidx
))
}
}
}
setTimeout
(()
=>
{
this
.
_converyorTag
=
true
;
this
.
eliminate
();
...
...
@@ -1306,6 +1365,77 @@ export default class MainScene extends Scene {
}
},
prop
)
}
//横向消除,不包括炮台石头
getEliHorPassCannoStone
(
row
:
number
,
col
:
number
){
var
elimitarr
:
number
[]
=
new
Array
();
//向左
for
(
var
i
=
col
;
i
>=
0
;
i
--
){
var
iemitidx
=
Tool
.
rcToIndex
(
row
,
i
);
var
lat
=
this
.
lattices
[
iemitidx
];
var
caneliminate
=
Tool
.
judgeEliminate
(
lat
);
var
iscannoblock
=
Tool
.
judgeIscannoBlock
(
lat
);
if
(
caneliminate
){
elimitarr
.
push
(
iemitidx
);
}
if
(
iscannoblock
){
break
;
}
}
//向右
for
(
var
i
=
col
;
i
<
Tool
.
colNum
;
i
++
){
var
iemitidx
=
Tool
.
rcToIndex
(
row
,
i
);
var
lat
=
this
.
lattices
[
iemitidx
];
var
caneliminate
=
Tool
.
judgeEliminate
(
lat
);
var
iscannoblock
=
Tool
.
judgeIscannoBlock
(
lat
);
if
(
caneliminate
){
elimitarr
.
push
(
iemitidx
);
}
if
(
iscannoblock
){
break
;
}
}
return
elimitarr
;
}
//竖向消除,不包括炮台石头
getEliVerPassCannoStone
(
row
:
number
,
col
:
number
){
var
elimitarr
:
number
[]
=
new
Array
();
//向上
for
(
var
i
=
row
;
i
>=
0
;
i
--
){
var
iemitidx
=
Tool
.
rcToIndex
(
i
,
col
);
var
lat
=
this
.
lattices
[
iemitidx
];
var
caneliminate
=
Tool
.
judgeEliminate
(
lat
);
var
iscannoblock
=
Tool
.
judgeIscannoBlock
(
lat
);
if
(
caneliminate
){
elimitarr
.
push
(
iemitidx
);
}
if
(
iscannoblock
){
break
;
}
}
//向下
for
(
var
i
=
row
;
i
<
Tool
.
rowNum
;
i
++
){
var
iemitidx
=
Tool
.
rcToIndex
(
i
,
col
);
var
lat
=
this
.
lattices
[
iemitidx
];
var
caneliminate
=
Tool
.
judgeEliminate
(
lat
);
var
iscannoblock
=
Tool
.
judgeIscannoBlock
(
lat
);
if
(
caneliminate
){
elimitarr
.
push
(
iemitidx
);
}
if
(
iscannoblock
){
break
;
}
}
return
elimitarr
;
}
//一般横向竖向消除,不过炮台石头
getEliPassCannoStone
(
row
:
number
,
col
:
number
){
var
elimitarr
:
number
[]
=
new
Array
();
var
elimitarrhor
=
this
.
getEliHorPassCannoStone
(
row
,
col
);
var
elimitarrver
=
this
.
getEliVerPassCannoStone
(
row
,
col
);
elimitarr
.
push
(...
elimitarrhor
);
elimitarr
.
push
(...
elimitarrver
);
return
elimitarr
;
}
mouseDownE
(
e
:
egret
.
TextEvent
)
{
// if (!this.enableTouch) return
...
...
@@ -2024,6 +2154,29 @@ export default class MainScene extends Scene {
this
.
pushScoreAni
(
baseScore
*
this
.
commonContinuityTimes
,
Tool
.
getPositionByIndex
(
index
))
}
}
// if(this.eliminatedElements.length>0){
// for(var i=0;i<this.eliminatedElements.length;i++){
// var ielimidx = this.eliminatedElements[i];
// for(var p=0;p<this.cannoArr.length;p++){
// var pcannoidx = this.cannoArr[p].idx;
// var isnext = Tool.checkNebByidx(pcannoidx,ielimidx);
// if(isnext){
// var pcannoele = this.cannoArr[p].ele;
// pcannoele.addOneCannoStat();
// var pcannostat = pcannoele.checkCannoStat();
// if(pcannostat){
// if(this.readyCannoArr.indexOf(p)==-1){
// this.readyCannoArr.push(p);
// }
// }
// }
// }
// }
// }
return
this
.
eliminatedElements
.
length
>
0
;
}
...
...
@@ -2084,7 +2237,28 @@ export default class MainScene extends Scene {
this
.
eliminate
();
return
}
if
(
this
.
_converyorTag
)
{
//炮台充能发射
var
emitcanno
:
Element
;
if
(
this
.
readyCannoArr
.
length
>
0
){
var
readyCannoIdx
=
this
.
readyCannoArr
[
0
];
emitcanno
=
this
.
cannoArr
[
readyCannoIdx
].
ele
;
}
// for(var p=0;p<this.cannoArr.length;p++){
// var pcanno = this.cannoArr[p].ele;
// var pcannostat = pcanno.checkCannoStat();
// if(pcannostat){
// emitcanno = pcanno;
// break;
// }
// }
if
(
emitcanno
){
this
.
fireCanno
(
emitcanno
);
return
;
}
if
(
this
.
_converyorTag
)
{
await
doConveyorAI
(
this
);
this
.
_converyorTag
=
false
;
}
...
...
@@ -2222,6 +2396,56 @@ export default class MainScene extends Scene {
})
}
//大炮发射
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
);
}
}
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
;
}
}
}
setTimeout
(()
=>
{
this
.
eliminate
();
this
.
readyCannoArr
.
shift
();
canno
.
resetCannoStat
();
},
200
);
}
checkAllBlock
()
{
// this.lattices.filter(item => item.block).forEach((item) => {
// item.block.nextState();
...
...
@@ -2392,19 +2616,37 @@ export default class MainScene extends Scene {
this
.
recoverEle
(
one
)
this
.
recoverEle
(
two
)
//添加消除元素two,同行或同列
for
(
var
i
=
0
;
i
<
this
.
lattices
.
length
;
i
++
)
{
var
lat
=
this
.
lattices
[
i
];
if
(
Tool
.
judgeEliminate
(
lat
)
&&
(
lat
.
row
==
lat1
.
row
||
lat
.
column
==
lat1
.
column
))
{
if
(
this
.
eliminatedElements
.
indexOf
(
i
)
==
-
1
)
this
.
eliminatedElements
.
push
(
i
);
if
(
this
.
lattices
[
i
].
element
.
type
==
ElementType
.
FISH
)
{
this
.
lattices
[
i
].
element
.
nextFishState
();
}
if
(
Tool
.
judgeHasScore
(
lat
.
element
))
{
// for (var i = 0; i < this.lattices.length; i++) {
// var lat = this.lattices[i];
// if (Tool.judgeEliminate(lat) && (lat.row == lat1.row || lat.column == lat1.column)) {
// if (this.eliminatedElements.indexOf(i) == -1) this.eliminatedElements.push(i);
// if (this.lattices[i].element.type == ElementType.FISH) {
// this.lattices[i].element.nextFishState();
// }
// if (Tool.judgeHasScore(lat.element)) {
// //线与线
// this.pushScoreAni(baseScore * this.effectContinuityTimes * effectBaseTimes.LL, Tool.getPositionByIndex(i))
// }
// }
// }
//新增石头阻挡
var
elimitarr
=
this
.
getEliPassCannoStone
(
lat1
.
row
,
lat1
.
column
);
for
(
var
j
=
0
;
j
<
elimitarr
.
length
;
j
++
){
var
jelidx
=
elimitarr
[
j
];
var
jlat
=
this
.
lattices
[
jelidx
];
if
(
this
.
eliminatedElements
.
indexOf
(
jelidx
)
==-
1
){
this
.
eliminatedElements
.
push
(
jelidx
);
if
(
jlat
.
element
.
type
==
ElementType
.
FISH
){
jlat
.
element
.
nextFishState
();
}
if
(
Tool
.
judgeHasScore
(
jlat
.
element
)){
//线与线
this
.
pushScoreAni
(
baseScore
*
this
.
effectContinuityTimes
*
effectBaseTimes
.
LL
,
Tool
.
getPositionByIndex
(
i
))
this
.
pushScoreAni
(
baseScore
*
this
.
effectContinuityTimes
*
effectBaseTimes
.
LL
,
Tool
.
getPositionByIndex
(
jelidx
));
}
}
}
}
//一个方向,一个爆炸
else
if
((
ele1
.
effectType
<
2
||
ele2
.
effectType
<
2
)
&&
...
...
@@ -2644,6 +2886,10 @@ export default class MainScene extends Scene {
//统一逻辑,个数等,都进里面
this
.
removeFestivalEleSmall
(
index
);
}
//炮台石头
else
if
(
ele
.
type
==
ElementType
.
CANNO_BLOCK
){
this
.
removeCannoBlock
(
index
);
}
}
}
//从消除列表移除
...
...
@@ -2732,18 +2978,33 @@ export default class MainScene extends Scene {
//动画移除自己
this
.
playAni
(
RecoverName
.
HORIZONTAL_ANI
,
p
);
this
.
recoverEle
(
index
);
for
(
var
i
=
0
;
i
<
Tool
.
colNum
;
i
++
)
{
var
ein
=
Tool
.
rcToIndex
(
row
,
i
);
if
(
Tool
.
judgeEliminate
(
this
.
lattices
[
ein
]))
{
if
(
this
.
eliminatedElements
.
indexOf
(
ein
)
<
0
&&
effectIndexs
.
indexOf
(
ein
)
<
0
)
{
this
.
eliminatedElements
.
push
(
ein
);
if
(
this
.
lattices
[
ein
].
element
.
type
==
ElementType
.
FISH
)
{
this
.
lattices
[
ein
].
element
.
nextFishState
();
}
//加分
if
(
Tool
.
judgeHasScore
(
this
.
lattices
[
ein
].
element
))
{
this
.
pushScoreAni
(
baseScore
*
this
.
effectContinuityTimes
*
effectBaseTimes
[
"0"
],
Tool
.
getPositionByIndex
(
ein
))
// for (var i = 0; i < Tool.colNum; i++) {
// var ein = Tool.rcToIndex(row, i);
// if (Tool.judgeEliminate(this.lattices[ein])) {
// if (this.eliminatedElements.indexOf(ein) < 0 && effectIndexs.indexOf(ein) < 0) {
// this.eliminatedElements.push(ein);
// if (this.lattices[ein].element.type == ElementType.FISH) {
// this.lattices[ein].element.nextFishState();
// }
// //加分
// if (Tool.judgeHasScore(this.lattices[ein].element)) {
// this.pushScoreAni(baseScore * this.effectContinuityTimes * effectBaseTimes["0"], Tool.getPositionByIndex(ein))
// }
// }
// }
// }
//新增石头阻挡
var
elimitarr
=
this
.
getEliHorPassCannoStone
(
row
,
lat
.
column
);
for
(
var
j
=
0
;
j
<
elimitarr
.
length
;
j
++
){
var
jelidx
=
elimitarr
[
j
];
var
jlat
=
this
.
lattices
[
jelidx
];
if
(
this
.
eliminatedElements
.
indexOf
(
jelidx
)
==-
1
&&
effectIndexs
.
indexOf
(
jelidx
)
==-
1
){
this
.
eliminatedElements
.
push
(
jelidx
);
if
(
jlat
.
element
.
type
==
ElementType
.
FISH
){
jlat
.
element
.
nextFishState
();
}
if
(
Tool
.
judgeHasScore
(
jlat
.
element
)){
this
.
pushScoreAni
(
baseScore
*
this
.
effectContinuityTimes
*
effectBaseTimes
[
"0"
],
Tool
.
getPositionByIndex
(
jelidx
));
}
}
}
...
...
@@ -2754,18 +3015,32 @@ export default class MainScene extends Scene {
//动画移除自己
this
.
playAni
(
RecoverName
.
VERTICAL_ANI
,
p
);
this
.
recoverEle
(
index
);
for
(
var
i
=
0
;
i
<
Tool
.
rowNum
;
i
++
)
{
var
ein
=
Tool
.
rcToIndex
(
i
,
col
);
if
(
Tool
.
judgeEliminate
(
this
.
lattices
[
ein
]))
{
if
(
this
.
eliminatedElements
.
indexOf
(
ein
)
<
0
&&
effectIndexs
.
indexOf
(
ein
)
<
0
)
{
this
.
eliminatedElements
.
push
(
ein
);
if
(
this
.
lattices
[
ein
].
element
.
type
==
ElementType
.
FISH
)
{
this
.
lattices
[
ein
].
element
.
nextFishState
();
}
//加分
if
(
Tool
.
judgeHasScore
(
this
.
lattices
[
ein
].
element
))
{
this
.
pushScoreAni
(
baseScore
*
this
.
effectContinuityTimes
*
effectBaseTimes
[
"1"
],
Tool
.
getPositionByIndex
(
ein
))
// for (var i = 0; i < Tool.rowNum; i++) {
// var ein = Tool.rcToIndex(i, col);
// if (Tool.judgeEliminate(this.lattices[ein])) {
// if (this.eliminatedElements.indexOf(ein) < 0 && effectIndexs.indexOf(ein) < 0) {
// this.eliminatedElements.push(ein);
// if (this.lattices[ein].element.type == ElementType.FISH) {
// this.lattices[ein].element.nextFishState();
// }
// //加分
// if (Tool.judgeHasScore(this.lattices[ein].element)) {
// this.pushScoreAni(baseScore * this.effectContinuityTimes * effectBaseTimes["1"], Tool.getPositionByIndex(ein))
// }
// }
// }
// }
var
elimitarr
=
this
.
getEliVerPassCannoStone
(
lat
.
row
,
col
);
for
(
var
j
=
0
;
j
<
elimitarr
.
length
;
j
++
){
var
jelidx
=
elimitarr
[
j
];
var
jlat
=
this
.
lattices
[
jelidx
];
if
(
this
.
eliminatedElements
.
indexOf
(
jelidx
)
==-
1
&&
effectIndexs
.
indexOf
(
jelidx
)
==-
1
){
this
.
eliminatedElements
.
push
(
jelidx
);
if
(
jlat
.
element
.
type
==
ElementType
.
FISH
){
jlat
.
element
.
nextFishState
();
}
if
(
Tool
.
judgeHasScore
(
jlat
.
element
)){
this
.
pushScoreAni
(
baseScore
*
this
.
effectContinuityTimes
*
effectBaseTimes
[
"1"
],
Tool
.
getPositionByIndex
(
jelidx
));
}
}
}
...
...
@@ -3294,7 +3569,13 @@ export default class MainScene extends Scene {
//播放动效
this
.
playAni
(
RecoverName
.
ROCK_ANI
,
Tool
.
getPositionByIndex
(
index
))
}
/**
* 炮台石头的动效
*/
removeCannoBlock
(
index
:
number
){
this
.
removeOperation
(
index
);
//炮台石头的动效
}
/**
* 果冻的移除,包括动效
* @param index
...
...
@@ -3380,6 +3661,22 @@ export default class MainScene extends Scene {
//置空格子的element,
this
.
lattices
[
index
].
element
=
null
;
//返回下,有地方要用
//炮台充能
for
(
var
p
=
0
;
p
<
this
.
cannoArr
.
length
;
p
++
){
var
pcannoidx
=
this
.
cannoArr
[
p
].
idx
;
var
isnext
=
Tool
.
checkNebByidx
(
pcannoidx
,
index
);
if
(
isnext
){
var
pcannoele
=
this
.
cannoArr
[
p
].
ele
;
pcannoele
.
addOneCannoStat
();
var
pcannostat
=
pcannoele
.
checkCannoStat
();
if
(
pcannostat
){
if
(
this
.
readyCannoArr
.
indexOf
(
p
)
==-
1
){
this
.
readyCannoArr
.
push
(
p
);
}
}
}
}
return
ele
}
...
...
egret/src/mainScene/doSandAI.ts
View file @
dd80c5fb
...
...
@@ -16,7 +16,7 @@ export default async (thisObj: MainScene) => {
const
sandLattices
=
thisObj
.
lattices
.
filter
(
lattice
=>
{
return
lattice
.
sand
;
});
console
.
log
(
sandLattices
);
//
console.log(sandLattices);
//map promise
//先判断是否能跳动,目前都能跳
const
promiseList
:
Promise
<
any
>
[]
=
[];
...
...
egret/src/something/Tool.ts
View file @
dd80c5fb
...
...
@@ -2,13 +2,14 @@ import { Element } from "./class/Element";
import
{
Lattice
}
from
"./class/Lattice"
;
import
{
RectMask
}
from
"./class/RectMask"
;
import
{
EffectType
}
from
"./enum/EffectType"
;
import
{
ElementType
,
FiveBaseElementTypes
}
from
"./enum/ElementType"
;
import
{
ElementType
,
FiveBaseElementTypes
,
forwardDirection
}
from
"./enum/ElementType"
;
import
{
RecoverName
}
from
"./enum/RecoverName"
;
import
{
StateType
}
from
"./enum/StateType"
;
import
{
FallType
}
from
"./interface/FallAniData"
;
import
{
GenerateLatData
}
from
"./interface/GenerateLatData"
;
import
{
Pool
}
from
"./Pool"
;
import
HoneyPotElement
from
"./class/HoneyPotElement"
;
import
{
ElementConfigType
}
from
"./enum/ElementConfigType"
;
//两种,0无棒棒糖,1有
const
offsetYTwo
:
number
[]
=
[];
...
...
@@ -230,6 +231,21 @@ export class Tool {
}
return
false
}
/**
* 根据idx判断相邻
* @param a
* @param b
*/
public
static
checkNebByidx
(
a
:
number
,
b
:
number
){
var
arc
=
this
.
indexToRc
(
a
);
var
brc
=
this
.
indexToRc
(
b
);
if
(
Math
.
abs
(
arc
[
0
]
-
brc
[
0
])
==
1
&&
Math
.
abs
(
arc
[
1
]
-
brc
[
1
])
==
0
)
{
return
true
}
else
if
(
Math
.
abs
(
arc
[
0
]
-
brc
[
0
])
==
0
&&
Math
.
abs
(
arc
[
1
]
-
brc
[
1
])
==
1
)
{
return
true
}
return
false
}
/**
* 数组中插入一个数值,按顺序的
...
...
@@ -281,8 +297,10 @@ export class Tool {
lat
.
element
.
type
==
ElementType
.
JELLY_MONSTER
||
lat
.
element
.
type
==
ElementType
.
FIREWORKS_SHOOTER
||
lat
.
element
.
type
==
ElementType
.
CHICKEN_EGG
||
lat
.
element
.
type
==
ElementType
.
FESTIVALELE_BIG
//
||
lat
.
element
.
type
==
ElementType
.
FESTIVALELE_BIG
||
// lat.element.type == ElementType.FESTIVALELE_SMALL
lat
.
element
.
type
==
ElementType
.
CANNO
||
lat
.
element
.
type
==
ElementType
.
CANNO_BLOCK
)
{
return
false
}
...
...
@@ -344,7 +362,9 @@ export class Tool {
//上方元素为冰淇淋
else
if
(
lat
.
element
.
type
==
ElementType
.
LOLLIPOP
||
lat
.
element
.
type
==
ElementType
.
JELLY_MONSTER
||
lat
.
element
.
type
==
ElementType
.
FIREWORKS_SHOOTER
lat
.
element
.
type
==
ElementType
.
FIREWORKS_SHOOTER
||
lat
.
element
.
type
==
ElementType
.
CANNO
||
lat
.
element
.
type
==
ElementType
.
CANNO_BLOCK
)
{
return
false
}
...
...
@@ -353,6 +373,21 @@ export class Tool {
return
true
}
}
/**
* 判断是否是炮台石头
* @param lat
*/
public
static
judgeIscannoBlock
(
lat
:
Lattice
){
if
(
!
lat
||!
lat
.
element
){
return
false
;
}
else
if
(
lat
.
element
.
type
==
ElementType
.
CANNO_BLOCK
){
return
true
;
}
else
{
return
false
;
}
}
/**
* 判断格子上是基础元素,包括各种状态的
...
...
@@ -428,7 +463,9 @@ export class Tool {
ele
.
type
==
ElementType
.
FIREWORKS_SHOOTER
||
ele
.
type
==
ElementType
.
CHICKEN_EGG
||
ele
.
type
==
ElementType
.
FESTIVALELE_BIG
||
ele
.
type
==
ElementType
.
FESTIVALELE_SMALL
ele
.
type
==
ElementType
.
FESTIVALELE_SMALL
||
ele
.
type
==
ElementType
.
CANNO
||
ele
.
type
==
ElementType
.
CANNO_BLOCK
)
{
return
false
;
}
...
...
@@ -454,7 +491,9 @@ export class Tool {
ele
.
hasState
(
StateType
.
HAIRBALLGREY
)
||
ele
.
hasState
(
StateType
.
BLOCK_LOCK
)
||
ele
.
hasState
(
StateType
.
HAIRBALLBLACK
)
||
ele
.
hasState
(
StateType
.
HAIRBALLBROWN
)
ele
.
hasState
(
StateType
.
HAIRBALLBROWN
)
||
ele
.
type
==
ElementType
.
CANNO
||
ele
.
type
==
ElementType
.
CANNO_BLOCK
)
{
return
false
;
}
...
...
@@ -474,7 +513,9 @@ export class Tool {
ele
.
hasState
(
StateType
.
BLOCK_LOCK
)
||
ele
.
monster
||
ele
.
hasState
(
StateType
.
HAIRBALLBLACK
)
||
ele
.
hasState
(
StateType
.
HAIRBALLBROWN
)
ele
.
hasState
(
StateType
.
HAIRBALLBROWN
)
||
ele
.
type
==
ElementType
.
CANNO
||
ele
.
type
==
ElementType
.
CANNO_BLOCK
)
{
return
false
;
}
...
...
@@ -860,7 +901,6 @@ export class Tool {
}
return
Tool
.
randomT
(
arr
);
}
/**
* 根据关卡的地图数据generateLats
*
...
...
@@ -1177,4 +1217,36 @@ export class Tool {
}
return
outArr
}
/**
* 判断是否是炮台
* @param type
*/
public
static
IsCanno
(
type
:
ElementConfigType
){
if
(
type
==
ElementConfigType
.
CANNO_DIR_TOP
||
type
==
ElementConfigType
.
CANNO_DIR_BOTTOM
||
type
==
ElementConfigType
.
CANNO_DIR_LEFT
||
type
==
ElementConfigType
.
CANNO_DIR_RIGHT
){
return
true
;
}
return
false
;
}
public
static
getCannoDir
(
type
:
ElementConfigType
){
if
(
type
==
ElementConfigType
.
CANNO_DIR_TOP
){
return
forwardDirection
.
up
;
}
else
if
(
type
==
ElementConfigType
.
CANNO_DIR_BOTTOM
){
return
forwardDirection
.
down
;
}
else
if
(
type
==
ElementConfigType
.
CANNO_DIR_LEFT
){
return
forwardDirection
.
left
;
}
else
if
(
type
==
ElementConfigType
.
CANNO_DIR_RIGHT
){
return
forwardDirection
.
right
;
}
else
{
console
.
error
(
"未定义跑跳"
);
}
}
}
\ No newline at end of file
egret/src/something/chapters/Chapter22.ts
View file @
dd80c5fb
import
{
ChapterData
}
from
"../interface/ChapterData"
;
import
{
PassType
}
from
"../enum/PassType"
;
import
{
ElementType
}
from
"../enum/ElementType"
;
//551-575
export
const
Chapters22
:
ChapterData
[]
=
[
//551
{
baseElementTypes
:
[
0
,
1
,
2
,
3
,
4
],
bubbleProbability
:
0
,
stepCount
:
35
,
passTarget
:
{
type
:
1
,
elements
:
[{
type
:
1
,
count
:
155
},
{
type
:
34
,
count
:
15
}]
},
starScores
:
[
15000
,
20000
,
25000
],
map
:
{
lattices
:
[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
4
,
1
,
0
,
1
,
0
,
1
,
4
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
1
],
connectedLats
:
[],
conveyor
:
[
[
9
,
63
],
[
17
,
71
]
],
conveyorConnectedLats
:
[
[
63
,
9
],
[
71
,
17
]
],
elements
:
[
1
,
19
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
2
,
1
,
1
,
20
,
1
,
1
,
1
,
1
,
2
,
2
,
2
,
1
,
1
,
1
,
1
,
6
,
1
,
1
,
1
,
1
,
1
,
6
,
1
,
1
,
1
,
1
,
1
,
16
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
16
,
1
,
1
,
1
,
1
,
1
,
22
,
1
,
1
,
16
,
1
,
1
,
1
,
1
,
5
,
6
,
1
,
1
,
2
,
1
,
1
,
6
,
5
,
1
,
1
,
1
,
2
,
2
,
2
,
1
,
1
,
1
],
baseElements
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
],
recycles
:
[],
generateLats
:
[{
index
:
0
,
type
:
null
},
{
index
:
1
,
type
:
null
},
{
index
:
2
,
type
:
null
},
{
index
:
3
,
type
:
null
},
{
index
:
4
,
type
:
null
},
{
index
:
5
,
type
:
null
},
{
index
:
6
,
type
:
null
},
{
index
:
7
,
type
:
null
},
{
index
:
8
,
type
:
null
}]
}
}
]
egret/src/something/chapters/getChapter.ts
View file @
dd80c5fb
...
...
@@ -69,7 +69,7 @@ chapters.forEach((chapter,index) => {
*/
export
function
getChapterData
(
index
:
number
):
ChapterData
{
//没有数据就返回第一关数据
return
chapters
[
index
]
||
chapters
[
1
];
return
chapters
[
index
]
||
chapters
[
55
1
];
}
var
a
=
{
...
...
egret/src/something/class/Element.ts
View file @
dd80c5fb
...
...
@@ -13,7 +13,7 @@ import { createCandyDis3Ani } from "../anis/candy/createCandyDis3Ani";
import
{
createCandyDis4Ani
}
from
"../anis/candy/createCandyDis4Ani"
;
import
{
createCandySubAni
}
from
"../anis/candy/createCandySubAni"
;
import
{
EffectType
}
from
"../enum/EffectType"
;
import
{
CandyBaseElementType
,
ElementType
,
FiveBaseElementTypes
,
transElementRes
}
from
"../enum/ElementType"
;
import
{
CandyBaseElementType
,
ElementType
,
FiveBaseElementTypes
,
transElementRes
,
forwardDirection
}
from
"../enum/ElementType"
;
import
{
RecoverName
}
from
"../enum/RecoverName"
;
import
{
stateDatas
,
StateType
}
from
"../enum/StateType"
;
import
{
ExplosiveBgAni
}
from
"../periodAni/ExplosiveBgAni"
;
...
...
@@ -35,11 +35,18 @@ import { Fish } from "./Fish";
* 坐标原点需要坐落在格子的中心点
* 最好到时按,底图,动效,气泡,笼子,毛球,进行分层,如果多个状态要共存时,必须分层,到时气泡的动画,要写再自己的层里
*/
//加载器
let
svgaParser
;
export
class
Element
extends
eui
.
Component
{
private
_fishState
=
0
;
private
_isNeb
:
boolean
;
//是否
get
isNeb
()
{
return
this
.
_isNeb
}
fishCanEliFlag
:
boolean
;
cannoMoveClip
:
any
;
cannoStat
:
number
[]
=
[
1
,
61
,
121
,
181
,
241
,
361
];
//尝试设置碰撞状态,如果之前被特效集中,那么可以设置碰撞状态。碰撞状态之后可以准备消除。
setFishNebFlag
()
{
if
(
this
.
_fishState
>
0
)
{
...
...
@@ -188,6 +195,50 @@ export class Element extends eui.Component {
this
.
addCandyStandbyAni
();
}
_cannoDir
:
forwardDirection
;
private
_cannoStat
:
number
=
0
;
resetToCannoView
(
cannodir
:
forwardDirection
){
this
.
_cannoDir
=
cannodir
;
this
.
resetCannoStat
();
// this.showImage.x = 0;
// 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
];
}
changeShowCannoStat
(){
this
.
cannolab
.
text
=
this
.
_cannoStat
+
""
;
this
.
cannoMoveClip
&&
this
.
cannoMoveClip
.
gotoAndPlay
(
this
.
cannoStat
[
this
.
_cannoStat
]);
}
checkCannoStat
(){
if
(
this
.
_cannoStat
==
3
){
return
true
;
}
return
false
;
}
resetCannoStat
(){
this
.
_cannoStat
=
0
;
this
.
changeShowCannoStat
();
}
addOneCannoStat
(){
this
.
_cannoStat
+=
1
;
if
(
this
.
_cannoStat
>
3
){
this
.
_cannoStat
=
3
;
}
this
.
changeShowCannoStat
();
}
playCandyDieAni
()
{
var
p
=
Tool
.
getPositionByIndex
(
this
.
index
);
createCandyDieBgAni
(
p
[
0
],
p
[
1
],
this
.
stage
);
...
...
@@ -255,6 +306,9 @@ export class Element extends eui.Component {
* 显示的图片,直接改source,"ele"+type
*/
protected
showImage
:
eui
.
Image
;
protected
cannobox
:
eui
.
Group
;
cannoboxwid
:
number
=
116
;
cannoboxhei
:
number
=
116
;
temEffectType
:
EffectType
=
null
;
/**
...
...
@@ -358,6 +412,8 @@ export class Element extends eui.Component {
*/
private
states
:
State
[]
=
[]
//模拟炮台发射情况
protected
cannolab
:
eui
.
Label
;
/**
*
* @param type 只应该是基础元素和特殊元素
...
...
@@ -366,8 +422,28 @@ export class Element extends eui.Component {
super
();
this
.
_type
=
type
;
this
.
showImage
=
new
eui
.
Image
();
this
.
changeSource
(
"ele"
+
this
.
type
+
"_png"
);
this
.
addChild
(
this
.
showImage
);
this
.
cannobox
=
new
eui
.
Group
();
this
.
cannobox
.
width
=
this
.
cannoboxwid
;
this
.
cannobox
.
height
=
this
.
cannoboxhei
;
this
.
cannobox
.
anchorOffsetX
=
this
.
cannoboxwid
/
2
;
this
.
cannobox
.
anchorOffsetY
=
this
.
cannoboxhei
/
2
;
this
.
addChild
(
this
.
cannobox
);
this
.
cannolab
=
new
eui
.
Label
();
this
.
cannolab
.
size
=
30
;
this
.
cannolab
.
textColor
=
0xff0000
;
this
.
cannolab
.
x
=
0
;
this
.
cannolab
.
y
=
0
;
this
.
addChild
(
this
.
cannolab
);
this
.
cannobox
.
visible
=
this
.
cannolab
.
visible
=
type
==
ElementType
.
CANNO
;
this
.
showImage
.
visible
=
type
!=
ElementType
.
CANNO
;
this
.
cannolab
.
visible
=
false
;
//鸡蛋
if
(
type
==
ElementType
.
CHICKEN_EGG
)
{
this
.
chickenEgg
=
Pool
.
takeOut
(
RecoverName
.
CHICKEN_EGG
)
...
...
@@ -389,6 +465,61 @@ export class Element extends eui.Component {
}
this
.
addChild
(
this
.
festivalEle
)
}
this
.
createCanno
();
}
//添加炮台
createCanno
(){
if
(
this
.
type
==
ElementType
.
CANNO
){
if
(
this
.
cannoMoveClip
){
return
;
}
if
(
!
svgaParser
)
svgaParser
=
new
window
[
"SVGA"
].
Parser
();
svgaParser
.
load
(
resPath
+
'resource/assets/svgas/canno.svga'
,
(
videoItem
)
=>
{
this
.
cannoMoveClip
=
new
window
[
"SVGA"
].
EgretMovieClip
(
videoItem
);
this
.
cannoMoveClip
.
lockStep
=
true
;
var
mvwidth
=
102
;
var
mvheight
=
116
;
this
.
cannoMoveClip
.
x
=
(
this
.
cannoboxwid
-
mvwidth
)
/
2
;
this
.
cannoMoveClip
.
y
=
0
;
this
.
cannobox
.
addChild
(
this
.
cannoMoveClip
);
console
.
log
(
"paotai"
,
this
.
cannoMoveClip
);
//1空,121,181,241,361
// this.cannoMoveClip.gotoAndStop(1);
// this.cannoMoveClip.gotoAndStop(120);
// this.cannoMoveClip.gotoAndStop(120);
// this.cannoMoveClip.gotoAndStop(180);
this
.
cannoMoveClip
.
addEventListener
(
egret
.
Event
.
ENTER_FRAME
,
this
.
listenCn
,
this
);
this
.
cannoMoveClip
.
addEventListener
(
egret
.
Event
.
COMPLETE
,
this
.
playComplete
,
this
);
});
}
}
// curframeidx:number = 1;
// testChangeMoveClip(num:number){
// this.curframeidx += num;
// this.cannoMoveClip.gotoAndStop(this.curframeidx);
// }
/**
* 炮台充能
* @param source
*/
listenCn
(){
var
statend
=
this
.
cannoStat
[
this
.
_cannoStat
+
1
];
if
(
this
.
cannoMoveClip
.
currentFrame
>=
statend
){
// console.log("炮台阶段动画播放完毕",this.cannoMoveClip.currentFrame);
this
.
cannoMoveClip
.
stop
();
}
}
/**
* 炮台动画播放一次完毕
*/
playComplete
(){
this
.
cannoMoveClip
.
stop
();
}
/**
...
...
@@ -398,7 +529,7 @@ export class Element extends eui.Component {
changeSource
(
source
:
string
)
{
// this.showImage.source = source;
var
texture
:
egret
.
Texture
=
RES
.
getRes
(
source
);
if
(
!
texture
)
{
return
;
}
if
(
!
texture
)
{
return
console
.
error
(
"未找到纹理"
,
source
,
this
.
type
)
;
}
this
.
showImage
.
texture
=
texture
this
.
showImage
.
x
=
-
texture
.
textureWidth
/
2
;
...
...
@@ -429,6 +560,10 @@ export class Element extends eui.Component {
egret
.
Tween
.
removeTweens
(
this
.
showImage
);
//类型重置,showImage修改
this
.
_type
=
type
;
this
.
cannolab
.
visible
=
type
==
ElementType
.
CANNO
;
this
.
showImage
.
visible
=
type
!=
ElementType
.
CANNO
;
this
.
changeSource
(
"ele"
+
type
+
"_png"
);
//特效重置
this
.
effectType
=
null
;
...
...
egret/src/something/enum/ElementConfigType.ts
View file @
dd80c5fb
...
...
@@ -67,4 +67,11 @@ export enum ElementConfigType {
FISH
=
15
,
HONEY_POT
=
16
,
FLOWER
=
17
,
/** 大炮 */
CANNO_DIR_TOP
=
18
,
CANNO_DIR_BOTTOM
=
19
,
CANNO_DIR_LEFT
=
20
,
CANNO_DIR_RIGHT
=
21
,
/** 大炮石头 */
CANNO_BLOCK
=
22
,
}
\ No newline at end of file
egret/src/something/enum/ElementType.ts
View file @
dd80c5fb
...
...
@@ -30,34 +30,36 @@ export enum ElementType {
FESTIVALELE_BIG
,
//节日元素大中间一个13
FESTIVALELE_SMALL
,
//节日元素飞溅的小元素14
CANDY_RABBIT
,
//兔子
CANDY_CHICKEN
,
//鸟
CANDY_CATTLE
,
//牛
CANDY_LION
,
//狮子
CANDY_PIG
,
//猪
MONSTER_JELLY1
,
JELLY_MONSTER
,
FIREWORKS_RABBIT
,
//烟花目标元素,下同
FIREWORKS_CHICKEN
,
FIREWORKS_CATTLE
,
FIREWORKS_LION
,
FIREWORKS_PIG
,
FIREWORKS_SHOOTER
,
//烟花
MONSTER_RABBIT
,
//独眼怪
MONSTER_CHICKEN
,
MONSTER_CATTLE
,
MONSTER_LION
,
MONSTER_PIG
,
FISH
,
//气鼓鱼
HONEY
,
// 蜂蜜
HONEY_POT
,
//蜂蜜罐
SAND
,
FLOWER
,
CANDY_RABBIT
,
//兔子15
CANDY_CHICKEN
,
//鸟16
CANDY_CATTLE
,
//牛17
CANDY_LION
,
//狮子18
CANDY_PIG
,
//猪19
MONSTER_JELLY1
,
//20
JELLY_MONSTER
,
//21
FIREWORKS_RABBIT
,
//烟花目标元素,下同22
FIREWORKS_CHICKEN
,
//23
FIREWORKS_CATTLE
,
//24
FIREWORKS_LION
,
//25
FIREWORKS_PIG
,
//26
FIREWORKS_SHOOTER
,
//烟花27
MONSTER_RABBIT
,
//独眼怪28
MONSTER_CHICKEN
,
//29
MONSTER_CATTLE
,
//30
MONSTER_LION
,
//31
MONSTER_PIG
,
//32
FISH
,
//气鼓鱼33
HONEY
,
// 蜂蜜34
HONEY_POT
,
//蜂蜜罐35
SAND
,
//36
FLOWER
,
//37
CANNO
,
//38
CANNO_BLOCK
,
//39
}
export
const
isMonsterEle
=
(
t
:
ElementType
)
=>
{
...
...
@@ -88,6 +90,12 @@ export enum MonsterBaseElementType {
}
export
enum
forwardDirection
{
left
=
"left"
,
up
=
"up"
,
right
=
"right"
,
down
=
"down"
,
}
export
const
fireworksTypeMap
:
any
=
{}
fireworksTypeMap
[
ElementType
.
RABBIT
]
=
ElementType
.
FIREWORKS_RABBIT
;
fireworksTypeMap
[
ElementType
.
CHICKEN
]
=
ElementType
.
FIREWORKS_CHICKEN
;
...
...
@@ -151,6 +159,13 @@ export const monsterElementMap = {
"5"
:
ElementType
.
PIG
,
}
export
const
connoDirection
=
{
"1"
:
forwardDirection
.
left
,
"2"
:
forwardDirection
.
up
,
"3"
:
forwardDirection
.
right
,
"4"
:
forwardDirection
.
down
,
}
export
const
elementMonsterResMap
=
{
"0"
:
ElementType
.
MONSTER_RABBIT
,
"1"
:
ElementType
.
MONSTER_CHICKEN
,
...
...
egret/src/something/interface/MapData.ts
View file @
dd80c5fb
import
{
GenerateLatData
}
from
"./GenerateLatData"
;
import
{
LatticeType
}
from
"../enum/LatticeType"
;
import
{
ElementConfigType
}
from
"../enum/ElementConfigType"
;
/**
* 地图数据接口
* 包括地图格子,和地图上的特殊元素,生成口,联通口
*/
export
interface
MapData
{
/**
* 传送带
*/
conveyor
?:
number
[][];
conveyorConnectedLats
?:
number
[][];
/**
...
...
@@ -42,7 +46,7 @@ export interface MapData {
* 9褐色毛球 特效消除,分裂
* 10黑色毛球 两次消除,一次眩晕,
*/
elements
?:
number
[];
elements
?:
ElementConfigType
[];
/**
* 9*9的格子,不修改写null或[]
* 十位是基础元素类型,对应数字减1就是基础元素类型
...
...
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