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
c9c85dee
Commit
c9c85dee
authored
May 08, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
铺草暂存
parent
5529bfa7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
150 additions
and
11 deletions
+150
-11
default.res.json
egret/resource/default.res.json
+7
-2
MainScene.ts
egret/src/mainScene/MainScene.ts
+143
-9
No files found.
egret/resource/default.res.json
View file @
c9c85dee
...
@@ -5403,9 +5403,14 @@
...
@@ -5403,9 +5403,14 @@
"name"
:
"startscenebg_png"
"name"
:
"startscenebg_png"
},
},
{
{
"
name"
:
"startscenebg_
jpg"
,
"
url"
:
"assets/startscenebg.
jpg"
,
"type"
:
"image"
,
"type"
:
"image"
,
"url"
:
"assets/startscenebg.jpg"
"name"
:
"startscenebg_jpg"
},
{
"url"
:
"assets/mainScene/ele41.png"
,
"type"
:
"image"
,
"name"
:
"ele41_png"
}
}
]
]
}
}
\ No newline at end of file
egret/src/mainScene/MainScene.ts
View file @
c9c85dee
...
@@ -6204,6 +6204,53 @@ export default class MainScene extends Scene {
...
@@ -6204,6 +6204,53 @@ export default class MainScene extends Scene {
*
*
*/
*/
solveTurf
(
turfidx
:
number
,
main
:
Array
<
{
idx
:
number
,
canturff
:
boolean
,
canturft
:
boolean
}
>
,
all
:
Array
<
{
idx
:
number
,
canturff
:
boolean
,
canturft
:
boolean
}
>
){
solveTurf
(
turfidx
:
number
,
main
:
Array
<
{
idx
:
number
,
canturff
:
boolean
,
canturft
:
boolean
}
>
,
all
:
Array
<
{
idx
:
number
,
canturff
:
boolean
,
canturft
:
boolean
}
>
){
var
oldneedturfarr
=
this
.
getOneElNeedPu
(
main
,
all
);
//当前消除不能铺上,之前之后的消除可能铺上
if
(
oldneedturfarr
.
length
>
0
){
var
zhijepuArr
:
Array
<
number
>
=
new
Array
();
var
freshpuArr
:
Array
<
number
>
=
new
Array
();
for
(
var
i3
=
0
;
i3
<
this
.
recoverArr
.
length
;
i3
++
){
var
i3data
=
this
.
recoverArr
[
i3
];
var
i3turidx
=
i3data
.
turidx
;
var
i3main
=
i3data
.
main
;
var
i3all
=
i3data
.
all
;
//给all能铺的铺上
var
olecanturfarr
=
this
.
getOneElCanPu
(
i3main
,
i3all
);
if
(
olecanturfarr
.
length
){
for
(
var
i4
=
0
;
i4
<
oldneedturfarr
.
length
;
i4
++
){
var
i4lidx
=
oldneedturfarr
[
i4
];
//todo,细化下
if
(
olecanturfarr
.
indexOf
(
i4lidx
)
!=-
1
){
//修改小消除组的数据
var
result1
=
this
.
changeOneRecover
(
i4lidx
,
i3turidx
,
i3main
,
i3all
);
var
i3needfresh
=
result1
.
needfresh
;
if
(
i3needfresh
){
freshpuArr
.
push
(
i3turidx
);
}
var
changearr
=
result1
.
changearr
;
var
izhijepu
=
this
.
checkPuArr
(
changearr
);
zhijepuArr
.
push
(...
izhijepu
);
}
}
}
}
//todo
// this.pu
}
}
/**
*
* @param main
* @param all
*/
getOneElNeedPu
(
main
:
Array
<
{
idx
:
number
,
canturff
:
boolean
,
canturft
:
boolean
}
>
,
all
:
Array
<
{
idx
:
number
,
canturff
:
boolean
,
canturft
:
boolean
}
>
){
var
canturff
=
false
;
var
canturff
=
false
;
for
(
var
i1
=
0
;
i1
<
main
.
length
;
i1
++
){
for
(
var
i1
=
0
;
i1
<
main
.
length
;
i1
++
){
var
i1data
=
main
[
i1
];
var
i1data
=
main
[
i1
];
...
@@ -6222,19 +6269,106 @@ export default class MainScene extends Scene {
...
@@ -6222,19 +6269,106 @@ export default class MainScene extends Scene {
}
}
}
}
}
}
return
oldneedturfarr
;
}
var
zhijepuArr
:
Array
<
number
>
=
new
Array
();
/**
var
freshpuArr
:
Array
<
number
>
=
new
Array
();
*
* @param main
for
(
var
i3
=
0
;
i3
<
this
.
recoverArr
.
length
;
i3
++
){
* @param all
var
i3data
=
this
.
recoverArr
[
i3
];
*/
var
i3idx
=
i3data
.
turidx
;
getOneElCanPu
(
main
:
Array
<
{
idx
:
number
,
canturff
:
boolean
,
canturft
:
boolean
}
>
,
all
:
Array
<
{
idx
:
number
,
canturff
:
boolean
,
canturft
:
boolean
}
>
){
var
i3main
=
i3data
.
main
;
var
canturff
=
false
;
var
i3all
=
i3data
.
all
;
for
(
var
i1
=
0
;
i1
<
main
.
length
;
i1
++
){
var
i1data
=
main
[
i1
];
if
(
i1data
.
canturff
){
canturff
=
true
;
break
;
}
}
var
oldneedturfarr
:
Array
<
number
>
=
new
Array
();
if
(
!
canturff
){
for
(
var
i2
=
0
;
i2
<
all
.
length
;
i2
++
){
var
i2data
=
all
[
i2
];
if
(
i2data
.
canturft
){
oldneedturfarr
.
push
(
i2data
.
idx
);
}
}
}
return
oldneedturfarr
;
}
/**
* 修改小消除组
* @param lidx
* @param turidx
* @param main
* @param all
*/
changeOneRecover
(
lidx
:
number
,
turidx
:
number
,
main
:
Array
<
{
idx
:
number
,
canturff
:
boolean
,
canturft
:
boolean
}
>
,
all
:
Array
<
{
idx
:
number
,
canturff
:
boolean
,
canturft
:
boolean
}
>
){
var
changemainidxarr
=
new
Array
();
var
changeallidxarr
=
new
Array
();
var
result1
:{
needfresh
:
boolean
,
changearr
:
Array
<
number
>
,
arridx
:
number
}
=
{
needfresh
:
false
,
changearr
:[],
arridx
:
turidx
}
//判断是否需要fresh
var
canturff
=
false
;
for
(
var
i1
=
0
;
i1
<
main
.
length
;
i1
++
){
var
i1data
=
main
[
i1
];
if
(
i1data
.
canturff
){
canturff
=
true
;
}
if
(
lidx
==
i1data
.
idx
&&
i1data
.
canturft
){
i1data
.
canturft
=
false
;
i1data
.
canturff
=
true
;
changemainidxarr
.
push
(
i1data
.
idx
);
}
}
//不需要刷新本次小消除的铺草
if
(
canturff
){
result1
.
needfresh
=
false
;
}
else
{
//需要刷新
if
(
changemainidxarr
.
length
>
0
){
result1
.
needfresh
=
true
;
}
}
for
(
var
i2
=
0
;
i2
<
all
.
length
;
i2
++
){
var
i2data
=
all
[
i2
];
if
(
i2data
.
idx
&&
i2data
.
canturft
){
i2data
.
canturft
=
false
;
i2data
.
canturff
=
true
;
changeallidxarr
.
push
(
i2data
.
idx
);
}
}
if
(
changeallidxarr
.
length
>
0
){
result1
.
changearr
=
changeallidxarr
;
}
}
return
result1
;
}
/**
* 是否直接铺草,或是等待元素消除时铺草
* @param changearr
*/
checkPuArr
(
changearr
:
Array
<
number
>
){
var
zhijepuArr
:
Array
<
number
>
=
new
Array
();
for
(
var
i
=
0
;
i
<
changearr
.
length
;
i
++
){
var
ilidx
=
changearr
[
i
];
//直接铺草
if
(
this
.
eliminatedElements
.
indexOf
(
ilidx
)
==-
1
){
zhijepuArr
.
push
(
ilidx
);
}
else
{
}
}
return
zhijepuArr
;
}
}
}
}
\ 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