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
570f1d68
Commit
570f1d68
authored
Apr 02, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解放猩猩
parent
16c4acbb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
27 deletions
+101
-27
MainScene.ts
egret/src/mainScene/MainScene.ts
+92
-22
Element.ts
egret/src/something/class/Element.ts
+9
-5
No files found.
egret/src/mainScene/MainScene.ts
View file @
570f1d68
...
...
@@ -2338,28 +2338,6 @@ export default class MainScene extends Scene {
}
}
// 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
;
}
...
...
@@ -3921,12 +3899,100 @@ export default class MainScene extends Scene {
}
}
checkPongoNebEle
(
lat0
:
Lattice
,
ele
?:
Element
)
{
if
(
!
lat0
||
!
ele
)
return
;
var
indexs
=
this
.
getNextIndexs
(
lat0
);
var
lockPongoArr
:
Array
<
{
idx
:
number
,
part
:
string
}
>
=
new
Array
();
for
(
let
i
=
0
;
i
<
indexs
.
length
;
i
++
)
{
let
index
=
indexs
[
i
];
let
lat
=
this
.
lattices
[
index
];
if
(
lat
&&
lat
.
element
&&
lat
.
element
.
type
==
ElementType
.
Pongo
)
{
const
type
=
ele
.
type
;
if
(
this
.
passElements
&&
this
.
passElements
[
type
]
!=
0
)
{
if
(
lat
.
element
.
hasState
(
StateType
.
PongoLockState
)){
var
ilockpongo
=
{
idx
:
lat
.
element
.
index
,
part
:
lat
.
element
.
inPongoPart
}
lockPongoArr
.
push
(
ilockpongo
);
//解锁猩猩被锁状态
lat
.
element
.
removePongoLockStat
();
}
}
}
}
//对本次解锁的猩猩部分,分成对应的几个猩猩
var
alockPongo
:
Array
<
number
>
=
[];
//只存左上
for
(
var
j
=
0
;
j
<
lockPongoArr
.
length
;
j
++
){
var
jpongodata
=
lockPongoArr
[
j
];
var
jpongoidx
=
jpongodata
.
idx
;
var
jpongopart
=
jpongodata
.
part
;
var
tlidx
:
number
;
if
(
jpongopart
==
"tl"
){
tlidx
=
jpongoidx
;
}
else
if
(
jpongopart
==
"tr"
){
tlidx
=
jpongoidx
-
1
;
}
else
if
(
jpongopart
==
"bl"
){
tlidx
=
jpongoidx
-
Tool
.
colNum
;
}
else
if
(
jpongopart
==
"br"
){
tlidx
=
jpongoidx
-
Tool
.
colNum
-
1
;
}
if
(
alockPongo
.
indexOf
(
tlidx
)
==-
1
){
alockPongo
.
push
(
tlidx
);
}
}
var
pglockstat
=
StateType
.
PongoLockState
;
//本次参与的消除的猩猩
for
(
var
p
=
0
;
p
<
alockPongo
.
length
;
p
++
){
var
tlpongoidx
=
alockPongo
[
p
];
var
trpongoidx
=
tlpongoidx
+
1
;
var
blpongoidx
=
tlpongoidx
+
Tool
.
colNum
;
var
brpongoidx
=
blpongoidx
+
1
;
var
tlpartstat
=
this
.
lattices
[
tlpongoidx
].
element
.
hasState
(
pglockstat
);
var
trpartstat
=
this
.
lattices
[
trpongoidx
].
element
.
hasState
(
pglockstat
);
var
blpartstat
=
this
.
lattices
[
blpongoidx
].
element
.
hasState
(
pglockstat
);
var
brpartstat
=
this
.
lattices
[
brpongoidx
].
element
.
hasState
(
pglockstat
);
//猩猩自由了
if
(
!
tlpartstat
&&!
trpartstat
&&!
blpartstat
&&!
brpartstat
){
console
.
log
(
tlpongoidx
,
"猩猩自由了"
);
}
}
}
getNextIndexs
(
lat0
:
Lattice
){
var
indexMy
=
lat0
.
index
;
var
indexs
=
[
indexMy
-
Tool
.
colNum
,
indexMy
+
Tool
.
colNum
,
];
if
(
lat0
.
column
>
0
)
{
indexs
.
push
(
indexMy
-
1
)
}
if
(
lat0
.
column
<
Tool
.
colNum
-
1
)
{
indexs
.
push
(
indexMy
+
1
)
}
return
indexs
;
}
//检查附近所有元素
checkNebAll
(
latttice
:
Lattice
,
ele
?:
Element
)
{
//如果格子有冰
this
.
checkLatticeBroken
(
latttice
);
this
.
checkFireworksNebEle
(
latttice
,
ele
);
this
.
checkFishNebEle
(
latttice
);
this
.
checkPongoNebEle
(
latttice
,
ele
);
//如果附近有石头
this
.
checkNebEle
(
latttice
,
(
lat
)
=>
{
return
lat
&&
lat
.
element
&&
lat
.
element
.
type
==
ElementType
.
ROCK
...
...
@@ -4097,6 +4163,10 @@ export default class MainScene extends Scene {
// }
// }
// }
//消除
return
ele
}
...
...
egret/src/something/class/Element.ts
View file @
570f1d68
...
...
@@ -236,7 +236,7 @@ export class Element extends eui.Component {
var
state
=
StateType
.
PongoLockState
;
if
(
this
.
hasState
(
state
)){
this
.
states
[
state
].
reset
(
part
);
}
else
{
var
stateData
=
stateDatas
[
state
];
...
...
@@ -247,11 +247,15 @@ export class Element extends eui.Component {
stateEx
=
new
className
();
}
this
.
states
[
state
]
=
stateEx
;
stateEx
.
reset
(
part
);
}
this
.
states
[
state
].
reset
(
part
);
//视图添加
this
.
addChild
(
this
.
states
[
state
]);
}
removePongoLockStat
(){
var
state
=
StateType
.
PongoLockState
;
this
.
states
[
state
].
recover
();
this
.
states
[
state
]
=
null
;
}
changeShowCannoStat
(){
this
.
cannolab
.
text
=
this
.
_cannoStat
+
""
;
...
...
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