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
b2f18b6e
Commit
b2f18b6e
authored
Aug 03, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码暂存
parent
cde65615
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
2 deletions
+64
-2
MainScene.ts
egret/src/mainScene/MainScene.ts
+46
-2
Tool.ts
egret/src/something/Tool.ts
+18
-0
No files found.
egret/src/mainScene/MainScene.ts
View file @
b2f18b6e
...
...
@@ -2669,21 +2669,65 @@ export default class MainScene extends Scene {
indexFall
=
indexMy
-
Tool
.
colNum
;
}
}
//找左上
//找左上
,左上联通不是本列
let
findLeft
=
()
=>
{
if
(
!
latFall
&&
Tool
.
indexToRc
(
indexMy
)[
1
]
!=
0
)
{
var
latLeftUp
=
this
.
lattices
[
indexMy
-
Tool
.
colNum
-
1
];
if
(
Tool
.
judgeFall
(
latLeftUp
))
{
// console.log("左上掉落需过滤");
// let latfina = Tool.getLatColIdx(lat.row,lat.column,this.lattices);
// let latlfirst = Tool.getFirstColIdx(latLeftUp.row,latLeftUp.column,this.lattices);
// let latfinalat = this.lattices[latfina];
// let latlflat = this.lattices[latlfirst];
// let latfinadown = latfinalat.down;
// let latlfup = latlflat.up;
// if(latfinadown==latlfirst){
// }else{
// latFall = latLeftUp;
// indexFall = indexMy - Tool.colNum - 1;
// }
//原
latFall
=
latLeftUp
;
indexFall
=
indexMy
-
Tool
.
colNum
-
1
;
}
}
}
//找右上
//找右上
,右上联通不是本列
let
findRight
=
()
=>
{
if
(
!
latFall
&&
Tool
.
indexToRc
(
indexMy
)[
1
]
!=
Tool
.
colNum
-
1
)
{
var
latRightUp
=
this
.
lattices
[
indexMy
-
Tool
.
colNum
+
1
];
if
(
Tool
.
judgeFall
(
latRightUp
))
{
// let latfina = Tool.getLatColIdx(lat.row,lat.column,this.lattices);
// let latrightfirst = Tool.getFirstColIdx(latRightUp.row,latRightUp.column,this.lattices);
// let latfinalat = this.lattices[latfina];
// let latrflat = this.lattices[latrightfirst];
// let latfinadown = latfinalat.down;
// let latrfup = latrflat.up;
// // console.log("斜落检测",latfina,latrightfirst,latfinadown,latrfup);
// if(latfinadown==latrightfirst){
// }else{
// // console.log("可以斜落");
// latFall = latRightUp;
// indexFall = indexMy - Tool.colNum + 1;
// }
// console.log("右上掉落需过滤",lat.up,lat.down,lat.column,lat.row);
// console.log("==续",latRightUp.up,latRightUp.down,latRightUp.column,latRightUp.row);
//原来直接掉落
latFall
=
latRightUp
;
indexFall
=
indexMy
-
Tool
.
colNum
+
1
;
}
...
...
egret/src/something/Tool.ts
View file @
b2f18b6e
...
...
@@ -1397,4 +1397,22 @@ export class Tool {
}
return
false
;
}
//获取本列最上的格子
public
static
getFirstColIdx
(
row
:
number
,
col
:
number
,
lattices
:
Array
<
Lattice
>
){
for
(
let
r
=
0
;
r
<
Tool
.
rowNum
;
r
++
){
let
idxe
=
r
*
Tool
.
rowNum
+
col
;
if
(
lattices
[
idxe
]){
return
idxe
}
}
}
//获取本列最下的格子
public
static
getLatColIdx
(
row
:
number
,
col
:
number
,
lattices
:
Array
<
Lattice
>
){
for
(
let
r
=
Tool
.
rowNum
-
1
;
r
>=
0
;
r
--
){
let
idxe
=
r
*
Tool
.
rowNum
+
col
;
if
(
lattices
[
idxe
]){
return
idxe
;
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment