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
87904b64
Commit
87904b64
authored
Jun 01, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
樱花暂存
parent
29f71450
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
259 additions
and
11 deletions
+259
-11
MainBase.ts
egret/libs/new_wx/MainBase.ts
+3
-0
ele46_sz.png
egret/resource/assets/mainScene/ele46_sz.png
+0
-0
default.res.json
egret/resource/default.res.json
+7
-2
MainScene.ts
egret/src/mainScene/MainScene.ts
+189
-0
Tool.ts
egret/src/something/Tool.ts
+10
-4
Chapter32.ts
egret/src/something/chapters/Chapter32.ts
+4
-4
getChapter.ts
egret/src/something/chapters/getChapter.ts
+1
-1
Element.ts
egret/src/something/class/Element.ts
+17
-0
shuzhi.ts
egret/src/something/class/shuzhi.ts
+28
-0
No files found.
egret/libs/new_wx/MainBase.ts
View file @
87904b64
...
...
@@ -326,7 +326,10 @@ export default class MainBase extends eui.UILayer {
RES
.
getResAsync
(
"ele43fn_png"
);
RES
.
getResAsync
(
"ele44fn_png"
);
RES
.
getResAsync
(
"ele45fn_png"
);
RES
.
getResAsync
(
"ele46_png"
);
RES
.
getResAsync
(
"ele46_sz_png"
);
for
(
var
i
=
1
;
i
<=
27
;
i
++
)
{
RES
.
getResAsync
(
"bonusFra"
+
i
+
"_png"
)
}
...
...
egret/resource/assets/mainScene/ele46_sz.png
0 → 100644
View file @
87904b64
4.17 KB
egret/resource/default.res.json
View file @
87904b64
This diff is collapsed.
Click to expand it.
egret/src/mainScene/MainScene.ts
View file @
87904b64
...
...
@@ -123,6 +123,7 @@ import doWormHoleAI from './doWormHoleAI';
import
{
Grass
}
from
'../something/class/Grass'
;
import
Food
from
'../something/class/Food'
;
import
foodAni
from
'../something/anis/foodAni'
;
import
shuzhi
from
'../something/class/shuzhi'
;
const
aniClass
=
{
"BoomAni"
:
BoomAni
,
...
...
@@ -441,6 +442,9 @@ export default class MainScene extends Scene {
}
>
=
[];
inaniFood
:
boolean
=
false
;
//樱花
//当前关卡的所有樱花
cherryData
:
Array
<
Array
<
number
>>
=
[];
constructor
(){
super
();
window
[
'gm'
]
=
this
.
gm
;
...
...
@@ -581,6 +585,7 @@ export default class MainScene extends Scene {
if
(
!
this
.
chapterTxt
.
parent
){
this
[
'chaptergro'
].
addChild
(
this
.
chapterTxt
);
}
console
.
log
(
"移除地图元素"
);
}
async
start
(
data
)
{
super
.
start
();
...
...
@@ -618,6 +623,11 @@ export default class MainScene extends Scene {
//初始化回收口,如果是棒棒糖关卡,那么在地图底部增加棒棒糖洞,用到map
this
.
initRecycle
();
this
.
initConnectedLats
();
//初始化樱花
this
.
initCherry
();
console
.
log
(
"樱花数据"
,
this
.
cherryData
);
//初始化元素
this
.
initElement
();
//重置基础元素类型及特效
...
...
@@ -1340,7 +1350,63 @@ export default class MainScene extends Scene {
this
.
connectState
=
1
;
}
//否则默认的2
}
//初始化樱花
initCherry
(){
var
cherydata
=
this
.
chapterData
.
map
.
cherrydata
;
if
(
cherydata
){
this
.
cherryData
=
JSON
.
parse
(
JSON
.
stringify
(
cherydata
));
}
else
{
this
.
cherryData
=
new
Array
();
}
for
(
var
i
=
0
;
i
<
this
.
cherryData
.
length
;
i
++
){
var
icherydata
=
this
.
cherryData
[
i
];
for
(
var
j
=
0
;
j
<
icherydata
.
length
;
j
++
){
let
idx
=
icherydata
[
j
];
let
p
=
Tool
.
getPositionByIndex
(
idx
);
//添加树枝
if
(
j
>
0
){
let
lastidx
=
icherydata
[
j
-
1
];
let
lastp
=
Tool
.
getPositionByIndex
(
lastidx
);
let
chanum
=
Math
.
abs
(
idx
-
lastidx
);
let
szp
;
let
roatype
:
string
;
if
(
chanum
==
9
){
szp
=
[
p
[
0
],(
lastp
[
1
]
-
p
[
1
])
/
2
+
p
[
1
]];
roatype
=
"vir"
;
}
else
if
(
chanum
==
1
){
szp
=
[(
lastp
[
0
]
-
p
[
0
])
/
2
+
p
[
0
],
p
[
1
]];
roatype
=
"hor"
;
}
else
{
console
.
error
(
"检查樱花分布"
,
idx
,
lastidx
,
i
,
j
);
}
if
(
szp
){
console
.
log
(
"树枝位置"
,
szp
[
0
],
szp
[
1
]);
let
onesz
=
new
shuzhi
();
onesz
.
name
=
"sz_"
+
idx
+
"_"
+
lastidx
;
onesz
.
x
=
szp
[
0
];
onesz
.
y
=
szp
[
1
];
onesz
.
setroa
(
roatype
);
this
.
mapupContainer
.
addChild
(
onesz
);
}
}
//添加元素
let
ele
:
Element
=
Pool
.
takeOut
(
RecoverName
.
ELEMENT
);
if
(
!
ele
){
ele
=
new
Element
(
ElementType
.
cherry
);
}
else
{
ele
.
reset
(
ElementType
.
cherry
);
}
console
.
log
(
"樱花位置"
,
p
[
0
],
p
[
1
]);
ele
.
x
=
p
[
0
];
ele
.
y
=
p
[
1
];
this
.
elementContainer
.
addChild
(
ele
);
this
.
lattices
[
idx
].
element
=
ele
;
}
}
}
//初始化地图元素
initElement
()
{
this
.
cannonums
=
0
;
...
...
@@ -1353,6 +1419,12 @@ export default class MainScene extends Scene {
//如果对应格子为空,直接跳过,
if
(
!
this
.
lattices
[
i
])
continue
;
var
p
=
Tool
.
getPositionByIndex
(
i
);
//初始元素忽略樱花
var
ischery
=
this
.
checkisCherry
(
i
);
if
(
ischery
){
continue
;
}
switch
(
elements
[
i
])
{
//如果为0记录空格
case
ElementConfigType
.
EMPTY
:
...
...
@@ -3096,6 +3168,7 @@ export default class MainScene extends Scene {
}
}
}
//樱花绽放,放在fallAllPormise里
//没有可消除元素,执行掉落,
// setTimeout(() => {
...
...
@@ -5693,6 +5766,7 @@ export default class MainScene extends Scene {
this
.
checkFireworksNebEle
(
latttice
,
ele
);
this
.
checkFishNebEle
(
latttice
);
this
.
checkPongoNebEle
(
latttice
,
ele
);
this
.
checkCherryNebEle
(
latttice
);
//如果附近有石头
this
.
checkNebEle
(
latttice
,
(
lat
)
=>
{
return
lat
&&
lat
.
element
&&
lat
.
element
.
type
==
ElementType
.
ROCK
...
...
@@ -5724,6 +5798,8 @@ export default class MainScene extends Scene {
this
.
checkNebEle
(
latttice
,
(
lat
)
=>
{
return
lat
&&
lat
.
element
&&
lat
.
element
.
type
==
ElementType
.
FESTIVALELE_SMALL
&&
(
!
lat
.
block
||
!
lat
.
block
.
isLock
());
});
//樱花元素
}
/**
...
...
@@ -7339,4 +7415,117 @@ export default class MainScene extends Scene {
return
[
cutx
,
cuty
];
}
//新元素樱花
//判断当前位置是否樱花
checkisCherry
(
idx
:
number
){
for
(
var
i
=
0
;
i
<
this
.
cherryData
.
length
;
i
++
){
var
icherydata
=
this
.
cherryData
[
i
];
if
(
icherydata
.
indexOf
(
idx
)
!=-
1
){
return
true
;
}
}
return
false
;
}
//相邻消除激活樱花
checkCherryNebEle
(
lat0
:
Lattice
){
if
(
!
lat0
){
return
;
}
var
indexs
=
this
.
getNextIndexs
(
lat0
);
for
(
let
i
=
0
;
i
<
indexs
.
length
;
i
++
){
let
index
=
indexs
[
i
];
let
lat
=
this
.
lattices
[
index
];
if
(
lat
&&
lat
.
element
){
let
ele
=
lat
.
element
;
if
(
ele
.
type
==
ElementType
.
cherry
&&
ele
.
activeStatus
==
0
){
this
.
activeCherry
(
index
);
}
}
}
}
//特效激活樱花
solveCherryEle
(
cherryArr
:
Array
<
number
>
){
}
//激活樱花
activeCherry
(
idx
:
number
){
console
.
log
(
"1消除樱花----------------------"
,
idx
);
var
lat
=
this
.
lattices
[
idx
];
var
ele
=
this
.
lattices
[
idx
].
element
;
let
pro1
=
ele
.
activeCherry
();
this
.
fallAllPormise
.
push
(
pro1
);
var
nearidxs
:
Array
<
{
forback
:
string
,
idx
:
number
}
>
=
this
.
getNearCherry
(
idx
);
//消除自身时,把连接自身的棍消除
this
.
removeCherryGun
(
idx
,
nearidxs
);
console
.
log
(
"2消除樱花----------------------"
,
JSON
.
stringify
(
nearidxs
));
// var pro2 = new Promise(res=>{
// setTimeout(() => {
// res();
// }, 200);
// })
// this.fallAllPormise.push(pro2);
for
(
let
i
=
0
;
i
<
nearidxs
.
length
;
i
++
){
let
nidx
=
nearidxs
[
i
].
idx
;
let
nlat
=
this
.
lattices
[
nidx
];
let
nele
=
nlat
.
element
;
if
(
nele
&&
nele
.
type
==
ElementType
.
cherry
&&
nele
.
activeStatus
==
0
){
this
.
activeCherry
(
nidx
);
}
}
}
//获取相邻樱花
getNearCherry
(
idx
:
number
){
var
nearidxs
=
new
Array
();
for
(
var
i
=
0
;
i
<
this
.
cherryData
.
length
;
i
++
){
var
icherydata
=
this
.
cherryData
[
i
];
for
(
var
j
=
0
;
j
<
icherydata
.
length
;
j
++
){
var
latidx
=
icherydata
[
j
];
if
(
latidx
==
idx
){
if
(
j
>
0
){
nearidxs
.
push
(
{
forback
:
"for"
,
idx
:
icherydata
[
j
-
1
]
}
);
}
if
(
j
<
icherydata
.
length
-
1
){
nearidxs
.
push
({
forback
:
"back"
,
idx
:
icherydata
[
j
+
1
]
});
}
break
;
}
}
}
return
nearidxs
;
}
//消除樱花棍
removeCherryGun
(
idx
:
number
,
nearidxs
:
Array
<
{
forback
:
string
,
idx
:
number
}
>
){
for
(
var
i
=
0
;
i
<
nearidxs
.
length
;
i
++
){
var
ineardata
=
nearidxs
[
i
];
var
iforback
=
ineardata
.
forback
;
var
iidx
=
ineardata
.
idx
;
var
iguname
=
""
;
if
(
iforback
==
"for"
){
iguname
=
"sz_"
+
idx
+
"_"
+
iidx
;
}
else
if
(
iforback
==
"back"
){
iguname
=
"sz_"
+
iidx
+
"_"
+
idx
;
}
var
isz
=
this
.
mapupContainer
.
getChildByName
(
iguname
);
isz
&&
this
.
mapupContainer
.
removeChild
(
isz
);
}
}
}
\ No newline at end of file
egret/src/something/Tool.ts
View file @
87904b64
...
...
@@ -305,7 +305,9 @@ export class Tool {
// lat.element.type == ElementType.FESTIVALELE_SMALL
lat
.
element
.
type
==
ElementType
.
CANNO
||
lat
.
element
.
type
==
ElementType
.
CANNO_BLOCK
||
lat
.
element
.
type
==
ElementType
.
Pongo
lat
.
element
.
type
==
ElementType
.
Pongo
||
lat
.
element
.
type
==
ElementType
.
cherry
)
{
return
false
}
...
...
@@ -370,7 +372,8 @@ export class Tool {
lat
.
element
.
type
==
ElementType
.
FIREWORKS_SHOOTER
||
lat
.
element
.
type
==
ElementType
.
CANNO
||
lat
.
element
.
type
==
ElementType
.
CANNO_BLOCK
||
lat
.
element
.
type
==
ElementType
.
Pongo
lat
.
element
.
type
==
ElementType
.
Pongo
||
lat
.
element
.
type
==
ElementType
.
cherry
)
{
return
false
}
...
...
@@ -472,7 +475,9 @@ export class Tool {
ele
.
type
==
ElementType
.
FESTIVALELE_SMALL
||
ele
.
type
==
ElementType
.
CANNO
||
ele
.
type
==
ElementType
.
CANNO_BLOCK
||
ele
.
type
==
ElementType
.
Pongo
ele
.
type
==
ElementType
.
Pongo
||
ele
.
type
==
ElementType
.
cherry
)
{
return
false
;
}
...
...
@@ -501,7 +506,8 @@ export class Tool {
ele
.
hasState
(
StateType
.
HAIRBALLBROWN
)
||
ele
.
type
==
ElementType
.
CANNO
||
ele
.
type
==
ElementType
.
CANNO_BLOCK
||
ele
.
type
==
ElementType
.
Pongo
ele
.
type
==
ElementType
.
Pongo
||
ele
.
type
==
ElementType
.
cherry
)
{
return
false
;
}
...
...
egret/src/something/chapters/Chapter32.ts
View file @
87904b64
...
...
@@ -2,14 +2,14 @@ import { ChapterData } from "../interface/ChapterData";
//801-825
export
const
Chapters32
:
ChapterData
[]
=
[
//
75
1
//
80
1
{
baseElementTypes
:
[
0
,
1
,
2
,
3
],
bubbleProbability
:
0
,
stepCount
:
26
,
passTarget
:
{
type
:
1
,
elements
:
[
{
type
:
9
,
count
:
71
},
{
type
:
0
,
count
:
102
}
]
},
starScores
:
[
15000
,
20000
,
25000
],
map
:
{
lattices
:
[
3
,
3
,
0
,
3
,
3
,
3
,
0
,
3
,
3
,
3
,
3
,
0
,
3
,
3
,
3
,
0
,
3
,
3
,
1
,
1
,
0
,
3
,
3
,
3
,
0
,
3
,
3
,
1
,
1
,
0
,
3
,
3
,
3
,
0
,
3
,
3
,
3
,
3
,
0
,
3
,
3
,
3
,
0
,
3
,
3
,
3
,
3
,
0
,
3
,
3
,
3
,
0
,
3
,
3
,
3
,
3
,
61
,
3
,
3
,
3
,
61
,
3
,
3
,
...
...
@@ -41,7 +41,7 @@ export const Chapters32: ChapterData[] = [
recycles
:
[],
cherrydata
:[
[
0
,
1
,
10
,
9
],
],
generateLats
:
[
{
index
:
0
,
type
:
null
},
{
index
:
1
,
type
:
null
},
...
...
egret/src/something/chapters/getChapter.ts
View file @
87904b64
...
...
@@ -89,7 +89,7 @@ chapters.forEach((chapter,index) => {
*/
export
function
getChapterData
(
index
:
number
):
ChapterData
{
//没有数据就返回第一关数据
// return chapters[75
1];
return
chapters
[
80
1
];
return
chapters
[
index
]
||
chapters
[
1
];
}
...
...
egret/src/something/class/Element.ts
View file @
87904b64
...
...
@@ -1313,4 +1313,21 @@ export class Element extends eui.Component {
onElimiate
(){}
get
isActive
()
{
return
false
}
canElimite
:
boolean
;
//激活樱花
activeStatus
:
number
=
0
;
//0未激活,1绽放中,2,结束
activeCherry
(){
this
.
activeStatus
=
1
;
return
new
Promise
(
res
=>
{
egret
.
Tween
.
get
(
this
.
showImage
)
.
to
({
alpha
:
0
},
300
)
.
call
(
function
(){
this
.
activeStatus
=
2
;
res
();
},
null
);
})
}
}
\ No newline at end of file
egret/src/something/class/shuzhi.ts
0 → 100644
View file @
87904b64
export
default
class
shuzhi
extends
egret
.
Bitmap
{
constructor
(){
super
();
var
texture
:
egret
.
Texture
=
RES
.
getRes
(
"ele46_sz_png"
);
if
(
!
texture
){
console
.
error
(
"检查树枝纹理"
);
return
;
};
this
.
texture
=
texture
;
this
.
anchorOffsetX
=
texture
.
textureWidth
/
2
;
this
.
anchorOffsetY
=
texture
.
textureHeight
/
2
;
this
.
touchEnabled
=
false
;
}
//树枝旋转,hor横向树枝,vir竖向树枝
setroa
(
type
:
string
){
var
roa
:
number
=
0
;
if
(
type
==
"hor"
){
roa
=
0
;
}
else
if
(
type
==
"vir"
){
roa
=
90
;
}
this
.
rotation
=
roa
;
console
.
log
(
"树枝啦啦啦啦"
,
this
);
}
}
\ 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