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
cc601233
Commit
cc601233
authored
Aug 24, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
6f48d065
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
545 additions
and
325 deletions
+545
-325
MainScene.ts
egret/src/mainScene/MainScene.ts
+26
-315
Chapters.ts
egret/src/something/Chapters.ts
+223
-10
Tool.ts
egret/src/something/Tool.ts
+295
-0
GuideMsg.ts
egret/src/something/uis/GuideMsg.ts
+1
-0
No files found.
egret/src/mainScene/MainScene.ts
View file @
cc601233
...
@@ -99,8 +99,6 @@ export default class MainScene extends Scene {
...
@@ -99,8 +99,6 @@ export default class MainScene extends Scene {
choosed
:
eui
.
Image
;
choosed
:
eui
.
Image
;
//消除后生成空格的索引
//消除后生成空格的索引
emptys
:
number
[]
=
[];
emptys
:
number
[]
=
[];
//有特效时要记录,因为结束时要用,记录索引吧,执行消除特效时去掉,生成时加入
effectElements
:
number
[]
=
[];
//消除队列的索引
//消除队列的索引
eliminatedElements
:
number
[]
=
[];
eliminatedElements
:
number
[]
=
[];
//棒棒糖生成标志
//棒棒糖生成标志
...
@@ -349,9 +347,9 @@ export default class MainScene extends Scene {
...
@@ -349,9 +347,9 @@ export default class MainScene extends Scene {
this
.
soundBtn
.
source
=
"mainSoundBtnOff_png"
this
.
soundBtn
.
source
=
"mainSoundBtnOff_png"
}
}
if
(
getBgOn
())
{
if
(
getBgOn
())
{
this
.
musicBtn
.
source
=
"main
Sound
BtnOn_png"
this
.
musicBtn
.
source
=
"main
Music
BtnOn_png"
}
else
{
}
else
{
this
.
musicBtn
.
source
=
"main
Sound
BtnOff_png"
this
.
musicBtn
.
source
=
"main
Music
BtnOff_png"
}
}
//初始化道具信息
//初始化道具信息
var
arrObj
=
[
"boomBtnNum"
,
"hammerBtnNum"
,
"stepBtnNum"
];
var
arrObj
=
[
"boomBtnNum"
,
"hammerBtnNum"
,
"stepBtnNum"
];
...
@@ -399,7 +397,7 @@ export default class MainScene extends Scene {
...
@@ -399,7 +397,7 @@ export default class MainScene extends Scene {
case
2
:
case
2
:
case
3
:
case
3
:
case
6
:
case
6
:
var
type
=
this
.
returnType
(
i
);
var
type
=
Tool
.
returnType
(
i
,
this
.
lattices
,
this
.
chapterData
.
baseElementTypes
);
let
ele
:
Element
=
Pool
.
takeOut
(
RecoverName
.
ELEMENT
);
let
ele
:
Element
=
Pool
.
takeOut
(
RecoverName
.
ELEMENT
);
if
(
!
ele
)
{
if
(
!
ele
)
{
ele
=
new
Element
(
type
)
ele
=
new
Element
(
type
)
...
@@ -472,7 +470,7 @@ export default class MainScene extends Scene {
...
@@ -472,7 +470,7 @@ export default class MainScene extends Scene {
this
.
lattices
[
connectedLat
[
1
]].
up
=
connectedLat
[
0
];
this
.
lattices
[
connectedLat
[
1
]].
up
=
connectedLat
[
0
];
}
}
//初始化完先检测死图
//初始化完先检测死图
this
.
warningCop
=
this
.
dieMapCheck
(
);
this
.
warningCop
=
Tool
.
dieMapCheck
(
this
.
lattices
);
if
(
!
this
.
warningCop
)
{
if
(
!
this
.
warningCop
)
{
//替换顺序
//替换顺序
this
.
upsetElement
();
this
.
upsetElement
();
...
@@ -481,31 +479,7 @@ export default class MainScene extends Scene {
...
@@ -481,31 +479,7 @@ export default class MainScene extends Scene {
// this.enableMouseEvt(true);
// this.enableMouseEvt(true);
// }
// }
}
}
//返回元素类别
private
returnType
(
index
:
number
)
{
var
rc
=
Tool
.
indexToRc
(
index
);
var
arr
=
this
.
chapterData
.
baseElementTypes
.
slice
();
//和左边两个比较
if
(
rc
[
1
]
>
1
)
{
//
var
lat1
=
this
.
lattices
[
index
-
1
];
var
lat2
=
this
.
lattices
[
index
-
2
];
if
(
Tool
.
judgeMatch
(
lat1
)
&&
Tool
.
judgeMatch
(
lat2
)
&&
lat1
.
element
.
type
==
lat2
.
element
.
type
)
{
Tool
.
removeEle
(
lat1
.
element
.
type
,
arr
);
}
}
//和上边两个比较
var
lat1
=
this
.
lattices
[
index
-
Tool
.
colNum
];
var
lat2
=
this
.
lattices
[
index
-
Tool
.
colNum
*
2
];
if
(
Tool
.
judgeMatch
(
lat1
)
&&
Tool
.
judgeMatch
(
lat2
)
&&
lat1
.
element
.
type
==
lat2
.
element
.
type
)
{
Tool
.
removeEle
(
lat1
.
element
.
type
,
arr
);
}
return
Tool
.
randomT
(
arr
);
}
/**
/**
* 更新三个道具
* 更新三个道具
*/
*/
...
@@ -640,7 +614,7 @@ export default class MainScene extends Scene {
...
@@ -640,7 +614,7 @@ export default class MainScene extends Scene {
NetManager
.
ins
.
showLog
(
getlogItem
(
7
));
NetManager
.
ins
.
showLog
(
getlogItem
(
7
));
if
(
this
.
boomBtnNum
.
count
<=
0
)
{
if
(
this
.
boomBtnNum
.
count
<=
0
)
{
//购买弹框
//购买弹框
PanelCtrl
.
instance
.
show
(
"Buy
1
"
)
PanelCtrl
.
instance
.
show
(
"Buy
2
"
)
}
else
{
}
else
{
this
.
useProp
(
PropType
.
BOOM
)
this
.
useProp
(
PropType
.
BOOM
)
}
}
...
@@ -649,7 +623,7 @@ export default class MainScene extends Scene {
...
@@ -649,7 +623,7 @@ export default class MainScene extends Scene {
NetManager
.
ins
.
showLog
(
getlogItem
(
10
));
NetManager
.
ins
.
showLog
(
getlogItem
(
10
));
if
(
this
.
hammerBtnNum
.
count
<=
0
)
{
if
(
this
.
hammerBtnNum
.
count
<=
0
)
{
//购买弹框
//购买弹框
PanelCtrl
.
instance
.
show
(
"Buy
2
"
,
{})
PanelCtrl
.
instance
.
show
(
"Buy
1
"
,
{})
}
else
{
}
else
{
this
.
useProp
(
PropType
.
HAMMER
)
this
.
useProp
(
PropType
.
HAMMER
)
}
}
...
@@ -1062,251 +1036,6 @@ export default class MainScene extends Scene {
...
@@ -1062,251 +1036,6 @@ export default class MainScene extends Scene {
}
}
/**
* 检测死图,需要提示
* 需要返回一组提示 两个能互相交换元素,数组
* 有返回证明不是死图,
*/
dieMapCheck
():
Element
[]
{
var
lattices
=
this
.
lattices
;
var
judgeFall
=
Tool
.
judgeFall
;
var
judgeMatch
=
Tool
.
judgeMatch
;
//记录有特效的元素,下面特效检测用
var
effectElements
=
[]
//检测普通元素,
var
lat2
,
lat3
;
//额外两个元素声明
for
(
var
i
=
Tool
.
colNum
*
Tool
.
rowNum
-
1
;
i
>=
0
;
i
--
)
{
var
rc
=
Tool
.
indexToRc
(
i
);
var
row
=
rc
[
0
];
var
col
=
rc
[
1
];
var
lat
=
lattices
[
i
];
//如果自身格子空或不能交换,跳入下一个
if
(
!
judgeFall
(
lat
))
continue
if
(
lat
.
element
.
effectType
!=
null
)
{
effectElements
.
push
(
lat
.
element
);
}
//与下交换
var
latDown
=
lattices
[
i
+
Tool
.
colNum
];
//能交换,并且类型不一致
if
(
judgeFall
(
latDown
)
&&
lat
.
element
.
type
!=
latDown
.
element
.
type
)
{
//判断向下,+2,+3 lat
lat2
=
lattices
[
i
+
Tool
.
colNum
*
2
];
lat3
=
lattices
[
i
+
Tool
.
colNum
*
3
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
lat
.
element
.
type
==
lat2
.
element
.
type
&&
lat
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latDown
.
element
];
}
//向上判断 -1 -2 latDown
lat2
=
lattices
[
i
-
Tool
.
colNum
];
lat3
=
lattices
[
i
-
Tool
.
colNum
*
2
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
latDown
.
element
.
type
==
lat2
.
element
.
type
&&
latDown
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latDown
.
element
];
}
//下横向判断左 -1 -2 lat 先确定col>1
if
(
col
>
1
)
{
lat2
=
lattices
[
i
+
Tool
.
colNum
-
1
];
lat3
=
lattices
[
i
+
Tool
.
colNum
-
2
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
lat
.
element
.
type
==
lat2
.
element
.
type
&&
lat
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latDown
.
element
];
}
}
//下横向判断右 +1 +2 lat 先确定col<Tool.colNum -2
if
(
col
<
Tool
.
colNum
-
2
)
{
lat2
=
lattices
[
i
+
Tool
.
colNum
+
1
];
lat3
=
lattices
[
i
+
Tool
.
colNum
+
2
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
lat
.
element
.
type
==
lat2
.
element
.
type
&&
lat
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latDown
.
element
];
}
}
//下横向中间 +1 -1 lat 先确定col>0;<Tool.colNum -1
if
(
col
>
0
&&
col
<
Tool
.
colNum
-
1
)
{
lat2
=
lattices
[
i
+
Tool
.
colNum
+
1
];
lat3
=
lattices
[
i
+
Tool
.
colNum
-
1
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
lat
.
element
.
type
==
lat2
.
element
.
type
&&
lat
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latDown
.
element
];
}
}
//
//上横向判断左 -1 -2 latDown 先确定col>1
if
(
col
>
1
)
{
lat2
=
lattices
[
i
-
1
];
lat3
=
lattices
[
i
-
2
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
latDown
.
element
.
type
==
lat2
.
element
.
type
&&
latDown
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latDown
.
element
];
}
}
//上横向判断右 +1 +2 latDown 先确定col<Tool.colNum -2
if
(
col
<
Tool
.
colNum
-
2
)
{
lat2
=
lattices
[
i
+
1
];
lat3
=
lattices
[
i
+
2
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
latDown
.
element
.
type
==
lat2
.
element
.
type
&&
latDown
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latDown
.
element
];
}
}
//下横向中间 +1 -1 latDown 先确定col>0;<Tool.colNum -1
if
(
col
>
0
&&
col
<
Tool
.
colNum
-
1
)
{
lat2
=
lattices
[
i
+
1
];
lat3
=
lattices
[
i
-
1
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
latDown
.
element
.
type
==
lat2
.
element
.
type
&&
latDown
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latDown
.
element
];
}
}
}
//与右交换,先确定col!=Tool.colNum-1,不是最右排元素8
if
(
col
!=
Tool
.
colNum
-
1
)
{
var
latRight
=
lattices
[
i
+
1
];
//能交换,并且类型不一致
if
(
judgeFall
(
latRight
)
&&
lat
.
element
.
type
!=
latRight
.
element
.
type
)
{
//判断向右,+2,+3 lat 先确定col<Tool.colNum - 3
if
(
col
<
Tool
.
colNum
-
3
)
{
lat2
=
lattices
[
i
+
2
];
lat3
=
lattices
[
i
+
3
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
lat
.
element
.
type
==
lat2
.
element
.
type
&&
lat
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latRight
.
element
];
}
}
//向左判断 -1 -2 latRight 先确定col>1
if
(
col
>
1
)
{
lat2
=
lattices
[
i
-
1
];
lat3
=
lattices
[
i
-
2
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
latRight
.
element
.
type
==
lat2
.
element
.
type
&&
latRight
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latRight
.
element
];
}
}
//右纵向判断下 *1+1 *2+1 lat
lat2
=
lattices
[
i
+
Tool
.
colNum
*
1
+
1
];
lat3
=
lattices
[
i
+
Tool
.
colNum
*
2
+
1
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
lat
.
element
.
type
==
lat2
.
element
.
type
&&
lat
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latRight
.
element
];
}
//右纵向判断上 -*1+1 -*2+1 lat
lat2
=
lattices
[
i
-
Tool
.
colNum
*
1
+
1
];
lat3
=
lattices
[
i
-
Tool
.
colNum
*
2
+
1
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
lat
.
element
.
type
==
lat2
.
element
.
type
&&
lat
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latRight
.
element
];
}
//右纵向中间 -*1 *1 lat
lat2
=
lattices
[
i
+
Tool
.
colNum
+
1
];
lat3
=
lattices
[
i
-
Tool
.
colNum
+
1
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
lat
.
element
.
type
==
lat2
.
element
.
type
&&
lat
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latRight
.
element
];
}
//
//左纵向判断下 *1 *2 latRight
lat2
=
lattices
[
i
+
Tool
.
colNum
*
1
];
lat3
=
lattices
[
i
+
Tool
.
colNum
*
2
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
latRight
.
element
.
type
==
lat2
.
element
.
type
&&
latRight
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latRight
.
element
];
}
//左纵向判断上 -*1 -*2 latRight
lat2
=
lattices
[
i
-
Tool
.
colNum
*
1
];
lat3
=
lattices
[
i
-
Tool
.
colNum
*
2
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
latRight
.
element
.
type
==
lat2
.
element
.
type
&&
latRight
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latRight
.
element
];
}
//左纵向中间 *1 -*1 latRight
lat2
=
lattices
[
i
+
Tool
.
colNum
];
lat3
=
lattices
[
i
-
Tool
.
colNum
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
latRight
.
element
.
type
==
lat2
.
element
.
type
&&
latRight
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latRight
.
element
];
}
}
}
}
//检测特效的
for
(
var
i
=
0
;
i
<
effectElements
.
length
;
i
++
)
{
var
effectElement
=
effectElements
[
i
];
//是魔力鸟,直接找周围元素,
if
(
effectElement
.
effectType
==
EffectType
.
MAGICLION
)
{
//上格子
var
up
=
lattices
[
effectElement
.
index
-
Tool
.
colNum
];
if
(
judgeFall
(
up
)
&&
up
.
element
.
type
!=
ElementType
.
LOLLIPOP
)
return
[
effectElement
,
up
.
element
];
//下格子
var
down
=
lattices
[
effectElement
.
index
+
Tool
.
colNum
];
if
(
judgeFall
(
down
)
&&
up
.
element
.
type
!=
ElementType
.
LOLLIPOP
)
return
[
effectElement
,
down
.
element
];
//左格子
var
col
=
Tool
.
indexToRc
(
effectElement
.
index
)[
1
];
//列数
if
(
col
!=
0
)
{
var
left
=
lattices
[
effectElement
.
index
-
1
];
if
(
judgeFall
(
left
)
&&
left
.
element
.
type
!=
ElementType
.
LOLLIPOP
)
return
[
effectElement
,
left
.
element
];
}
if
(
col
!=
Tool
.
colNum
-
1
)
{
var
right
=
lattices
[
effectElement
.
index
+
1
];
if
(
judgeFall
(
right
)
&&
right
.
element
.
type
!=
ElementType
.
LOLLIPOP
)
return
[
effectElement
,
right
.
element
];
}
continue
}
//是普通特效,找周围是特效的
//上格子
var
up
=
lattices
[
effectElement
.
index
-
Tool
.
colNum
];
if
(
judgeFall
(
up
)
&&
up
.
element
.
effectType
!=
null
)
return
[
effectElement
,
up
.
element
];
//下格子
var
down
=
lattices
[
effectElement
.
index
+
Tool
.
colNum
];
if
(
judgeFall
(
down
)
&&
down
.
element
.
effectType
!=
null
)
return
[
effectElement
,
down
.
element
];
//左格子
var
col
=
Tool
.
indexToRc
(
effectElement
.
index
)[
1
];
//列数
if
(
col
!=
0
)
{
var
left
=
lattices
[
effectElement
.
index
-
1
];
if
(
judgeFall
(
left
)
&&
left
.
element
.
effectType
!=
null
)
return
[
effectElement
,
left
.
element
];
}
if
(
col
!=
Tool
.
colNum
)
{
var
right
=
lattices
[
effectElement
.
index
+
1
];
if
(
judgeFall
(
right
)
&&
right
.
element
.
effectType
!=
null
)
return
[
effectElement
,
right
.
element
];
}
}
return
null
}
/**
/**
* 只关心交换后元素的可消除
* 只关心交换后元素的可消除
* 或者冰淇淋的掉落
* 或者冰淇淋的掉落
...
@@ -1347,7 +1076,7 @@ export default class MainScene extends Scene {
...
@@ -1347,7 +1076,7 @@ export default class MainScene extends Scene {
for
(
var
g
=
0
;
g
<
Tool
.
colNum
;
g
++
)
{
for
(
var
g
=
0
;
g
<
Tool
.
colNum
;
g
++
)
{
arr
.
push
(
i
*
Tool
.
colNum
+
g
)
arr
.
push
(
i
*
Tool
.
colNum
+
g
)
}
}
let
re
=
this
.
fn
(
arr
);
let
re
=
Tool
.
fn
(
arr
,
this
.
lattices
);
for
(
var
j
=
0
;
j
<
re
.
length
;
j
++
)
{
for
(
var
j
=
0
;
j
<
re
.
length
;
j
++
)
{
let
len
=
re
[
j
].
length
;
let
len
=
re
[
j
].
length
;
if
(
len
>=
3
)
{
if
(
len
>=
3
)
{
...
@@ -1382,7 +1111,7 @@ export default class MainScene extends Scene {
...
@@ -1382,7 +1111,7 @@ export default class MainScene extends Scene {
for
(
var
g
=
0
;
g
<
Tool
.
rowNum
;
g
++
)
{
for
(
var
g
=
0
;
g
<
Tool
.
rowNum
;
g
++
)
{
arr
.
push
(
Tool
.
colNum
*
g
+
m
)
arr
.
push
(
Tool
.
colNum
*
g
+
m
)
}
}
let
re
=
this
.
fn
(
arr
);
let
re
=
Tool
.
fn
(
arr
,
this
.
lattices
);
for
(
var
j
=
0
;
j
<
re
.
length
;
j
++
)
{
for
(
var
j
=
0
;
j
<
re
.
length
;
j
++
)
{
let
len
=
re
[
j
].
length
;
let
len
=
re
[
j
].
length
;
if
(
len
>=
3
)
{
if
(
len
>=
3
)
{
...
@@ -1444,30 +1173,7 @@ export default class MainScene extends Scene {
...
@@ -1444,30 +1173,7 @@ export default class MainScene extends Scene {
return
this
.
eliminatedElements
.
length
>
0
;
return
this
.
eliminatedElements
.
length
>
0
;
}
}
/**
* 将有相邻相同的组合,不是基础元素的,都会是单独的
* @param arr
*/
public
fn
(
arr
:
number
[])
{
var
lattices
=
this
.
lattices
var
result
=
[],
i
=
0
;
result
[
i
]
=
[
arr
[
0
]];
arr
.
reduce
(
function
(
prev
,
cur
)
{
var
latP
=
lattices
[
prev
];
var
latC
=
lattices
[
cur
];
if
(
Tool
.
judgeMatch
(
latP
)
&&
Tool
.
judgeMatch
(
latC
)
&&
latP
.
element
.
type
==
latC
.
element
.
type
)
{
result
[
i
].
push
(
cur
)
}
else
{
result
[
++
i
]
=
[
cur
];
}
// cur.type == prev.type ? result[i].push(cur) : result[++i] = [cur];
return
cur
;
});
return
result
;
}
//执行消除,应该是一个迭代,只要eliminatedElements有东西就一直执行
//执行消除,应该是一个迭代,只要eliminatedElements有东西就一直执行
eliminate
()
{
eliminate
()
{
...
@@ -1552,7 +1258,7 @@ export default class MainScene extends Scene {
...
@@ -1552,7 +1258,7 @@ export default class MainScene extends Scene {
PanelCtrl
.
instance
.
show
(
"failed"
);
PanelCtrl
.
instance
.
show
(
"failed"
);
}
else
{
}
else
{
//检查死图
//检查死图
this
.
warningCop
=
this
.
dieMapCheck
()
this
.
warningCop
=
Tool
.
dieMapCheck
(
this
.
lattices
);
if
(
!
this
.
warningCop
)
{
if
(
!
this
.
warningCop
)
{
//死图。替换顺序,出toast
//死图。替换顺序,出toast
showToast
(
"没有可以消除的元素"
)
showToast
(
"没有可以消除的元素"
)
...
@@ -1794,6 +1500,7 @@ export default class MainScene extends Scene {
...
@@ -1794,6 +1500,7 @@ export default class MainScene extends Scene {
*/
*/
effectEliminate
(
effectIndexs
:
number
[])
{
effectEliminate
(
effectIndexs
:
number
[])
{
if
(
effectIndexs
.
length
&&
!
this
.
hasPassed
)
this
.
effectContinuityTimes
++
;
if
(
effectIndexs
.
length
&&
!
this
.
hasPassed
)
this
.
effectContinuityTimes
++
;
var
sounds
:
SoundType
[]
=
[];
for
(
var
j
=
0
;
j
<
effectIndexs
.
length
;
j
++
)
{
for
(
var
j
=
0
;
j
<
effectIndexs
.
length
;
j
++
)
{
var
index
=
effectIndexs
[
j
];
var
index
=
effectIndexs
[
j
];
var
lat
:
Lattice
=
this
.
lattices
[
index
];
var
lat
:
Lattice
=
this
.
lattices
[
index
];
...
@@ -1801,7 +1508,7 @@ export default class MainScene extends Scene {
...
@@ -1801,7 +1508,7 @@ export default class MainScene extends Scene {
var
p
=
Tool
.
getPositionByIndex
(
index
);
var
p
=
Tool
.
getPositionByIndex
(
index
);
switch
(
ele
.
effectType
)
{
switch
(
ele
.
effectType
)
{
case
EffectType
.
MAGICLION
:
case
EffectType
.
MAGICLION
:
playSound
(
SoundType
.
magic
)
if
(
sounds
.
indexOf
(
SoundType
.
magic
)
==
-
1
)
sounds
.
push
(
SoundType
.
magic
)
this
.
playAni
(
RecoverName
.
MAGICLION_ANI
,
p
);
this
.
playAni
(
RecoverName
.
MAGICLION_ANI
,
p
);
this
.
recoverEle
(
index
);
this
.
recoverEle
(
index
);
//为了不重复
//为了不重复
...
@@ -1837,7 +1544,7 @@ export default class MainScene extends Scene {
...
@@ -1837,7 +1544,7 @@ export default class MainScene extends Scene {
}
}
break
;
break
;
case
EffectType
.
EXPLOSIVE
:
case
EffectType
.
EXPLOSIVE
:
playSound
(
SoundType
.
boom
)
if
(
sounds
.
indexOf
(
SoundType
.
boom
)
==
-
1
)
sounds
.
push
(
SoundType
.
boom
)
//动画移除自己
//动画移除自己
var
boomAni
=
this
.
playAni
(
RecoverName
.
BOOM_ANI
,
p
);
var
boomAni
=
this
.
playAni
(
RecoverName
.
BOOM_ANI
,
p
);
boomAni
.
scaleX
=
boomAni
.
scaleY
=
1
;
boomAni
.
scaleX
=
boomAni
.
scaleY
=
1
;
...
@@ -1857,7 +1564,7 @@ export default class MainScene extends Scene {
...
@@ -1857,7 +1564,7 @@ export default class MainScene extends Scene {
}
}
break
;
break
;
case
EffectType
.
HORIZONTAL
:
case
EffectType
.
HORIZONTAL
:
playSound
(
SoundType
.
line
)
if
(
sounds
.
indexOf
(
SoundType
.
line
)
==
-
1
)
sounds
.
push
(
SoundType
.
line
)
var
row
=
lat
.
row
;
var
row
=
lat
.
row
;
//动画移除自己
//动画移除自己
this
.
playAni
(
RecoverName
.
HORIZONTAL_ANI
,
p
);
this
.
playAni
(
RecoverName
.
HORIZONTAL_ANI
,
p
);
...
@@ -1876,7 +1583,7 @@ export default class MainScene extends Scene {
...
@@ -1876,7 +1583,7 @@ export default class MainScene extends Scene {
}
}
break
;
break
;
case
EffectType
.
VERTICAL
:
case
EffectType
.
VERTICAL
:
playSound
(
SoundType
.
line
)
if
(
sounds
.
indexOf
(
SoundType
.
line
)
==
-
1
)
sounds
.
push
(
SoundType
.
line
)
var
col
=
lat
.
column
;
var
col
=
lat
.
column
;
//动画移除自己
//动画移除自己
this
.
playAni
(
RecoverName
.
VERTICAL_ANI
,
p
);
this
.
playAni
(
RecoverName
.
VERTICAL_ANI
,
p
);
...
@@ -1896,6 +1603,10 @@ export default class MainScene extends Scene {
...
@@ -1896,6 +1603,10 @@ export default class MainScene extends Scene {
break
;
break
;
}
}
}
}
//播放音乐
for
(
var
a
=
0
;
a
<
sounds
.
length
;
a
++
)
{
playSound
(
sounds
[
a
]);
}
}
}
/**
/**
* 判断是否通关
* 判断是否通关
...
@@ -2071,7 +1782,7 @@ export default class MainScene extends Scene {
...
@@ -2071,7 +1782,7 @@ export default class MainScene extends Scene {
this
.
eliminate
()
this
.
eliminate
()
}
else
{
}
else
{
//检查死图
//检查死图
this
.
warningCop
=
this
.
dieMapCheck
()
this
.
warningCop
=
Tool
.
dieMapCheck
(
this
.
lattices
);
if
(
!
this
.
warningCop
)
{
if
(
!
this
.
warningCop
)
{
//死图。替换顺序
//死图。替换顺序
this
.
upsetElement
()
this
.
upsetElement
()
...
@@ -2141,8 +1852,8 @@ export default class MainScene extends Scene {
...
@@ -2141,8 +1852,8 @@ export default class MainScene extends Scene {
Loading2
.
instace
.
show
();
Loading2
.
instace
.
show
();
NetManager
.
ins
.
hc_submit
((
s
,
data
)
=>
{
NetManager
.
ins
.
hc_submit
((
s
,
data
)
=>
{
if
(
s
)
{
if
(
s
)
{
const
submitData
=
DataManager
.
ins
.
getData
(
'hc_submit'
).
data
;
const
submitData
=
DataManager
.
ins
.
getData
(
'hc_submit'
).
data
;
if
(
submitData
.
prizeType
==
1
)
{
if
(
submitData
.
prizeType
==
1
)
{
//提交成功后捞结果
//提交成功后捞结果
NetManager
.
ins
.
getPlugOrderStatus
((
s
)
=>
{
NetManager
.
ins
.
getPlugOrderStatus
((
s
)
=>
{
...
@@ -2161,13 +1872,13 @@ export default class MainScene extends Scene {
...
@@ -2161,13 +1872,13 @@ export default class MainScene extends Scene {
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
NO_PRIZE_PANEL
,
{
starCount
:
this
.
scoreProgress
.
starCount
});
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
NO_PRIZE_PANEL
,
{
starCount
:
this
.
scoreProgress
.
starCount
});
}
}
},
},
submitData
.
prizeResponse
.
orderNum
,
submitData
.
prizeResponse
.
orderNum
,
()
=>
{
return
DataManager
.
ins
.
getData
(
'getPlugOrderStatus'
).
result
==
0
});
()
=>
{
return
DataManager
.
ins
.
getData
(
'getPlugOrderStatus'
).
result
==
0
});
}
else
{
}
else
{
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
NO_PRIZE_PANEL
,
{
starCount
:
this
.
scoreProgress
.
starCount
});
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
NO_PRIZE_PANEL
,
{
starCount
:
this
.
scoreProgress
.
starCount
});
}
}
}
else
{
}
else
{
Loading2
.
instace
.
hide
();
Loading2
.
instace
.
hide
();
if
(
!
data
)
{
if
(
!
data
)
{
...
...
egret/src/something/Chapters.ts
View file @
cc601233
...
@@ -602,29 +602,242 @@ export const Chapters: ChapterData[] = [
...
@@ -602,29 +602,242 @@ export const Chapters: ChapterData[] = [
map
:
{
map
:
{
lattices
:
[
lattices
:
[
0
,
0
,
0
,
1
,
4
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
4
,
1
,
0
,
0
,
0
,
1
,
2
,
5
,
1
,
1
,
1
,
5
,
2
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
2
,
5
,
1
,
1
,
1
,
5
,
2
,
1
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
5
,
5
,
1
,
1
,
1
,
5
,
5
,
1
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
2
,
1
,
1
,
1
,
2
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
2
,
2
,
2
,
1
,
1
,
1
,
2
,
2
,
2
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
2
,
5
,
5
,
2
,
2
,
2
,
5
,
5
,
2
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
1
,
1
,
1
,
1
,
1
,
0
,
2
,
5
,
2
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
],
],
generateLats
:
[
3
,
4
,
5
],
generateLats
:
[
3
,
4
,
5
],
},
},
baseElementTypes
:
[
0
,
1
,
2
,
3
,
4
],
baseElementTypes
:
[
0
,
1
,
2
,
3
,
4
],
effectInitProbability
:
0.05
,
effectInitProbability
:
0.05
,
stepCount
:
46
,
stepCount
:
18
,
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
{
type
:
ElementType
.
LOLLIPOP
,
count
:
2
}
]
},
starScores
:
[
2000
,
5000
,
12000
]
},
//第二十二关
{
map
:
{
lattices
:
[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
],
generateLats
:
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
],
},
baseElementTypes
:
[
0
,
1
,
2
,
3
,
4
],
effectInitProbability
:
0.05
,
stepCount
:
53
,
passTarget
:
{
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
elements
:
[
{
{
type
:
ElementType
.
ICE
,
type
:
ElementType
.
ICE
,
count
:
22
count
:
30
}
}
]
]
},
},
starScores
:
[
11000
,
22000
,
45000
]
starScores
:
[
40000
,
80000
,
100000
]
},
//第二十三关
{
map
:
{
lattices
:
[
0
,
0
,
1
,
1
,
4
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
],
generateLats
:
[
2
,
3
,
4
,
5
,
6
],
},
baseElementTypes
:
[
0
,
1
,
2
,
3
,
4
],
effectInitProbability
:
0.05
,
stepCount
:
23
,
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
{
type
:
ElementType
.
LOLLIPOP
,
count
:
2
}
]
},
starScores
:
[
10000
,
24000
,
35000
]
},
//第二十四关
{
map
:
{
lattices
:
[
0
,
0
,
0
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
],
generateLats
:
[
3
,
4
,
5
],
},
baseElementTypes
:
[
0
,
1
,
2
,
3
,
4
],
effectInitProbability
:
0.1
,
stepCount
:
42
,
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
{
type
:
ElementType
.
ICE
,
count
:
27
}
]
},
starScores
:
[
15000
,
35000
,
60000
]
},
//第二十五关
{
map
:
{
lattices
:
[
0
,
1
,
1
,
1
,
1
,
4
,
1
,
1
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
0
,
0
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
0
,
0
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
0
,
],
generateLats
:
[
1
,
2
,
3
,
4
,
5
,
6
,
7
],
},
baseElementTypes
:
[
0
,
1
,
2
,
3
,
4
],
effectInitProbability
:
0.05
,
stepCount
:
35
,
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
{
type
:
ElementType
.
LOLLIPOP
,
count
:
4
}
]
},
starScores
:
[
20000
,
40000
,
45000
]
},
//第二十六关
{
map
:
{
lattices
:
[
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
5
,
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
5
,
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
5
,
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
5
,
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
5
,
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
5
,
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
5
,
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
],
generateLats
:
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
],
},
baseElementTypes
:
[
0
,
1
,
2
,
3
,
4
],
effectInitProbability
:
0.05
,
stepCount
:
20
,
passTarget
:
{
type
:
PassType
.
SCORE_TARGET
,
score
:
20000
,
},
starScores
:
[
7000
,
12000
,
20000
]
},
//第二十七关
{
map
:
{
lattices
:
[
1
,
1
,
1
,
1
,
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
5
,
1
,
1
,
1
,
1
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
3
,
5
,
3
,
5
,
3
,
5
,
3
,
5
,
3
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
3
,
5
,
3
,
5
,
3
,
5
,
3
,
5
,
3
,
],
generateLats
:
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
],
},
baseElementTypes
:
[
0
,
1
,
2
,
3
,
4
],
effectInitProbability
:
0.05
,
stepCount
:
22
,
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
{
type
:
ElementType
.
ICE
,
count
:
10
}
],
},
starScores
:
[
15000
,
35000
,
60000
]
},
//第二十八关
{
map
:
{
lattices
:
[
1
,
1
,
1
,
1
,
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
5
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
5
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
5
,
1
,
1
,
1
,
1
,
0
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
],
generateLats
:
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
],
},
baseElementTypes
:
[
0
,
1
,
2
,
3
,
4
],
effectInitProbability
:
0.05
,
stepCount
:
22
,
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
{
type
:
ElementType
.
ICE
,
count
:
10
}
],
},
starScores
:
[
15000
,
35000
,
60000
]
},
},
]
]
\ No newline at end of file
egret/src/something/Tool.ts
View file @
cc601233
...
@@ -198,6 +198,301 @@ export class Tool {
...
@@ -198,6 +198,301 @@ export class Tool {
}
}
}
}
/**
* 检测死图,需要提示
* 需要返回一组提示 两个能互相交换元素,数组
* 有返回证明不是死图,
*/
public
static
dieMapCheck
(
lattices
:
Lattice
[]):
Element
[]
{
var
judgeFall
=
Tool
.
judgeFall
;
var
judgeMatch
=
Tool
.
judgeMatch
;
//记录有特效的元素,下面特效检测用
var
effectElements
=
[]
//检测普通元素,
var
lat2
,
lat3
;
//额外两个元素声明
for
(
var
i
=
Tool
.
colNum
*
Tool
.
rowNum
-
1
;
i
>=
0
;
i
--
)
{
var
rc
=
Tool
.
indexToRc
(
i
);
var
row
=
rc
[
0
];
var
col
=
rc
[
1
];
var
lat
=
lattices
[
i
];
//如果自身格子空或不能交换,跳入下一个
if
(
!
judgeFall
(
lat
))
continue
if
(
lat
.
element
.
effectType
!=
null
)
{
effectElements
.
push
(
lat
.
element
);
}
//与下交换
var
latDown
=
lattices
[
i
+
Tool
.
colNum
];
//能交换,并且类型不一致
if
(
judgeFall
(
latDown
)
&&
lat
.
element
.
type
!=
latDown
.
element
.
type
)
{
//判断向下,+2,+3 lat
lat2
=
lattices
[
i
+
Tool
.
colNum
*
2
];
lat3
=
lattices
[
i
+
Tool
.
colNum
*
3
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
lat
.
element
.
type
==
lat2
.
element
.
type
&&
lat
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latDown
.
element
];
}
//向上判断 -1 -2 latDown
lat2
=
lattices
[
i
-
Tool
.
colNum
];
lat3
=
lattices
[
i
-
Tool
.
colNum
*
2
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
latDown
.
element
.
type
==
lat2
.
element
.
type
&&
latDown
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latDown
.
element
];
}
//下横向判断左 -1 -2 lat 先确定col>1
if
(
col
>
1
)
{
lat2
=
lattices
[
i
+
Tool
.
colNum
-
1
];
lat3
=
lattices
[
i
+
Tool
.
colNum
-
2
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
lat
.
element
.
type
==
lat2
.
element
.
type
&&
lat
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latDown
.
element
];
}
}
//下横向判断右 +1 +2 lat 先确定col<Tool.colNum -2
if
(
col
<
Tool
.
colNum
-
2
)
{
lat2
=
lattices
[
i
+
Tool
.
colNum
+
1
];
lat3
=
lattices
[
i
+
Tool
.
colNum
+
2
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
lat
.
element
.
type
==
lat2
.
element
.
type
&&
lat
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latDown
.
element
];
}
}
//下横向中间 +1 -1 lat 先确定col>0;<Tool.colNum -1
if
(
col
>
0
&&
col
<
Tool
.
colNum
-
1
)
{
lat2
=
lattices
[
i
+
Tool
.
colNum
+
1
];
lat3
=
lattices
[
i
+
Tool
.
colNum
-
1
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
lat
.
element
.
type
==
lat2
.
element
.
type
&&
lat
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latDown
.
element
];
}
}
//
//上横向判断左 -1 -2 latDown 先确定col>1
if
(
col
>
1
)
{
lat2
=
lattices
[
i
-
1
];
lat3
=
lattices
[
i
-
2
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
latDown
.
element
.
type
==
lat2
.
element
.
type
&&
latDown
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latDown
.
element
];
}
}
//上横向判断右 +1 +2 latDown 先确定col<Tool.colNum -2
if
(
col
<
Tool
.
colNum
-
2
)
{
lat2
=
lattices
[
i
+
1
];
lat3
=
lattices
[
i
+
2
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
latDown
.
element
.
type
==
lat2
.
element
.
type
&&
latDown
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latDown
.
element
];
}
}
//下横向中间 +1 -1 latDown 先确定col>0;<Tool.colNum -1
if
(
col
>
0
&&
col
<
Tool
.
colNum
-
1
)
{
lat2
=
lattices
[
i
+
1
];
lat3
=
lattices
[
i
-
1
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
latDown
.
element
.
type
==
lat2
.
element
.
type
&&
latDown
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latDown
.
element
];
}
}
}
//与右交换,先确定col!=Tool.colNum-1,不是最右排元素8
if
(
col
!=
Tool
.
colNum
-
1
)
{
var
latRight
=
lattices
[
i
+
1
];
//能交换,并且类型不一致
if
(
judgeFall
(
latRight
)
&&
lat
.
element
.
type
!=
latRight
.
element
.
type
)
{
//判断向右,+2,+3 lat 先确定col<Tool.colNum - 3
if
(
col
<
Tool
.
colNum
-
3
)
{
lat2
=
lattices
[
i
+
2
];
lat3
=
lattices
[
i
+
3
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
lat
.
element
.
type
==
lat2
.
element
.
type
&&
lat
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latRight
.
element
];
}
}
//向左判断 -1 -2 latRight 先确定col>1
if
(
col
>
1
)
{
lat2
=
lattices
[
i
-
1
];
lat3
=
lattices
[
i
-
2
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
latRight
.
element
.
type
==
lat2
.
element
.
type
&&
latRight
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latRight
.
element
];
}
}
//右纵向判断下 *1+1 *2+1 lat
lat2
=
lattices
[
i
+
Tool
.
colNum
*
1
+
1
];
lat3
=
lattices
[
i
+
Tool
.
colNum
*
2
+
1
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
lat
.
element
.
type
==
lat2
.
element
.
type
&&
lat
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latRight
.
element
];
}
//右纵向判断上 -*1+1 -*2+1 lat
lat2
=
lattices
[
i
-
Tool
.
colNum
*
1
+
1
];
lat3
=
lattices
[
i
-
Tool
.
colNum
*
2
+
1
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
lat
.
element
.
type
==
lat2
.
element
.
type
&&
lat
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latRight
.
element
];
}
//右纵向中间 -*1 *1 lat
lat2
=
lattices
[
i
+
Tool
.
colNum
+
1
];
lat3
=
lattices
[
i
-
Tool
.
colNum
+
1
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
lat
.
element
.
type
==
lat2
.
element
.
type
&&
lat
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latRight
.
element
];
}
//
//左纵向判断下 *1 *2 latRight
lat2
=
lattices
[
i
+
Tool
.
colNum
*
1
];
lat3
=
lattices
[
i
+
Tool
.
colNum
*
2
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
latRight
.
element
.
type
==
lat2
.
element
.
type
&&
latRight
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latRight
.
element
];
}
//左纵向判断上 -*1 -*2 latRight
lat2
=
lattices
[
i
-
Tool
.
colNum
*
1
];
lat3
=
lattices
[
i
-
Tool
.
colNum
*
2
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
latRight
.
element
.
type
==
lat2
.
element
.
type
&&
latRight
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latRight
.
element
];
}
//左纵向中间 *1 -*1 latRight
lat2
=
lattices
[
i
+
Tool
.
colNum
];
lat3
=
lattices
[
i
-
Tool
.
colNum
];
if
(
judgeMatch
(
lat2
)
&&
judgeMatch
(
lat3
)
&&
latRight
.
element
.
type
==
lat2
.
element
.
type
&&
latRight
.
element
.
type
==
lat3
.
element
.
type
)
{
return
[
lat
.
element
,
latRight
.
element
];
}
}
}
}
//检测特效的
for
(
var
i
=
0
;
i
<
effectElements
.
length
;
i
++
)
{
var
effectElement
=
effectElements
[
i
];
//是魔力鸟,直接找周围元素,
if
(
effectElement
.
effectType
==
EffectType
.
MAGICLION
)
{
//上格子
var
up
=
lattices
[
effectElement
.
index
-
Tool
.
colNum
];
if
(
judgeFall
(
up
)
&&
up
.
element
.
type
!=
ElementType
.
LOLLIPOP
)
return
[
effectElement
,
up
.
element
];
//下格子
var
down
=
lattices
[
effectElement
.
index
+
Tool
.
colNum
];
if
(
judgeFall
(
down
)
&&
up
.
element
.
type
!=
ElementType
.
LOLLIPOP
)
return
[
effectElement
,
down
.
element
];
//左格子
var
col
=
Tool
.
indexToRc
(
effectElement
.
index
)[
1
];
//列数
if
(
col
!=
0
)
{
var
left
=
lattices
[
effectElement
.
index
-
1
];
if
(
judgeFall
(
left
)
&&
left
.
element
.
type
!=
ElementType
.
LOLLIPOP
)
return
[
effectElement
,
left
.
element
];
}
if
(
col
!=
Tool
.
colNum
-
1
)
{
var
right
=
lattices
[
effectElement
.
index
+
1
];
if
(
judgeFall
(
right
)
&&
right
.
element
.
type
!=
ElementType
.
LOLLIPOP
)
return
[
effectElement
,
right
.
element
];
}
continue
}
//是普通特效,找周围是特效的
//上格子
var
up
=
lattices
[
effectElement
.
index
-
Tool
.
colNum
];
if
(
judgeFall
(
up
)
&&
up
.
element
.
effectType
!=
null
)
return
[
effectElement
,
up
.
element
];
//下格子
var
down
=
lattices
[
effectElement
.
index
+
Tool
.
colNum
];
if
(
judgeFall
(
down
)
&&
down
.
element
.
effectType
!=
null
)
return
[
effectElement
,
down
.
element
];
//左格子
var
col
=
Tool
.
indexToRc
(
effectElement
.
index
)[
1
];
//列数
if
(
col
!=
0
)
{
var
left
=
lattices
[
effectElement
.
index
-
1
];
if
(
judgeFall
(
left
)
&&
left
.
element
.
effectType
!=
null
)
return
[
effectElement
,
left
.
element
];
}
if
(
col
!=
Tool
.
colNum
)
{
var
right
=
lattices
[
effectElement
.
index
+
1
];
if
(
judgeFall
(
right
)
&&
right
.
element
.
effectType
!=
null
)
return
[
effectElement
,
right
.
element
];
}
}
return
null
}
/**
* 将有相邻相同的组合,不是基础元素的,都会是单独的
* @param arr
*/
public
static
fn
(
arr
:
number
[],
lattices
:
Lattice
[])
{
var
result
=
[],
i
=
0
;
result
[
i
]
=
[
arr
[
0
]];
arr
.
reduce
(
function
(
prev
,
cur
)
{
var
latP
=
lattices
[
prev
];
var
latC
=
lattices
[
cur
];
if
(
Tool
.
judgeMatch
(
latP
)
&&
Tool
.
judgeMatch
(
latC
)
&&
latP
.
element
.
type
==
latC
.
element
.
type
)
{
result
[
i
].
push
(
cur
)
}
else
{
result
[
++
i
]
=
[
cur
];
}
// cur.type == prev.type ? result[i].push(cur) : result[++i] = [cur];
return
cur
;
});
return
result
;
}
/**
* 返回元素类别
* 元素初始化排列时,不能出现三消的情况
* @param index
*/
public
static
returnType
(
index
:
number
,
lattices
:
Lattice
[],
baseElementTypes
:
number
[])
{
var
rc
=
Tool
.
indexToRc
(
index
);
var
arr
=
baseElementTypes
.
slice
();
//和左边两个比较
if
(
rc
[
1
]
>
1
)
{
//
var
lat1
=
lattices
[
index
-
1
];
var
lat2
=
lattices
[
index
-
2
];
if
(
Tool
.
judgeMatch
(
lat1
)
&&
Tool
.
judgeMatch
(
lat2
)
&&
lat1
.
element
.
type
==
lat2
.
element
.
type
)
{
Tool
.
removeEle
(
lat1
.
element
.
type
,
arr
);
}
}
//和上边两个比较
var
lat1
=
lattices
[
index
-
Tool
.
colNum
];
var
lat2
=
lattices
[
index
-
Tool
.
colNum
*
2
];
if
(
Tool
.
judgeMatch
(
lat1
)
&&
Tool
.
judgeMatch
(
lat2
)
&&
lat1
.
element
.
type
==
lat2
.
element
.
type
)
{
Tool
.
removeEle
(
lat1
.
element
.
type
,
arr
);
}
return
Tool
.
randomT
(
arr
);
}
/**
/**
* 从数组移除一个元素
* 从数组移除一个元素
...
...
egret/src/something/uis/GuideMsg.ts
View file @
cc601233
...
@@ -58,6 +58,7 @@ export class GuideMsg extends egret.DisplayObjectContainer {
...
@@ -58,6 +58,7 @@ export class GuideMsg extends egret.DisplayObjectContainer {
if
(
this
.
moiveClip
)
this
.
removeChild
(
this
.
moiveClip
);
if
(
this
.
moiveClip
)
this
.
removeChild
(
this
.
moiveClip
);
//svga
//svga
if
(
moiveClip
[
"guide"
+
num
])
{
if
(
moiveClip
[
"guide"
+
num
])
{
this
.
moiveClip
=
moiveClip
[
"guide"
+
num
];
this
.
addChild
(
moiveClip
[
"guide"
+
num
]);
this
.
addChild
(
moiveClip
[
"guide"
+
num
]);
callback
();
callback
();
}
else
{
}
else
{
...
...
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