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
7f8e3a65
Commit
7f8e3a65
authored
Oct 23, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
02610ea8
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
507 additions
and
340 deletions
+507
-340
MainScene.ts
egret/src/mainScene/MainScene.ts
+217
-283
StartPanel.ts
egret/src/panels/StartPanel.ts
+6
-10
ChaptersOri.ts
egret/src/something/ChaptersOri.ts
+4
-17
Tool.ts
egret/src/something/Tool.ts
+50
-18
Chapter1.ts
egret/src/something/chapters/Chapter1.ts
+125
-0
Chapter2.ts
egret/src/something/chapters/Chapter2.ts
+38
-0
getChapter.ts
egret/src/something/chapters/getChapter.ts
+18
-0
FallELeType.ts
egret/src/something/enum/FallELeType.ts
+12
-0
GenerateLatData.ts
egret/src/something/interface/GenerateLatData.ts
+27
-0
MapData.ts
egret/src/something/interface/MapData.ts
+10
-12
No files found.
egret/src/mainScene/MainScene.ts
View file @
7f8e3a65
...
...
@@ -20,7 +20,6 @@ import { RockAni } from '../something/anis/RockAni';
import
{
ScoreAni
}
from
'../something/anis/ScoreAni'
;
import
{
ThreeCrossAni
}
from
'../something/anis/ThreeCrossAni'
;
import
{
VerticalAni
}
from
'../something/anis/VerticalAni'
;
import
{
Chapters
}
from
'../something/Chapters'
;
import
{
Element
}
from
'../something/class/Element'
;
import
{
Ice
}
from
'../something/class/Ice'
;
import
{
Lattice
}
from
'../something/class/Lattice'
;
...
...
@@ -59,12 +58,10 @@ import { JellyDisAni } from '../something/anis/JellyDisAni';
import
{
EggBrokenAni
}
from
'../something/anis/EggBrokenAni'
;
import
{
FallAniData
,
FallType
}
from
'../something/interface/FallAniData'
;
import
{
EleMaskAni
}
from
'../something/anis/EleMaskAni'
;
// tslint:disable: no-var-keyword
// tslint:disable: prefer-const
// tslint:disable: cyclomatic-complexity
// tslint:disable: prefer-for-of
// tslint:disable: only-arrow-functions
// tslint:disable: no-inferrable-types
import
{
getChapterData
}
from
'../something/chapters/getChapter'
;
import
{
GenerateLatData
}
from
'../something/interface/GenerateLatData'
;
import
{
FallEleType
}
from
'../something/enum/FallELeType'
;
const
aniClass
=
{
"BoomAni"
:
BoomAni
,
"IceAni"
:
IceAni
,
...
...
@@ -107,16 +104,16 @@ const movieClips: any = {}
export
default
class
MainScene
extends
Scene
{
get
skinKey
()
{
return
'Main2'
}
exposure
//关卡数据
chapterData
:
ChapterData
;
//关数
chapter
:
number
//所有的格子数组
lattices
:
Lattice
[];
//生成口
generateIndexs
:
number
[];
//
最后一行的行数
endRowNum
:
number
=
0
;
//生成口
,索引就是列数,元素式该列的生成口数据,能不止一个
generateIndexs
:
GenerateLatData
[]
[];
//
回收口的格子索引
recycleIndexs
:
number
[]
;
//元素的容器,为了移动事件简单
elementContainer
:
egret
.
DisplayObjectContainer
;
//选中框
...
...
@@ -133,7 +130,7 @@ export default class MainScene extends Scene {
isManual
:
boolean
;
//选中的元素
SELECTED
:
Element
;
//
暂时不
用
//
判断是否提示交换元素
用
enableTouch
:
boolean
;
//提示交换对象
warningCop
:
Element
[];
...
...
@@ -150,6 +147,7 @@ export default class MainScene extends Scene {
lollipopCount
:
number
=
0
;
//是否已通关
hasPassed
:
boolean
=
false
;
//是否结算时间
isCountingTime
:
boolean
=
false
;
//通关的目标元素的计数,下标和元素类型索引一致
passElements
:
number
[];
...
...
@@ -219,69 +217,30 @@ export default class MainScene extends Scene {
gameGuide
:
GameGuide
;
start
(
data
)
{
super
.
start
();
// var a={x:1}
// egret.Tween.get(a)
// .to({x:100},1000)
// .call(()=>{
// console.log(a.x)
// })
// .set({x:0})
// .call(()=>{
// console.log(a.x)
// })
//第几关
this
.
chapter
=
(
data
&&
data
.
chapter
)
?
data
.
chapter
:
1
;
// this.chapter = 24;
this
.
chapterTxt
.
text
=
"第"
+
this
.
chapter
+
"关"
;
//关卡数据
var
mapDataIndex
=
this
.
chapter
;
//56到70的话,中间36到50
if
(
this
.
chapter
>=
56
&&
this
.
chapter
<=
70
)
{
//循环36到50
mapDataIndex
=
this
.
chapter
-
20
}
this
.
chapterData
=
Chapters
[
mapDataIndex
];
this
.
chapterData
=
getChapterData
(
this
.
chapter
)
//初始化索引信息,暂时不做判断列数的奇偶,如需,要修改的地方再考虑,还有道具使用的蒙层是否要改
Tool
.
init
(
/*Tool.getColOddEven(this.chapterData.map.lattices)*/
);
this
.
initUi
();
this
.
initSvgas
();
//先禁掉事件
this
.
enableMouseEvt
(
false
);
//
this.initBuired()
//
三个曝光埋点
NetManager
.
ins
.
showLog
(
getlogItem
(
7
))
NetManager
.
ins
.
showLog
(
getlogItem
(
10
))
NetManager
.
ins
.
showLog
(
getlogItem
(
13
))
//步数初始化,1期定制,56到70的话
if
(
this
.
chapter
>=
56
&&
this
.
chapter
<=
70
)
{
this
.
steps
=
this
.
chapterData
.
stepCount
-
4
;
}
else
{
this
.
steps
=
this
.
chapterData
.
stepCount
;
}
//步数初始化
this
.
steps
=
this
.
chapterData
.
stepCount
;
//分数置0
this
.
score
=
0
;
//通关目标,如果通关目标是元素时,赋值this.passElements,否则
if
(
this
.
chapterData
.
passTarget
.
type
==
PassType
.
ELEMENT_TARGET
)
{
this
.
hasEliminatedElements
=
[];
this
.
passElements
=
[];
for
(
var
m
=
0
;
m
<
this
.
chapterData
.
passTarget
.
elements
.
length
;
m
++
)
{
var
element
:
ElementTargetData
=
this
.
chapterData
.
passTarget
.
elements
[
m
];
this
.
passElements
[
element
.
type
]
=
element
.
count
;
this
.
hasEliminatedElements
[
element
.
type
]
=
0
;
}
this
.
elementTargets
=
new
ElementTargets
(
this
.
passElements
);
this
.
elementTargets
.
x
=
375
;
this
.
elementTargets
.
y
=
155
;
this
.
addChild
(
this
.
elementTargets
);
this
.
targetScoreTxt
.
visible
=
false
;
}
else
{
this
.
passElements
=
null
;
this
.
targetScoreTxt
.
visible
=
true
;
this
.
targetScoreTxt
.
text
=
"目标分数:"
+
this
.
chapterData
.
passTarget
.
score
;
}
//初始化目标信息
this
.
initTarget
();
//初始化回收口,如果是棒棒糖关卡,那么在地图底部增加棒棒糖洞,
this
.
initRecycle
();
//初始化格子
this
.
initLattices
();
//初始化元素
...
...
@@ -299,83 +258,11 @@ export default class MainScene extends Scene {
}
//设置栏置顶
this
.
addChild
(
this
[
"settingAll"
])
//如果是棒棒糖关卡,那么在地图底部增加棒棒糖洞
if
(
this
.
chapterData
.
passTarget
.
type
==
PassType
.
ELEMENT_TARGET
)
{
const
elements
=
this
.
chapterData
.
passTarget
.
elements
;
if
(
elements
[
0
].
type
==
ElementType
.
LOLLIPOP
)
this
.
drawLollipopHole
();
}
//AiControl初始化,用于判断格子中是否有果冻,是否有鸡蛋,必须在初始化元素后执行
AiControl
.
ins
.
init
(
this
.
lattices
);
//游戏引导
const
gameGuideChapterNum
=
[
1
,
5
,
6
,
7
,
8
,
9
,
10
,
19
,
24
,
81
]
if
(
gameGuideChapterNum
.
indexOf
(
this
.
chapter
>>
0
)
>
-
1
)
{
if
(
!
readCache
(
getCacheKey
()
+
this
.
chapter
))
{
this
.
gameGuide
=
new
GameGuide
(
this
);
this
.
addChild
(
this
.
gameGuide
);
this
.
gameGuide
.
show
();
}
}
// 234是道具引导
else
if
(
this
.
chapter
==
2
||
this
.
chapter
==
3
||
this
.
chapter
==
4
)
{
if
(
!
readCache
(
getCacheKey
()
+
this
.
chapter
+
"prop"
))
{
this
.
enableMouseEvt
(
false
);
var
pgi
=
new
PropGuideInt
(
this
)
this
.
addChild
(
pgi
);
pgi
.
init
(
this
.
chapter
>>
0
)
this
.
lattices
[
41
].
element
.
effectType
=
EffectType
.
EXPLOSIVE
}
}
//开启事件,具体不应该放在这里,到时看
// this.enableMouseEvt(true);
//测试代码
var
fail
=
new
eui
.
Image
(
RES
.
getRes
(
"guideKnowBtn_png"
));
fail
.
x
=
10
;
fail
.
y
=
10
;
fail
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
function
()
{
playSound
(
SoundType
.
fail
);
PanelCtrl
.
instance
.
show
(
"failed"
,
{
level
:
this
.
chapter
});
},
this
)
// this.addChild(fail);
var
sucess
=
new
eui
.
Image
(
RES
.
getRes
(
"guideKnowBtn_png"
));
sucess
.
x
=
474
;
sucess
.
y
=
10
;
sucess
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
function
()
{
var
json
=
{};
json
[
1
]
=
99999
;
if
(
this
.
passElements
)
{
//i就是元素类型的索引
for
(
var
i
=
0
;
i
<
this
.
passElements
.
length
;
i
++
)
{
if
(
this
.
passElements
[
i
]
!=
undefined
)
{
json
[
submitTran
[
i
]]
=
999
}
}
}
this
.
submit
(
JSON
.
stringify
(
json
))
},
this
)
// this.addChild(sucess)
}
private
drawLollipopHole
()
{
const
texture
:
egret
.
Texture
=
RES
.
getRes
(
'main_mapbottom_png'
);
const
imgs
=
new
egret
.
DisplayObjectContainer
;
for
(
const
key
in
this
.
endRowNumHash
)
{
const
{
index
,
row
}
=
this
.
endRowNumHash
[
key
];
if
(
this
.
endRowNum
==
row
)
{
const
img
=
new
eui
.
Image
(
texture
);
const
[
x
,
y
]
=
Tool
.
getPositionByIndex
(
index
);
img
.
x
=
x
;
img
.
y
=
y
;
imgs
.
addChild
(
img
);
}
}
imgs
.
x
=
-
texture
.
textureWidth
/
2
;
imgs
.
y
=
Tool
.
height
/
2
-
10
;
imgs
.
cacheAsBitmap
=
true
;
this
.
map
.
addChildAt
(
imgs
,
0
);
//引导
this
.
initGuide
();
}
/**
* 加载所有用到的svga
...
...
@@ -468,34 +355,97 @@ export default class MainScene extends Scene {
this
[
arrObj
[
i
]].
count
=
nums
[
i
];
this
.
addChild
(
this
[
arrObj
[
i
]])
}
//道具使用
引导
//道具使用
时蒙层
this
.
propGuide
=
new
PropGuide
();
this
.
propGuide
.
touchEnabled
=
true
;
// this.addChild(this.propGuide);
//bonusTime引导
//bonusTime引导
,备用的
this
.
bonusTime
=
new
BonusTime
();
this
.
bonusTime
.
x
=
375
;
this
.
bonusTime
.
y
=
600
;
}
endRowNumHash
;
initTarget
()
{
//分数置0
this
.
score
=
0
;
//通关目标,如果通关目标是元素时,赋值this.passElements,否则
if
(
this
.
chapterData
.
passTarget
.
type
==
PassType
.
ELEMENT_TARGET
)
{
this
.
hasEliminatedElements
=
[];
this
.
passElements
=
[];
for
(
var
m
=
0
;
m
<
this
.
chapterData
.
passTarget
.
elements
.
length
;
m
++
)
{
var
element
:
ElementTargetData
=
this
.
chapterData
.
passTarget
.
elements
[
m
];
this
.
passElements
[
element
.
type
]
=
element
.
count
;
this
.
hasEliminatedElements
[
element
.
type
]
=
0
;
}
this
.
elementTargets
=
new
ElementTargets
(
this
.
passElements
);
this
.
elementTargets
.
x
=
375
;
this
.
elementTargets
.
y
=
155
;
this
.
addChild
(
this
.
elementTargets
);
this
.
targetScoreTxt
.
visible
=
false
;
}
else
{
this
.
passElements
=
null
;
this
.
targetScoreTxt
.
visible
=
true
;
this
.
targetScoreTxt
.
text
=
"目标分数:"
+
this
.
chapterData
.
passTarget
.
score
;
}
}
initRecycle
()
{
//以防万一,初始化下。不排除,目标元素不是棒棒糖的,但是元素里有棒棒糖的情况;
this
.
recycleIndexs
=
[];
//通关目标是消除元素,并且有棒棒糖
//不考虑0,初始的时候目标是0?
if
(
this
.
passElements
&&
this
.
passElements
[
ElementType
.
LOLLIPOP
])
{
//初始化recycleIndexs,
var
recycles
=
this
.
chapterData
.
map
.
recycles
;
//如果没有就取最下层的
if
(
!
recycles
||
!
recycles
.
length
)
{
var
endRowNumHash
=
{},
endRowNum
:
number
=
0
;;
for
(
var
i
=
0
;
i
<
this
.
chapterData
.
map
.
lattices
.
length
;
i
++
)
{
var
lat
=
this
.
chapterData
.
map
.
lattices
[
i
];
if
(
!
lat
[
i
])
continue
;
var
rc
=
Tool
.
indexToRc
(
i
);
const
[
row
,
col
]
=
rc
;
//不用考虑0
if
(
!
endRowNumHash
[
col
])
{
endRowNumHash
[
col
]
=
{
row
:
row
,
index
:
i
};
}
if
(
row
>
endRowNumHash
[
col
].
row
)
{
endRowNumHash
[
col
]
=
{
row
:
row
,
index
:
i
};
}
//取大行数
endRowNum
=
Math
.
max
(
rc
[
0
],
endRowNum
)
}
this
.
recycleIndexs
=
[];
for
(
const
key
in
endRowNumHash
)
{
const
{
index
,
row
}
=
endRowNumHash
[
key
];
if
(
endRowNum
==
row
)
this
.
recycleIndexs
.
push
(
index
)
}
}
//如果有数据,直接用数据,
else
{
this
.
recycleIndexs
=
recycles
.
slice
();
}
//画回收口
const
texture
:
egret
.
Texture
=
RES
.
getRes
(
'main_mapbottom_png'
);
const
imgs
=
new
egret
.
DisplayObjectContainer
;
for
(
var
m
=
0
;
m
<
this
.
recycleIndexs
.
length
;
m
++
)
{
var
p
=
Tool
.
getPositionByIndex
(
this
.
recycleIndexs
[
m
]);
const
img
=
new
eui
.
Image
(
texture
);
img
.
x
=
p
[
0
];
img
.
y
=
p
[
1
];
imgs
.
addChild
(
img
);
}
imgs
.
x
=
-
texture
.
textureWidth
/
2
;
imgs
.
y
=
Tool
.
height
/
2
-
10
;
imgs
.
cacheAsBitmap
=
true
;
this
.
map
.
addChildAt
(
imgs
,
0
);
}
}
//初始化地图格子数据
initLattices
()
{
this
.
endRowNumHash
=
{};
var
latticesD
=
this
.
chapterData
.
map
.
lattices
;
var
generateLats
=
this
.
chapterData
.
map
.
generateLats
;
//先格子
this
.
lattices
=
[];
for
(
var
i
=
0
;
i
<
latticesD
.
length
;
i
++
)
{
if
(
!
latticesD
[
i
])
continue
;
//记录最下一层的行数
var
rc
=
Tool
.
indexToRc
(
i
);
const
[
row
,
col
]
=
rc
;
if
(
this
.
endRowNumHash
[
col
]
==
null
)
{
this
.
endRowNumHash
[
col
]
=
{
row
:
row
,
index
:
i
};
}
if
(
row
>
this
.
endRowNumHash
[
col
].
row
)
{
this
.
endRowNumHash
[
col
]
=
{
row
:
row
,
index
:
i
};
}
this
.
endRowNum
=
rc
[
0
]
>
this
.
endRowNum
?
rc
[
0
]
:
this
.
endRowNum
;
this
.
lattices
[
i
]
=
Pool
.
takeOut
(
RecoverName
.
LATTICE
);
if
(
!
this
.
lattices
[
i
])
{
this
.
lattices
[
i
]
=
new
Lattice
(
i
);
...
...
@@ -517,9 +467,8 @@ export default class MainScene extends Scene {
ice
.
y
=
p
[
1
]
-
81
/
2
;
}
}
console
.
log
(
this
.
endRowNumHash
);
//设置生成口
this
.
generateIndexs
=
Tool
.
setGenerateLats
(
this
.
lattices
,
generateLats
)
//设置生成口,
this
.
generateIndexs
=
Tool
.
setGenerateLats
(
this
.
lattices
,
this
.
chapterData
.
map
.
generateLats
||
[])
//联通口
var
connectedLats
=
this
.
chapterData
.
map
.
connectedLats
||
[];
for
(
var
i
=
0
;
i
<
connectedLats
.
length
;
i
++
)
{
...
...
@@ -528,6 +477,7 @@ export default class MainScene extends Scene {
this
.
lattices
[
connectedLat
[
1
]].
up
=
connectedLat
[
0
];
}
}
//初始化地图元素
initElement
()
{
//没有就根据地图格子随机元素
var
elements
=
this
.
chapterData
.
map
.
elements
||
Tool
.
setNumber01
(
this
.
chapterData
.
map
.
lattices
.
slice
());
...
...
@@ -618,16 +568,17 @@ 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
);
//测试导出元素类型
// 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
()
{
...
...
@@ -655,6 +606,28 @@ export default class MainScene extends Scene {
ele
.
effectType
=
arr
[
0
]
?
arr
[
0
]
-
1
:
null
;
}
}
//初始化引导,游戏和道具
initGuide
()
{
//游戏引导
const
gameGuideChapterNum
=
[
1
,
5
,
6
,
7
,
8
,
9
,
10
,
19
,
24
,
81
]
if
(
gameGuideChapterNum
.
indexOf
(
this
.
chapter
>>
0
)
>
-
1
)
{
if
(
!
readCache
(
getCacheKey
()
+
this
.
chapter
))
{
this
.
gameGuide
=
new
GameGuide
(
this
);
this
.
addChild
(
this
.
gameGuide
);
this
.
gameGuide
.
show
();
}
}
// 234是道具引导
else
if
(
this
.
chapter
==
2
||
this
.
chapter
==
3
||
this
.
chapter
==
4
)
{
if
(
!
readCache
(
getCacheKey
()
+
this
.
chapter
+
"prop"
))
{
this
.
enableMouseEvt
(
false
);
var
pgi
=
new
PropGuideInt
(
this
)
this
.
addChild
(
pgi
);
pgi
.
init
(
this
.
chapter
>>
0
)
this
.
lattices
[
41
].
element
.
effectType
=
EffectType
.
EXPLOSIVE
}
}
}
/**
* 更新三个道具
...
...
@@ -667,17 +640,6 @@ export default class MainScene extends Scene {
}
}
// 初始化埋点信息
initBuired
()
{
const
dpm
=
Buried
.
connectDpm
(
110
,
1
,
1
);
const
dcm
=
Buried
.
connectDcm
(
202
,
0
,
0
);
this
.
exposure
=
Buried
.
createExposure
(
dpm
,
dcm
);
//发送曝光埋点
NetManager
.
ins
.
showLog
(
this
.
exposure
);
}
//侦听事件
initEvents
()
{
this
.
addEventListener
(
egret
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
);
...
...
@@ -997,7 +959,8 @@ export default class MainScene extends Scene {
var
aarr
=
[
s
,
o
]
for
(
var
i
=
0
;
i
<
aarr
.
length
;
i
++
)
{
var
ele
=
aarr
[
i
];
if
(
ele
.
type
==
ElementType
.
LOLLIPOP
&&
ele
.
row
==
this
.
endRowNum
)
{
//元素是棒棒糖,并且在回收口索引内
if
(
ele
.
type
==
ElementType
.
LOLLIPOP
&&
this
.
recycleIndexs
.
indexOf
(
ele
.
index
)
>
-
1
)
{
this
.
recoverEle
(
ele
.
index
);
this
.
lollipopCount
--
;
//通关目标还有棒棒糖,并且,图中不足,下次需要生成
...
...
@@ -1048,19 +1011,8 @@ export default class MainScene extends Scene {
fall
(
callback
:
Function
)
{
//去重一次
Tool
.
removeReapty
(
this
.
emptys
);
//注释里的备用
/*var anis = this.fallVertical();
anis = anis.concat(this.fallSkew());
if (!anis.length) {
//如果没有能掉落的就直接回调
callback();
} else {
//有就执行掉落动画
this.fallAni(anis, () => {
this.fall(callback)
})
}*/
//先判断,是否在生成口中有
//逻辑需要重新梳理
if
(
/*!this.fallVerMark ||*/
Tool
.
judgeOutOne
(
this
.
emptys
,
this
.
lattices
))
{
// this.fallVerMark = true;
var
anis
=
this
.
fallVerticalEx
();
...
...
@@ -1169,39 +1121,40 @@ export default class MainScene extends Scene {
}
}
//找m列的生成口
if
(
this
.
generateIndexs
[
m
]
!=
undefined
)
{
let
lat
=
this
.
lattices
[
this
.
generateIndexs
[
m
]];
let
index
=
this
.
generateIndexs
[
m
];
//如果有格子。无元素,是生成口,要补齐下面能掉落的
if
(
lat
&&
!
lat
.
element
&&
lat
.
isGenerate
)
{
//找出从生成口一直到能掉落的空格,两个
var
downIndex
=
index
;
var
type
:
FallType
=
FallType
.
STRIGHT
;
let
connects
:
{
index
:
number
,
type
:
FallType
}[]
=
[]
let
anisOther
:
FallAniData
[]
=
[]
while
(
this
.
emptys
.
indexOf
(
downIndex
)
>
-
1
)
{
connects
.
push
({
index
:
downIndex
,
type
:
type
,
})
anis
.
push
({
ele
:
null
,
indexs
:
connects
.
slice
()
});
Tool
.
removeEle
(
downIndex
,
this
.
emptys
)
if
(
this
.
lattices
[
downIndex
].
down
!=
null
)
{
downIndex
=
this
.
lattices
[
downIndex
].
down
;
type
=
FallType
.
THROUGH
}
else
{
downIndex
+=
Tool
.
colNum
;
type
=
FallType
.
STRIGHT
//找m列的生成口,可能有多个
if
(
this
.
generateIndexs
[
m
])
{
for
(
var
aaa
=
0
;
aaa
<
this
.
generateIndexs
[
m
].
length
;
aaa
++
)
{
let
index
=
this
.
generateIndexs
[
m
][
aaa
].
index
;
let
lat
=
this
.
lattices
[
index
];
//如果有格子。无元素,是生成口,要补齐下面能掉落的
if
(
lat
&&
!
lat
.
element
&&
lat
.
isGenerate
)
{
//找出从生成口一直到能掉落的空格,两个
let
downIndex
=
index
;
let
type
:
FallType
=
FallType
.
STRIGHT
;
let
connects
:
{
index
:
number
,
type
:
FallType
}[]
=
[]
let
anisOther
:
FallAniData
[]
=
[]
while
(
this
.
emptys
.
indexOf
(
downIndex
)
>
-
1
)
{
connects
.
push
({
index
:
downIndex
,
type
:
type
,
})
anis
.
push
({
ele
:
null
,
indexs
:
connects
.
slice
()
});
Tool
.
removeEle
(
downIndex
,
this
.
emptys
)
if
(
this
.
lattices
[
downIndex
].
down
!=
null
)
{
downIndex
=
this
.
lattices
[
downIndex
].
down
;
type
=
FallType
.
THROUGH
}
else
{
downIndex
+=
Tool
.
colNum
;
type
=
FallType
.
STRIGHT
}
}
let
len
=
anis
.
length
;
for
(
let
i
=
len
-
1
;
i
>=
len
-
connects
.
length
;
i
--
)
{
anis
[
i
].
wait
=
(
len
-
1
-
i
)
*
Tool
.
latDeltaTime
*
2
/
3
;
}
}
// var p = Tool.getPositionByIndex(index);
var
len
=
anis
.
length
;
//越前面的越上面,y越小
for
(
var
i
=
len
-
1
;
i
>=
len
-
connects
.
length
;
i
--
)
{
anis
[
i
].
wait
=
(
len
-
1
-
i
)
*
Tool
.
latDeltaTime
*
2
/
3
;
}
}
}
...
...
@@ -1292,62 +1245,6 @@ export default class MainScene extends Scene {
return
anis
}
/**
* 执行掉落动画
* @param anis 数组,0是元素,1是目标位置索引,2是掉落层数
* @param emptys
* @param callback
*/
fallAni
(
anis
:
any
[],
callback
:
Function
,
isVertical
:
boolean
=
false
)
{
var
deltaTime
=
100
;
if
(
isVertical
)
{
playSound
(
SoundType
.
fall
);
deltaTime
=
150
}
let
count
=
0
;
let
countAll
=
anis
.
length
;
for
(
let
i
=
0
;
i
<
anis
.
length
;
i
++
)
{
let
obj
:
Element
=
anis
[
i
][
0
];
let
index
=
anis
[
i
][
1
];
let
rowCount
=
anis
[
i
][
2
]
||
1
;
let
position
=
Tool
.
getPositionByIndex
(
index
);
if
(
!
obj
)
{
obj
=
this
.
createELement
()
//位置信息赋值
this
.
elementContainer
.
addChild
(
obj
);
obj
.
x
=
position
[
0
];
obj
.
y
=
position
[
1
]
-
Tool
.
height
*
rowCount
;
}
//现在得位置的赋值
var
lat
=
this
.
lattices
[
index
];
lat
.
element
=
obj
;
obj
.
fallAni
()
//执行Tween
egret
.
Tween
.
get
(
obj
)
.
to
({
x
:
position
[
0
],
y
:
position
[
1
]
},
deltaTime
*
rowCount
/*, egret.Ease.cubicOut*/
)
.
call
(()
=>
{
obj
.
x
=
position
[
0
];
obj
.
y
=
position
[
1
];
//查看每个掉落的obj是否有冰淇淋,并且index是底部的索引,如果是,掉落完后,该格置空,加入emptys,并且需要掉落冰淇淋判断
if
(
obj
.
type
==
ElementType
.
LOLLIPOP
&&
Tool
.
indexToRc
(
index
)[
0
]
==
this
.
endRowNum
)
{
this
.
recoverEle
(
index
);
this
.
lollipopCount
--
;
//通关目标还有棒棒糖,并且,图中不足,下次需要生成
if
(
this
.
passElements
&&
this
.
passElements
[
ElementType
.
LOLLIPOP
]
&&
this
.
lollipopCount
<
this
.
passElements
[
ElementType
.
LOLLIPOP
])
{
this
.
lollipopMark
=
true
}
}
count
++
;
if
(
count
==
countAll
)
{
callback
()
}
})
}
}
fallAniSuper
(
anis
:
FallAniData
[],
callback
:
Function
,
isVertical
:
boolean
=
false
)
{
let
deltaTime
=
Tool
.
latDeltaTime
;
//是竖直的。播放声音
...
...
@@ -1368,10 +1265,10 @@ export default class MainScene extends Scene {
let
endIndex
=
indexs
[
indexs
.
length
-
1
].
index
;
let
tween
:
egret
.
Tween
;
if
(
!
ele
)
{
ele
=
this
.
createELement
();
this
.
elementContainer
.
addChild
(
ele
);
//取出第一个索引
let
firstIndex
=
indexs
.
shift
()
ele
=
this
.
createELement
(
firstIndex
.
index
);
this
.
elementContainer
.
addChild
(
ele
);
oriRow
=
Tool
.
indexToRc
(
firstIndex
.
index
)[
0
];
let
fp
=
Tool
.
getPositionByIndex
(
firstIndex
.
index
);
ele
.
x
=
fp
[
0
];
...
...
@@ -1454,7 +1351,7 @@ export default class MainScene extends Scene {
let
endP
=
Tool
.
getPositionByIndex
(
endIndex
);
ele
.
x
=
endP
[
0
];
ele
.
y
=
endP
[
1
];
if
(
ele
.
type
==
ElementType
.
LOLLIPOP
&&
Tool
.
indexToRc
(
endIndex
)[
0
]
==
this
.
endRowNum
)
{
if
(
ele
.
type
==
ElementType
.
LOLLIPOP
&&
this
.
recycleIndexs
.
indexOf
(
endIndex
)
>
-
1
)
{
this
.
recoverEle
(
endIndex
);
this
.
lollipopCount
--
;
//通关目标还有棒棒糖,并且,图中不足,下次需要生成
...
...
@@ -1477,17 +1374,54 @@ export default class MainScene extends Scene {
* 创建一个掉落元素,
* 逻辑包括棒棒糖逻辑
* 定制掉落元素逻辑
* @param index 生成口索引。定制掉落口用,不存在则随机
*/
createELement
()
{
var
type
;
createELement
(
index
:
number
):
Element
{
var
type
:
ElementType
;
var
effectType
:
EffectType
=
null
;
//优先棒棒糖
if
(
this
.
lollipopMark
)
{
this
.
lollipopMark
=
false
;
type
=
ElementType
.
LOLLIPOP
;
this
.
lollipopCount
++
;
}
else
{
type
=
Tool
.
randomT
(
this
.
chapterData
.
baseElementTypes
)
}
return
Tool
.
getElement
(
type
);
//生成口定制掉落
else
{
//列数
var
col
=
Tool
.
indexToRc
(
index
)[
1
];
//找出索引是index的数据
var
data
:
GenerateLatData
=
this
.
generateIndexs
[
col
].
filter
((
d
)
=>
{
return
d
.
index
==
index
})[
0
];
if
(
data
)
{
//先去掉cus里的
let
one
=
data
.
cus
.
shift
()
if
(
one
)
{
var
oneData
=
Tool
.
praseEleNumber
(
one
);
type
=
oneData
[
0
]
===
null
?
Tool
.
randomT
(
this
.
chapterData
.
baseElementTypes
)
:
oneData
[
0
];
effectType
=
oneData
[
1
];
}
//否则根据type来定
else
{
if
(
data
.
type
==
FallEleType
.
RANELE
)
{
type
=
Tool
.
randomT
(
this
.
chapterData
.
baseElementTypes
)
}
else
if
(
data
.
type
==
FallEleType
.
RANEFF
)
{
type
=
Tool
.
randomT
(
this
.
chapterData
.
baseElementTypes
);
effectType
=
Tool
.
randomT
([
0
,
1
,
2
,
3
])
}
else
{
type
=
data
.
type
-
2
}
}
}
//随机
else
{
type
=
Tool
.
randomT
(
this
.
chapterData
.
baseElementTypes
)
}
}
let
ele
=
Tool
.
getElement
(
type
);
ele
.
effectType
=
effectType
;
return
ele
;
}
/**
...
...
egret/src/panels/StartPanel.ts
View file @
7f8e3a65
...
...
@@ -13,12 +13,12 @@ import { iswx } from "../iswx";
import
PropType
from
"../PropType"
;
import
setGlow
from
"../setGlow"
;
import
{
showShare
}
from
"../shareCtrl"
;
import
{
Chapters
}
from
"../something/Chapters"
;
import
{
ElementType
}
from
"../something/enum/ElementType"
;
import
{
PassType
}
from
"../something/enum/PassType"
;
import
TargetItemRenderer
from
"./TargetItemRenderer"
;
import
{
addRankFriendList
}
from
"../mapScene/RankFriendList"
;
import
{
addAdComp
}
from
"./BoxPanel"
;
import
{
getChapterData
}
from
"../something/chapters/getChapter"
;
export
default
class
StartPanel
extends
Panel
{
static
currlevel
;
...
...
@@ -39,28 +39,24 @@ export default class StartPanel extends Panel {
this
[
'levelTxt'
].
text
=
`第
${
data
}
关`
;
this
.
_level
=
data
;
let
mapDataIndex
=
data
;
if
(
data
>=
56
&&
data
<=
70
)
{
//循环36到50
mapDataIndex
=
data
-
20
}
this
[
'targetGroup'
].
visible
=
false
;
this
[
'scoreGroup'
].
visible
=
false
;
const
levelType
=
Chapters
[
mapDataIndex
]
.
passTarget
.
type
;
const
levelType
=
getChapterData
(
mapDataIndex
)
.
passTarget
.
type
;
if
(
levelType
==
PassType
.
ELEMENT_TARGET
)
{
this
[
'targetGroup'
].
visible
=
true
;
// this['targetTxt'].text = '在规定步数内\n消除足够数量目标';
this
.
list
.
itemRenderer
=
TargetItemRenderer
;
const
ac
=
new
eui
.
ArrayCollection
(
Chapters
[
mapDataIndex
]
.
passTarget
.
elements
);
const
ac
=
new
eui
.
ArrayCollection
(
getChapterData
(
mapDataIndex
)
.
passTarget
.
elements
);
this
.
list
.
dataProvider
=
ac
;
const
elements
=
Chapters
[
mapDataIndex
]
.
passTarget
.
elements
;
const
elements
=
getChapterData
(
mapDataIndex
)
.
passTarget
.
elements
;
if
(
elements
.
length
==
1
&&
elements
[
0
].
type
==
ElementType
.
LOLLIPOP
)
this
[
'tips'
].
text
=
'在指定步数内将目标元素移至最底部'
;
}
else
if
(
levelType
==
PassType
.
SCORE_TARGET
)
{
this
[
'scoreGroup'
].
visible
=
true
;
this
[
'targetScoreTxt'
].
text
=
`
${
Chapters
[
mapDataIndex
]
.
passTarget
.
score
}
`
;
// this['targetTxt'].text = `在规定步数内\n分数达到${
Chapters[mapDataIndex]
.passTarget.score}分`;
this
[
'targetScoreTxt'
].
text
=
`
${
getChapterData
(
mapDataIndex
)
.
passTarget
.
score
}
`
;
// this['targetTxt'].text = `在规定步数内\n分数达到${
getChapterData(mapDataIndex)
.passTarget.score}分`;
}
const
prop2Nums
=
getPropNums
(
PropType
.
BOOM
);
...
...
egret/src/something/Chapters.ts
→
egret/src/something/Chapters
Ori
.ts
View file @
7f8e3a65
...
...
@@ -8,9 +8,10 @@ import { ElementType } from "./enum/ElementType";
// const Vigenere = CipherJS.Vigenere;
// Vigenere.encrypt('MY SECRET MESSAGE', 'MY SECRET KEY')
export
const
Chapters
:
ChapterData
[]
=
[
/**
* 副本,备用120关数据
*/
export
const
ChaptersOri
:
any
[]
=
[
//第0关为空吧,
null
,
//第一关
...
...
@@ -28,20 +29,6 @@ export const Chapters: ChapterData[] = [
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
],
generateLats
:
[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
],
paths
:
[
{
indexs
:
[
"0_l_u"
,
"8_r_u"
,
"80_r_d"
,
"72_l_d"
,
"63_l_u"
,
"63_r_u"
,
"54_r_u"
,
"54_l_u"
],
holes
:
[
{
indexs
:
[
"50_l_u"
,
"50_l_d"
,
"50_r_d"
,
"50_r_u"
],
},
{
indexs
:
[
"48_l_u"
,
"48_l_d"
,
"48_r_d"
,
"48_r_u"
],
}
]
}
],
// connectedLats: [[27, 45], [28, 46], [29, 47]]
},
baseElementTypes
:
[
0
,
1
,
2
,
3
,
4
],
effectInitProbability
:
0.1
,
...
...
egret/src/something/Tool.ts
View file @
7f8e3a65
...
...
@@ -8,6 +8,7 @@ import { Pool } from "./Pool";
import
{
RecoverName
}
from
"./enum/RecoverName"
;
import
{
RectMask
}
from
"./class/RectMask"
;
import
{
FallType
}
from
"./interface/FallAniData"
;
import
{
GenerateLatData
}
from
"./interface/GenerateLatData"
;
export
class
Tool
{
/**
...
...
@@ -685,25 +686,39 @@ export class Tool {
/**
* 根据关卡的地图数据generateLats
*
设置每列最上面的格子为生成口,
*
* @param lattices
* @param generateLats
[0,1,1,1,1,1,1,1,0]
*
/
public
static
setGenerateLats
(
lattices
:
Lattice
[],
generateLats
:
number
[])
{
var
indexs
=
[]
for
(
var
m
=
0
;
m
<
Tool
.
colNum
;
m
++
)
{
//找每列第一个元素
for
(
var
g
=
0
;
g
<
Tool
.
rowNum
;
g
++
)
{
var
index
=
Tool
.
colNum
*
g
+
m
;
//如果格子存在,并且该列g的数据为1;
if
(
lattices
[
index
]
&&
generateLats
[
m
])
{
lattices
[
index
].
isGenerate
=
true
;
indexs
[
m
]
=
index
;
break
}
}
* @param generateLats
*
@return 数组,索引就是列数,每个元素是该列的生成口数据
*/
public
static
setGenerateLats
(
lattices
:
Lattice
[],
generateLats
:
GenerateLatData
[]):
GenerateLatData
[][]
{
var
arr
:
GenerateLatData
[][]
=
[];
for
(
var
i
=
0
;
i
<
generateLats
.
length
;
i
++
)
{
var
generateLat
:
GenerateLatData
=
generateLats
[
i
];
var
index
=
generateLat
.
index
;
if
(
!
lattices
[
index
])
continue
lattices
[
index
].
isGenerate
=
true
;
var
rc
=
this
.
indexToRc
(
index
)
;
//确实属于哪一列
var
col
=
rc
[
1
];
if
(
!
arr
[
col
])
arr
[
col
]
=
[];
arr
[
col
].
push
(
generateLat
);
}
return
indexs
return
arr
// var indexs = [];
// for (var m = 0; m < Tool.colNum; m++) {
// //找每列第一个元素
// for (var g = 0; g < Tool.rowNum; g++) {
// var index = Tool.colNum * g + m;
// //如果格子存在,并且该列g的数据为1;
// if (lattices[index] && generateLats[m]) {
// lattices[index].isGenerate = true;
// indexs[m] = index;
// break
// }
// }
// }
// return indexs
}
/**
* 将9*9都转化成01格子
...
...
@@ -821,6 +836,23 @@ export class Tool {
}
return
false
;
}
/**
* 十位是基础元素类型,对应数字减1就是基础元素类型
* 个位是特效类型(0表示无特效),对应数字减1就是特效类型
* @param num
* @return [] 0下标是元素类型,1下标是特效类型
*/
public
static
praseEleNumber
(
num
)
{
//解析num;
var
arr
:
number
[]
=
this
.
returnTO
(
num
);
//基础类型,没有就是null,有就-1,对ElementType对应
var
baseType
=
arr
[
1
]
?
arr
[
1
]
-
1
:
null
;
//不是基础类型
if
(
baseType
>
4
)
baseType
=
null
;
//特效类型
var
effectType
=
arr
[
0
]
?
arr
[
0
]
-
1
:
null
;
return
[
baseType
,
effectType
];
}
/**
* 从数组移除一个元素
...
...
@@ -879,7 +911,7 @@ export class Tool {
}
/**
* 返回个十百等,0是个位
* 返回个十百等,0是个位
,1是十位,依次
* 78[ 8, 7]
* 789[ 9, 8, 7]
* @param num 整数
...
...
egret/src/something/chapters/Chapter1.ts
0 → 100644
View file @
7f8e3a65
import
{
ChapterData
}
from
"../interface/ChapterData"
;
import
{
PassType
}
from
"../enum/PassType"
;
import
{
ElementType
}
from
"../enum/ElementType"
;
/**
* 1到20关数据
*/
export
const
Chapters1
:
ChapterData
[]
=
[
//第0关为空吧,
null
,
//1
{
baseElementTypes
:
[
0
,
1
,
2
,
3
],
effectInitProbability
:
0
,
stepCount
:
25
,
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
{
type
:
ElementType
.
CHICKEN
,
count
:
45
,
},
],
},
starScores
:
[
4000
,
8000
,
12000
],
map
:
{
lattices
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
],
generateLats
:
[
{
index
:
11
,
type
:
0
,
cus
:
[]
},
{
index
:
15
,
type
:
0
,
cus
:
[]
},
],
// connectedLats: [[0, 18], [1, 19], [2, 20]],
elements
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
],
baseElements
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
20
,
0
,
0
,
0
,
20
,
0
,
0
,
0
,
20
,
10
,
20
,
0
,
20
,
10
,
20
,
0
,
20
,
10
,
20
,
10
,
20
,
10
,
20
,
10
,
20
,
20
,
10
,
20
,
20
,
10
,
20
,
20
,
10
,
20
,
0
,
20
,
10
,
20
,
10
,
20
,
10
,
20
,
0
,
0
,
0
,
20
,
10
,
20
,
10
,
20
,
0
,
0
,
0
,
0
,
0
,
20
,
10
,
20
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
20
,
0
,
0
,
0
,
0
,
],
// recycles: [70, 71, 72, 73]
},
},
//2
{
baseElementTypes
:
[
0
,
1
,
2
,
3
],
effectInitProbability
:
0
,
stepCount
:
6
,
passTarget
:
{
type
:
PassType
.
ELEMENT_TARGET
,
elements
:
[
{
type
:
ElementType
.
ICE
,
count
:
26
,
},
],
},
starScores
:
[
4000
,
8000
,
12000
],
map
:
{
lattices
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
0
,
2
,
2
,
2
,
2
,
0
,
2
,
2
,
2
,
2
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
2
,
2
,
0
,
0
,
0
,
1
,
1
,
0
,
1
,
2
,
2
,
1
,
0
,
1
,
2
,
2
,
1
,
0
,
2
,
2
,
0
,
0
,
0
,
2
,
2
,
0
,
2
,
2
,
2
,
2
,
0
,
2
,
2
,
2
,
2
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
],
generateLats
:
[
// { index: 11, type: 0, cus: [] },
// { index: 15, type: 0, cus: [] },
],
// connectedLats: [[0, 18], [1, 19], [2, 20]],
elements
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
],
baseElements
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
10
,
10
,
0
,
0
,
0
,
10
,
20
,
0
,
20
,
20
,
10
,
20
,
0
,
10
,
20
,
10
,
20
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
40
,
30
,
0
,
0
,
0
,
10
,
30
,
0
,
10
,
30
,
40
,
20
,
0
,
20
,
30
,
40
,
10
,
0
,
40
,
30
,
0
,
0
,
0
,
40
,
30
,
0
,
20
,
20
,
10
,
10
,
0
,
20
,
40
,
20
,
10
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
],
// recycles: [70, 71, 72, 73]
},
},
]
\ No newline at end of file
egret/src/something/chapters/Chapter2.ts
0 → 100644
View file @
7f8e3a65
import
{
ChapterData
}
from
"../interface/ChapterData"
;
import
{
PassType
}
from
"../enum/PassType"
;
import
{
ElementType
}
from
"../enum/ElementType"
;
/**
* 21到40关数据
*/
export
const
Chapters2
:
ChapterData
[]
=
[
//21
{
map
:
{
lattices
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
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
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
],
// generateLats: ,
connectedLats
:
[],
elements
:
[
]
},
baseElementTypes
:
[
0
,
1
,
2
,
3
,
4
],
effectInitProbability
:
0.1
,
stepCount
:
30
,
passTarget
:
{
type
:
PassType
.
SCORE_TARGET
,
score
:
6000
,
},
starScores
:
[
2000
,
4000
,
6000
]
},
]
\ No newline at end of file
egret/src/something/chapters/getChapter.ts
0 → 100644
View file @
7f8e3a65
import
{
Chapters1
}
from
"./Chapter1"
;
import
{
Chapters2
}
from
"./Chapter2"
;
import
{
ChapterData
}
from
"../interface/ChapterData"
;
//所有的关卡
const
chapters
:
ChapterData
[]
=
[].
concat
(
Chapters1
,
// Chapters2,
)
/**
* 获取关卡数据,返回关卡数据
* 以后每添加20关,添加一个文件,上面concat一个文件
* @param index 关数 从1开始
*/
export
function
getChapterData
(
index
:
number
)
{
//没有数据就返回第一关数据
return
chapters
[
index
]
||
chapters
[
1
];
}
\ No newline at end of file
egret/src/something/enum/FallELeType.ts
0 → 100644
View file @
7f8e3a65
/**
* 掉落元素类型
*/
export
enum
FallEleType
{
RANELE
=
0
,
//随机元素无特效
RANEFF
,
//随机元素加随机特效
RABBIT
,
//兔子 下面的顺序和ElementType前5保持一致,不要随便修改
CHICKEN
,
//鸡
CATTLE
,
//牛
LION
,
//狮子
PIG
,
//猪
}
\ No newline at end of file
egret/src/something/interface/GenerateLatData.ts
0 → 100644
View file @
7f8e3a65
import
{
FallEleType
}
from
"../enum/FallELeType"
;
/**
* 格子生成口数据格式
*/
export
interface
GenerateLatData
{
/**
* 生成口的索引
*/
index
:
number
;
/**
* 掉落元素类型
*/
type
:
FallEleType
/**
* 自定义掉落元素
* 十位是基础元素类型,对应数字减1就是基础元素类型
* 个位是特效类型(0表示无特效),对应数字减1就是特效类型
* 10
* 11
* 12
* 13
* 14
*/
cus
:
number
[];
}
\ No newline at end of file
egret/src/something/interface/MapData.ts
View file @
7f8e3a65
import
{
PathData
}
from
"./Path
Data"
;
import
{
GenerateLatData
}
from
"./GenerateLat
Data"
;
/**
* 地图数据接口
...
...
@@ -17,11 +17,9 @@ export interface MapData {
lattices
:
number
[];
/**
* 能生成元素的格子索引
* 代表每列的第一个格子是否是生成口
* 长度9,
* 例子[0,0,0,1,1,1,0,0,0];
*
*/
generateLats
:
number
[];
generateLats
?:
GenerateLatData
[];
/**
* 一维格子数组,步长9,
* 9*9
...
...
@@ -34,7 +32,7 @@ export interface MapData {
* 5果冻
* 6鸡蛋
*/
elements
?:
number
[];
elements
?:
number
[];
/**
* 9*9的格子
* 十位是基础元素类型,对应数字减1就是基础元素类型
...
...
@@ -45,12 +43,7 @@ export interface MapData {
* 13
* 14
*/
baseElements
?:
number
[];
/**
* 路径的索引
* 暂时不需要了
*/
paths
?:
PathData
[]
baseElements
?:
number
[];
/**
* 再考虑
* 元素为两个索引的数组[8,9],第一个元素为up,第二个元素为down
...
...
@@ -58,4 +51,9 @@ export interface MapData {
*/
connectedLats
?:
any
[];
/**
* 棒棒糖回收口
*
*/
recycles
?:
number
[];
}
\ 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