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
b9f0340b
Commit
b9f0340b
authored
Oct 26, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
570a98f8
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
827 additions
and
168 deletions
+827
-168
GameGuide.ts
egret/src/mainScene/GameGuide.ts
+5
-5
MainScene.ts
egret/src/mainScene/MainScene.ts
+113
-96
Tool.ts
egret/src/something/Tool.ts
+12
-17
HatchAni.ts
egret/src/something/anis/HatchAni.ts
+1
-1
JellySpreadAni.ts
egret/src/something/anis/JellySpreadAni.ts
+15
-3
Chapter2.ts
egret/src/something/chapters/Chapter2.ts
+459
-2
Element.ts
egret/src/something/class/Element.ts
+32
-2
ElementType.ts
egret/src/something/enum/ElementType.ts
+12
-11
AiControl.ts
egret/src/something/logic/AiControl.ts
+157
-17
HairballBlackState.ts
egret/src/something/states/HairballBlackState.ts
+21
-14
No files found.
egret/src/mainScene/GameGuide.ts
View file @
b9f0340b
...
...
@@ -293,19 +293,19 @@ const chapterFuns = {
]
},
//笼子消除
2
4
:
{
2
5
:
{
stepCount
:
1
,
showIndexs
:
[
[
40
,
49
,
58
,
50
],
[
0
,
1
,
2
,
3
],
],
hideIndexs
:
[
[
40
,
58
],
[
0
,
1
],
],
handIndexs
:
[
[
49
,
50
]
[
3
,
2
]
],
msg
:
[
"
被困住的元素无法进行移动,当触发元素
\n
消除时,元素上的藤蔓即可被消除
"
"
和困住藤蔓里的动物匹配
\n
消除,就可以打破藤蔓啦!
"
]
},
//果冻消除
...
...
egret/src/mainScene/MainScene.ts
View file @
b9f0340b
...
...
@@ -24,7 +24,7 @@ import { Element } from '../something/class/Element';
import
{
Ice
}
from
'../something/class/Ice'
;
import
{
Lattice
}
from
'../something/class/Lattice'
;
import
{
EffectType
}
from
'../something/enum/EffectType'
;
import
{
codeMsgs
,
ElementType
,
submitTran
}
from
'../something/enum/ElementType'
;
import
{
codeMsgs
,
ElementType
,
submitTran
,
FiveBaseElementTypes
}
from
'../something/enum/ElementType'
;
import
{
PassType
}
from
'../something/enum/PassType'
;
import
{
RecoverName
}
from
'../something/enum/RecoverName'
;
import
{
ChapterData
}
from
'../something/interface/ChapterData'
;
...
...
@@ -78,6 +78,7 @@ const aniClass = {
"JellyDisAni"
:
JellyDisAni
,
"EggBrokenAni"
:
EggBrokenAni
,
"HairballGreyDisAni"
:
HairballGreyDisAni
,
// "HairballBlackDisAni": HairballBlackDisAni,
}
export
const
baseScore
=
20
;
/**
...
...
@@ -100,7 +101,6 @@ export const effectBaseTimes = {
MM
:
50
}
//三个toast和bonusTime
const
movieClips
:
any
=
{}
...
...
@@ -626,19 +626,6 @@ export default class MainScene extends Scene {
}
}
// this.lattices[11].element.effectType=EffectType.MAGICLION;
// this.lattices[20].element.effectType=EffectType.MAGICLION;
//测试导出元素类型
// var bbb = [];
// for (var a = 0; a < this.lattices.length; a++) {
// var lat = this.lattices[a];
// if (lat && lat.element && lat.element.type <= 4) {
// bbb.push(lat.element.type + 1);
// } else {
// bbb.push(0)
// }
// }
// console.log(bbb);
}
//重置基础元素及特效类型
initBaseElement
()
{
...
...
@@ -654,7 +641,7 @@ export default class MainScene extends Scene {
//基础类型,没有就是null,有就-1,对ElementType对应
var
baseType
=
arr
[
1
]
?
arr
[
1
]
-
1
:
null
;
//不是基础类型,跳出
if
(
baseType
>
4
)
continue
;
if
(
FiveBaseElementTypes
.
indexOf
(
baseType
)
==
-
1
)
continue
;
let
ele
:
Element
=
this
.
lattices
[
i
].
element
;
if
(
baseType
!=
null
)
{
ele
.
resetType
(
baseType
);
...
...
@@ -666,7 +653,7 @@ export default class MainScene extends Scene {
//初始化引导,游戏和道具
initGuide
()
{
//游戏引导
const
gameGuideChapterNum
=
[
1
,
2
,
3
,
5
,
8
,
9
,
10
,
12
,
17
]
const
gameGuideChapterNum
=
[
1
,
2
,
3
,
5
,
8
,
9
,
10
,
12
,
17
,
25
]
if
(
gameGuideChapterNum
.
indexOf
(
this
.
chapter
>>
0
)
>
-
1
)
{
if
(
!
readCache
(
getCacheKey
()
+
this
.
chapter
))
{
this
.
gameGuide
=
new
GameGuide
(
this
);
...
...
@@ -1728,93 +1715,110 @@ export default class MainScene extends Scene {
this
.
eliminate
()
return
}
//鸡蛋的ai操作
//鸡蛋的ai操作
,存在判断三消,毛球的ai,也一样,所以放前面,存在三消时都直接执行eliminate了。不执行后续的回调
AiControl
.
ins
.
eggMotion
(
this
,
()
=>
{
//如果早已通关,正在结算
if
(
this
.
hasPassed
)
{
//如果原先特效还有,
if
(
!
this
.
isCountingTime
)
{
this
.
terminateSteps
();
}
//如果只有步数转化的,不能再进结算,
else
{
//通关了
//提交分数等
var
json
=
this
.
getSubmitJson
()
this
.
submit
(
json
)
}
return
}
//判断是否已达目标
this
.
hasPassed
=
this
.
judgePass
();
// console.log(this.hasPassed)
//如果已达目标
if
(
this
.
hasPassed
)
{
//连消基数为1
this
.
commonContinuityTimes
=
1
;
this
.
effectContinuityTimes
=
1
;
if
(
movieClips
[
"bonusTime"
])
{
this
.
addChild
(
movieClips
[
"bonusTime"
])
movieClips
[
"bonusTime"
].
gotoAndPlay
(
1
,
true
)
setTimeout
(()
=>
{
//后执行毛球跳动
AiControl
.
ins
.
hairballMotion
(
this
,
()
=>
{
//如果早已通关,正在结算
if
(
this
.
hasPassed
)
{
//如果原先特效还有,
if
(
!
this
.
isCountingTime
)
{
this
.
terminateSteps
();
if
(
movieClips
[
"bonusTime"
].
parent
)
{
this
.
removeChild
(
movieClips
[
"bonusTime"
])
}
},
1930
)
}
else
{
this
.
addChild
(
this
.
bonusTime
);
this
.
bonusTime
.
play
(()
=>
{
this
.
removeChild
(
this
.
bonusTime
)
this
.
terminateSteps
();
})
}
//如果只有步数转化的,不能再进结算,
else
{
//通关了
//提交分数等
var
json
=
this
.
getSubmitJson
()
this
.
submit
(
json
)
}
return
}
return
}
//出累计一步分数的toast;
this
.
oneStepScoreToast
();
//连消置0
this
.
commonContinuityTimes
=
0
;
this
.
effectContinuityTimes
=
0
;
//判断步数是否为0;
if
(
this
.
steps
==
0
)
{
//失败弹框
playSound
(
SoundType
.
fail
);
PanelCtrl
.
instance
.
show
(
"failed"
,
{
level
:
this
.
chapter
});
return
}
//额外加一步ai果冻的操作,然后再执行检查死图
AiControl
.
ins
.
jellyMotion
(
this
,
()
=>
{
//检查死图
this
.
warningCop
=
Tool
.
dieMapCheck
(
this
.
lattices
);
if
(
!
this
.
warningCop
)
{
//检查一边是否已死
if
(
Tool
.
alreadyDie
(
this
.
lattices
))
{
showToast
(
"元素已无法消除"
)
//判断是否已达目标
this
.
hasPassed
=
this
.
judgePass
();
// console.log(this.hasPassed)
//如果已达目标
if
(
this
.
hasPassed
)
{
//连消基数为1
this
.
commonContinuityTimes
=
1
;
this
.
effectContinuityTimes
=
1
;
if
(
movieClips
[
"bonusTime"
])
{
this
.
addChild
(
movieClips
[
"bonusTime"
])
movieClips
[
"bonusTime"
].
gotoAndPlay
(
1
,
true
)
setTimeout
(()
=>
{
playSound
(
SoundType
.
fail
);
PanelCtrl
.
instance
.
show
(
"failed"
,
{
level
:
this
.
chapter
});
},
1000
)
this
.
terminateSteps
();
if
(
movieClips
[
"bonusTime"
].
parent
)
{
this
.
removeChild
(
movieClips
[
"bonusTime"
])
}
},
1930
)
}
else
{
//死图。替换顺序,出toast
showToast
(
"没有可以消除的元素"
)
// PanelCtrl.instance.show(ModuleTypes.TOAST_PANEL, { msg: "没有可以消除的元素", isHideMask: true })
setTimeout
(()
=>
{
this
.
upsetElement
()
},
1000
)
this
.
addChild
(
this
.
bonusTime
);
this
.
bonusTime
.
play
(()
=>
{
this
.
removeChild
(
this
.
bonusTime
)
this
.
terminateSteps
();
})
}
}
else
{
//如果还有游戏引导
if
(
this
.
gameGuide
)
{
this
.
addChild
(
this
.
gameGuide
)
this
.
gameGuide
.
show
()
};
//允许移动
this
.
enableMouseEvt
(
true
)
return
}
//出累计一步分数的toast;
this
.
oneStepScoreToast
();
//连消置0
this
.
commonContinuityTimes
=
0
;
this
.
effectContinuityTimes
=
0
;
//判断步数是否为0;
if
(
this
.
steps
==
0
)
{
//失败弹框
playSound
(
SoundType
.
fail
);
PanelCtrl
.
instance
.
show
(
"failed"
,
{
level
:
this
.
chapter
});
return
}
//果冻的时间980,气泡的时间1100,必须考虑直接执行的情况,所以必须同时判断
//额外加一步ai果冻的操作,考虑和气泡一起改变,然后再执行检查死图
let
count
=
0
;
let
countAll
=
2
;
//和操作步数一致
//果冻的先执行,因为有元素类型的改变,会影响变色气泡的动画
AiControl
.
ins
.
jellyMotion
(
this
,
()
=>
{
if
(
++
count
===
countAll
)
this
.
aiMotionCheckDieMap
()
})
//然后执行气泡
AiControl
.
ins
.
bubbleMotion
(
this
,
()
=>
{
if
(
++
count
===
countAll
)
this
.
aiMotionCheckDieMap
()
})
})
})
}
/**
* 果冻蔓延和气泡变色需要重新检查死图
*/
aiMotionCheckDieMap
()
{
//检查死图
this
.
warningCop
=
Tool
.
dieMapCheck
(
this
.
lattices
);
if
(
!
this
.
warningCop
)
{
//检查一边是否已死
if
(
Tool
.
alreadyDie
(
this
.
lattices
))
{
showToast
(
"元素已无法消除"
)
setTimeout
(()
=>
{
playSound
(
SoundType
.
fail
);
PanelCtrl
.
instance
.
show
(
"failed"
,
{
level
:
this
.
chapter
});
},
1000
)
}
else
{
//死图。替换顺序,出toast
showToast
(
"没有可以消除的元素"
)
// PanelCtrl.instance.show(ModuleTypes.TOAST_PANEL, { msg: "没有可以消除的元素", isHideMask: true })
setTimeout
(()
=>
{
this
.
upsetElement
()
},
1000
)
}
}
else
{
//如果还有游戏引导
if
(
this
.
gameGuide
)
{
this
.
addChild
(
this
.
gameGuide
)
this
.
gameGuide
.
show
()
};
//允许移动
this
.
enableMouseEvt
(
true
)
}
}
/**
* 特效元素的组合效果
*/
...
...
@@ -2037,7 +2041,20 @@ export default class MainScene extends Scene {
}
//有黑色毛球的,一次眩晕,两次消失
else
if
(
ele
.
hasState
(
StateType
.
HAIRBALLGREY
))
{
//逻辑待写,参照上面
var
blackballBrownState
:
HairballBlackState
=
ele
.
getState
(
StateType
.
HAIRBALLBLACK
);
//醒着的就晕
if
(
blackballBrownState
.
isAwake
)
{
blackballBrownState
.
isAwake
=
false
;
}
//已经是晕的就消除,这个再考虑
else
{
//播放毛球消失动画
this
.
playAni
(
RecoverName
.
HAIRBALLBLACKDIS_ANI
,
p
);
//设为无毛球
ele
.
setState
(
StateType
.
HAIRBALLBLACK
,
false
)
//算个数
this
.
goElementTarget
(
ElementType
.
HAIRBALLBLACK
,
[
ele
.
x
,
ele
.
y
]);
}
}
//如果有特效,存下
else
if
(
ele
.
effectType
!=
null
)
{
...
...
@@ -2057,7 +2074,7 @@ export default class MainScene extends Scene {
this
.
checkNebAll
(
this
.
lattices
[
index
])
}
else
{
//单纯元素消失特效
if
(
ele
.
type
<=
4
)
{
if
(
FiveBaseElementTypes
.
indexOf
(
ele
.
type
)
>=
0
)
{
this
.
playAni
(
RecoverName
.
ELEDIS_ANI
,
p
)
//这里面会去算个数
this
.
recoverEle
(
index
)
...
...
egret/src/something/Tool.ts
View file @
b9f0340b
import
{
ChapterData
}
from
"./interface/ChapterData"
;
import
{
Element
}
from
"./class/Element"
;
import
{
Lattice
}
from
"./class/Lattice"
;
import
{
ElementType
}
from
"./enum/ElementType"
;
import
{
ElementType
,
FiveBaseElementTypes
}
from
"./enum/ElementType"
;
import
{
PassType
}
from
"./enum/PassType"
;
import
{
EffectType
}
from
"./enum/EffectType"
;
import
{
Pool
}
from
"./Pool"
;
...
...
@@ -16,7 +16,7 @@ export class Tool {
* 每格掉落时间
* 掉落速度这个定
*/
public
static
latDeltaTime
:
number
=
90
;
public
static
latDeltaTime
:
number
=
90
;
/**
* 总行数
*/
...
...
@@ -304,21 +304,18 @@ export class Tool {
/**
* 判断格子上是基础元素,包括各种状态的
*
* @param lat
*/
public
static
judgeBaseEle
(
lat
:
Lattice
)
{
//上方格子为null,或格子上元素为null
if
(
!
lat
||
!
lat
.
element
)
{
return
false
}
//不是基础元素,元素类型枚举01234
else
if
(
lat
.
element
.
type
>
4
)
{
return
false
}
//剩下情况
else
{
if
(
lat
&&
lat
.
element
&&
FiveBaseElementTypes
.
indexOf
(
lat
.
element
.
type
)
>=
0
//在5种基本元素中
)
{
return
true
}
return
false
}
/**
...
...
@@ -654,9 +651,7 @@ export class Tool {
//记录是否有三个格子挨着,且未锁定,没有毛球,这个逻辑略烦,暂定至少都未锁定,有bug再改
var
hasThree
=
false
;
for
(
var
i
=
0
;
i
<
lattices
.
length
;
i
++
)
{
if
(
lattices
[
i
]
&&
lattices
[
i
].
element
&&
lattices
[
i
].
element
.
type
<=
4
&&
if
(
this
.
judgeBaseEle
(
lattices
[
i
])
&&
!
lattices
[
i
].
element
.
hasState
(
StateType
.
LOCK
)
&&
!
lattices
[
i
].
element
.
hasState
(
StateType
.
HAIRBALLGREY
)
&&
!
lattices
[
i
].
element
.
hasState
(
StateType
.
HAIRBALLBLACK
)
&&
...
...
@@ -938,7 +933,7 @@ export class Tool {
* 十位是基础元素类型,对应数字减1就是基础元素类型
* 个位是特效类型(0表示无特效),对应数字减1就是特效类型
* @param num
* @return [] 0下标是元素类型,1下标是特效类型
* @return [] 0下标是元素类型
(返回null说明不合规则)
,1下标是特效类型
*/
public
static
praseEleNumber
(
num
)
{
//解析num;
...
...
@@ -946,7 +941,7 @@ export class Tool {
//基础类型,没有就是null,有就-1,对ElementType对应
var
baseType
=
arr
[
1
]
?
arr
[
1
]
-
1
:
null
;
//不是基础类型
if
(
baseType
>
4
)
baseType
=
null
;
if
(
FiveBaseElementTypes
.
indexOf
(
baseType
)
==
-
1
)
baseType
=
null
;
//特效类型
var
effectType
=
arr
[
0
]
?
arr
[
0
]
-
1
:
null
;
return
[
baseType
,
effectType
];
...
...
egret/src/something/anis/HatchAni.ts
View file @
b9f0340b
...
...
@@ -26,7 +26,7 @@ export function HatchAni(startIndex: number, endIndexs: number[], thisObj: MainS
//回收
thisObj
.
removeChild
(
eleC
);
Pool
.
recover
(
RecoverName
.
ELEMENT
,
eleC
);
//对应的索引的类型变成鸡
//对应的索引的类型变成鸡
,抛物线动画时间都一致,其实可以在统一回调里执行数据更新
thisObj
.
lattices
[
endIndex
].
element
.
reset
(
ElementType
.
CHICKEN
);
//动画,和bonusTime的效果一样,暂时没加
...
...
egret/src/something/anis/JellySpreadAni.ts
View file @
b9f0340b
...
...
@@ -4,6 +4,7 @@ import { RecoverName } from "../enum/RecoverName";
import
{
playSound
,
SoundType
}
from
"../../soundCtrl"
;
import
{
Tool
}
from
"../Tool"
;
import
{
ElementType
}
from
"../enum/ElementType"
;
import
{
Element
}
from
"../class/Element"
;
/**
* 需要回调的
...
...
@@ -18,7 +19,7 @@ export class JellySpreadAni extends egret.DisplayObjectContainer {
shoot
:
egret
.
Bitmap
;
constructor
()
{
super
()
var
texture
:
egret
.
Texture
=
RES
.
getRes
(
"ele"
+
ElementType
.
JELLY
+
"_png"
)
var
texture
:
egret
.
Texture
=
RES
.
getRes
(
"ele"
+
ElementType
.
JELLY
+
"_png"
)
this
.
targetImage
=
new
egret
.
Bitmap
(
texture
);
this
.
targetImage
.
anchorOffsetX
=
texture
.
textureWidth
/
2
;
this
.
targetImage
.
anchorOffsetY
=
texture
.
textureHeight
/
2
;
...
...
@@ -35,9 +36,14 @@ export class JellySpreadAni extends egret.DisplayObjectContainer {
this
.
addChild
(
this
.
shoot
);
}
play
(
startP
:
number
[],
endP
:
number
[]
,
callback
:
Function
)
{
play
(
startP
:
number
[],
cloneEle
:
Element
,
callback
:
Function
)
{
this
.
x
=
startP
[
0
];
this
.
y
=
startP
[
1
];
//终点位置全局先赋值出来,判断用
var
endP
=
[
cloneEle
.
x
,
cloneEle
.
y
];
//添加进
this
.
addChildAt
(
cloneEle
,
0
);
this
.
shoot
.
visible
=
true
;
this
.
shoot
.
x
=
0
...
...
@@ -80,7 +86,9 @@ export class JellySpreadAni extends egret.DisplayObjectContainer {
obj
.
x
=
-
Tool
.
width
;
}
}
//cloneEle的位置赋值
cloneEle
.
x
=
this
.
targetImage
.
x
;
cloneEle
.
y
=
this
.
targetImage
.
y
;
egret
.
Tween
.
get
(
this
.
oriImage
)
.
to
({
scaleX
:
1.07
,
scaleY
:
0.89
},
150
)
...
...
@@ -94,6 +102,10 @@ export class JellySpreadAni extends egret.DisplayObjectContainer {
.
to
({
scaleX
:
2
,
scaleY
:
1
},
230
)
.
to
(
obj
,
50
)
.
call
(()
=>
{
//回收克隆元素
this
.
removeChild
(
cloneEle
);
Pool
.
recover
(
RecoverName
.
ELEMENT
,
cloneEle
)
//回调
callback
();
this
.
shoot
.
visible
=
false
;
this
.
targetImage
.
visible
=
true
;
...
...
egret/src/something/chapters/Chapter2.ts
View file @
b9f0340b
...
...
@@ -207,10 +207,10 @@ export const Chapters2: ChapterData[] = [
bubbleProbability
:
0
,
stepCount
:
27
,
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
type
:
1
,
elements
:
[
{
type
:
ElementType
.
ICE
,
type
:
9
,
count
:
31
},
]
...
...
@@ -259,4 +259,461 @@ export const Chapters2: ChapterData[] = [
connectedLats
:
[[
2
,
29
],
[
3
,
30
],
[
4
,
31
],
[
74
,
6
],
[
75
,
7
],
[
76
,
8
]]
},
},
//25
{
baseElementTypes
:
[
0
,
1
,
2
,
3
],
bubbleProbability
:
0
,
stepCount
:
28
,
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
{
type
:
ElementType
.
RABBIT
,
count
:
42
},
{
type
:
ElementType
.
CHICKEN
,
count
:
42
},
]
},
starScores
:
[
4000
,
8000
,
12000
],
map
:
{
lattices
:
[
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
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
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
],
elements
:
[
4
,
4
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
4
,
4
,
4
,
4
,
4
,
4
,
0
,
0
,
0
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
0
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
0
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
0
,
4
,
4
,
4
,
4
,
4
,
4
,
0
,
0
,
0
,
4
,
4
,
4
,
4
,
4
,
4
,
0
,
0
,
0
,
4
,
4
,
4
,
4
,
4
,
4
,
],
baseElements
:
[
11
,
13
,
20
,
10
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
20
,
30
,
20
,
30
,
20
,
30
,
0
,
0
,
0
,
30
,
20
,
30
,
20
,
30
,
20
,
33
,
32
,
0
,
10
,
20
,
10
,
20
,
10
,
20
,
32
,
41
,
0
,
20
,
10
,
20
,
10
,
20
,
10
,
42
,
23
,
0
,
10
,
20
,
10
,
20
,
10
,
20
,
0
,
0
,
0
,
20
,
30
,
20
,
30
,
20
,
30
,
0
,
0
,
0
,
30
,
20
,
30
,
20
,
30
,
20
,
],
generateLats
:
[
{
index
:
0
,
type
:
[
0
],
cus
:
[]
},
{
index
:
3
,
type
:
[
0
],
cus
:
[]
},
{
index
:
2
,
type
:
[
0
],
cus
:
[]
},
{
index
:
1
,
type
:
[
0
],
cus
:
[]
},
{
index
:
36
,
type
:
[
0
],
cus
:
[]
},
{
index
:
37
,
type
:
[
0
],
cus
:
[]
},
{
index
:
21
,
type
:
[
0
],
cus
:
[]
},
{
index
:
22
,
type
:
[
0
],
cus
:
[]
},
{
index
:
23
,
type
:
[
0
],
cus
:
[]
},
{
index
:
24
,
type
:
[
0
],
cus
:
[]
},
{
index
:
25
,
type
:
[
0
],
cus
:
[]
},
{
index
:
26
,
type
:
[
0
],
cus
:
[]
},
],
},
},
//26
{
baseElementTypes
:
[
0
,
1
,
2
,
3
],
bubbleProbability
:
0
,
stepCount
:
28
,
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
{
type
:
5
,
count
:
8
},
]
},
starScores
:
[
4000
,
8000
,
12000
],
map
:
{
lattices
:
[
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
],
elements
:
[
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
2
,
1
,
1
,
1
,
2
,
0
,
0
,
0
,
0
,
1
,
1
,
4
,
1
,
1
,
0
,
0
,
0
,
0
,
2
,
1
,
1
,
1
,
2
,
0
,
0
,
0
,
0
,
4
,
1
,
4
,
1
,
4
,
0
,
0
,
0
,
0
,
2
,
1
,
1
,
1
,
2
,
0
,
0
,
0
,
0
,
4
,
1
,
4
,
1
,
4
,
0
,
0
,
0
,
0
,
2
,
1
,
1
,
1
,
2
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
],
baseElements
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
14
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
31
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
],
generateLats
:
[
{
index
:
4
,
type
:
[
0
],
cus
:
[]
},
{
index
:
3
,
type
:
[
0
],
cus
:
[]
},
{
index
:
2
,
type
:
[
0
],
cus
:
[]
},
{
index
:
5
,
type
:
[
0
],
cus
:
[]
},
{
index
:
6
,
type
:
[
0
],
cus
:
[]
},
],
},
},
//27
{
baseElementTypes
:
[
0
,
1
,
2
,
3
],
bubbleProbability
:
0
,
stepCount
:
28
,
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
{
type
:
ElementType
.
ICE
,
count
:
48
},
]
},
starScores
:
[
4000
,
8000
,
12000
],
map
:
{
lattices
:
[
0
,
0
,
1
,
1
,
0
,
1
,
1
,
0
,
0
,
0
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
0
,
1
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
1
,
0
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
0
,
0
,
0
,
2
,
2
,
2
,
2
,
2
,
0
,
0
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
1
,
1
,
3
,
3
,
1
,
3
,
3
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
0
,
1
,
1
,
1
,
],
elements
:
[
0
,
0
,
2
,
2
,
0
,
2
,
2
,
0
,
0
,
0
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
0
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
0
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
0
,
0
,
0
,
2
,
2
,
2
,
2
,
2
,
0
,
0
,
2
,
0
,
0
,
0
,
2
,
0
,
0
,
0
,
2
,
2
,
0
,
0
,
0
,
2
,
0
,
0
,
0
,
2
,
2
,
1
,
0
,
0
,
1
,
0
,
0
,
1
,
2
,
1
,
2
,
1
,
0
,
1
,
0
,
1
,
2
,
1
,
],
baseElements
:
[
0
,
0
,
2
,
2
,
0
,
2
,
2
,
0
,
0
,
0
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
0
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
0
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
0
,
0
,
0
,
2
,
2
,
2
,
2
,
2
,
0
,
0
,
2
,
0
,
0
,
0
,
2
,
0
,
0
,
0
,
2
,
2
,
0
,
0
,
0
,
2
,
3
,
0
,
0
,
2
,
2
,
32
,
0
,
0
,
22
,
0
,
0
,
32
,
2
,
32
,
2
,
32
,
0
,
23
,
0
,
32
,
2
,
32
,
],
generateLats
:
[
{
index
:
10
,
type
:
[
0
],
cus
:
[]
},
{
index
:
3
,
type
:
[
0
],
cus
:
[]
},
{
index
:
2
,
type
:
[
0
],
cus
:
[]
},
{
index
:
5
,
type
:
[
0
],
cus
:
[]
},
{
index
:
6
,
type
:
[
0
],
cus
:
[]
},
{
index
:
16
,
type
:
[
0
],
cus
:
[]
},
{
index
:
45
,
type
:
[
0
],
cus
:
[]
},
{
index
:
53
,
type
:
[
0
],
cus
:
[]
},
],
},
},
//28
{
baseElementTypes
:
[
0
,
1
,
2
,
4
],
bubbleProbability
:
0
,
stepCount
:
28
,
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
{
type
:
ElementType
.
ICE
,
count
:
25
},
]
},
starScores
:
[
4000
,
8000
,
12000
],
map
:
{
lattices
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
3
,
3
,
3
,
3
,
3
,
1
,
0
,
0
,
1
,
3
,
3
,
3
,
3
,
3
,
1
,
0
,
0
,
1
,
3
,
3
,
3
,
3
,
3
,
1
,
0
,
0
,
1
,
3
,
3
,
3
,
3
,
3
,
1
,
0
,
0
,
1
,
3
,
3
,
3
,
3
,
3
,
1
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
],
elements
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
0
,
0
,
0
,
0
,
0
,
4
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
4
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
4
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
],
baseElements
:
[
0
,
0
,
2
,
2
,
0
,
2
,
2
,
0
,
0
,
0
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
0
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
0
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
0
,
0
,
0
,
2
,
2
,
2
,
2
,
2
,
0
,
0
,
2
,
0
,
0
,
0
,
2
,
0
,
0
,
0
,
2
,
2
,
0
,
0
,
0
,
2
,
3
,
0
,
0
,
2
,
2
,
32
,
0
,
0
,
22
,
0
,
0
,
32
,
2
,
32
,
2
,
32
,
0
,
23
,
0
,
32
,
2
,
32
,
],
generateLats
:
[
{
index
:
10
,
type
:
[
0
],
cus
:
[]
},
{
index
:
11
,
type
:
[
0
],
cus
:
[]
},
{
index
:
12
,
type
:
[
0
],
cus
:
[]
},
{
index
:
13
,
type
:
[
0
],
cus
:
[]
},
{
index
:
14
,
type
:
[
0
],
cus
:
[]
},
{
index
:
15
,
type
:
[
0
],
cus
:
[]
},
{
index
:
16
,
type
:
[
0
],
cus
:
[]
},
],
},
},
//29
{
baseElementTypes
:
[
0
,
1
,
2
,
3
,
4
],
bubbleProbability
:
0
,
stepCount
:
24
,
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
{
type
:
ElementType
.
ICE
,
count
:
21
},
]
},
starScores
:
[
4000
,
8000
,
12000
],
map
:
{
lattices
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
3
,
3
,
3
,
1
,
2
,
2
,
2
,
1
,
1
,
1
,
1
,
3
,
1
,
2
,
1
,
2
,
1
,
1
,
3
,
3
,
3
,
1
,
2
,
2
,
2
,
1
,
1
,
3
,
1
,
1
,
1
,
1
,
1
,
2
,
1
,
1
,
3
,
3
,
3
,
1
,
1
,
1
,
2
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
],
elements
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
4
,
4
,
4
,
1
,
1
,
1
,
1
,
1
,
1
,
4
,
1
,
4
,
1
,
1
,
1
,
1
,
1
,
1
,
4
,
4
,
4
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
4
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
4
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
],
baseElements
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
42
,
0
,
32
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
23
,
0
,
12
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
],
generateLats
:
[
{
index
:
10
,
type
:
[
0
],
cus
:
[]
},
{
index
:
11
,
type
:
[
0
],
cus
:
[]
},
{
index
:
12
,
type
:
[
0
],
cus
:
[]
},
{
index
:
13
,
type
:
[
0
],
cus
:
[]
},
{
index
:
14
,
type
:
[
0
],
cus
:
[]
},
{
index
:
15
,
type
:
[
0
],
cus
:
[]
},
{
index
:
16
,
type
:
[
0
],
cus
:
[]
},
{
index
:
9
,
type
:
[
0
],
cus
:
[]
},
{
index
:
17
,
type
:
[
0
],
cus
:
[]
},
],
},
},
//30
{
baseElementTypes
:
[
4
,
1
,
2
,
3
],
bubbleProbability
:
0
,
stepCount
:
28
,
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
{
type
:
6
,
count
:
7
},
]
},
starScores
:
[
4000
,
8000
,
12000
],
map
:
{
lattices
:
[
1
,
0
,
1
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
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
,
],
elements
:
[
3
,
0
,
3
,
0
,
3
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
0
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
0
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
],
baseElements
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
],
generateLats
:
[
{
index
:
0
,
type
:
[
0
],
cus
:
[]
},
{
index
:
2
,
type
:
[
0
],
cus
:
[]
},
{
index
:
4
,
type
:
[
0
],
cus
:
[]
},
],
recycles
:
[
72
,
73
,
74
,
75
,
76
,
77
,
78
,
79
]
},
},
//31
{
baseElementTypes
:
[
4
,
1
,
2
,
3
],
bubbleProbability
:
0
,
stepCount
:
28
,
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
{
type
:
ElementType
.
ICE
,
count
:
24
},
]
},
starScores
:
[
4000
,
8000
,
12000
],
map
:
{
lattices
:
[
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
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
1
,
1
,
1
,
2
,
2
,
1
,
2
,
2
,
1
,
1
,
1
,
1
,
2
,
2
,
1
,
2
,
2
,
1
,
1
,
],
elements
:
[
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
0
,
0
,
4
,
4
,
4
,
4
,
4
,
0
,
0
,
0
,
0
,
4
,
4
,
1
,
4
,
4
,
0
,
0
,
0
,
2
,
2
,
2
,
4
,
2
,
2
,
2
,
0
,
0
,
0
,
2
,
2
,
1
,
2
,
2
,
0
,
0
,
0
,
0
,
2
,
2
,
1
,
2
,
2
,
0
,
0
,
],
baseElements
:
[
30
,
20
,
30
,
20
,
30
,
20
,
30
,
20
,
30
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
0
,
0
,
50
,
50
,
40
,
50
,
50
,
0
,
0
,
0
,
0
,
40
,
40
,
50
,
40
,
40
,
0
,
0
,
0
,
2
,
2
,
2
,
50
,
2
,
2
,
2
,
1
,
1
,
1
,
2
,
2
,
40
,
2
,
2
,
1
,
1
,
1
,
1
,
2
,
2
,
44
,
2
,
2
,
1
,
1
,
],
generateLats
:
[
{
index
:
0
,
type
:
[
0
],
cus
:
[]
},
{
index
:
2
,
type
:
[
0
],
cus
:
[]
},
{
index
:
1
,
type
:
[
0
],
cus
:
[]
},
{
index
:
3
,
type
:
[
0
],
cus
:
[]
},
{
index
:
4
,
type
:
[
0
],
cus
:
[]
},
{
index
:
5
,
type
:
[
0
],
cus
:
[]
},
{
index
:
6
,
type
:
[
0
],
cus
:
[]
},
{
index
:
7
,
type
:
[
0
],
cus
:
[]
},
{
index
:
8
,
type
:
[
0
],
cus
:
[]
},
],
},
},
//32
//33
//34
//35
//36
//37
//38
//39
//40
]
\ No newline at end of file
egret/src/something/class/Element.ts
View file @
b9f0340b
...
...
@@ -15,6 +15,7 @@ import { HairballBrownState } from "../states/HairballBrownState";
import
{
BubbleState
}
from
"../states/BubbleState"
;
import
{
HairballGreyState
}
from
"../states/HairballGreyState"
;
import
{
HairballBlackState
}
from
"../states/HairballBlackState"
;
import
{
Tool
}
from
"../Tool"
;
/**
...
...
@@ -124,10 +125,14 @@ export class Element extends eui.Component {
/**
* 所有的状态,注意,变色气泡特殊,不能和特效共存,所以初始化时,气泡的不能加特效。生成特效,去掉气泡
* 索引必须按枚举
* 索引必须按
StateType的
枚举
*/
private
states
:
State
[]
=
[]
/**
*
* @param type 只应该是基础元素和特殊元素
*/
constructor
(
type
:
ElementType
)
{
super
();
this
.
_type
=
type
;
...
...
@@ -170,7 +175,7 @@ export class Element extends eui.Component {
/**
* 会重置掉所有特效类型,枷锁,鸡蛋等
* @param type
* @param type
只应该是基础元素和特殊元素
*/
reset
(
type
:
ElementType
)
{
this
.
alpha
=
this
.
scaleX
=
this
.
scaleY
=
1
;
...
...
@@ -229,6 +234,7 @@ export class Element extends eui.Component {
/**
* 只修改类型,不改变其他状态
* @param type 只应该是基础元素和特殊元素
*/
resetType
(
type
:
ElementType
)
{
//如果重置成特殊元素,或鸡蛋,或石头,或果冻,或棒棒糖,直接用reset方法
...
...
@@ -408,4 +414,28 @@ export class Element extends eui.Component {
getState
(
state
:
StateType
):
any
{
return
this
.
states
[
state
]
}
/**
* 克隆一个
* 类型
* 特效
* 状态
* 位置
*/
clone
():
Element
{
let
ele
=
Tool
.
getElement
(
this
.
type
);
//特效加上
ele
.
effectType
=
this
.
effectType
;
//状态加上
for
(
var
i
=
0
;
i
<
this
.
states
.
length
;
i
++
)
{
let
state
=
this
.
states
[
i
];
if
(
!
state
)
continue
;
ele
.
setState
(
i
,
true
,
this
.
type
)
}
//位置信息
ele
.
x
=
this
.
x
;
ele
.
y
=
this
.
y
;
return
ele
}
}
\ No newline at end of file
egret/src/something/enum/ElementType.ts
View file @
b9f0340b
/**
* 元素类型 <=4就是基础元素
*
*
枚举尽量从后面添加,否则要改很多东西,submitTran重新对应,ele图片重新对应,开始弹框目标实现等等,没改全后果自负
* 修改索引时,需要修改ele的图片,和通关目标类。飞入特效类
*/
export
enum
ElementType
{
...
...
@@ -26,17 +26,18 @@ export enum ElementType {
HAIRBALLBROWN
,
//褐色毛球11
HAIRBALLBLACK
,
//黑色毛球12
}
var
a
=
[
0
,
40
,
30
,
0
,
44
,
0
,
20
,
40
,
0
,
0
,
20
,
20
,
0
,
40
,
0
,
50
,
50
,
0
,
0
,
30
,
50
,
0
,
3
,
0
,
20
,
30
,
0
,
0
,
10
,
0
,
0
,
0
,
0
,
0
,
20
,
0
,
0
,
50
,
40
,
0
,
0
,
0
,
10
,
30
,
0
,
30
,
10
,
30
,
50
,
0
,
40
,
50
,
50
,
20
,
0
,
50
,
40
,
30
,
50
,
20
,
10
,
40
,
0
,
0
,
0
,
10
,
10
,
3
,
30
,
50
,
0
,
0
,
0
,
0
,
0
,
30
,
50
,
40
,
0
,
0
,
0
,
/**
* 5种基本元素的数组,每项是ElementType的枚举值
*/
export
const
FiveBaseElementTypes
:
ElementType
[]
=
[
ElementType
.
RABBIT
,
ElementType
.
CHICKEN
,
ElementType
.
CATTLE
,
ElementType
.
LION
,
ElementType
.
PIG
,
]
export
const
codeMsgs
=
{
"E1002090011"
:
"用户关卡记录异常"
,
"E1002090012"
:
"暂不能挑战此关卡"
,
...
...
egret/src/something/logic/AiControl.ts
View file @
b9f0340b
...
...
@@ -10,12 +10,16 @@ import { HatchAni } from "../anis/HatchAni";
import
{
PieceToEggAni
}
from
"../anis/PieceToEggAni"
;
import
{
StateType
}
from
"../enum/StateType"
;
import
{
BubbleAni
}
from
"../anis/BubbleAni"
;
import
{
Element
}
from
"../class/Element"
;
//孵鸡的数量
const
chickenNum
:
number
=
4
export
class
AiControl
{
private
static
_ins
:
AiControl
/**
* 只实例一次,所以不能直接把thisObj干进来,每个方法里带吧
*/
static
get
ins
()
{
return
AiControl
.
_ins
||
(
AiControl
.
_ins
=
new
AiControl
())
}
...
...
@@ -32,7 +36,7 @@ export class AiControl {
*/
private
hasBubble
:
boolean
;
/**
* 判断是否还有毛球,暂时不考虑毛球能再生
* 判断是否还有毛球,暂时不考虑毛球能再生
,以后可能改能掉落毛球,再说
*/
private
hasHairball
:
boolean
;
...
...
@@ -102,16 +106,28 @@ export class AiControl {
jellySpreadAni
=
new
JellySpreadAni
()
}
thisObj
.
addChild
(
jellySpreadAni
);
//隐藏原来的元素
thisObj
.
lattices
[
spread
[
0
]].
element
.
visible
=
false
;
jellySpreadAni
.
play
(
Tool
.
getPositionByIndex
(
spread
[
0
]),
Tool
.
getPositionByIndex
(
spread
[
1
]),
()
=>
{
//显示隐藏元素
thisObj
.
lattices
[
spread
[
0
]].
element
.
visible
=
true
;
//播放完后,将终点元素变成果冻
thisObj
.
lattices
[
spread
[
1
]].
element
.
reset
(
ElementType
.
JELLY
);
//执行回调
callback
()
})
//起始元素
let
fromEle
:
Element
=
thisObj
.
lattices
[
spread
[
0
]].
element
;
//终点元素
let
endEle
:
Element
=
thisObj
.
lattices
[
spread
[
1
]].
element
;
//克隆一个终点元素
let
cloneEle
:
Element
=
endEle
.
clone
();
//对后续有影响的数据必须提交更新,视图不对就隐藏先,动画里加上对应视图,动画播放回调里去掉动画视图,显示数据视图;
//将终点元素变成果冻,,
endEle
.
reset
(
ElementType
.
JELLY
);
//隐藏元素
fromEle
.
visible
=
false
;
endEle
.
visible
=
false
;
jellySpreadAni
.
play
(
Tool
.
getPositionByIndex
(
spread
[
0
]),
cloneEle
,
()
=>
{
//显示隐藏元素
fromEle
.
visible
=
true
;
endEle
.
visible
=
true
;
//执行回调
callback
()
})
}
/**
* 鸡蛋得孵化逻辑
...
...
@@ -171,6 +187,7 @@ export class AiControl {
//补上剩下的,如果还不足,就不管
four
=
four
.
concat
(
Tool
.
getRandomArrayElementsEx
(
chickenIndexs
,
chickenNum
-
four
.
length
))
}
//四个元素变成鸡的数据更新在动画播放完的函数里执行,暂时对数据无影响,延后更新数据无妨
//播蛋壳动画
let
activeEgg
=
thisObj
.
lattices
[
activeEggIndex
].
element
.
chickenEgg
;
activeEgg
.
visible
=
false
;
...
...
@@ -215,12 +232,12 @@ export class AiControl {
callback
();
return
}
//找出所有的气泡
//找出所有的气泡
,必须按顺序,从左到右,从上到下
var
indexs
:
number
[]
=
[];
for
(
var
i
=
0
;
i
<
thisObj
.
lattices
.
length
;
i
++
)
{
var
lat
=
thisObj
.
lattices
[
i
];
//是基础元素,有气泡状态
if
(
Tool
.
judgeBaseEle
(
lat
)
&&
!
lat
.
element
.
hasState
(
StateType
.
BUBBLE
))
{
if
(
Tool
.
judgeBaseEle
(
lat
)
&&
lat
.
element
.
hasState
(
StateType
.
BUBBLE
))
{
indexs
.
push
(
i
);
}
}
...
...
@@ -240,8 +257,8 @@ export class AiControl {
let
ele
=
lat
.
element
;
let
fromType
=
ele
.
type
;
//计算type
let
type
:
ElementType
=
1
;
//直接重置类型,为了后续计算,但是要隐藏,待动画播放完显示
let
type
:
ElementType
=
getBubbleType
(
index
,
thisObj
.
lattices
,
thisObj
.
chapterData
.
baseElementTypes
)
;
//直接重置类型,为了后续计算
泡泡类型
,但是要隐藏,待动画播放完显示
ele
.
resetType
(
type
);
ele
.
visible
=
false
;
//变色动画
...
...
@@ -265,6 +282,70 @@ export class AiControl {
})
}
}
/**
* 跳动,以及褐色毛球的分裂
* 黑色毛球眩晕不执行跳动,不过结束后要重置为不眩晕状态,和callback同步执行
* @param thisObj
* @param callback
*/
hairballMotion
(
thisObj
:
MainScene
,
callback
:
Function
)
{
//没有毛球。直接回调
if
(
!
this
.
hasHairball
)
{
callback
();
return
}
//找出所有能跳动的毛球;
var
jumpBallIndexs
:
number
[]
=
[];
//即将唤醒的黑色毛球
var
awakeBallIndexs
:
number
[]
=
[];
//即将分裂的褐色毛球
var
divideBallIndexs
:
number
[]
=
[];
for
(
var
i
=
0
;
i
<
thisObj
.
lattices
.
length
;
i
++
)
{
var
lat
=
thisObj
.
lattices
[
i
];
//是基础元素
if
(
Tool
.
judgeBaseEle
(
lat
))
{
//灰色直接进跳动
if
(
lat
.
element
.
hasState
(
StateType
.
HAIRBALLGREY
))
{
jumpBallIndexs
.
push
(
i
);
}
//黑色
if
(
lat
.
element
.
hasState
(
StateType
.
HAIRBALLBLACK
))
{
//醒着的跳动
if
(
lat
.
element
.
getState
(
StateType
.
HAIRBALLBLACK
).
isAwake
)
{
jumpBallIndexs
.
push
(
i
);
}
//晕着的即将醒
else
{
awakeBallIndexs
.
push
(
i
);
}
}
//褐色
if
(
lat
.
element
.
hasState
(
StateType
.
HAIRBALLBROWN
))
{
//激活的即将分裂
if
(
lat
.
element
.
getState
(
StateType
.
HAIRBALLBROWN
).
isActive
)
{
divideBallIndexs
.
push
(
i
);
}
//未激活的跳动
else
{
jumpBallIndexs
.
push
(
i
);
}
};
}
}
//没有毛球,直接回调,
if
(
!
jumpBallIndexs
.
length
&&
!
awakeBallIndexs
.
length
&&
!
divideBallIndexs
.
length
)
{
//标记无毛球
this
.
hasHairball
=
false
;
callback
();
return
}
//分裂的优先
//跳动的
//唤醒的
}
}
/**
...
...
@@ -282,7 +363,7 @@ function judgeJellyExist(lattices: Lattice[]) {
return
false
;
}
/**
* 判断毛球是否存在
* 判断毛球是否存在
,甭管什么毛球
* @param lattices
*/
function
judgeHairballExist
(
lattices
:
Lattice
[])
{
...
...
@@ -355,8 +436,67 @@ function judgeSpread(index: number, lattices: Lattice[]): number {
}
return
null
}
/**
* 获得气泡变化类型
* @param index 变化的格子索引
* @param lattices 所有格子
* @param baseElementTypes 可选基础类型
*/
function
getBubbleType
(
index
:
number
,
lattices
:
Lattice
[],
baseElementTypes
:
number
[]):
ElementType
{
//变色,只取基础类型
var
rc
=
Tool
.
indexToRc
(
index
);
var
arr
=
baseElementTypes
.
slice
();
let
operation
=
(
lat1
:
Lattice
,
lat2
:
Lattice
)
=>
{
//必须是都可匹配的
if
(
Tool
.
judgeMatch
(
lat1
)
&&
Tool
.
judgeMatch
(
lat2
)
&&
lat1
.
element
.
type
==
lat2
.
element
.
type
)
{
Tool
.
removeEle
(
lat1
.
element
.
type
,
arr
);
}
}
//和左边两个比较
if
(
rc
[
1
]
>
1
)
operation
(
lattices
[
index
-
1
],
lattices
[
index
-
2
])
//和上边两个比较
if
(
rc
[
0
]
>
1
)
operation
(
lattices
[
index
-
Tool
.
colNum
],
lattices
[
index
-
Tool
.
colNum
*
2
])
//下面的比较都要忽略因为顺序从小到大,所以忽略带气泡状态的,
//与左右边两个比较,不能是第一列和最后一列
if
(
rc
[
1
]
>
0
&&
rc
[
1
]
<
Tool
.
colNum
-
1
)
{
let
lat1
=
lattices
[
index
-
1
];
let
lat2
=
lattices
[
index
+
1
];
//右边的格子,不能有气泡,有气泡就不用去判断了
if
(
Tool
.
judgeMatch
(
lat2
)
&&
!
lat2
.
element
.
hasState
(
StateType
.
BUBBLE
))
operation
(
lat1
,
lat2
)
}
//与上下两个比较,不能是第一行和最后一行
if
(
rc
[
0
]
>
0
&&
rc
[
0
]
<
Tool
.
rowNum
-
1
)
{
let
lat1
=
lattices
[
index
-
Tool
.
colNum
];
let
lat2
=
lattices
[
index
+
Tool
.
colNum
];
//下边的格子,不能有气泡,有气泡就不用去判断了
if
(
Tool
.
judgeMatch
(
lat2
)
&&
!
lat2
.
element
.
hasState
(
StateType
.
BUBBLE
))
operation
(
lat1
,
lat2
)
}
// function getBubble
//右二或下二的判断操作
let
operationAdd
=
(
lat1
:
Lattice
,
lat2
:
Lattice
)
=>
{
if
(
Tool
.
judgeMatch
(
lat1
)
&&
Tool
.
judgeMatch
(
lat2
)
&&
!
lat1
.
element
.
hasState
(
StateType
.
BUBBLE
)
&&
!
lat2
.
element
.
hasState
(
StateType
.
BUBBLE
)
&&
lat1
.
element
.
type
==
lat2
.
element
.
type
)
{
Tool
.
removeEle
(
lat1
.
element
.
type
,
arr
);
}
}
//与右边两个比较
if
(
rc
[
1
]
<
Tool
.
colNum
-
2
)
operationAdd
(
lattices
[
index
+
1
],
lattices
[
index
+
2
]);
//与下边两个比较
if
(
rc
[
0
]
<
Tool
.
colNum
-
2
)
operationAdd
(
lattices
[
index
+
Tool
.
colNum
],
lattices
[
index
+
Tool
.
colNum
*
2
]);
//如果没有可选,返回自身的类型,动画还是要放的
if
(
!
arr
.
length
)
return
lattices
[
index
].
element
.
type
;
//随机一个
return
Tool
.
randomT
(
arr
);
}
...
...
egret/src/something/states/HairballBlackState.ts
View file @
b9f0340b
...
...
@@ -7,35 +7,42 @@ import { ElementType } from "../enum/ElementType";
/**
* 黑色毛球状态
* 两次消除,需要修改图片,,,再说,还没写
* 两次消除,需要修改图片,,,再说,还没写
,切换眩晕状态,是否有动画,都再说
*/
export
class
HairballBlackState
extends
State
{
private
showImage
:
egret
.
Bitmap
;
/**
* 是否激活
*/
isActive
:
boolean
;
_isAwake
:
boolean
;
get
isAwake
():
boolean
{
return
this
.
_isAwake
;
}
set
isAwake
(
value
:
boolean
)
{
this
.
_isAwake
=
value
;
//换图
}
constructor
()
{
super
();
var
texture
:
egret
.
Texture
=
RES
.
getRes
(
"ele"
+
ElementType
.
HAIRBALLBLACK
+
"_png"
)
this
.
showImage
=
new
egret
.
Bitmap
(
texture
);
this
.
showImage
=
new
egret
.
Bitmap
();
this
.
addChild
(
this
.
showImage
);
this
.
showImage
.
x
=
-
texture
.
textureWidth
/
2
;
this
.
showImage
.
y
=
-
texture
.
textureHeight
/
2
;
this
.
isActive
=
false
;
this
.
changeSource
(
"ele"
+
ElementType
.
HAIRBALLBLACK
+
"_png"
)
this
.
_isAwake
=
true
;
}
reset
()
{
this
.
isActive
=
false
;
this
.
_isAwake
=
true
;
//换图
this
.
changeSource
(
"ele"
+
ElementType
.
HAIRBALLBLACK
+
"_png"
)
}
recover
()
{
if
(
this
.
parent
)
this
.
parent
.
removeChild
(
this
);
Pool
.
recover
(
RecoverName
.
HAIRBALLBLACK_STATE
,
this
);
}
//
private changeSource(source: string) {
//
var texture: egret.Texture = RES.getRes(source);
//
this.showImage.texture = texture;
//
this.showImage.x = -texture.textureWidth / 2;
//
this.showImage.y = -texture.textureHeight / 2
//
}
private
changeSource
(
source
:
string
)
{
var
texture
:
egret
.
Texture
=
RES
.
getRes
(
source
);
this
.
showImage
.
texture
=
texture
;
this
.
showImage
.
x
=
-
texture
.
textureWidth
/
2
;
this
.
showImage
.
y
=
-
texture
.
textureHeight
/
2
}
}
\ 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