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
e5f98ab7
Commit
e5f98ab7
authored
Mar 27, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整炮台石头的规则
parent
1eb5c963
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
183 additions
and
46 deletions
+183
-46
MainScene.ts
egret/src/mainScene/MainScene.ts
+181
-44
Element.ts
egret/src/something/class/Element.ts
+2
-2
No files found.
egret/src/mainScene/MainScene.ts
View file @
e5f98ab7
...
@@ -1282,21 +1282,40 @@ export default class MainScene extends Scene {
...
@@ -1282,21 +1282,40 @@ export default class MainScene extends Scene {
var
rc
=
Tool
.
indexToRc
(
index
);
var
rc
=
Tool
.
indexToRc
(
index
);
var
p
=
Tool
.
getPositionByIndex
(
index
);
var
p
=
Tool
.
getPositionByIndex
(
index
);
this
.
playAni
(
RecoverName
.
CROSS_ANI
,
p
);
this
.
playAni
(
RecoverName
.
CROSS_ANI
,
p
);
for
(
var
i
=
0
;
i
<
this
.
lattices
.
length
;
i
++
)
{
// for (var i = 0; i < this.lattices.length; i++) {
var
lat
=
this
.
lattices
[
i
];
// var lat = this.lattices[i];
if
(
Tool
.
judgeEliminate
(
lat
)
&&
(
lat
.
row
==
rc
[
0
]
||
lat
.
column
==
rc
[
1
]))
{
// if (Tool.judgeEliminate(lat) && (lat.row == rc[0] || lat.column == rc[1])) {
if
(
this
.
eliminatedElements
.
indexOf
(
i
)
==
-
1
)
{
// if (this.eliminatedElements.indexOf(i) == -1) {
this
.
eliminatedElements
.
push
(
i
);
// this.eliminatedElements.push(i);
if
(
this
.
lattices
[
i
].
element
.
type
==
ElementType
.
FISH
)
{
// if (this.lattices[i].element.type == ElementType.FISH) {
this
.
lattices
[
i
].
element
.
nextFishState
();
// this.lattices[i].element.nextFishState();
}
// }
if
(
Tool
.
judgeHasScore
(
lat
.
element
))
{
// 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
//算直线+直线LL
this
.
pushScoreAni
(
baseScore
*
1
*
effectBaseTimes
.
LL
,
Tool
.
getPositionByIndex
(
i
))
this
.
pushScoreAni
(
baseScore
*
1
*
effectBaseTimes
.
LL
,
Tool
.
getPositionByIndex
(
jelidx
))
}
}
}
}
}
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
_converyorTag
=
true
;
this
.
_converyorTag
=
true
;
this
.
eliminate
();
this
.
eliminate
();
...
@@ -1334,6 +1353,77 @@ export default class MainScene extends Scene {
...
@@ -1334,6 +1353,77 @@ export default class MainScene extends Scene {
}
}
},
prop
)
},
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
)
{
mouseDownE
(
e
:
egret
.
TextEvent
)
{
// if (!this.enableTouch) return
// if (!this.enableTouch) return
...
@@ -2509,19 +2599,37 @@ export default class MainScene extends Scene {
...
@@ -2509,19 +2599,37 @@ export default class MainScene extends Scene {
this
.
recoverEle
(
one
)
this
.
recoverEle
(
one
)
this
.
recoverEle
(
two
)
this
.
recoverEle
(
two
)
//添加消除元素two,同行或同列
//添加消除元素two,同行或同列
for
(
var
i
=
0
;
i
<
this
.
lattices
.
length
;
i
++
)
{
// for (var i = 0; i < this.lattices.length; i++) {
var
lat
=
this
.
lattices
[
i
];
// var lat = this.lattices[i];
if
(
Tool
.
judgeEliminate
(
lat
)
&&
(
lat
.
row
==
lat1
.
row
||
lat
.
column
==
lat1
.
column
))
{
// if (Tool.judgeEliminate(lat) && (lat.row == lat1.row || lat.column == lat1.column)) {
if
(
this
.
eliminatedElements
.
indexOf
(
i
)
==
-
1
)
this
.
eliminatedElements
.
push
(
i
);
// if (this.eliminatedElements.indexOf(i) == -1) this.eliminatedElements.push(i);
if
(
this
.
lattices
[
i
].
element
.
type
==
ElementType
.
FISH
)
{
// if (this.lattices[i].element.type == ElementType.FISH) {
this
.
lattices
[
i
].
element
.
nextFishState
();
// this.lattices[i].element.nextFishState();
}
// }
if
(
Tool
.
judgeHasScore
(
lat
.
element
))
{
// 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
)
&&
else
if
((
ele1
.
effectType
<
2
||
ele2
.
effectType
<
2
)
&&
...
@@ -2858,18 +2966,33 @@ export default class MainScene extends Scene {
...
@@ -2858,18 +2966,33 @@ export default class MainScene extends Scene {
//动画移除自己
//动画移除自己
this
.
playAni
(
RecoverName
.
HORIZONTAL_ANI
,
p
);
this
.
playAni
(
RecoverName
.
HORIZONTAL_ANI
,
p
);
this
.
recoverEle
(
index
);
this
.
recoverEle
(
index
);
for
(
var
i
=
0
;
i
<
Tool
.
colNum
;
i
++
)
{
// for (var i = 0; i < Tool.colNum; i++) {
var
ein
=
Tool
.
rcToIndex
(
row
,
i
);
// var ein = Tool.rcToIndex(row, i);
if
(
Tool
.
judgeEliminate
(
this
.
lattices
[
ein
]))
{
// if (Tool.judgeEliminate(this.lattices[ein])) {
if
(
this
.
eliminatedElements
.
indexOf
(
ein
)
<
0
&&
effectIndexs
.
indexOf
(
ein
)
<
0
)
{
// if (this.eliminatedElements.indexOf(ein) < 0 && effectIndexs.indexOf(ein) < 0) {
this
.
eliminatedElements
.
push
(
ein
);
// this.eliminatedElements.push(ein);
if
(
this
.
lattices
[
ein
].
element
.
type
==
ElementType
.
FISH
)
{
// if (this.lattices[ein].element.type == ElementType.FISH) {
this
.
lattices
[
ein
].
element
.
nextFishState
();
// this.lattices[ein].element.nextFishState();
}
// }
//加分
// //加分
if
(
Tool
.
judgeHasScore
(
this
.
lattices
[
ein
].
element
))
{
// if (Tool.judgeHasScore(this.lattices[ein].element)) {
this
.
pushScoreAni
(
baseScore
*
this
.
effectContinuityTimes
*
effectBaseTimes
[
"0"
],
Tool
.
getPositionByIndex
(
ein
))
// 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
));
}
}
}
}
}
}
...
@@ -2880,18 +3003,32 @@ export default class MainScene extends Scene {
...
@@ -2880,18 +3003,32 @@ export default class MainScene extends Scene {
//动画移除自己
//动画移除自己
this
.
playAni
(
RecoverName
.
VERTICAL_ANI
,
p
);
this
.
playAni
(
RecoverName
.
VERTICAL_ANI
,
p
);
this
.
recoverEle
(
index
);
this
.
recoverEle
(
index
);
for
(
var
i
=
0
;
i
<
Tool
.
rowNum
;
i
++
)
{
// for (var i = 0; i < Tool.rowNum; i++) {
var
ein
=
Tool
.
rcToIndex
(
i
,
col
);
// var ein = Tool.rcToIndex(i, col);
if
(
Tool
.
judgeEliminate
(
this
.
lattices
[
ein
]))
{
// if (Tool.judgeEliminate(this.lattices[ein])) {
if
(
this
.
eliminatedElements
.
indexOf
(
ein
)
<
0
&&
effectIndexs
.
indexOf
(
ein
)
<
0
)
{
// if (this.eliminatedElements.indexOf(ein) < 0 && effectIndexs.indexOf(ein) < 0) {
this
.
eliminatedElements
.
push
(
ein
);
// this.eliminatedElements.push(ein);
if
(
this
.
lattices
[
ein
].
element
.
type
==
ElementType
.
FISH
)
{
// if (this.lattices[ein].element.type == ElementType.FISH) {
this
.
lattices
[
ein
].
element
.
nextFishState
();
// this.lattices[ein].element.nextFishState();
}
// }
//加分
// //加分
if
(
Tool
.
judgeHasScore
(
this
.
lattices
[
ein
].
element
))
{
// if (Tool.judgeHasScore(this.lattices[ein].element)) {
this
.
pushScoreAni
(
baseScore
*
this
.
effectContinuityTimes
*
effectBaseTimes
[
"1"
],
Tool
.
getPositionByIndex
(
ein
))
// 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
));
}
}
}
}
}
}
...
...
egret/src/something/class/Element.ts
View file @
e5f98ab7
...
@@ -219,7 +219,7 @@ export class Element extends eui.Component {
...
@@ -219,7 +219,7 @@ export class Element extends eui.Component {
}
}
changeShowCannoStat
(){
changeShowCannoStat
(){
this
.
cannolab
.
text
=
this
.
_cannoStat
+
""
;
this
.
cannolab
.
text
=
this
.
_cannoStat
+
""
;
this
.
cannoMoveClip
.
gotoAndPlay
(
this
.
cannoStat
[
this
.
_cannoStat
]);
this
.
cannoMoveClip
&&
this
.
cannoMoveClip
.
gotoAndPlay
(
this
.
cannoStat
[
this
.
_cannoStat
]);
}
}
checkCannoStat
(){
checkCannoStat
(){
if
(
this
.
_cannoStat
==
3
){
if
(
this
.
_cannoStat
==
3
){
...
@@ -511,7 +511,7 @@ export class Element extends eui.Component {
...
@@ -511,7 +511,7 @@ export class Element extends eui.Component {
listenCn
(){
listenCn
(){
var
statend
=
this
.
cannoStat
[
this
.
_cannoStat
+
1
];
var
statend
=
this
.
cannoStat
[
this
.
_cannoStat
+
1
];
if
(
this
.
cannoMoveClip
.
currentFrame
>=
statend
){
if
(
this
.
cannoMoveClip
.
currentFrame
>=
statend
){
console
.
log
(
"炮台阶段动画播放完毕"
,
this
.
cannoMoveClip
.
currentFrame
);
//
console.log("炮台阶段动画播放完毕",this.cannoMoveClip.currentFrame);
this
.
cannoMoveClip
.
stop
();
this
.
cannoMoveClip
.
stop
();
}
}
}
}
...
...
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