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
5dcef6ac
Commit
5dcef6ac
authored
Feb 27, 2020
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
c49cdf1e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
188 additions
and
14 deletions
+188
-14
MainScene.ts
egret/src/mainScene/MainScene.ts
+2
-1
doHoneyPotAI.ts
egret/src/mainScene/doHoneyPotAI.ts
+10
-13
doSandAI.ts
egret/src/mainScene/doSandAI.ts
+59
-0
ElementConfigType.ts
egret/src/something/enum/ElementConfigType.ts
+1
-0
ElementType.ts
egret/src/something/enum/ElementType.ts
+1
-0
home.json
mock/happyclear/home.json
+115
-0
No files found.
egret/src/mainScene/MainScene.ts
View file @
5dcef6ac
...
@@ -100,6 +100,7 @@ import jellyMonsterAI from './jellyMonsterAI';
...
@@ -100,6 +100,7 @@ import jellyMonsterAI from './jellyMonsterAI';
import
{
createHoneyDisAni
}
from
'../effect/createHoneyDisAni'
;
import
{
createHoneyDisAni
}
from
'../effect/createHoneyDisAni'
;
import
Sand
,
{
getSandDisplayBlock
}
from
'../something/Sand'
;
import
Sand
,
{
getSandDisplayBlock
}
from
'../something/Sand'
;
import
{
SandAni
}
from
'../something/anis/SandAni'
;
import
{
SandAni
}
from
'../something/anis/SandAni'
;
import
doSandAI
from
'./doSandAI'
;
const
aniClass
=
{
const
aniClass
=
{
"BoomAni"
:
BoomAni
,
"BoomAni"
:
BoomAni
,
...
@@ -634,7 +635,6 @@ export default class MainScene extends Scene {
...
@@ -634,7 +635,6 @@ export default class MainScene extends Scene {
latticeDisplay
.
x
=
p
[
0
];
latticeDisplay
.
x
=
p
[
0
];
latticeDisplay
.
y
=
p
[
1
];
latticeDisplay
.
y
=
p
[
1
];
}
}
}
}
}
}
//生成口数据
//生成口数据
...
@@ -2025,6 +2025,7 @@ export default class MainScene extends Scene {
...
@@ -2025,6 +2025,7 @@ export default class MainScene extends Scene {
this
.
eliminate
();
this
.
eliminate
();
return
return
}
}
await
doSandAI
(
this
);
const
doHoneyPotAIResult
=
await
doHoneyPotAI
(
this
);
const
doHoneyPotAIResult
=
await
doHoneyPotAI
(
this
);
if
(
doHoneyPotAIResult
.
length
>
0
)
{
//如果有激活的罐子被消除,那么表示可以自动消除,则不需要进行下一步
if
(
doHoneyPotAIResult
.
length
>
0
)
{
//如果有激活的罐子被消除,那么表示可以自动消除,则不需要进行下一步
doHoneyPotAIResult
.
forEach
((
index
)
=>
{
doHoneyPotAIResult
.
forEach
((
index
)
=>
{
...
...
egret/src/mainScene/doHoneyPotAI.ts
View file @
5dcef6ac
import
{
ElementType
}
from
"../something/enum/ElementType"
;
import
MainScene
from
"./MainScene"
;
import
{
Tool
}
from
"../something/Tool"
;
import
{
Element
}
from
"../something/class/Element"
;
import
{
MonsterShootAni
}
from
"../something/anis/MonsterShootAni"
;
import
{
Pool
}
from
"../something/Pool"
;
import
{
RecoverName
}
from
"../something/enum/RecoverName"
;
import
wait
from
"../../libs/new_tc/wait"
;
import
wait
from
"../../libs/new_tc/wait"
;
import
{
EffectType
}
from
"../something/enum/EffectType"
;
import
{
EggBrokenAni
}
from
"../something/anis/EggBrokenAni"
;
import
{
StateType
}
from
"../something/enum/StateType"
;
import
{
createHoneyBombAni
}
from
"../effect/createHoneyBombAni"
;
import
{
createHoneyBombAni
}
from
"../effect/createHoneyBombAni"
;
import
HoneyPotElement
from
"../something/class/HoneyPotElement"
;
import
{
HoneyPotShootAni
}
from
"../something/anis/HoneyPotShootAni"
;
import
{
createHoneyBubbleAni
}
from
"../effect/createHoneyBubbleAni"
;
import
{
createHoneyBubbleAni
}
from
"../effect/createHoneyBubbleAni"
;
import
{
HoneyPotShootAni
}
from
"../something/anis/HoneyPotShootAni"
;
import
{
Element
}
from
"../something/class/Element"
;
import
HoneyPotElement
from
"../something/class/HoneyPotElement"
;
import
{
ElementType
}
from
"../something/enum/ElementType"
;
import
{
RecoverName
}
from
"../something/enum/RecoverName"
;
import
{
StateType
}
from
"../something/enum/StateType"
;
import
{
Pool
}
from
"../something/Pool"
;
import
{
Tool
}
from
"../something/Tool"
;
import
MainScene
from
"./MainScene"
;
/**
/**
* 罐子爆炸
* 罐子爆炸
*/
*/
...
@@ -26,7 +23,7 @@ export default async (thisObj: MainScene) => {
...
@@ -26,7 +23,7 @@ export default async (thisObj: MainScene) => {
lattice
.
element
.
canElimite
=
true
;
lattice
.
element
.
canElimite
=
true
;
}
}
}
}
console
.
log
(
'激活的罐子'
,
activeElementIndexs
);
//
console.log('激活的罐子', activeElementIndexs);
//遍历所有基础元素
//遍历所有基础元素
const
baseElements
:
Element
[]
=
[];
const
baseElements
:
Element
[]
=
[];
...
...
egret/src/mainScene/doSandAI.ts
0 → 100644
View file @
5dcef6ac
import
MainScene
from
"./MainScene"
;
import
{
Lattice
}
from
"../something/class/Lattice"
;
import
{
Tool
}
from
"../something/Tool"
;
/**
* 沙子移动
*/
export
default
async
(
thisObj
:
MainScene
)
=>
{
//暂时不考虑这个问题:是否应该避免石头下的沙子移动,因为被石头盖住了看不到
// const sand = thisObj.lattices.filter(lattice => {
// // return lattice.sand && (!lattice.element || lattice.element.type != ElementType.ROCK);
// });
//找出所有的沙子
const
sandLattices
=
thisObj
.
lattices
.
filter
(
lattice
=>
{
return
lattice
.
sand
;
});
console
.
log
(
sandLattices
);
//map promise
//先判断是否能跳动,目前都能跳
for
(
let
i
=
0
;
i
<
sandLattices
.
length
;
i
++
)
{
const
sandLattice
=
sandLattices
[
i
];
const
indexEnd
=
judgeActionIndex
(
sandLattice
.
index
,
thisObj
.
lattices
)
if
(
indexEnd
)
{
//判断是否有地方可以
//先修改数据,再进行动画播放
const
sand
=
sandLattice
.
sand
;
sandLattice
.
sand
=
null
;
const
latticeEnd
=
thisObj
.
lattices
[
indexEnd
];
latticeEnd
.
sand
=
sand
;
const
p
=
Tool
.
getPositionByIndex
(
indexEnd
);
egret
.
Tween
.
get
(
sand
).
to
({
x
:
p
[
0
],
y
:
p
[
1
]},
200
);
// sand.x = p[0];
// sand.y = p[1];
}
}
}
//找到毛球移动的目标位置
const
judgeActionIndex
=
(
index
:
number
,
lattices
:
Lattice
[]):
number
=>
{
//四个方向尽量随机
var
arr
=
[
index
-
Tool
.
colNum
,
index
+
Tool
.
colNum
];
var
rc
=
Tool
.
indexToRc
(
index
);
var
col
=
rc
[
1
];
//列数大于0才可能有左边格子
if
(
col
>
0
)
arr
.
push
(
index
-
1
);
//列数不为最右边
if
(
col
<
Tool
.
colNum
-
1
)
arr
.
push
(
index
+
1
);
while
(
arr
.
length
)
{
var
rand
=
Math
.
floor
(
Math
.
random
()
*
arr
.
length
);
var
i
=
arr
.
splice
(
rand
,
1
)[
0
];
if
(
Tool
.
judgeBaseEle
(
lattices
[
i
])
&&
!
lattices
[
i
].
element
.
hasAnyState
()
&&
!
lattices
[
i
].
element
.
candy
&&
!
lattices
[
i
].
sand
&&
!
lattices
[
i
].
element
.
monster
)
{
return
i
}
}
return
null
}
\ No newline at end of file
egret/src/something/enum/ElementConfigType.ts
View file @
5dcef6ac
...
@@ -66,4 +66,5 @@ export enum ElementConfigType {
...
@@ -66,4 +66,5 @@ export enum ElementConfigType {
*/
*/
FISH
=
15
,
FISH
=
15
,
HONEY_POT
=
16
,
HONEY_POT
=
16
,
FLOWER
=
17
,
}
}
\ No newline at end of file
egret/src/something/enum/ElementType.ts
View file @
5dcef6ac
...
@@ -57,6 +57,7 @@ export enum ElementType {
...
@@ -57,6 +57,7 @@ export enum ElementType {
HONEY
,
// 蜂蜜
HONEY
,
// 蜂蜜
HONEY_POT
,
//蜂蜜罐
HONEY_POT
,
//蜂蜜罐
SAND
,
SAND
,
FLOWER
,
}
}
export
const
isMonsterEle
=
(
t
:
ElementType
)
=>
{
export
const
isMonsterEle
=
(
t
:
ElementType
)
=>
{
...
...
mock/happyclear/home.json
View file @
5dcef6ac
...
@@ -2272,6 +2272,121 @@
...
@@ -2272,6 +2272,121 @@
"levelNum"
:
452
,
"levelNum"
:
452
,
"maxScore"
:
47440
,
"maxScore"
:
47440
,
"stars"
:
1
"stars"
:
1
},
{
"levelNum"
:
453
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
454
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
455
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
456
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
457
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
458
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
459
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
460
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
461
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
462
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
463
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
464
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
465
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
466
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
467
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
468
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
469
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
470
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
471
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
472
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
473
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
474
,
"maxScore"
:
47440
,
"stars"
:
1
},
{
"levelNum"
:
475
,
"maxScore"
:
47440
,
"stars"
:
1
}
}
],
],
...
...
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