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
93a7252c
Commit
93a7252c
authored
Apr 15, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
黑洞暂存
parent
741d00ef
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
300 additions
and
19 deletions
+300
-19
MainBase.ts
egret/libs/new_wx/MainBase.ts
+2
-0
wormhole.png
egret/resource/assets/mainScene/wormhole.png
+0
-0
default.res.json
egret/resource/default.res.json
+6
-1
MainScene.ts
egret/src/mainScene/MainScene.ts
+47
-1
doWormHoleAI.ts
egret/src/mainScene/doWormHoleAI.ts
+135
-0
Tool.ts
egret/src/something/Tool.ts
+11
-0
BaseBlock.ts
egret/src/something/block/BaseBlock.ts
+3
-0
Chapter24.ts
egret/src/something/chapters/Chapter24.ts
+19
-16
getChapter.ts
egret/src/something/chapters/getChapter.ts
+1
-1
Element.ts
egret/src/something/class/Element.ts
+10
-0
Lattice.ts
egret/src/something/class/Lattice.ts
+33
-0
WormHole.ts
egret/src/something/class/WormHole.ts
+29
-0
MapData.ts
egret/src/something/interface/MapData.ts
+4
-0
No files found.
egret/libs/new_wx/MainBase.ts
View file @
93a7252c
...
...
@@ -313,6 +313,8 @@ export default class MainBase extends eui.UILayer {
RES
.
getResAsync
(
"ele39_png"
);
RES
.
getResAsync
(
"ele40_png"
);
RES
.
getResAsync
(
"kuang_png"
);
RES
.
getResAsync
(
"wormhole_png"
);
for
(
var
i
=
1
;
i
<=
27
;
i
++
)
{
RES
.
getResAsync
(
"bonusFra"
+
i
+
"_png"
)
}
...
...
egret/resource/assets/mainScene/wormhole.png
0 → 100644
View file @
93a7252c
11.4 KB
egret/resource/default.res.json
View file @
93a7252c
...
...
@@ -241,7 +241,7 @@
"name"
:
"helpGroup"
},
{
"keys"
:
"virprizebg_png,lightdi_png"
,
"keys"
:
"virprizebg_png,lightdi_png
,wormhole_png
"
,
"name"
:
"preload"
}
],
...
...
@@ -5396,6 +5396,11 @@
"url"
:
"assets/mainScene/kuang.png"
,
"type"
:
"image"
,
"name"
:
"kuang_png"
},
{
"name"
:
"wormhole_png"
,
"type"
:
"image"
,
"url"
:
"assets/mainScene/wormhole.png"
}
]
}
\ No newline at end of file
egret/src/mainScene/MainScene.ts
View file @
93a7252c
...
...
@@ -118,6 +118,8 @@ import { getArrowDir, getArrowRotation, fillConveyor, getOneConveyorMask } from
import
createArrowBg
from
'../something/conveyor/createArrowBg'
;
import
doConveyorAI
from
'./doConveyorAI'
;
import
Rect
=
eui
.
Rect
;
import
WormHole
from
'../something/class/WormHole'
;
import
doWormHoleAI
from
'./doWormHoleAI'
;
const
aniClass
=
{
"BoomAni"
:
BoomAni
,
...
...
@@ -219,6 +221,9 @@ export default class MainScene extends Scene {
recycleIndexs
:
number
[];
//元素的容器,为了移动事件简单
elementContainer
:
egret
.
DisplayObjectContainer
;
//虫洞层
wormholeContainer
:
egret
.
DisplayObjectContainer
;
//选中框
choosed
:
eui
.
Image
;
//消除后生成空格的索引
...
...
@@ -362,6 +367,9 @@ export default class MainScene extends Scene {
NetManager
.
ins
.
showLog
(
getlogItem
(
13
))
this
.
initConveyor
();
//虫洞
this
.
initWormHole
();
//初始话地图格子数据
this
.
initLattices
();
//初始化回收口,如果是棒棒糖关卡,那么在地图底部增加棒棒糖洞,用到map
...
...
@@ -695,6 +703,10 @@ export default class MainScene extends Scene {
this
.
conveyorMap
=
{};
this
.
map
=
bg
;
this
.
map
.
addChild
(
conveyor
);
this
.
wormholeContainer
=
new
egret
.
DisplayObjectContainer
();
this
.
addChild
(
this
.
wormholeContainer
);
//容器
this
.
elementContainer
=
new
egret
.
DisplayObjectContainer
();
this
.
addChild
(
this
.
elementContainer
);
...
...
@@ -862,6 +874,31 @@ export default class MainScene extends Scene {
}
}
initWormHole
(){
let
wormholes
=
this
.
chapterData
.
map
.
WORMHOLE
;
if
(
wormholes
&&
wormholes
.
length
>
0
){
let
tex
=
RES
.
getRes
(
"wormhole_png"
);
for
(
var
i
=
0
;
i
<
wormholes
.
length
;
i
++
){
var
iwormhole
=
wormholes
[
i
];
if
(
iwormhole
.
length
>
1
){
for
(
var
j
=
0
;
j
<
iwormhole
.
length
;
j
++
){
var
jhole
=
iwormhole
[
j
];
let
jholepos
=
Tool
.
getPositionByIndex
(
jhole
);
let
onehole
:
WormHole
=
Tool
.
getOneWormHole
();
onehole
.
init
(
jhole
);
this
.
wormholeContainer
.
addChild
(
onehole
);
onehole
.
x
=
jholepos
[
0
];
onehole
.
y
=
jholepos
[
1
];
console
.
log
(
"添加了一个黑洞"
,
onehole
);
}
}
else
{
console
.
error
(
i
+
"号线仅存在一个黑洞????"
);
}
}
}
}
//初始化地图格子数据,包括生成口,联通口
initLattices
()
{
var
latticesD
=
this
.
chapterData
.
map
.
lattices
;
...
...
@@ -2724,6 +2761,15 @@ export default class MainScene extends Scene {
await
doConveyorAI
(
this
);
this
.
_converyorTag
=
false
;
}
//黑洞转移
let
wormholes
=
this
.
chapterData
.
map
.
WORMHOLE
;
if
(
wormholes
&&
wormholes
.
length
>
0
){
await
doWormHoleAI
(
this
);
console
.
log
(
"黑洞转移完毕"
);
}
//棒棒糖消除
var
recoverlp
:
number
=
0
;
for
(
var
lp
=
0
;
lp
<
this
.
recycleIndexs
.
length
;
lp
++
){
...
...
egret/src/mainScene/doWormHoleAI.ts
0 → 100644
View file @
93a7252c
import
MainScene
from
"./MainScene"
;
import
{
Lattice
}
from
"../something/class/Lattice"
;
import
{
LatticeType
}
from
"../something/enum/LatticeType"
;
import
{
Tool
}
from
"../something/Tool"
;
const
getMapsp
=
function
(
lattice
:
Lattice
){
var
mapcf
:{
mapele
:
egret
.
DisplayObject
,
mapdata
:{}
}
=
{
mapele
:
null
,
mapdata
:{}
}
if
(
lattice
){
if
(
lattice
.
ice
){
mapcf
.
mapele
=
lattice
.
ice
;
mapcf
.
mapdata
[
"maptype"
]
=
LatticeType
.
ICE
;
mapcf
.
mapdata
[
"maptypenum"
]
=
lattice
.
ice
.
countNum
;
}
else
if
(
lattice
.
sand
){
mapcf
.
mapele
=
lattice
.
sand
;
mapcf
.
mapdata
[
"maptype"
]
=
LatticeType
.
SAND
;
}
else
if
(
lattice
.
block
){
mapcf
.
mapele
=
lattice
.
block
;
var
blockice
=
lattice
.
block
.
ice
;
var
blockicecout
=
lattice
.
block
.
iceCountNum
;
var
blockstate
=
lattice
.
block
.
state
;
mapcf
.
mapdata
[
"maptype"
]
=
LatticeType
.
BlOCK
;
if
(
blockice
){
if
(
blockicecout
==
1
){
mapcf
.
mapdata
[
"maptype"
]
=
LatticeType
.
BLOCK_AND_ICE
}
else
if
(
blockicecout
==
2
){
mapcf
.
mapdata
[
"maptype"
]
=
LatticeType
.
BLOCK_AND_DARK_ICE
;
}
}
mapcf
.
mapdata
[
"blockstate"
]
=
lattice
.
block
.
state
;
}
else
{
//无地图元素
}
}
return
mapcf
;
}
const
getElesp
=
function
(
lattice
:
Lattice
){
var
elecf
:{
ele
:
egret
.
DisplayObject
,
eledata
:{
}
}
=
{
ele
:
null
,
eledata
:{}
};
if
(
lattice
&&
lattice
.
element
){
var
elesp
=
lattice
.
element
;
var
eletype
=
elesp
.
type
;
var
allstate
=
elesp
.
getAllState
();
elecf
.
ele
=
elesp
;
elecf
.
eledata
[
"type"
]
=
eletype
;
elecf
.
eledata
[
"states"
]
=
allstate
;
}
return
elecf
;
}
const
tweenAnisp
=
function
(
sp
:
egret
.
DisplayObject
,
posx
:
number
,
posy
:
number
,
lattice
:
Lattice
=
null
,
mapcf
:
any
=
null
,
elecf
:
any
=
null
){
var
pro
=
new
Promise
(
function
(
resolve
,
reject
){
egret
.
Tween
.
get
(
sp
)
.
to
({
scaleX
:
0
,
scaleY
:
0
,
},
500
)
.
call
(()
=>
{
sp
.
x
=
posx
;
sp
.
y
=
posy
;
console
.
log
(
"黑洞转移位置"
,
posx
,
posy
);
})
.
to
({
scaleX
:
1
,
scaleY
:
1
},
500
)
.
call
(()
=>
{
if
(
lattice
&&
mapcf
&&
elecf
){
lattice
.
changeData
(
mapcf
,
elecf
);
// console.log("替换数据",JSON.stringify(lattice));
}
resolve
();
})
})
return
pro
;
}
export
default
async
(
thisObj
:
MainScene
)
=>
{
const
promiseList
:
Promise
<
any
>
[]
=
[];
let
wormholes
=
thisObj
.
chapterData
.
map
.
WORMHOLE
;
for
(
let
i
=
0
;
i
<
wormholes
.
length
;
i
++
){
let
iwormhole
=
wormholes
[
i
];
if
(
iwormhole
.
length
>
1
){
for
(
let
j
=
0
;
j
<
iwormhole
.
length
;
j
++
){
let
jholeidx
=
iwormhole
[
j
];
let
jlholeidx
;
if
(
j
==
iwormhole
.
length
-
1
){
jlholeidx
=
iwormhole
[
0
];
}
else
{
jlholeidx
=
iwormhole
[
j
+
1
];
}
let
jidxlattice
:
Lattice
=
thisObj
.
lattices
[
jholeidx
];
let
jlidxlattice
:
Lattice
=
thisObj
.
lattices
[
jlholeidx
];
let
mapcf
=
getMapsp
(
jidxlattice
);
let
elecf
=
getElesp
(
jidxlattice
);
let
mapsp
=
mapcf
.
mapele
;
let
elesp
=
elecf
.
ele
;
let
jlidxpos
=
Tool
.
getPositionByIndex
(
jlholeidx
);
// console.log("转移前1----------",JSON.stringify(jidxlattice),"\n2--------------",JSON.stringify(jlidxlattice))
console
.
log
(
"11111111黑洞转移位置"
,
jlholeidx
,
jlidxpos
[
0
],
jlidxpos
[
1
]);
if
(
mapsp
){
let
mapro
=
tweenAnisp
(
mapsp
,
jlidxpos
[
0
],
jlidxpos
[
1
]);
promiseList
.
push
(
mapro
);
}
if
(
elesp
){
let
elepro
=
tweenAnisp
(
elesp
,
jlidxpos
[
0
],
jlidxpos
[
1
],
jlidxlattice
,
mapcf
,
elecf
);
promiseList
.
push
(
elepro
);
}
}
}
}
await
Promise
.
all
(
promiseList
).
then
(()
=>
{
console
.
log
(
"替换数据"
);
console
.
log
(
thisObj
.
lattices
);
// lattice:Lattice,mapcf:any,elecf:any
})
}
\ No newline at end of file
egret/src/something/Tool.ts
View file @
93a7252c
...
...
@@ -10,6 +10,7 @@ import { GenerateLatData } from "./interface/GenerateLatData";
import
{
Pool
}
from
"./Pool"
;
import
HoneyPotElement
from
"./class/HoneyPotElement"
;
import
{
ElementConfigType
}
from
"./enum/ElementConfigType"
;
import
WormHole
from
"./class/WormHole"
;
//两种,0无棒棒糖,1有
const
offsetYTwo
:
number
[]
=
[];
...
...
@@ -1271,4 +1272,14 @@ export class Tool {
var
roanum
=
[
-
90
,
0
,
90
,
180
][
roaidx
];
return
roanum
;
}
//黑洞
public
static
getOneWormHole
(){
var
onewormhole
=
Pool
.
takeOut
(
"wormhole"
);
if
(
!
onewormhole
){
onewormhole
=
new
WormHole
();
}
return
onewormhole
;
}
}
\ No newline at end of file
egret/src/something/block/BaseBlock.ts
View file @
93a7252c
...
...
@@ -9,6 +9,9 @@ export default class BaseBlock extends egret.DisplayObjectContainer {
this
.
_state
=
state
;
this
.
initUI
();
}
get
state
(){
return
this
.
_state
;
}
initUI
()
{
this
.
_block
=
new
egret
.
Bitmap
(
RES
.
getRes
(
'common_block_png'
));
...
...
egret/src/something/chapters/Chapter24.ts
View file @
93a7252c
...
...
@@ -94,6 +94,9 @@ export const Chapters24: ChapterData[] = [
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
],
WORMHOLE
:[
[
1
,
6
,
45
,
71
]
],
connectedLats
:
[
[
27
,
45
],
[
28
,
46
],
...
...
@@ -104,22 +107,22 @@ export const Chapters24: ChapterData[] = [
[
34
,
52
],
[
35
,
53
]
],
conveyor
:
[
[
71
,
66
],
[
65
,
74
],
[
62
,
56
],
[
55
,
73
],
[
53
,
46
],
[
45
,
72
]
],
conveyorConnectedLats
:
[
[
66
,
65
],
[
74
,
71
],
[
56
,
55
],
[
73
,
62
],
[
46
,
45
],
[
72
,
53
]
],
//
conveyor: [
//
[ 71, 66 ],
//
[ 65, 74 ],
//
[ 62, 56 ],
//
[ 55, 73 ],
//
[ 53, 46 ],
//
[ 45, 72 ]
//
],
//
conveyorConnectedLats: [
//
[ 66, 65 ],
//
[ 74, 71 ],
//
[ 56, 55 ],
//
[ 73, 62 ],
//
[ 46, 45 ],
//
[ 72, 53 ]
//
],
elements
:
[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
...
...
egret/src/something/chapters/getChapter.ts
View file @
93a7252c
...
...
@@ -73,7 +73,7 @@ chapters.forEach((chapter,index) => {
*/
export
function
getChapterData
(
index
:
number
):
ChapterData
{
//没有数据就返回第一关数据
//
return chapters[612];
return
chapters
[
612
];
return
chapters
[
index
]
||
chapters
[
1
];
}
...
...
egret/src/something/class/Element.ts
View file @
93a7252c
...
...
@@ -1153,6 +1153,16 @@ export class Element extends eui.Component {
return
false
}
getAllState
():
StateType
[]{
var
statearr
=
new
Array
();
for
(
var
i
=
0
;
i
<
this
.
states
.
length
;
i
++
){
if
(
this
.
states
[
i
]){
statearr
.
push
(
i
);
}
}
return
statearr
;
}
/**
* 去掉所有状态
*/
...
...
egret/src/something/class/Lattice.ts
View file @
93a7252c
...
...
@@ -3,6 +3,7 @@ import { Tool } from "../Tool";
import
{
Element
}
from
"./Element"
;
import
{
Ice
}
from
"./Ice"
;
import
Sand
from
"../Sand"
;
import
{
LatticeType
}
from
"../enum/LatticeType"
;
/**
* 位置信息直接用一个二维数组记录,然后用row,col取
...
...
@@ -101,10 +102,42 @@ export class Lattice {
this
.
column
=
rc
[
1
];
//重置属性,后面自行赋值
this
.
ice
=
null
;
this
.
block
=
null
;
this
.
sand
=
null
;
this
.
element
=
null
;
this
.
up
=
null
;
this
.
down
=
null
;
this
.
isGenerate
=
false
;
}
changeData
(
mapcf
:
any
,
elecf
:
any
){
this
.
ice
=
null
;
this
.
block
=
null
;
this
.
sand
=
null
;
this
.
element
=
null
;
if
(
mapcf
.
mapdata
[
"maptype"
]){
var
maptype
=
mapcf
.
mapdata
[
"maptype"
];
switch
(
maptype
){
case
LatticeType
.
ICE
:
this
.
ice
=
mapcf
.
mapele
;
break
;
case
LatticeType
.
SAND
:
this
.
sand
=
mapcf
.
mapele
;
break
;
case
LatticeType
.
BlOCK
:
case
LatticeType
.
BLOCK_AND_ICE
:
case
LatticeType
.
BLOCK_AND_DARK_ICE
:
this
.
block
=
mapcf
.
mapele
;
break
;
default
:
console
.
error
(
"未定义地图类型,检查"
);
break
;
}
}
if
(
elecf
.
eledata
[
"type"
]){
this
.
element
=
elecf
.
ele
;
}
}
}
\ No newline at end of file
egret/src/something/class/WormHole.ts
0 → 100644
View file @
93a7252c
export
default
class
WormHole
extends
egret
.
Sprite
{
showImage
:
eui
.
Image
;
constructor
(){
super
();
this
.
showImage
=
new
eui
.
Image
();
this
.
addChild
(
this
.
showImage
);
var
texture
:
egret
.
Texture
=
RES
.
getRes
(
"wormhole_png"
);
if
(
texture
){
this
.
showImage
.
texture
=
texture
;
this
.
showImage
.
x
=
0
;
this
.
showImage
.
y
=
0
;
this
.
showImage
.
anchorOffsetX
=
this
.
showImage
.
width
/
2
;
this
.
showImage
.
anchorOffsetY
=
this
.
showImage
.
height
/
2
;
this
.
showImage
.
scaleX
=
1.5
;
this
.
showImage
.
scaleY
=
1.5
;
}
}
index
:
number
init
(
index
:
number
){
this
.
index
=
index
;
}
recover
(){
if
(
this
.
parent
){
this
.
parent
.
removeChild
(
this
);
}
}
}
\ No newline at end of file
egret/src/something/interface/MapData.ts
View file @
93a7252c
...
...
@@ -70,4 +70,8 @@ export interface MapData {
* 格子索引
*/
recycles
?:
number
[];
/**
* 黑洞
*/
WORMHOLE
?:
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