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
74a28db1
Commit
74a28db1
authored
Oct 26, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
7ed69a67
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
155 additions
and
100 deletions
+155
-100
MainScene.ts
egret/src/mainScene/MainScene.ts
+90
-79
Tool.ts
egret/src/something/Tool.ts
+8
-1
EleDownAni.ts
egret/src/something/anis/EleDownAni.ts
+42
-0
EleMaskAni.ts
egret/src/something/anis/EleMaskAni.ts
+2
-1
IceAni.ts
egret/src/something/anis/IceAni.ts
+2
-1
PieceToEggAni.ts
egret/src/something/anis/PieceToEggAni.ts
+2
-1
RockAni.ts
egret/src/something/anis/RockAni.ts
+2
-1
ChickenEgg.ts
egret/src/something/class/ChickenEgg.ts
+3
-1
Element.ts
egret/src/something/class/Element.ts
+1
-1
ElementType.ts
egret/src/something/enum/ElementType.ts
+3
-1
FallELeType.ts
egret/src/something/enum/FallELeType.ts
+0
-13
No files found.
egret/src/mainScene/MainScene.ts
View file @
74a28db1
...
@@ -62,6 +62,7 @@ import { StateType } from '../something/enum/StateType';
...
@@ -62,6 +62,7 @@ import { StateType } from '../something/enum/StateType';
import
{
HairballBlackState
}
from
'../something/states/HairballBlackState'
;
import
{
HairballBlackState
}
from
'../something/states/HairballBlackState'
;
import
{
HairballGreyDisAni
}
from
'../something/anis/HairballGreyDisAni'
;
import
{
HairballGreyDisAni
}
from
'../something/anis/HairballGreyDisAni'
;
import
{
HairballBrownState
}
from
'../something/states/HairballBrownState'
;
import
{
HairballBrownState
}
from
'../something/states/HairballBrownState'
;
import
{
EleDownAni
}
from
'../something/anis/EleDownAni'
;
const
aniClass
=
{
const
aniClass
=
{
"BoomAni"
:
BoomAni
,
"BoomAni"
:
BoomAni
,
...
@@ -170,6 +171,14 @@ export default class MainScene extends Scene {
...
@@ -170,6 +171,14 @@ export default class MainScene extends Scene {
* 4表示都有,遍历两边,down比up小,从左先
* 4表示都有,遍历两边,down比up小,从左先
*/
*/
connectState
:
number
=
2
;
connectState
:
number
=
2
;
/**
* 应用棋盘大遮罩,还是单独对生成元素,连通元素用小方形遮罩
* 出于性能问题,用大遮罩,只遮一次,
* 但是如果出现连通口上格子的下排正下方格子不为空的情况,必须用小方形遮罩,否则元素穿帮
* 或者生成口上排正上方格子不为空时也
* 默认用大遮罩
*/
useSmallMask
:
boolean
=
false
;
//皮肤上的
//皮肤上的
public
starProgress
:
eui
.
Image
;
public
starProgress
:
eui
.
Image
;
public
scoreTxt
:
eui
.
Label
;
public
scoreTxt
:
eui
.
Label
;
...
@@ -245,15 +254,10 @@ export default class MainScene extends Scene {
...
@@ -245,15 +254,10 @@ export default class MainScene extends Scene {
NetManager
.
ins
.
showLog
(
getlogItem
(
10
))
NetManager
.
ins
.
showLog
(
getlogItem
(
10
))
NetManager
.
ins
.
showLog
(
getlogItem
(
13
))
NetManager
.
ins
.
showLog
(
getlogItem
(
13
))
//步数初始化
this
.
steps
=
this
.
chapterData
.
stepCount
;
//初始化目标信息
//初始化目标信息
this
.
initTarget
();
this
.
initTarget
();
//初始化回收口,如果是棒棒糖关卡,那么在地图底部增加棒棒糖洞,
//初始化回收口,如果是棒棒糖关卡,那么在地图底部增加棒棒糖洞,
用到map
this
.
initRecycle
();
this
.
initRecycle
();
//初始化格子
this
.
initLattices
();
//初始化元素
//初始化元素
this
.
initElement
();
this
.
initElement
();
//重置基础元素类型及特效
//重置基础元素类型及特效
...
@@ -271,7 +275,6 @@ export default class MainScene extends Scene {
...
@@ -271,7 +275,6 @@ export default class MainScene extends Scene {
this
.
addChild
(
this
[
"settingAll"
])
this
.
addChild
(
this
[
"settingAll"
])
//AiControl初始化,
//AiControl初始化,
AiControl
.
ins
.
init
(
this
.
lattices
);
AiControl
.
ins
.
init
(
this
.
lattices
);
//引导
//引导
this
.
initGuide
();
this
.
initGuide
();
}
}
...
@@ -312,31 +315,27 @@ export default class MainScene extends Scene {
...
@@ -312,31 +315,27 @@ export default class MainScene extends Scene {
this
.
stepNumber
.
x
=
123
;
this
.
stepNumber
.
x
=
123
;
this
.
stepNumber
.
y
=
97
;
this
.
stepNumber
.
y
=
97
;
this
.
addChild
(
this
.
stepNumber
);
this
.
addChild
(
this
.
stepNumber
);
//步数初始化
this
.
steps
=
this
.
chapterData
.
stepCount
;
//分数进度条,托管
//分数进度条,托管
this
.
scoreProgress
=
new
ScoreProgress
(
this
.
starProgress
,
this
.
scoreTxt
,
this
.
chapterData
.
starScores
);
this
.
scoreProgress
=
new
ScoreProgress
(
this
.
starProgress
,
this
.
scoreTxt
,
this
.
chapterData
.
starScores
);
this
.
scoreTxt
.
y
-=
2
;
this
.
scoreTxt
.
y
-=
2
;
//背景图生成
//地图生成
// var bg = drawBg(this.chapterData.map.paths, this.chapterData.map.lattices)
var
path
=
generateMapBg
(
this
.
chapterData
.
map
.
lattices
);
var
path
=
generateMapBg
(
this
.
chapterData
.
map
.
lattices
);
var
bg
=
drawBg
(
path
,
this
.
chapterData
.
map
.
lattices
)
var
bg
=
drawBg
(
path
,
this
.
chapterData
.
map
.
lattices
)
this
.
addChild
(
bg
);
this
.
addChild
(
bg
);
this
.
map
=
bg
;
this
.
map
=
bg
;
//选择框
//初始话地图格子数据,主要因为有冰块,要添加进map,还有要判断是否需要大遮罩,所以位置在这里
var
textureChoosed
:
egret
.
Texture
=
RES
.
getRes
(
"chooseRect_png"
)
this
.
initLattices
();
this
.
choosed
=
new
eui
.
Image
(
textureChoosed
);
this
.
choosed
.
x
=
-
textureChoosed
.
textureWidth
/
2
;
this
.
choosed
.
y
=
-
textureChoosed
.
textureHeight
/
2
;
//容器
//容器
this
.
elementContainer
=
new
egret
.
DisplayObjectContainer
();
this
.
elementContainer
=
new
egret
.
DisplayObjectContainer
();
this
.
addChild
(
this
.
elementContainer
);
this
.
addChild
(
this
.
elementContainer
);
//加遮罩
//加遮罩
// var mask = new egret.Shape();
if
(
!
this
.
useSmallMask
)
{
// mask.graphics.beginFill(0xffffff, 1);
var
mask
=
drawShape
(
path
);
// mask.graphics.drawRect(Tool.offsetX, Tool.offsetY, Tool.width * Tool.colNum, Tool.height * Tool.rowNum + 100);
this
.
elementContainer
.
mask
=
mask
;
// mask.graphics.endFill();
this
.
addChild
(
mask
)
// var mask = drawShape(path);
}
// this.elementContainer.mask = mask;
// this.addChild(mask)
//容器事件
//容器事件
this
.
elementContainer
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
mouseDownE
,
this
);
this
.
elementContainer
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
mouseDownE
,
this
);
this
.
elementContainer
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_MOVE
,
this
.
mouseMoveE
,
this
);
this
.
elementContainer
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_MOVE
,
this
.
mouseMoveE
,
this
);
...
@@ -366,11 +365,16 @@ export default class MainScene extends Scene {
...
@@ -366,11 +365,16 @@ export default class MainScene extends Scene {
this
[
arrObj
[
i
]].
count
=
nums
[
i
];
this
[
arrObj
[
i
]].
count
=
nums
[
i
];
this
.
addChild
(
this
[
arrObj
[
i
]])
this
.
addChild
(
this
[
arrObj
[
i
]])
}
}
//道具使用时蒙层
//选择框 无需加入场景
var
textureChoosed
:
egret
.
Texture
=
RES
.
getRes
(
"chooseRect_png"
)
this
.
choosed
=
new
eui
.
Image
(
textureChoosed
);
this
.
choosed
.
x
=
-
textureChoosed
.
textureWidth
/
2
;
this
.
choosed
.
y
=
-
textureChoosed
.
textureHeight
/
2
;
//道具使用时蒙层 无需加入场景
this
.
propGuide
=
new
PropGuide
();
this
.
propGuide
=
new
PropGuide
();
this
.
propGuide
.
touchEnabled
=
true
;
this
.
propGuide
.
touchEnabled
=
true
;
// this.addChild(this.propGuide);
// this.addChild(this.propGuide);
//bonusTime引导,备用的
//bonusTime引导,备用的
,无需加入场景
this
.
bonusTime
=
new
BonusTime
();
this
.
bonusTime
=
new
BonusTime
();
this
.
bonusTime
.
x
=
375
;
this
.
bonusTime
.
x
=
375
;
this
.
bonusTime
.
y
=
600
;
this
.
bonusTime
.
y
=
600
;
...
@@ -406,7 +410,7 @@ export default class MainScene extends Scene {
...
@@ -406,7 +410,7 @@ export default class MainScene extends Scene {
if
(
this
.
passElements
&&
this
.
passElements
[
ElementType
.
LOLLIPOP
])
{
if
(
this
.
passElements
&&
this
.
passElements
[
ElementType
.
LOLLIPOP
])
{
//初始化recycleIndexs,
//初始化recycleIndexs,
var
recycles
=
this
.
chapterData
.
map
.
recycles
;
var
recycles
=
this
.
chapterData
.
map
.
recycles
;
//如果没有就取最下层的
//如果没有就取最下层的
,用地图数据格子初始化
if
(
!
recycles
||
!
recycles
.
length
)
{
if
(
!
recycles
||
!
recycles
.
length
)
{
var
endRowNumHash
=
{},
endRowNum
:
number
=
0
;;
var
endRowNumHash
=
{},
endRowNum
:
number
=
0
;;
for
(
var
i
=
0
;
i
<
this
.
chapterData
.
map
.
lattices
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
chapterData
.
map
.
lattices
.
length
;
i
++
)
{
...
@@ -450,7 +454,7 @@ export default class MainScene extends Scene {
...
@@ -450,7 +454,7 @@ export default class MainScene extends Scene {
this
.
map
.
addChildAt
(
imgs
,
0
);
this
.
map
.
addChildAt
(
imgs
,
0
);
}
}
}
}
//初始化地图格子数据
//初始化地图格子数据
,包括生成口,联通口
initLattices
()
{
initLattices
()
{
var
latticesD
=
this
.
chapterData
.
map
.
lattices
;
var
latticesD
=
this
.
chapterData
.
map
.
lattices
;
//先格子
//先格子
...
@@ -478,8 +482,16 @@ export default class MainScene extends Scene {
...
@@ -478,8 +482,16 @@ export default class MainScene extends Scene {
ice
.
y
=
p
[
1
];
ice
.
y
=
p
[
1
];
}
}
}
}
//生成口数据
var
genLatDatas
=
this
.
chapterData
.
map
.
generateLats
||
[];
//设置生成口,
//设置生成口,
this
.
generateIndexs
=
Tool
.
setGenerateLats
(
this
.
lattices
,
this
.
chapterData
.
map
.
generateLats
||
[])
this
.
generateIndexs
=
Tool
.
setGenerateLats
(
this
.
lattices
,
genLatDatas
)
//判断生成口上排正上方格子是否存在
for
(
var
i
=
0
;
i
<
genLatDatas
.
length
;
i
++
)
{
var
genLatData
:
GenerateLatData
=
genLatDatas
[
i
]
var
index
=
genLatData
.
index
;
if
(
this
.
lattices
[
index
-
Tool
.
colNum
])
this
.
useSmallMask
=
true
;
}
var
downMax
:
number
=
0
;
var
downMax
:
number
=
0
;
var
upMax
:
number
=
0
;
var
upMax
:
number
=
0
;
...
@@ -488,6 +500,7 @@ export default class MainScene extends Scene {
...
@@ -488,6 +500,7 @@ export default class MainScene extends Scene {
//联通口
//联通口
var
connectedLats
=
this
.
chapterData
.
map
.
connectedLats
||
[];
var
connectedLats
=
this
.
chapterData
.
map
.
connectedLats
||
[];
for
(
var
i
=
0
;
i
<
connectedLats
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
connectedLats
.
length
;
i
++
)
{
//0是上格子,1是下格子
var
connectedLat
=
connectedLats
[
i
];
var
connectedLat
=
connectedLats
[
i
];
this
.
lattices
[
connectedLat
[
0
]].
down
=
connectedLat
[
1
];
this
.
lattices
[
connectedLat
[
0
]].
down
=
connectedLat
[
1
];
this
.
lattices
[
connectedLat
[
1
]].
up
=
connectedLat
[
0
];
this
.
lattices
[
connectedLat
[
1
]].
up
=
connectedLat
[
0
];
...
@@ -496,12 +509,10 @@ export default class MainScene extends Scene {
...
@@ -496,12 +509,10 @@ export default class MainScene extends Scene {
var
colDown
=
Tool
.
indexToRc
(
connectedLat
[
1
])[
1
];
var
colDown
=
Tool
.
indexToRc
(
connectedLat
[
1
])[
1
];
downMax
=
Math
.
max
(
downMax
,
colDown
);
downMax
=
Math
.
max
(
downMax
,
colDown
);
upMax
=
Math
.
max
(
upMax
,
colUp
);
upMax
=
Math
.
max
(
upMax
,
colUp
);
if
(
colUp
>
colDown
)
{
if
(
colUp
>
colDown
)
hasBigToSmall
=
true
;
hasBigToSmall
=
true
;
else
if
(
colUp
<
colDown
)
hasSmallToBig
=
true
;
}
//连通口上格子的下排正下方格子是否存在
else
if
(
colUp
<
colDown
)
{
if
(
this
.
lattices
[
connectedLat
[
0
]
+
Tool
.
colNum
])
this
.
useSmallMask
=
true
;
hasSmallToBig
=
true
;
}
}
}
//1表示存在小列连通到大列,从右往左遍历
//1表示存在小列连通到大列,从右往左遍历
//2表示存在大列连通到小烈,从左往右遍历
//2表示存在大列连通到小烈,从左往右遍历
...
@@ -519,8 +530,7 @@ export default class MainScene extends Scene {
...
@@ -519,8 +530,7 @@ export default class MainScene extends Scene {
}
}
else
if
(
hasSmallToBig
)
{
else
if
(
hasSmallToBig
)
{
this
.
connectState
=
1
;
this
.
connectState
=
1
;
}
}
//否则默认的2
//否则默认的2
}
}
//初始化地图元素
//初始化地图元素
initElement
()
{
initElement
()
{
...
@@ -1064,8 +1074,6 @@ export default class MainScene extends Scene {
...
@@ -1064,8 +1074,6 @@ export default class MainScene extends Scene {
if
(
/*!this.fallVerMark ||*/
Tool
.
judgeOutOne
(
this
.
emptys
,
this
.
lattices
))
{
if
(
/*!this.fallVerMark ||*/
Tool
.
judgeOutOne
(
this
.
emptys
,
this
.
lattices
))
{
// this.fallVerMark = true;
// this.fallVerMark = true;
var
anis
=
this
.
fallVerticalEx
();
var
anis
=
this
.
fallVerticalEx
();
// anis = anis.concat(this.fallVerticalEx())
// anis = anis.concat(this.fallSkewEx())
if
(
!
anis
.
length
)
{
if
(
!
anis
.
length
)
{
anis
=
this
.
fallSkewEx
()
anis
=
this
.
fallSkewEx
()
if
(
!
anis
.
length
)
{
if
(
!
anis
.
length
)
{
...
@@ -1216,20 +1224,20 @@ export default class MainScene extends Scene {
...
@@ -1216,20 +1224,20 @@ export default class MainScene extends Scene {
}
}
}
}
}
}
//
if (this.connectState == 1) {
if
(
this
.
connectState
==
1
)
{
// for (var m = Tool.colNum; m >= 0; m++
)operation(m)
for
(
var
m
=
Tool
.
colNum
;
m
>=
0
;
m
--
)
operation
(
m
)
//
}
}
//
else if (this.connectState == 2) {
else
if
(
this
.
connectState
==
2
)
{
for
(
var
m
=
0
;
m
<
Tool
.
colNum
;
m
++
)
operation
(
m
)
for
(
var
m
=
0
;
m
<
Tool
.
colNum
;
m
++
)
operation
(
m
)
//
}
}
//
else if (this.connectState == 3) {
else
if
(
this
.
connectState
==
3
)
{
// for (var m = Tool.colNum; m >= 0; m++
) operation(m);
for
(
var
m
=
Tool
.
colNum
;
m
>=
0
;
m
--
)
operation
(
m
);
//
for (var m = 0; m < Tool.colNum; m++) operation(m);
for
(
var
m
=
0
;
m
<
Tool
.
colNum
;
m
++
)
operation
(
m
);
//
}
}
//
else if (this.connectState == 4) {
else
if
(
this
.
connectState
==
4
)
{
//
for (var m = 0; m < Tool.colNum; m++) operation(m);
for
(
var
m
=
0
;
m
<
Tool
.
colNum
;
m
++
)
operation
(
m
);
// for (var m = Tool.colNum; m >= 0; m++
) operation(m);
for
(
var
m
=
Tool
.
colNum
;
m
>=
0
;
m
--
)
operation
(
m
);
//
}
}
return
anis
;
return
anis
;
}
}
...
@@ -1331,7 +1339,7 @@ export default class MainScene extends Scene {
...
@@ -1331,7 +1339,7 @@ export default class MainScene extends Scene {
//是竖直的。播放声音
//是竖直的。播放声音
if
(
isVertical
)
{
if
(
isVertical
)
{
playSound
(
SoundType
.
fall
);
playSound
(
SoundType
.
fall
);
deltaTime
=
Tool
.
latDeltaTime
*
2
/
3
;
deltaTime
=
Tool
.
latDeltaTime
*
2
/
3
;
//加系数有问题,包括wait
}
}
let
count
=
0
;
let
count
=
0
;
let
countAll
=
anis
.
length
;
let
countAll
=
anis
.
length
;
...
@@ -1355,25 +1363,26 @@ export default class MainScene extends Scene {
...
@@ -1355,25 +1363,26 @@ export default class MainScene extends Scene {
let
fp
=
Tool
.
getPositionByIndex
(
firstIndex
.
index
);
let
fp
=
Tool
.
getPositionByIndex
(
firstIndex
.
index
);
ele
.
x
=
fp
[
0
];
ele
.
x
=
fp
[
0
];
ele
.
y
=
fp
[
1
]
-
Tool
.
height
;
ele
.
y
=
fp
[
1
]
-
Tool
.
height
;
//加遮罩
let
mask
=
Tool
.
getRectMask
();
mask
.
x
=
fp
[
0
];
mask
.
y
=
fp
[
1
];
this
.
elementContainer
.
addChild
(
mask
);
ele
.
mask
=
mask
;
tween
=
egret
.
Tween
.
get
(
ele
);
tween
=
egret
.
Tween
.
get
(
ele
);
//有等待的话
//有等待的话,只有多格子掉落的时候才有
if
(
wait
)
{
if
(
wait
)
tween
.
wait
(
wait
);
// console.log(wait)
//加遮罩,需要遮罩写法,
tween
.
wait
(
wait
);
if
(
this
.
useSmallMask
)
{
let
mask
=
Tool
.
getRectMask
();
mask
.
x
=
fp
[
0
];
mask
.
y
=
fp
[
1
];
this
.
elementContainer
.
addChild
(
mask
);
ele
.
mask
=
mask
;
tween
.
to
({
x
:
fp
[
0
],
y
:
fp
[
1
]
},
deltaTime
)
.
call
(()
=>
{
//移除遮罩
ele
.
mask
=
null
;
//回收
mask
.
recover
()
})
}
else
{
tween
.
to
({
x
:
fp
[
0
],
y
:
fp
[
1
]
},
deltaTime
)
}
}
tween
.
to
({
x
:
fp
[
0
],
y
:
fp
[
1
]
},
deltaTime
)
.
call
(()
=>
{
//移除遮罩
ele
.
mask
=
null
;
//回收
mask
.
recover
()
})
wait
+=
deltaTime
wait
+=
deltaTime
}
else
{
}
else
{
oriRow
=
ele
.
row
;
oriRow
=
ele
.
row
;
...
@@ -1391,22 +1400,24 @@ export default class MainScene extends Scene {
...
@@ -1391,22 +1400,24 @@ export default class MainScene extends Scene {
let
indexUp
=
this
.
lattices
[
index
].
up
;
let
indexUp
=
this
.
lattices
[
index
].
up
;
let
downPos
=
Tool
.
getPositionByIndex
(
index
);
let
downPos
=
Tool
.
getPositionByIndex
(
index
);
let
upPos
=
Tool
.
getPositionByIndex
(
indexUp
);
let
upPos
=
Tool
.
getPositionByIndex
(
indexUp
);
//加遮罩
//用遮罩的写法
// let mask11 = Tool.getRectMask();
if
(
this
.
useSmallMask
)
{
// mask11.x = indexUp[0];
//up处的动画
// mask11.y = indexUp[1];
EleMaskAni
(
ele
,
upPos
,
wait
,
this
.
elementContainer
,
true
,
deltaTime
);
// ele.mask = mask11;
tween
.
set
({
alpha
:
0
})
// this.elementContainer.addChild(mask11);
.
wait
(
deltaTime
)
EleMaskAni
(
ele
,
upPos
,
wait
,
this
.
elementContainer
,
true
);
.
set
({
alpha
:
1
})
tween
.
set
({
alpha
:
0
})
//down位置处的动画
.
wait
(
deltaTime
)
EleMaskAni
(
ele
,
downPos
,
wait
,
this
.
elementContainer
,
false
,
deltaTime
);
.
set
({
alpha
:
1
})
}
else
{
//down位置处的动画
tween
.
to
({
x
:
upPos
[
0
],
y
:
upPos
[
1
]
+
Tool
.
height
},
deltaTime
);
EleMaskAni
(
ele
,
downPos
,
wait
,
this
.
elementContainer
);
EleDownAni
(
ele
,
downPos
,
wait
,
this
.
elementContainer
,
false
,
deltaTime
)
}
//修改oriRow
//修改oriRow
oriRow
=
Tool
.
indexToRc
(
index
)[
0
];
oriRow
=
Tool
.
indexToRc
(
index
)[
0
];
lastX
=
downPos
[
0
];
lastX
=
downPos
[
0
];
lastY
=
downPos
[
1
];
lastY
=
downPos
[
1
];
wait
+=
deltaTime
;
}
else
{
}
else
{
//算间隔
//算间隔
var
delta
=
Tool
.
indexToRc
(
index
)[
0
]
-
oriRow
;
var
delta
=
Tool
.
indexToRc
(
index
)[
0
]
-
oriRow
;
...
...
egret/src/something/Tool.ts
View file @
74a28db1
...
@@ -14,9 +14,16 @@ import { StateType } from "./enum/StateType";
...
@@ -14,9 +14,16 @@ import { StateType } from "./enum/StateType";
export
class
Tool
{
export
class
Tool
{
/**
/**
* 每格掉落时间
* 每格掉落时间
* 掉落速度这个定
*/
public
static
latDeltaTime
:
number
=
90
;
/**
* 总行数
*/
*/
public
static
latDeltaTime
=
90
;
public
static
rowNum
=
9
;
public
static
rowNum
=
9
;
/**
* 总列数
*/
public
static
colNum
=
9
;
public
static
colNum
=
9
;
/**
/**
* 格子宽度
* 格子宽度
...
...
egret/src/something/anis/EleDownAni.ts
0 → 100644
View file @
74a28db1
import
{
Tool
}
from
"../Tool"
;
import
{
ElementType
}
from
"../enum/ElementType"
;
import
{
EffectType
}
from
"../enum/EffectType"
;
import
{
Element
}
from
"../class/Element"
;
import
{
Pool
}
from
"../Pool"
;
import
{
RecoverName
}
from
"../enum/RecoverName"
;
/**
* 元素向下的动画
* 没有遮罩
* @param eleC
* @param p
* @param con
* @param callback
*/
export
function
EleDownAni
(
eleC
:
Element
,
p
:
number
[],
wait
:
number
,
con
:
egret
.
DisplayObjectContainer
,
isUp
:
boolean
=
false
,
deltaTime
:
number
,
callback
?:
Function
)
{
let
ele
=
Tool
.
getElement
(
eleC
.
type
);
ele
.
effectType
=
eleC
.
effectType
;
ele
.
x
=
p
[
0
];
ele
.
y
=
p
[
1
]
-
Tool
.
height
*
(
isUp
?
0
:
1
);
egret
.
Tween
.
get
(
ele
)
.
wait
(
wait
)
.
call
(()
=>
{
con
.
addChild
(
ele
);
})
.
to
({
x
:
p
[
0
],
y
:
p
[
1
]
+
Tool
.
height
*
(
isUp
?
1
:
0
)
},
deltaTime
)
.
call
(()
=>
{
//回收元素
con
.
removeChild
(
ele
);
Pool
.
recover
(
RecoverName
.
ELEMENT
,
ele
);
//回调
callback
&&
callback
();
})
}
\ No newline at end of file
egret/src/something/anis/EleMaskAni.ts
View file @
74a28db1
...
@@ -18,6 +18,7 @@ export function EleMaskAni(
...
@@ -18,6 +18,7 @@ export function EleMaskAni(
wait
:
number
,
wait
:
number
,
con
:
egret
.
DisplayObjectContainer
,
con
:
egret
.
DisplayObjectContainer
,
isUp
:
boolean
=
false
,
isUp
:
boolean
=
false
,
deltaTime
:
number
,
callback
?:
Function
callback
?:
Function
)
{
)
{
let
ele
=
Tool
.
getElement
(
eleC
.
type
);
let
ele
=
Tool
.
getElement
(
eleC
.
type
);
...
@@ -37,7 +38,7 @@ export function EleMaskAni(
...
@@ -37,7 +38,7 @@ export function EleMaskAni(
.
call
(()
=>
{
.
call
(()
=>
{
con
.
addChild
(
ele
);
con
.
addChild
(
ele
);
})
})
.
to
({
x
:
p
[
0
],
y
:
p
[
1
]
+
Tool
.
height
*
(
isUp
?
1
:
0
)
},
Tool
.
latD
eltaTime
)
.
to
({
x
:
p
[
0
],
y
:
p
[
1
]
+
Tool
.
height
*
(
isUp
?
1
:
0
)
},
d
eltaTime
)
.
call
(()
=>
{
.
call
(()
=>
{
//回收元素
//回收元素
con
.
removeChild
(
ele
);
con
.
removeChild
(
ele
);
...
...
egret/src/something/anis/IceAni.ts
View file @
74a28db1
import
{
Ani
}
from
"../class/Ani"
;
import
{
Ani
}
from
"../class/Ani"
;
import
{
ImageAni
}
from
"../class/ImageAni"
;
import
{
ImageAni
}
from
"../class/ImageAni"
;
import
{
ElementType
}
from
"../enum/ElementType"
;
//原点已是中心
//原点已是中心
export
class
IceAni
extends
Ani
{
export
class
IceAni
extends
Ani
{
...
@@ -10,7 +11,7 @@ export class IceAni extends Ani {
...
@@ -10,7 +11,7 @@ export class IceAni extends Ani {
constructor
()
{
constructor
()
{
super
();
super
();
this
.
aniName
=
"IceAni"
;
this
.
aniName
=
"IceAni"
;
this
.
showImage
=
new
ImageAni
([
"ele
7
_png"
,
"ice2_png"
,
"ice3_png"
,
"ice4_png"
,
"ice5_png"
,
"ice6_png"
]);
this
.
showImage
=
new
ImageAni
([
"ele
"
+
ElementType
.
ICE
+
"
_png"
,
"ice2_png"
,
"ice3_png"
,
"ice4_png"
,
"ice5_png"
,
"ice6_png"
]);
this
.
addChild
(
this
.
showImage
)
this
.
addChild
(
this
.
showImage
)
}
}
...
...
egret/src/something/anis/PieceToEggAni.ts
View file @
74a28db1
...
@@ -3,6 +3,7 @@ import { Pool } from "../Pool";
...
@@ -3,6 +3,7 @@ import { Pool } from "../Pool";
import
{
RecoverName
}
from
"../enum/RecoverName"
;
import
{
RecoverName
}
from
"../enum/RecoverName"
;
import
{
playSound
,
SoundType
}
from
"../../soundCtrl"
;
import
{
playSound
,
SoundType
}
from
"../../soundCtrl"
;
import
{
Tool
}
from
"../Tool"
;
import
{
Tool
}
from
"../Tool"
;
import
{
ElementType
}
from
"../enum/ElementType"
;
const
offsetX
=
91
/
2
;
const
offsetX
=
91
/
2
;
const
offsetY
=
62
/
2
;
const
offsetY
=
62
/
2
;
...
@@ -20,7 +21,7 @@ export class PieceToEggAni extends egret.DisplayObjectContainer {
...
@@ -20,7 +21,7 @@ export class PieceToEggAni extends egret.DisplayObjectContainer {
eggPiece5
:
egret
.
Bitmap
;
eggPiece5
:
egret
.
Bitmap
;
constructor
()
{
constructor
()
{
super
()
super
()
var
arr
=
[
"ele
9
_png"
,
"eggPiece1_png"
,
"eggPiece2_png"
,
"eggPiece3_png"
,
"eggPiece4_png"
,
"eggPiece5_png"
];
var
arr
=
[
"ele
"
+
ElementType
.
CHICKEN_EGG
+
"
_png"
,
"eggPiece1_png"
,
"eggPiece2_png"
,
"eggPiece3_png"
,
"eggPiece4_png"
,
"eggPiece5_png"
];
var
objs
=
[
"showImage"
,
"eggPiece1"
,
"eggPiece2"
,
"eggPiece3"
,
"eggPiece4"
,
"eggPiece5"
];
var
objs
=
[
"showImage"
,
"eggPiece1"
,
"eggPiece2"
,
"eggPiece3"
,
"eggPiece4"
,
"eggPiece5"
];
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
...
...
egret/src/something/anis/RockAni.ts
View file @
74a28db1
import
{
Ani
}
from
"../class/Ani"
;
import
{
Ani
}
from
"../class/Ani"
;
import
{
ImageAni
}
from
"../class/ImageAni"
;
import
{
ImageAni
}
from
"../class/ImageAni"
;
import
{
ElementType
}
from
"../enum/ElementType"
;
//原点已是中心
//原点已是中心
export
class
RockAni
extends
Ani
{
export
class
RockAni
extends
Ani
{
...
@@ -10,7 +11,7 @@ export class RockAni extends Ani {
...
@@ -10,7 +11,7 @@ export class RockAni extends Ani {
constructor
()
{
constructor
()
{
super
();
super
();
this
.
aniName
=
"RockAni"
;
this
.
aniName
=
"RockAni"
;
this
.
showImage
=
new
ImageAni
([
"ele
5
_png"
,
"rock2_png"
,
"rock3_png"
,
"rock4_png"
,
"rock5_png"
,
"rock6_png"
]);
this
.
showImage
=
new
ImageAni
([
"ele
"
+
ElementType
.
ROCK
+
"
_png"
,
"rock2_png"
,
"rock3_png"
,
"rock4_png"
,
"rock5_png"
,
"rock6_png"
]);
this
.
addChild
(
this
.
showImage
)
this
.
addChild
(
this
.
showImage
)
}
}
...
...
egret/src/something/class/ChickenEgg.ts
View file @
74a28db1
import
{
ElementType
}
from
"../enum/ElementType"
;
//四种状态的图片
//四种状态的图片
const
images
=
{
const
images
=
{
3
:
"ele
9
_png"
,
3
:
"ele
"
+
ElementType
.
CHICKEN_EGG
+
"
_png"
,
2
:
"eggStatus2_png"
,
2
:
"eggStatus2_png"
,
1
:
"eggStatus1_png"
,
1
:
"eggStatus1_png"
,
0
:
"eggStatus0_png"
0
:
"eggStatus0_png"
...
...
egret/src/something/class/Element.ts
View file @
74a28db1
...
@@ -161,7 +161,7 @@ export class Element extends eui.Component {
...
@@ -161,7 +161,7 @@ export class Element extends eui.Component {
this
.
showImage
.
y
=
-
texture
.
textureHeight
/
2
;
this
.
showImage
.
y
=
-
texture
.
textureHeight
/
2
;
//特殊逻辑,因为魔力鸟动效要旋转,所以隐藏原图showImage,还有鸡蛋
//特殊逻辑,因为魔力鸟动效要旋转,所以隐藏原图showImage,还有鸡蛋
if
(
source
==
"magicLion_png"
||
source
==
"ele
9
_png"
)
{
if
(
source
==
"magicLion_png"
||
source
==
"ele
"
+
ElementType
.
CHICKEN_EGG
+
"
_png"
)
{
this
.
showImage
.
alpha
=
0
;
this
.
showImage
.
alpha
=
0
;
}
else
{
}
else
{
this
.
showImage
.
alpha
=
1
;
this
.
showImage
.
alpha
=
1
;
...
...
egret/src/something/enum/ElementType.ts
View file @
74a28db1
...
@@ -54,7 +54,8 @@ export const submitTran = {
...
@@ -54,7 +54,8 @@ export const submitTran = {
4
:
8
,
4
:
8
,
5
:
9
,
5
:
9
,
6
:
3
,
6
:
3
,
7
:
2
,
9
:
2
,
10
:
10
}
}
// SCORE(1, "分数"),
// SCORE(1, "分数"),
...
@@ -66,3 +67,4 @@ export const submitTran = {
...
@@ -66,3 +67,4 @@ export const submitTran = {
// LION(7, "狮子"),
// LION(7, "狮子"),
// PIG(8, "猪"),
// PIG(8, "猪"),
// STONE(9, "石头")
// STONE(9, "石头")
// GREYBALL(10, "灰色")
egret/src/something/enum/FallELeType.ts
deleted
100644 → 0
View file @
7ed69a67
/**
* 掉落元素类型
* 没用了
*/
export
enum
FallEleType
{
RANELE
=
0
,
//随机元素无特效
RANEFF
,
//随机元素加随机特效
RABBIT
,
//兔子 下面的顺序和ElementType前5保持一致,不要随便修改
CHICKEN
,
//鸡
CATTLE
,
//牛
LION
,
//狮子
PIG
,
//猪
}
\ 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