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
7c9156b3
Commit
7c9156b3
authored
Nov 04, 2019
by
邱旭
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://gitlab2.dui88.com/wanghongyuan/xiaoxiaole
into dev
parents
e925be57
ac47af6a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
110 additions
and
33 deletions
+110
-33
propNum1.png
egret/resource/assets/mainScene/propNum1.png
+0
-0
propNum5.png
egret/resource/assets/mainScene/propNum5.png
+0
-0
propNum7.png
egret/resource/assets/mainScene/propNum7.png
+0
-0
MainScene.ts
egret/src/mainScene/MainScene.ts
+15
-4
Tool.ts
egret/src/something/Tool.ts
+25
-29
ChapterNum.ts
egret/src/something/uis/ChapterNum.ts
+70
-0
No files found.
egret/resource/assets/mainScene/propNum1.png
View replaced file @
e925be57
View file @
7c9156b3
14.3 KB
|
W:
|
H:
14.7 KB
|
W:
|
H:
2-up
Swipe
Onion skin
egret/resource/assets/mainScene/propNum5.png
View replaced file @
e925be57
View file @
7c9156b3
14.4 KB
|
W:
|
H:
14.9 KB
|
W:
|
H:
2-up
Swipe
Onion skin
egret/resource/assets/mainScene/propNum7.png
View replaced file @
e925be57
View file @
7c9156b3
14.4 KB
|
W:
|
H:
14.8 KB
|
W:
|
H:
2-up
Swipe
Onion skin
egret/src/mainScene/MainScene.ts
View file @
7c9156b3
...
...
@@ -63,6 +63,7 @@ import { HairballBrownState } from '../something/states/HairballBrownState';
import
{
EleDownAni
}
from
'../something/anis/EleDownAni'
;
import
{
GameGuide
}
from
'../something/uis/GameGuide'
;
import
{
PropBtnCon
}
from
'../something/uis/PropBtnCon'
;
import
{
ChapterNum
}
from
'../something/uis/ChapterNum'
;
const
aniClass
=
{
"BoomAni"
:
BoomAni
,
...
...
@@ -304,6 +305,12 @@ export default class MainScene extends Scene {
}
//初始化界面ui,,道具弄在这里s
initUi
()
{
//第几关
var
chapterTxt
=
new
ChapterNum
();
chapterTxt
.
num
=
this
.
chapter
>>
0
;
chapterTxt
.
x
=
122
;
chapterTxt
.
y
=
148
this
.
addChild
(
chapterTxt
)
//步数
this
.
stepNumber
=
new
StepNumber
();
this
.
stepNumber
.
x
=
123
;
...
...
@@ -1888,8 +1895,10 @@ export default class MainScene extends Scene {
this
.
magicRotateData
=
[
rotateData
];
for
(
var
i
=
0
;
i
<
this
.
lattices
.
length
;
i
++
)
{
var
lat
=
this
.
lattices
[
i
];
if
(
Tool
.
judgeMatch
(
lat
)
&&
lat
.
element
.
type
==
other
.
type
)
{
if
(
Tool
.
judgeBaseEle
(
lat
)
&&
//是基础元素
lat
.
element
.
effectType
!=
EffectType
.
MAGICLION
&&
//不能是魔力鸟特效
lat
.
element
.
type
==
other
.
type
//类型相等
)
{
//一个魔力鸟时其实不用加,因为石头或果冻的不会进入判断
if
(
this
.
eliminatedElements
.
indexOf
(
i
)
==
-
1
)
this
.
eliminatedElements
.
push
(
i
);
//如果other带特效,符合的元素都加上特效,没动效,直接加吧先,
...
...
@@ -2146,8 +2155,10 @@ export default class MainScene extends Scene {
this
.
magicRotateData
.
push
(
rotateData
);
//对于魔力鸟的效果有不一样的,旋转,该组元素要旋转消除
for
(
var
i
=
0
;
i
<
this
.
lattices
.
length
;
i
++
)
{
if
(
Tool
.
judgeMatch
(
this
.
lattices
[
i
])
&&
this
.
lattices
[
i
].
element
.
type
==
type
)
{
if
(
Tool
.
judgeBaseEle
(
this
.
lattices
[
i
])
&&
//是基础元素
this
.
lattices
[
i
].
element
.
effectType
!=
EffectType
.
MAGICLION
&&
//不是魔力鸟
this
.
lattices
[
i
].
element
.
type
==
type
//类型相等
)
{
if
(
this
.
eliminatedElements
.
indexOf
(
i
)
<
0
&&
effectIndexs
.
indexOf
(
i
)
<
0
)
{
this
.
eliminatedElements
.
push
(
i
);
//无特效未枷锁,无毛球的参与旋转
...
...
egret/src/something/Tool.ts
View file @
7c9156b3
...
...
@@ -269,11 +269,14 @@ export class Tool {
if
(
!
lat
||
!
lat
.
element
)
{
return
false
}
//上方元素为石头,或元素为锁定,或者是果冻,或者鸡蛋
//上方元素为石头,或元素为锁定,或者是果冻,或者鸡蛋
,或者大小节日元素
else
if
(
lat
.
element
.
type
==
ElementType
.
ROCK
||
lat
.
element
.
hasState
(
StateType
.
LOCK
)
||
lat
.
element
.
type
==
ElementType
.
JELLY
||
lat
.
element
.
type
==
ElementType
.
CHICKEN_EGG
)
{
lat
.
element
.
type
==
ElementType
.
CHICKEN_EGG
||
lat
.
element
.
type
==
ElementType
.
FESTIVALELE_BIG
||
lat
.
element
.
type
==
ElementType
.
FESTIVALELE_SMALL
)
{
return
false
}
//剩下情况
...
...
@@ -299,35 +302,25 @@ export class Tool {
}
/**
* 判断格子是否可进行匹配,
* 不包括魔力鸟,不包括
头
毛球的
* 判断格子是否可进行匹配,
只有基础5种元素才能参与匹配
* 不包括魔力鸟,不包括
带
毛球的
* 包括笼子里的
* @param lat
*/
public
static
judgeMatch
(
lat
:
Lattice
)
{
//上方格子为null,或格子上元素为null
if
(
!
lat
||
!
lat
.
element
)
{
return
false
}
//上方元素为石头,或为冰淇淋,或为魔力鸟,或为果冻,或为鸡蛋,或有毛球
else
if
(
lat
.
element
.
type
==
ElementType
.
ROCK
||
lat
.
element
.
type
==
ElementType
.
LOLLIPOP
||
lat
.
element
.
effectType
==
EffectType
.
MAGICLION
||
lat
.
element
.
type
==
ElementType
.
JELLY
||
lat
.
element
.
type
==
ElementType
.
CHICKEN_EGG
||
lat
.
element
.
hasState
(
StateType
.
HAIRBALLGREY
)
||
lat
.
element
.
hasState
(
StateType
.
HAIRBALLBLACK
)
||
lat
.
element
.
hasState
(
StateType
.
HAIRBALLBROWN
))
{
return
false
}
//剩下情况
else
{
if
(
Tool
.
judgeBaseEle
(
lat
)
&&
//是基础元素
lat
.
element
.
effectType
!=
EffectType
.
MAGICLION
&&
//特效不为魔力鸟
!
lat
.
element
.
hasState
(
StateType
.
HAIRBALLGREY
)
&&
//不带毛球, 下同
!
lat
.
element
.
hasState
(
StateType
.
HAIRBALLBLACK
)
&&
!
lat
.
element
.
hasState
(
StateType
.
HAIRBALLBROWN
)
)
{
return
true
}
return
false
}
/**
* 判断能执行消除的元素,
* 包括所有特效和基本元素,石头,果冻,鸡蛋,各种状态的
* 包括所有特效和基本元素,石头,果冻,鸡蛋,
节日元素,
各种状态的
* @param lat
*/
public
static
judgeEliminate
(
lat
:
Lattice
)
{
...
...
@@ -358,7 +351,6 @@ export class Tool {
return
true
}
return
false
}
/**
...
...
@@ -366,9 +358,9 @@ export class Tool {
* @param lat 格子
*/
public
static
judgeUpsetMove
(
lat
:
Lattice
)
{
if
(
Tool
.
judgeBaseEle
(
lat
)
&&
!
lat
.
element
.
hasState
(
StateType
.
LOCK
)
&&
!
lat
.
element
.
hasState
(
StateType
.
HAIRBALLGREY
)
&&
if
(
Tool
.
judgeBaseEle
(
lat
)
&&
//基础元素
!
lat
.
element
.
hasState
(
StateType
.
LOCK
)
&&
//不带锁
!
lat
.
element
.
hasState
(
StateType
.
HAIRBALLGREY
)
&&
//不带毛球,下同
!
lat
.
element
.
hasState
(
StateType
.
HAIRBALLBLACK
)
&&
!
lat
.
element
.
hasState
(
StateType
.
HAIRBALLBROWN
)
)
{
...
...
@@ -392,7 +384,9 @@ export class Tool {
ele
.
hasState
(
StateType
.
HAIRBALLBLACK
)
||
ele
.
hasState
(
StateType
.
HAIRBALLBROWN
)
||
ele
.
type
==
ElementType
.
JELLY
||
ele
.
type
==
ElementType
.
CHICKEN_EGG
ele
.
type
==
ElementType
.
CHICKEN_EGG
||
ele
.
type
==
ElementType
.
FESTIVALELE_BIG
||
ele
.
type
==
ElementType
.
FESTIVALELE_SMALL
)
{
return
false
;
}
...
...
@@ -400,7 +394,7 @@ export class Tool {
}
/**
* 是否要算分数
* 排除元素 石头,鸡蛋,果冻,
* 排除元素 石头,鸡蛋,果冻,
节日元素
* 排除状态 枷锁,毛球,因为存在时,元素不会消除
* @param ele 元素
*/
...
...
@@ -410,6 +404,8 @@ export class Tool {
ele
.
type
==
ElementType
.
JELLY
||
ele
.
type
==
ElementType
.
CHICKEN_EGG
||
ele
.
type
==
ElementType
.
LOLLIPOP
||
ele
.
type
==
ElementType
.
FESTIVALELE_BIG
||
ele
.
type
==
ElementType
.
FESTIVALELE_SMALL
||
ele
.
hasState
(
StateType
.
LOCK
)
||
ele
.
hasState
(
StateType
.
HAIRBALLGREY
)
||
ele
.
hasState
(
StateType
.
HAIRBALLBLACK
)
||
...
...
@@ -420,7 +416,7 @@ export class Tool {
return
true
}
/**
* 判断能否参与魔力鸟旋转的元素
* 判断能否参与魔力鸟旋转的元素
,不判断基础元素,因为这方法前必加判断
* 无特效,无锁,无毛球,
* @param ele 元素
*/
...
...
egret/src/something/uis/ChapterNum.ts
0 → 100644
View file @
7c9156b3
import
{
BitmapNumber
}
from
"../class/BitmapNumber"
;
import
{
Tool
}
from
"../Tool"
;
import
{
Pool
}
from
"../Pool"
;
import
{
RecoverName
}
from
"../enum/RecoverName"
;
/**
* 位图数字 目标元素数量
* 不管多少位,都按中间数字居中
* 暂不做通用,以后再说,否则回收问题
*/
export
class
ChapterNum
extends
egret
.
DisplayObjectContainer
{
/**
* 数字
*/
private
_num
:
number
;
get
num
():
number
{
return
this
.
_num
}
set
num
(
value
:
number
)
{
if
(
value
==
this
.
_num
)
return
;
this
.
_num
=
value
;
var
arr
=
Tool
.
returnTO
(
value
);
//位数从小到大add,
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
this
.
$children
[
i
])
{
//先用完原先$children里的,不通用就没必要修改resName
this
.
$children
[
i
][
"num"
]
=
arr
[
i
];
}
else
{
//如果没有就
let
o
:
BitmapNumber
=
Pool
.
takeOut
(
RecoverName
.
BITMAP_NUMBER
);
if
(
!
o
)
{
o
=
new
BitmapNumber
(
"propNum"
);
}
else
{
o
.
reset
(
"propNum"
)
}
o
.
num
=
arr
[
i
];
this
.
addChild
(
o
)
}
}
//如果多了,去掉后面的,回收
if
(
this
.
$children
.
length
>
arr
.
length
)
{
//移除后序
for
(
var
i
=
this
.
$children
.
length
-
1
;
i
>=
arr
.
length
;
i
--
)
{
let
c
=
this
.
$children
[
i
];
this
.
removeChild
(
c
);
Pool
.
recover
(
RecoverName
.
BITMAP_NUMBER
,
c
);
}
}
//居中适配
this
.
center
()
}
constructor
()
{
super
();
this
.
num
=
0
;
}
/**
* 居中位置
*/
center
()
{
//按顺序排,从右到左,
var
len
=
this
.
$children
.
length
;
var
w
=
this
.
$children
[
0
][
"texture"
].
textureWidth
-
2
;
var
right
=
len
/
2
*
w
-
w
;
for
(
var
i
=
0
;
i
<
this
.
$children
.
length
;
i
++
)
{
this
.
$children
[
i
].
x
=
right
-
w
*
i
;
}
}
}
\ 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