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
c24326ea
Commit
c24326ea
authored
Feb 12, 2020
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
3fd1a080
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
14 deletions
+104
-14
MainScene.ts
egret/src/mainScene/MainScene.ts
+50
-4
doFishAI.ts
egret/src/mainScene/doFishAI.ts
+22
-0
Chapter16.ts
egret/src/something/chapters/Chapter16.ts
+9
-9
Element.ts
egret/src/something/class/Element.ts
+23
-1
No files found.
egret/src/mainScene/MainScene.ts
View file @
c24326ea
...
...
@@ -95,6 +95,7 @@ import { DataManager } from './../../libs/tw/manager/DataManager';
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
doMonsterAI
from
'./doMonsterAI'
;
import
jellyMonsterAI
from
'./jellyMonsterAI'
;
import
doFishAI
from
'./doFishAI'
;
const
aniClass
=
{
"BoomAni"
:
BoomAni
,
...
...
@@ -844,7 +845,7 @@ export default class MainScene extends Scene {
//初始化引导,游戏和道具
initGuide
()
{
//游戏引导
const
gameGuideChapterNum
=
[
1
,
2
,
3
,
5
,
8
,
9
,
10
,
12
,
17
,
25
,
41
,
61
,
101
,
121
,
226
,
377
]
const
gameGuideChapterNum
=
[
1
,
2
,
3
,
5
,
8
,
9
,
10
,
12
,
17
,
25
,
41
,
61
,
101
,
121
,
226
,
377
]
if
(
gameGuideChapterNum
.
indexOf
(
this
.
chapter
>>
0
)
>
-
1
)
{
if
(
!
readCache
(
getCacheKey
()
+
this
.
chapter
))
{
this
.
gameGuide
=
new
GameGuide
(
this
);
...
...
@@ -1984,12 +1985,18 @@ export default class MainScene extends Scene {
async
fallCallback
()
{
//掉落后有消除,执行消除
if
(
this
.
threeMatch
())
{
this
.
eliminate
()
this
.
eliminate
()
;
return
}
const
doFishResult
=
await
doFishAI
(
this
);
if
(
doFishResult
.
length
>
0
)
{
//这里应该先播放动画,播放完了,再执行消除
this
.
eliminate
();
return
;
}
const
genarateEffect
=
await
doMonsterAI
(
this
);
if
(
genarateEffect
.
length
>
0
)
{
//如果有苏醒的怪物被消除,那么表示可以自动消除,则不需要进行下一步
genarateEffect
.
forEach
((
ele
:
Element
)
=>
{
genarateEffect
.
forEach
((
ele
:
Element
)
=>
{
this
.
eliminatedElements
.
push
(
ele
.
index
);
});
await
wait
(
500
);
...
...
@@ -2464,6 +2471,14 @@ export default class MainScene extends Scene {
// else if (ele.type == ElementType.FIREWORKS_SHOOTER) {
// //没有处理
// }
//fish
else
if
(
ele
.
type
==
ElementType
.
FISH
)
{
if
(
ele
.
fishCanEliFlag
)
{
this
.
playAni
(
RecoverName
.
ELEDIS_ANI
,
p
)
//这里面会去算个数
this
.
recoverEle
(
index
);
}
}
//鸡蛋
else
if
(
ele
.
type
==
ElementType
.
CHICKEN_EGG
)
{
//额外逻辑,
...
...
@@ -2554,6 +2569,9 @@ export default class MainScene extends Scene {
(
Math
.
abs
(
this
.
lattices
[
i
].
row
-
lat
.
row
)
<
2
&&
Math
.
abs
(
this
.
lattices
[
i
].
column
-
lat
.
column
)
<
2
))
{
if
(
this
.
eliminatedElements
.
indexOf
(
i
)
<
0
&&
effectIndexs
.
indexOf
(
i
)
<
0
)
{
this
.
eliminatedElements
.
push
(
i
);
if
(
this
.
lattices
[
i
].
element
.
type
==
ElementType
.
FISH
)
{
this
.
lattices
[
i
].
element
.
nextFishState
();
}
//加分
if
(
Tool
.
judgeHasScore
(
this
.
lattices
[
i
].
element
))
{
this
.
pushScoreAni
(
baseScore
*
this
.
effectContinuityTimes
*
effectBaseTimes
[
"2"
],
Tool
.
getPositionByIndex
(
i
))
...
...
@@ -2573,6 +2591,9 @@ export default class MainScene extends Scene {
if
(
Tool
.
judgeEliminate
(
this
.
lattices
[
ein
]))
{
if
(
this
.
eliminatedElements
.
indexOf
(
ein
)
<
0
&&
effectIndexs
.
indexOf
(
ein
)
<
0
)
{
this
.
eliminatedElements
.
push
(
ein
);
if
(
this
.
lattices
[
ein
].
element
.
type
==
ElementType
.
FISH
)
{
this
.
lattices
[
ein
].
element
.
nextFishState
();
}
//加分
if
(
Tool
.
judgeHasScore
(
this
.
lattices
[
ein
].
element
))
{
this
.
pushScoreAni
(
baseScore
*
this
.
effectContinuityTimes
*
effectBaseTimes
[
"0"
],
Tool
.
getPositionByIndex
(
ein
))
...
...
@@ -2592,6 +2613,9 @@ export default class MainScene extends Scene {
if
(
Tool
.
judgeEliminate
(
this
.
lattices
[
ein
]))
{
if
(
this
.
eliminatedElements
.
indexOf
(
ein
)
<
0
&&
effectIndexs
.
indexOf
(
ein
)
<
0
)
{
this
.
eliminatedElements
.
push
(
ein
);
if
(
this
.
lattices
[
ein
].
element
.
type
==
ElementType
.
FISH
)
{
this
.
lattices
[
ein
].
element
.
nextFishState
();
}
//加分
if
(
Tool
.
judgeHasScore
(
this
.
lattices
[
ein
].
element
))
{
this
.
pushScoreAni
(
baseScore
*
this
.
effectContinuityTimes
*
effectBaseTimes
[
"1"
],
Tool
.
getPositionByIndex
(
ein
))
...
...
@@ -3047,12 +3071,34 @@ export default class MainScene extends Scene {
}
}
}
checkFishNebEle
(
lat0
:
Lattice
)
{
if
(
!
lat0
)
return
;
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
)
}
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
.
FISH
)
{
lat
.
element
.
setFishNebFlag
();
}
}
}
//检查附近所有元素
checkNebAll
(
latttice
:
Lattice
,
ele
?:
Element
)
{
//如果格子有冰
this
.
iceBroken
(
latttice
);
this
.
checkFireworksNebEle
(
latttice
,
ele
);
this
.
checkFishNebEle
(
latttice
);
//如果附近有石头
this
.
checkNebEle
(
latttice
,
(
lat
)
=>
{
return
lat
&&
lat
.
element
&&
lat
.
element
.
type
==
ElementType
.
ROCK
...
...
@@ -3152,7 +3198,7 @@ export default class MainScene extends Scene {
}
//时间再调cd
setTimeout
(()
=>
{
callback
();
callback
();
},
400
)
}
...
...
egret/src/mainScene/doFishAI.ts
0 → 100644
View file @
c24326ea
import
MainScene
from
"./MainScene"
;
import
{
ElementType
}
from
"../something/enum/ElementType"
;
import
wait
from
"../../libs/new_tc/wait"
;
/**
* fish爆炸
*/
export
default
async
(
thisObj
:
MainScene
)
=>
{
//先找出所有有碰撞状态的fish
//如果有的话那么可以设置消除状态了
const
indexs
:
number
[]
=
[];
for
(
var
i
=
0
;
i
<
thisObj
.
lattices
.
length
;
i
++
)
{
const
lattice
=
thisObj
.
lattices
[
i
]
if
(
lattice
&&
lattice
.
element
&&
lattice
.
element
.
type
==
ElementType
.
FISH
&&
lattice
.
element
.
isNeb
)
{
lattice
.
element
.
fishCanEliFlag
=
true
;
indexs
.
push
(
i
);
thisObj
.
eliminatedElements
.
push
(
i
);
}
}
await
wait
(
1000
);
//然后再消除四周的
return
indexs
;
}
\ No newline at end of file
egret/src/something/chapters/Chapter16.ts
View file @
c24326ea
...
...
@@ -5,7 +5,7 @@ import { ElementType } from "../enum/ElementType";
export
const
Chapters16
:
ChapterData
[]
=
[
//1引导基本消除
{
baseElementTypes
:
[
0
,
1
,
2
,
3
],
baseElementTypes
:
[
0
,
1
,
2
,
3
,
4
],
bubbleProbability
:
0
,
stepCount
:
25
,
passTarget
:
{
...
...
@@ -47,14 +47,14 @@ export const Chapters16: ChapterData[] = [
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
],
baseElements
:
[
2
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
2
0
,
0
,
0
,
0
,
20
,
0
,
0
,
0
,
20
,
10
,
20
,
0
,
2
0
,
10
,
20
,
0
,
20
,
10
,
20
,
10
,
20
,
10
,
2
0
,
10
,
20
,
2
0
,
10
,
20
,
20
,
10
,
2
0
,
20
,
10
,
20
,
0
,
20
,
10
,
20
,
10
,
2
0
,
10
,
20
,
0
,
0
,
0
,
20
,
10
,
20
,
10
,
20
,
0
,
0
,
0
,
0
,
0
,
20
,
10
,
2
0
,
0
,
0
,
0
,
2
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
3
0
,
0
,
0
,
0
,
20
,
0
,
0
,
0
,
20
,
10
,
20
,
0
,
3
0
,
10
,
20
,
0
,
20
,
10
,
20
,
10
,
20
,
10
,
4
0
,
10
,
20
,
2
1
,
10
,
20
,
20
,
0
,
4
0
,
20
,
10
,
20
,
0
,
30
,
10
,
30
,
10
,
3
0
,
10
,
20
,
0
,
0
,
0
,
20
,
30
,
22
,
10
,
20
,
0
,
0
,
0
,
0
,
0
,
20
,
10
,
3
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
20
,
0
,
0
,
0
,
0
,
],
// recycles: [70, 71, 72, 73]
...
...
egret/src/something/class/Element.ts
View file @
c24326ea
...
...
@@ -28,12 +28,31 @@ import { FestivalEle } from "./FestivalEle";
import
{
FestivalEle2
}
from
"./FestivalEle2"
;
import
{
Monster
}
from
"./Monster"
;
import
{
State
}
from
"./State"
;
import
wait
from
"../../../libs/new_tc/wait"
;
/**
* 考虑到底继承白鹭的啥Component还是Container
* 坐标原点需要坐落在格子的中心点
* 最好到时按,底图,动效,气泡,笼子,毛球,进行分层,如果多个状态要共存时,必须分层,到时气泡的动画,要写再自己的层里
*/
export
class
Element
extends
eui
.
Component
{
private
_fishState
=
0
;
private
_isNeb
:
boolean
;
//是否
get
isNeb
()
{
return
this
.
_isNeb
}
fishCanEliFlag
:
boolean
;
//尝试设置碰撞状态,如果之前被特效集中,那么可以设置碰撞状态。碰撞状态之后可以准备消除。
setFishNebFlag
()
{
if
(
this
.
_fishState
>
0
)
{
this
.
_isNeb
=
true
;
}
}
async
nextFishState
()
{
await
wait
(
1000
);
this
.
_fishState
++
;
if
(
this
.
_fishState
==
1
)
{
this
.
changeSource
(
"ele33_1_png"
);
}
}
private
_fireworksTimer
=
0
;
get
canFire
()
{
const
t
=
new
Date
().
getTime
();
...
...
@@ -137,11 +156,13 @@ export class Element extends eui.Component {
resetToMonsterView
(
res
:
ElementType
)
{
this
.
changeSource
(
"ele"
+
res
+
"_png"
);
this
.
monster
=
new
Monster
(
res
,
this
.
type
);
this
.
monster
=
new
Monster
(
res
,
this
.
type
);
this
.
addChild
(
this
.
monster
);
this
.
showImage
.
alpha
=
0
;
}
resetToFishView
()
{
this
.
_fishState
=
0
;
this
.
_isNeb
=
false
;
this
.
changeSource
(
"ele33_0_png"
);
// this.monster = new Monster(res,this.type);
// this.addChild(this.monster);
...
...
@@ -396,6 +417,7 @@ export class Element extends eui.Component {
* @param type 只应该是基础元素和特殊元素
*/
reset
(
type
:
ElementType
)
{
this
.
_isNeb
=
false
;
this
.
alpha
=
this
.
scaleX
=
this
.
scaleY
=
1
;
this
.
showImage
.
anchorOffsetX
=
0
;
this
.
showImage
.
anchorOffsetY
=
0
;
...
...
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