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
ba58cb0f
Commit
ba58cb0f
authored
Apr 17, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
减少大炮的遍历
parent
241e286d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
7 deletions
+40
-7
MainScene.ts
egret/src/mainScene/MainScene.ts
+17
-2
doWormHoleAI.ts
egret/src/mainScene/doWormHoleAI.ts
+19
-1
Chapter25.ts
egret/src/something/chapters/Chapter25.ts
+4
-4
No files found.
egret/src/mainScene/MainScene.ts
View file @
ba58cb0f
...
@@ -325,6 +325,8 @@ export default class MainScene extends Scene {
...
@@ -325,6 +325,8 @@ export default class MainScene extends Scene {
// cannoArr:Array<{idx:number,ele:Element}> = [];
// cannoArr:Array<{idx:number,ele:Element}> = [];
//本地图炮台总数
//本地图炮台总数
cannonums
:
number
=
0
;
cannonums
:
number
=
0
;
//新增调整
cannoidxArr
:
Array
<
number
>
=
[];
//每个炮台对应的特效
//每个炮台对应的特效
cannoEffect
:
Array
<
any
>
=
[];
cannoEffect
:
Array
<
any
>
=
[];
//准备发射的炮台
//准备发射的炮台
...
@@ -643,8 +645,9 @@ export default class MainScene extends Scene {
...
@@ -643,8 +645,9 @@ export default class MainScene extends Scene {
//该遍历之后尽量简化下todo
//该遍历之后尽量简化下todo
getCannoByBianhao
(
cannoidx
:
number
):
Element
{
getCannoByBianhao
(
cannoidx
:
number
):
Element
{
var
canno
:
Element
;
var
canno
:
Element
;
for
(
var
i
=
0
;
i
<
this
.
lattices
.
length
;
i
++
){
// console.log("获取大炮",cannoidx,this.cannoidxArr);
var
ilattice
=
this
.
lattices
[
i
];
for
(
var
i
=
0
;
i
<
this
.
cannoidxArr
.
length
;
i
++
){
var
ilattice
=
this
.
lattices
[
this
.
cannoidxArr
[
i
]];
if
(
ilattice
&&
ilattice
.
element
&&
ilattice
.
element
.
type
==
ElementType
.
CANNO
){
if
(
ilattice
&&
ilattice
.
element
&&
ilattice
.
element
.
type
==
ElementType
.
CANNO
){
var
icannobianhao
=
ilattice
.
element
.
cannobianhao
;
var
icannobianhao
=
ilattice
.
element
.
cannobianhao
;
if
(
cannoidx
==
icannobianhao
){
if
(
cannoidx
==
icannobianhao
){
...
@@ -653,6 +656,17 @@ export default class MainScene extends Scene {
...
@@ -653,6 +656,17 @@ export default class MainScene extends Scene {
}
}
}
}
}
}
// for(var i=0;i<this.lattices.length;i++){
// var ilattice = this.lattices[i];
// if(ilattice&&ilattice.element&&ilattice.element.type==ElementType.CANNO){
// var icannobianhao = ilattice.element.cannobianhao;
// if(cannoidx==icannobianhao){
// canno = ilattice.element;
// break;
// }
// }
// }
return
canno
;
return
canno
;
}
}
listenCnlight
(
e
){
listenCnlight
(
e
){
...
@@ -1214,6 +1228,7 @@ export default class MainScene extends Scene {
...
@@ -1214,6 +1228,7 @@ export default class MainScene extends Scene {
})
})
}
}
this
.
cannonums
+=
1
;
this
.
cannonums
+=
1
;
this
.
cannoidxArr
.
push
(
i
);
//给大炮附加发射等特效
//给大炮附加发射等特效
this
.
initCannoSvgas
(
canno
,
cannobianhao
);
this
.
initCannoSvgas
(
canno
,
cannobianhao
);
break
;
break
;
...
...
egret/src/mainScene/doWormHoleAI.ts
View file @
ba58cb0f
...
@@ -109,7 +109,17 @@ const changeData = function(worms:number[],thisObj:MainScene){
...
@@ -109,7 +109,17 @@ const changeData = function(worms:number[],thisObj:MainScene){
while
(
inidx
<
wormsleng
){
while
(
inidx
<
wormsleng
){
let
hmapdata
=
getMapsp
(
ihlattice
);
let
hmapdata
=
getMapsp
(
ihlattice
);
let
heledata
=
getElesp
(
ihlattice
);
let
heledata
=
getElesp
(
ihlattice
);
if
(
foreledata
.
ele
&&
foreledata
.
eledata
[
"type"
]
==
ElementType
.
CANNO
){
//重设mainscene的数组
var
startidx
=
ilattice
.
index
;
var
toidx
=
ihlattice
.
index
;
for
(
var
c
=
0
;
c
<
thisObj
.
cannoidxArr
.
length
;
c
++
){
var
cidx
=
thisObj
.
cannoidxArr
[
c
];
if
(
cidx
==
startidx
){
thisObj
.
cannoidxArr
[
c
]
=
toidx
;
c
=
thisObj
.
cannoidxArr
.
length
;
}
}
}
ihlattice
.
changeData
(
formapdata
,
foreledata
);
ihlattice
.
changeData
(
formapdata
,
foreledata
);
formapdata
=
hmapdata
;
formapdata
=
hmapdata
;
...
@@ -127,6 +137,14 @@ const changeData = function(worms:number[],thisObj:MainScene){
...
@@ -127,6 +137,14 @@ const changeData = function(worms:number[],thisObj:MainScene){
ilattice
=
thisObj
.
lattices
[
iwormholeidx
];
ilattice
=
thisObj
.
lattices
[
iwormholeidx
];
ihlattice
=
thisObj
.
lattices
[
ilwormholeidx
];
ihlattice
=
thisObj
.
lattices
[
ilwormholeidx
];
}
}
var
cannobianArr
:
Array
<
number
>
=
[];
for
(
var
j
=
0
;
j
<
thisObj
.
cannoidxArr
.
length
;
j
++
){
var
jcannoidx
=
thisObj
.
cannoidxArr
[
j
];
var
jcannoele
=
thisObj
.
lattices
[
jcannoidx
].
element
;
cannobianArr
.
push
(
jcannoele
.
cannobianhao
);
}
// console.log("单线交换完毕",thisObj.cannoidxArr,cannobianArr);
// console.log("本条线数据交换完毕");
// console.log("本条线数据交换完毕");
}
}
export
default
async
(
thisObj
:
MainScene
)
=>
{
export
default
async
(
thisObj
:
MainScene
)
=>
{
...
...
egret/src/something/chapters/Chapter25.ts
View file @
ba58cb0f
...
@@ -12,7 +12,7 @@ export const Chapters25: ChapterData[] = [
...
@@ -12,7 +12,7 @@ export const Chapters25: ChapterData[] = [
starScores
:
[
15000
,
20000
,
25000
],
starScores
:
[
15000
,
20000
,
25000
],
map
:
{
map
:
{
lattices
:
[
lattices
:
[
1
,
6
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
...
@@ -52,14 +52,14 @@ export const Chapters25: ChapterData[] = [
...
@@ -52,14 +52,14 @@ export const Chapters25: ChapterData[] = [
// [ 72, 53 ]
// [ 72, 53 ]
// ],
// ],
elements
:
[
elements
:
[
1
,
16
,
1
,
1
,
1
,
1
,
1
,
1
,
16
,
1
,
19
,
1
,
1
,
1
,
1
,
1
,
1
,
2
,
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
,
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
,
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
,
1
,
20
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
16
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
16
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
14
,
1
,
1
,
9
,
1
,
1
,
1
,
1
,
1
,
14
,
1
,
1
,
9
,
1
,
22
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
],
],
baseElements
:
[
baseElements
:
[
...
...
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