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
1b766b54
Commit
1b766b54
authored
Oct 21, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
e56185c5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
14 deletions
+87
-14
MainScene.ts
egret/src/mainScene/MainScene.ts
+37
-9
Tool.ts
egret/src/something/Tool.ts
+21
-2
Element.ts
egret/src/something/class/Element.ts
+6
-2
ElementType.ts
egret/src/something/enum/ElementType.ts
+11
-0
MapData.ts
egret/src/something/interface/MapData.ts
+12
-1
No files found.
egret/src/mainScene/MainScene.ts
View file @
1b766b54
...
@@ -273,6 +273,17 @@ export default class MainScene extends Scene {
...
@@ -273,6 +273,17 @@ export default class MainScene extends Scene {
this
.
initLattices
();
this
.
initLattices
();
//初始化元素
//初始化元素
this
.
initElement
();
this
.
initElement
();
//重置基础元素类型及特效
this
.
initBaseElement
();
//初始化完先检测死图
this
.
warningCop
=
Tool
.
dieMapCheck
(
this
.
lattices
);
if
(
!
this
.
warningCop
)
{
//替换顺序
this
.
upsetElement
();
}
else
{
this
.
enableMouseEvt
(
true
);
}
//设置栏置顶
//设置栏置顶
this
.
addChild
(
this
[
"settingAll"
])
this
.
addChild
(
this
[
"settingAll"
])
//如果是棒棒糖关卡,那么在地图底部增加棒棒糖洞
//如果是棒棒糖关卡,那么在地图底部增加棒棒糖洞
...
@@ -505,6 +516,7 @@ export default class MainScene extends Scene {
...
@@ -505,6 +516,7 @@ export default class MainScene extends Scene {
}
}
}
}
initElement
()
{
initElement
()
{
//没有就根据地图格子随机元素
var
elements
=
this
.
chapterData
.
map
.
elements
||
Tool
.
setNumber01
(
this
.
chapterData
.
map
.
lattices
.
slice
());
var
elements
=
this
.
chapterData
.
map
.
elements
||
Tool
.
setNumber01
(
this
.
chapterData
.
map
.
lattices
.
slice
());
for
(
var
i
=
0
;
i
<
elements
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
elements
.
length
;
i
++
)
{
//如果对应格子为空,直接跳过,
//如果对应格子为空,直接跳过,
...
@@ -603,15 +615,31 @@ export default class MainScene extends Scene {
...
@@ -603,15 +615,31 @@ export default class MainScene extends Scene {
}
}
}
}
console
.
log
(
bbb
);
console
.
log
(
bbb
);
}
//初始化完先检测死图
//重置基础元素及特效类型
this
.
warningCop
=
Tool
.
dieMapCheck
(
this
.
lattices
);
initBaseElement
()
{
if
(
!
this
.
warningCop
)
{
var
elements
=
this
.
chapterData
.
map
.
baseElements
;
//替换顺序
if
(
!
elements
||
!
elements
.
length
)
return
;
this
.
upsetElement
();
for
(
var
i
=
0
;
i
<
elements
.
length
;
i
++
)
{
}
//不是基础元素,跳过,
else
{
if
(
!
Tool
.
judgeBaseEle
(
this
.
lattices
[
i
]))
continue
;
this
.
enableMouseEvt
(
true
);
//是0,跳过
if
(
!
elements
[
i
])
continue
//解析elements[i];
var
arr
:
number
[]
=
Tool
.
returnTO
(
elements
[
i
]);
//基础类型,没有就是null,有就-1,对ElementType对应
var
baseType
=
arr
[
1
]
?
arr
[
1
]
-
1
:
null
;
//不是基础类型,跳出
if
(
baseType
>
4
)
continue
;
let
ele
:
Element
=
this
.
lattices
[
i
].
element
;
if
(
baseType
!=
null
)
{
//重置类型
var
isLock
=
ele
.
isLock
;
ele
.
reset
(
baseType
);
ele
.
isLock
=
isLock
;
}
//特效类型
ele
.
effectType
=
arr
[
0
]
?
arr
[
0
]
-
1
:
null
;
}
}
}
}
...
...
egret/src/something/Tool.ts
View file @
1b766b54
...
@@ -264,6 +264,25 @@ export class Tool {
...
@@ -264,6 +264,25 @@ 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
{
return
true
}
}
/**
/**
* 判断元素是否可被手势选中和交换
* 判断元素是否可被手势选中和交换
* 主要点击元素判断使用
* 主要点击元素判断使用
...
@@ -490,7 +509,7 @@ export class Tool {
...
@@ -490,7 +509,7 @@ export class Tool {
if
(
judgeFall
(
up
)
&&
up
.
element
.
type
!=
ElementType
.
LOLLIPOP
)
return
[
effectElement
,
up
.
element
];
if
(
judgeFall
(
up
)
&&
up
.
element
.
type
!=
ElementType
.
LOLLIPOP
)
return
[
effectElement
,
up
.
element
];
//下格子
//下格子
var
down
=
lattices
[
effectElement
.
index
+
Tool
.
colNum
];
var
down
=
lattices
[
effectElement
.
index
+
Tool
.
colNum
];
if
(
judgeFall
(
down
)
&&
up
.
element
.
type
!=
ElementType
.
LOLLIPOP
)
return
[
effectElement
,
down
.
element
];
if
(
judgeFall
(
down
)
&&
down
.
element
.
type
!=
ElementType
.
LOLLIPOP
)
return
[
effectElement
,
down
.
element
];
//左格子
//左格子
var
col
=
Tool
.
indexToRc
(
effectElement
.
index
)[
1
];
//列数
var
col
=
Tool
.
indexToRc
(
effectElement
.
index
)[
1
];
//列数
if
(
col
!=
0
)
{
if
(
col
!=
0
)
{
...
@@ -863,7 +882,7 @@ export class Tool {
...
@@ -863,7 +882,7 @@ export class Tool {
}
}
return
shuffled
.
slice
(
min
);
return
shuffled
.
slice
(
min
);
}
}
public
static
getRandomArrayElementsEx
(
arr
:
any
[],
count
:
number
):
any
[]
{
public
static
getRandomArrayElementsEx
(
arr
:
any
[],
count
:
number
):
any
[]
{
//如果count大于等于数组长度,返回所有数组
//如果count大于等于数组长度,返回所有数组
if
(
arr
.
length
<=
count
)
return
arr
.
slice
();
if
(
arr
.
length
<=
count
)
return
arr
.
slice
();
if
(
count
<=
0
)
return
[];
if
(
count
<=
0
)
return
[];
...
...
egret/src/something/class/Element.ts
View file @
1b766b54
...
@@ -171,7 +171,7 @@ export class Element extends eui.Component {
...
@@ -171,7 +171,7 @@ export class Element extends eui.Component {
this
.
showImage
.
x
=
-
texture
.
textureWidth
/
2
;
this
.
showImage
.
x
=
-
texture
.
textureWidth
/
2
;
this
.
showImage
.
y
=
-
texture
.
textureHeight
/
2
;
this
.
showImage
.
y
=
-
texture
.
textureHeight
/
2
;
//特殊逻辑,因为魔力鸟动效要旋转,所以隐藏原图showImage
//特殊逻辑,因为魔力鸟动效要旋转,所以隐藏原图showImage
,还有鸡蛋
if
(
source
==
"magicLion_png"
||
source
==
"ele9_png"
)
{
if
(
source
==
"magicLion_png"
||
source
==
"ele9_png"
)
{
this
.
showImage
.
alpha
=
0
;
this
.
showImage
.
alpha
=
0
;
}
else
{
}
else
{
...
@@ -179,6 +179,10 @@ export class Element extends eui.Component {
...
@@ -179,6 +179,10 @@ export class Element extends eui.Component {
}
}
}
}
/**
* 会重置掉所有特效类型,枷锁,鸡蛋等
* @param type
*/
reset
(
type
:
ElementType
)
{
reset
(
type
:
ElementType
)
{
this
.
alpha
=
this
.
scaleX
=
this
.
scaleY
=
1
;
this
.
alpha
=
this
.
scaleX
=
this
.
scaleY
=
1
;
//类型重置,showImage修改
//类型重置,showImage修改
...
@@ -199,7 +203,7 @@ export class Element extends eui.Component {
...
@@ -199,7 +203,7 @@ export class Element extends eui.Component {
if
(
type
==
ElementType
.
CHICKEN_EGG
)
{
if
(
type
==
ElementType
.
CHICKEN_EGG
)
{
this
.
chickenEgg
=
this
.
chickenEgg
||
Pool
.
takeOut
(
RecoverName
.
CHICKEN_EGG
)
this
.
chickenEgg
=
this
.
chickenEgg
||
Pool
.
takeOut
(
RecoverName
.
CHICKEN_EGG
)
if
(
!
this
.
chickenEgg
)
{
if
(
!
this
.
chickenEgg
)
{
//新建
,里面是解锁的所有图片组
//新建
this
.
chickenEgg
=
new
ChickenEgg
();
this
.
chickenEgg
=
new
ChickenEgg
();
}
else
{
}
else
{
this
.
chickenEgg
.
reset
();
this
.
chickenEgg
.
reset
();
...
...
egret/src/something/enum/ElementType.ts
View file @
1b766b54
...
@@ -16,6 +16,17 @@ export enum ElementType {
...
@@ -16,6 +16,17 @@ export enum ElementType {
JELLY
,
//果冻8
JELLY
,
//果冻8
CHICKEN_EGG
,
//鸡蛋9
CHICKEN_EGG
,
//鸡蛋9
}
}
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
,
]
export
const
codeMsgs
=
{
export
const
codeMsgs
=
{
"E1002090011"
:
"用户关卡记录异常"
,
"E1002090011"
:
"用户关卡记录异常"
,
"E1002090012"
:
"暂不能挑战此关卡"
,
"E1002090012"
:
"暂不能挑战此关卡"
,
...
...
egret/src/something/interface/MapData.ts
View file @
1b766b54
...
@@ -34,7 +34,18 @@ export interface MapData {
...
@@ -34,7 +34,18 @@ export interface MapData {
* 5果冻
* 5果冻
* 6鸡蛋
* 6鸡蛋
*/
*/
elements
?:
number
[]
elements
?:
number
[];
/**
* 9*9的格子
* 十位是基础元素类型,对应数字减1就是基础元素类型
* 个位是特效类型(0表示无特效),对应数字减1就是特效类型
* 10
* 11
* 12
* 13
* 14
*/
baseElements
?:
number
[];
/**
/**
* 路径的索引
* 路径的索引
* 暂时不需要了
* 暂时不需要了
...
...
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