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
5810d6a4
Commit
5810d6a4
authored
Mar 12, 2020
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
37af37d1
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
87 additions
and
32 deletions
+87
-32
MainScene.ts
egret/src/mainScene/MainScene.ts
+9
-1
doConveyorAI.ts
egret/src/mainScene/doConveyorAI.ts
+12
-10
Chapter20 copy.ts
egret/src/something/chapters/Chapter20 copy.ts
+10
-3
Chapter20.ts
egret/src/something/chapters/Chapter20.ts
+6
-3
Element.ts
egret/src/something/class/Element.ts
+5
-4
Fish.ts
egret/src/something/class/Fish.ts
+14
-5
Monster.ts
egret/src/something/class/Monster.ts
+16
-2
cloneElement.ts
egret/src/something/cloneElement.ts
+15
-4
No files found.
egret/src/mainScene/MainScene.ts
View file @
5810d6a4
...
@@ -163,6 +163,7 @@ for (let i = 1; i < 999; i++) { /// TODO 测试
...
@@ -163,6 +163,7 @@ for (let i = 1; i < 999; i++) { /// TODO 测试
const
festivalIndex
:
number
=
40
;
const
festivalIndex
:
number
=
40
;
export
default
class
MainScene
extends
Scene
{
export
default
class
MainScene
extends
Scene
{
private
_converyorTag
;
get
skinKey
()
{
get
skinKey
()
{
return
'Main2'
return
'Main2'
}
}
...
@@ -1259,6 +1260,7 @@ export default class MainScene extends Scene {
...
@@ -1259,6 +1260,7 @@ export default class MainScene extends Scene {
}
}
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
_converyorTag
=
true
;
this
.
eliminate
();
this
.
eliminate
();
},
200
)
},
200
)
break
;
break
;
...
@@ -1270,6 +1272,7 @@ export default class MainScene extends Scene {
...
@@ -1270,6 +1272,7 @@ export default class MainScene extends Scene {
Tool
.
getPositionByIndex
(
index
)
Tool
.
getPositionByIndex
(
index
)
)
)
}
}
this
.
_converyorTag
=
true
;
this
.
eliminate
();
this
.
eliminate
();
break
;
break
;
case
PropType
.
CHANCE_NUM
:
case
PropType
.
CHANCE_NUM
:
...
@@ -1296,6 +1299,7 @@ export default class MainScene extends Scene {
...
@@ -1296,6 +1299,7 @@ export default class MainScene extends Scene {
mouseDownE
(
e
:
egret
.
TextEvent
)
{
mouseDownE
(
e
:
egret
.
TextEvent
)
{
// if (!this.enableTouch) return
// if (!this.enableTouch) return
this
.
_converyorTag
=
true
;
var
self
=
this
;
var
self
=
this
;
if
(
e
.
target
.
parent
instanceof
Element
)
{
if
(
e
.
target
.
parent
instanceof
Element
)
{
//去掉提示动画
//去掉提示动画
...
@@ -1321,6 +1325,7 @@ export default class MainScene extends Scene {
...
@@ -1321,6 +1325,7 @@ export default class MainScene extends Scene {
}
}
mouseMoveE
(
e
)
{
mouseMoveE
(
e
)
{
this
.
_converyorTag
=
true
;
if
(
this
.
SELECTED
&&
e
.
target
.
parent
instanceof
Element
)
{
if
(
this
.
SELECTED
&&
e
.
target
.
parent
instanceof
Element
)
{
if
(
!
Tool
.
judgeChosen
(
e
.
target
.
parent
))
return
if
(
!
Tool
.
judgeChosen
(
e
.
target
.
parent
))
return
if
(
Tool
.
checkNeb
(
e
.
target
.
parent
,
this
.
SELECTED
))
{
if
(
Tool
.
checkNeb
(
e
.
target
.
parent
,
this
.
SELECTED
))
{
...
@@ -2069,7 +2074,10 @@ export default class MainScene extends Scene {
...
@@ -2069,7 +2074,10 @@ export default class MainScene extends Scene {
this
.
eliminate
();
this
.
eliminate
();
return
return
}
}
if
(
this
.
_converyorTag
)
{
await
doConveyorAI
(
this
);
await
doConveyorAI
(
this
);
this
.
_converyorTag
=
false
;
}
await
doSandAI
(
this
);
await
doSandAI
(
this
);
const
doHoneyPotAIResult
=
await
doHoneyPotAI
(
this
);
const
doHoneyPotAIResult
=
await
doHoneyPotAI
(
this
);
if
(
doHoneyPotAIResult
.
length
>
0
)
{
//如果有激活的罐子被消除,那么表示可以自动消除,则不需要进行下一步
if
(
doHoneyPotAIResult
.
length
>
0
)
{
//如果有激活的罐子被消除,那么表示可以自动消除,则不需要进行下一步
...
...
egret/src/mainScene/doConveyorAI.ts
View file @
5810d6a4
...
@@ -77,16 +77,12 @@ const getTargetConveyor = (thisObj: MainScene, targetIndex: number) => {
...
@@ -77,16 +77,12 @@ const getTargetConveyor = (thisObj: MainScene, targetIndex: number) => {
};
};
export
default
async
(
thisObj
:
MainScene
)
=>
{
export
default
async
(
thisObj
:
MainScene
)
=>
{
//移动的动画,如果是两头的需要一个带遮罩的动画,会涉及元素的复制
//复制的元素为了保险,只做动画用。
//检查与其他元素的兼容性,比如带有svga的独眼怪、果冻怪等等
//糖果兼容
const
{
elementContainer
}
=
thisObj
;
const
{
elementContainer
}
=
thisObj
;
const
conveyorList
=
thisObj
.
chapterData
.
map
.
conveyor
;
const
conveyorList
=
thisObj
.
chapterData
.
map
.
conveyor
;
if
(
!
conveyorList
)
return
;
if
(
!
conveyorList
)
return
;
const
elementsList
=
[];
//所有轨道元素组的列表
const
elementsList
=
[];
//所有轨道元素组的列表
const
targetLatticesList
:
Lattice
[][]
=
[];
//所有轨道目标地图组的列表
const
targetLatticesList
:
Lattice
[][]
=
[];
//所有轨道目标地图组的列表
const
latticesList
=
[];
//所有轨道当前地图组的列表
const
latticesList
:
Lattice
[][]
=
[];
//所有轨道当前地图组的列表
const
targetIndexsList
=
[];
const
targetIndexsList
=
[];
let
listItems
=
[];
let
listItems
=
[];
...
@@ -108,8 +104,10 @@ export default async (thisObj: MainScene) => {
...
@@ -108,8 +104,10 @@ export default async (thisObj: MainScene) => {
targetIndexs
[
0
]
=
foundTarget
;
targetIndexs
[
0
]
=
foundTarget
;
}
}
console
.
log
(
list
,
targetIndexs
);
// console.log(list, targetIndexs);
const
elements
=
list
.
map
(
index
=>
thisObj
.
lattices
[
index
].
element
);
//当前传送带元素
const
elements
=
list
.
map
(
index
=>
thisObj
.
lattices
[
index
].
element
);
//当前传送带元素
const
lattices
=
list
.
map
(
index
=>
thisObj
.
lattices
[
index
]);
//当前的lattices
const
lattices
=
list
.
map
(
index
=>
thisObj
.
lattices
[
index
]);
//当前的lattices
const
targetLattices
=
targetIndexs
.
map
(
index
=>
thisObj
.
lattices
[
index
]);
const
targetLattices
=
targetIndexs
.
map
(
index
=>
thisObj
.
lattices
[
index
]);
...
@@ -123,8 +121,6 @@ export default async (thisObj: MainScene) => {
...
@@ -123,8 +121,6 @@ export default async (thisObj: MainScene) => {
lattices
.
forEach
(
lat
=>
lat
.
element
=
null
);
lattices
.
forEach
(
lat
=>
lat
.
element
=
null
);
});
});
const
promiseList
:
Promise
<
any
>
[]
=
[];
const
promiseList
:
Promise
<
any
>
[]
=
[];
elementsList
.
forEach
((
elements
,
i
)
=>
{
elementsList
.
forEach
((
elements
,
i
)
=>
{
const
conveyor
=
conveyorList
[
i
];
const
conveyor
=
conveyorList
[
i
];
...
@@ -134,7 +130,13 @@ export default async (thisObj: MainScene) => {
...
@@ -134,7 +130,13 @@ export default async (thisObj: MainScene) => {
const
lastListIndex
=
getLastListIndex
(
conveyor
);
const
lastListIndex
=
getLastListIndex
(
conveyor
);
elements
.
forEach
((
ele
,
eleIndex
)
=>
{
elements
.
forEach
((
ele
,
eleIndex
)
=>
{
targetLattices
[
eleIndex
].
element
=
ele
;
targetLattices
[
eleIndex
].
element
=
ele
;
if
(
!
ele
)
return
;
if
(
!
ele
)
{
const
currentEleIndex
=
lattices
[
eleIndex
].
index
;
const
targetEleIndex
=
targetLattices
[
eleIndex
].
index
;
const
emptyIndex
=
thisObj
.
emptys
.
indexOf
(
currentEleIndex
);
thisObj
.
emptys
[
emptyIndex
]
=
targetEleIndex
;
return
;
}
const
targetP
=
Tool
.
getPositionByIndex
(
targetIndexs
[
eleIndex
]);
const
targetP
=
Tool
.
getPositionByIndex
(
targetIndexs
[
eleIndex
]);
const
promise
=
new
Promise
((
r
)
=>
{
const
promise
=
new
Promise
((
r
)
=>
{
//这里判断哪个是尾部的元素.
//这里判断哪个是尾部的元素.
...
...
egret/src/something/chapters/Chapter20 copy.ts
View file @
5810d6a4
import
{
ChapterData
}
from
"../interface/ChapterData"
;
import
{
ChapterData
}
from
"../interface/ChapterData"
;
import
{
PassType
}
from
"../enum/PassType"
;
import
{
ElementType
}
from
"../enum/ElementType"
;
//501-525
//501-525
export
const
Chapters20
:
ChapterData
[]
=
[
export
const
Chapters20
:
ChapterData
[]
=
[
{
baseElementTypes
:
[
0
,
1
,
2
,
3
,
4
],
bubbleProbability
:
0
,
stepCount
:
25
,
passTarget
:
{
type
:
1
,
elements
:
[{
type
:
2
,
count
:
88
}]
},
starScores
:
[
15000
,
20000
,
25000
],
map
:
{
lattices
:
[
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
4
,
1
,
1
,
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
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
4
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
],
connectedLats
:
[[
31
,
49
]],
conveyor
:
[[
24
,
60
],
[
59
,
56
],
[
47
,
20
]],
conveyorConnectedLats
:
[[
60
,
59
],
[
56
,
47
],
[
20
,
24
]],
elements
:
[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
2
,
1
,
1
,
2
,
1
,
1
,
2
,
1
,
1
,
2
,
1
,
1
,
1
,
1
,
1
,
2
,
1
,
1
,
2
,
1
,
1
,
1
,
1
,
1
,
2
,
1
,
1
,
2
,
1
,
1
,
12
,
1
,
1
,
2
,
1
,
1
,
2
,
1
,
1
,
1
,
1
,
1
,
2
,
1
,
1
,
2
,
1
,
1
,
1
,
1
,
1
,
2
,
1
,
1
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
],
baseElements
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
],
recycles
:
[],
generateLats
:
[{
index
:
0
,
type
:
null
},
{
index
:
1
,
type
:
null
},
{
index
:
2
,
type
:
null
},
{
index
:
3
,
type
:
null
},
{
index
:
5
,
type
:
null
},
{
index
:
6
,
type
:
null
},
{
index
:
7
,
type
:
null
},
{
index
:
8
,
type
:
null
},
{
index
:
13
,
type
:
null
}]
}
}
{
baseElementTypes
:
[
0
,
1
,
2
,
3
],
bubbleProbability
:
0
,
stepCount
:
27
,
passTarget
:
{
type
:
1
,
elements
:
[{
type
:
3
,
count
:
98
}]
},
starScores
:
[
15000
,
20000
,
25000
],
map
:
{
lattices
:
[
1
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
,
1
,
1
,
1
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type
:
null
},
{
index
:
2
,
type
:
null
},
{
index
:
4
,
type
:
null
},
{
index
:
6
,
type
:
null
},
{
index
:
8
,
type
:
null
},
{
index
:
10
,
type
:
null
},
{
index
:
12
,
type
:
null
},
{
index
:
14
,
type
:
null
},
{
index
:
16
,
type
:
null
}]
}
}
]
]
\ No newline at end of file
egret/src/something/chapters/Chapter20.ts
View file @
5810d6a4
...
@@ -3,9 +3,12 @@ import { ChapterData } from "../interface/ChapterData";
...
@@ -3,9 +3,12 @@ import { ChapterData } from "../interface/ChapterData";
export
const
Chapters20
:
ChapterData
[]
=
[
export
const
Chapters20
:
ChapterData
[]
=
[
{
{
baseElementTypes
:
[
0
,
1
,
2
,
3
],
bubbleProbability
:
0
,
stepCount
:
27
,
passTarget
:
{
type
:
1
,
elements
:
[{
type
:
3
,
count
:
98
}]
},
starScores
:
[
15000
,
20000
,
25000
],
map
:
{
baseElementTypes
:
[
0
,
1
,
2
,
3
],
bubbleProbability
:
0
,
stepCount
:
27
,
passTarget
:
{
type
:
1
,
elements
:
[{
type
:
3
,
count
:
98
}]
},
starScores
:
[
15000
,
20000
,
25000
],
map
:
{
lattices
:
[
1
,
0
,
2
,
0
,
1
,
0
,
1
,
0
,
1
,
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
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
0
,
1
,
0
,
0
,
1
],
connectedLats
:
[],
lattices
:
[
1
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,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generateLats
:
[{
index
:
0
,
type
:
null
},
{
index
:
2
,
type
:
null
},
{
index
:
4
,
type
:
null
},
{
index
:
6
,
type
:
null
},
{
index
:
8
,
type
:
null
},
{
index
:
10
,
type
:
null
},
{
index
:
12
,
type
:
null
},
{
index
:
14
,
type
:
null
},
{
index
:
16
,
type
:
null
}]
conveyorConnectedLats
:
[[
65
,
2
]],
elements
:
[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
12
,
1
,
12
,
1
,
12
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
2
,
1
,
2
,
1
,
1
,
1
,
1
,
4
,
1
,
2
,
1
,
2
,
1
,
4
,
1
,
1
,
4
,
12
,
2
,
12
,
2
,
12
,
4
,
1
,
1
,
1
,
1
,
2
,
1
,
2
,
1
,
1
,
1
,
1
,
1
,
1
,
2
,
1
,
2
,
1
,
1
,
1
],
baseElements
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
],
recycles
:
[],
generateLats
:
[{
index
:
0
,
type
:
null
},
{
index
:
2
,
type
:
null
},
{
index
:
4
,
type
:
null
},
{
index
:
6
,
type
:
null
},
{
index
:
8
,
type
:
null
},
{
index
:
10
,
type
:
null
},
{
index
:
12
,
type
:
null
},
{
index
:
14
,
type
:
null
},
{
index
:
16
,
type
:
null
}]
}
}
}
}
]
]
\ No newline at end of file
egret/src/something/class/Element.ts
View file @
5810d6a4
...
@@ -155,16 +155,17 @@ export class Element extends eui.Component {
...
@@ -155,16 +155,17 @@ export class Element extends eui.Component {
});
});
}
}
resetToMonsterView
(
res
:
ElementType
)
{
resetToMonsterView
(
res
:
ElementType
,
statusNum
=
0
)
{
this
.
changeSource
(
"ele"
+
res
+
"_png"
);
this
.
changeSource
(
"ele"
+
res
+
"_png"
);
this
.
monster
=
new
Monster
(
res
,
this
.
type
);
this
.
monster
=
new
Monster
(
res
,
this
.
type
,
statusNum
);
this
.
addChild
(
this
.
monster
);
this
.
addChild
(
this
.
monster
);
this
.
showImage
.
alpha
=
0
;
this
.
showImage
.
alpha
=
0
;
}
}
resetToFishView
()
{
resetToFishView
(
s
=
'toStandBy'
)
{
this
.
_fishState
=
0
;
this
.
_fishState
=
0
;
this
.
_isNeb
=
false
;
this
.
_isNeb
=
false
;
this
[
'fish'
]
=
new
Fish
();
this
[
'fish'
]
=
new
Fish
(
s
);
this
.
addChild
(
this
[
'fish'
]);
this
.
addChild
(
this
[
'fish'
]);
this
.
changeSource
(
"ele33_0_png"
);
this
.
changeSource
(
"ele33_0_png"
);
this
.
showImage
.
alpha
=
0
;
this
.
showImage
.
alpha
=
0
;
...
...
egret/src/something/class/Fish.ts
View file @
5810d6a4
...
@@ -10,31 +10,40 @@ const frames = [
...
@@ -10,31 +10,40 @@ const frames = [
];
];
export
class
Fish
extends
eui
.
Component
{
export
class
Fish
extends
eui
.
Component
{
_mv
;
_mv
;
constructor
()
{
state
;
constructor
(
s
=
'toStandBy'
)
{
super
();
super
();
this
.
initSvga
();
this
.
initSvga
(
s
);
}
}
async
initSvga
()
{
async
initSvga
(
s
)
{
const
mv
:
any
=
await
loadSvga
(
getResPath
()
+
'resource/assets/svgas/fish.svga'
);
const
mv
:
any
=
await
loadSvga
(
getResPath
()
+
'resource/assets/svgas/fish.svga'
);
this
.
_mv
=
mv
;
this
.
_mv
=
mv
;
this
.
addChild
(
mv
);
this
.
addChild
(
mv
);
mv
.
anchorOffsetX
=
80
/
2
;
mv
.
anchorOffsetX
=
80
/
2
;
mv
.
anchorOffsetY
=
80
/
2
;
mv
.
anchorOffsetY
=
80
/
2
;
this
.
addEvents
();
this
.
addEvents
();
if
(
s
==
'toStandBy'
)
this
.
toStandBy
();
this
.
toStandBy
();
if
(
s
==
'toActive'
)
this
.
toActive
();
if
(
s
==
'toExplose'
)
this
.
toExplose
();
}
}
toStandBy
()
{
toStandBy
()
{
this
.
state
=
'toStandBy'
;
this
.
_mv
.
gotoAndPlay
(
1
);
this
.
_mv
.
gotoAndPlay
(
1
);
this
.
_start
=
1
this
.
_start
=
1
this
.
_end
=
180
this
.
_end
=
180
}
}
toActive
()
{
toActive
()
{
this
.
state
=
'toActive'
;
this
.
_mv
.
gotoAndPlay
(
181
);
this
.
_mv
.
gotoAndPlay
(
181
);
this
.
_start
=
-
1
this
.
_start
=
-
1
this
.
_end
=
-
1
this
.
_end
=
-
1
}
}
toExplose
()
{
toExplose
()
{
this
.
state
=
'toExplose'
;
this
.
_mv
.
stop
();
this
.
_mv
.
stop
();
// this._mv.gotoAndPlay(361);
// this._mv.gotoAndPlay(361);
// this._start = -1
// this._start = -1
...
@@ -52,7 +61,7 @@ export class Fish extends eui.Component {
...
@@ -52,7 +61,7 @@ export class Fish extends eui.Component {
this
.
_start
=
241
;
this
.
_start
=
241
;
this
.
_end
=
360
;
this
.
_end
=
360
;
}
}
if
(
this
.
_mv
.
currentFrame
==
(
361
+
1
))
{
if
(
this
.
_mv
.
currentFrame
==
(
361
+
1
))
{
this
.
_start
=
-
1
;
this
.
_start
=
-
1
;
this
.
_end
=
-
1
;
this
.
_end
=
-
1
;
this
.
_mv
.
stop
();
this
.
_mv
.
stop
();
...
...
egret/src/something/class/Monster.ts
View file @
5810d6a4
...
@@ -6,9 +6,22 @@ const frames = [
...
@@ -6,9 +6,22 @@ const frames = [
[
1
,
120
],
[
1
,
120
],
[
121
,
360
],
[
121
,
360
],
[
361
,
600
],
[
361
,
600
],
[
601
,
960
],
[
601
,
841
],
];
];
export
class
Monster
extends
eui
.
Component
{
export
class
Monster
extends
eui
.
Component
{
resetStatusNum
(
statusNum
)
{
this
.
_statusNum
=
statusNum
;
if
(
this
.
_statusNum
>
4
)
{
this
.
_statusNum
=
4
;
this
.
removeEvents
();
}
//播放动画,动画时间要短200ms以内
if
(
this
.
_statusNum
<=
3
)
{
this
.
changeSource
();
}
}
async
nextStatus
()
{
async
nextStatus
()
{
this
.
_statusNum
++
;
this
.
_statusNum
++
;
if
(
this
.
_statusNum
>
4
)
{
if
(
this
.
_statusNum
>
4
)
{
...
@@ -43,6 +56,7 @@ export class Monster extends eui.Component {
...
@@ -43,6 +56,7 @@ export class Monster extends eui.Component {
* 状态变化 0,1,2,3
* 状态变化 0,1,2,3
*/
*/
private
_statusNum
:
number
;
private
_statusNum
:
number
;
get
statusNum
(){
return
this
.
_statusNum
}
res
:
ElementType
;
res
:
ElementType
;
_mv
;
_mv
;
...
@@ -82,7 +96,7 @@ export class Monster extends eui.Component {
...
@@ -82,7 +96,7 @@ export class Monster extends eui.Component {
}
}
changeSource
()
{
changeSource
()
{
if
(
this
.
_mv
)
if
(
this
.
_mv
&&
frames
[
this
.
_statusNum
]
)
this
.
_mv
.
gotoAndPlay
(
frames
[
this
.
_statusNum
][
0
]);
this
.
_mv
.
gotoAndPlay
(
frames
[
this
.
_statusNum
][
0
]);
}
}
}
}
\ No newline at end of file
egret/src/something/cloneElement.ts
View file @
5810d6a4
import
{
Tool
}
from
"./Tool"
;
import
{
Tool
}
from
"./Tool"
;
import
{
Element
}
from
"./class/Element"
;
import
{
Element
}
from
"./class/Element"
;
import
{
ElementType
}
from
"./enum/ElementType"
;
export
default
(
fromElement
:
Element
)
=>
{
export
default
(
fromElement
:
Element
)
=>
{
let
ele
=
Tool
.
getElement
(
fromElement
.
type
);
let
ele
=
Tool
.
getElement
(
fromElement
.
type
);
//特效加上
//特效加上
ele
.
effectType
=
fromElement
.
effectType
;
ele
.
effectType
=
fromElement
.
effectType
;
...
@@ -15,13 +16,23 @@ export default (fromElement:Element) => {
...
@@ -15,13 +16,23 @@ export default (fromElement:Element) => {
ele
.
x
=
fromElement
.
x
;
ele
.
x
=
fromElement
.
x
;
ele
.
y
=
fromElement
.
y
;
ele
.
y
=
fromElement
.
y
;
if
(
fromElement
.
isMonsterJelly
)
{
if
(
fromElement
.
isMonsterJelly
)
{
ele
.
isMonsterJelly
=
true
;
ele
.
isMonsterJelly
=
true
;
}
}
if
(
fromElement
.
candy
)
{
if
(
fromElement
.
candy
)
{
ele
.
resetToCandyView
(
fromElement
.
candy
.
baseElement
);
ele
.
resetToCandyView
(
fromElement
.
candy
.
baseElement
);
ele
.
candy
.
resetStep
(
fromElement
.
candy
.
step
);
ele
.
candy
.
resetStep
(
fromElement
.
candy
.
step
);
}
}
if
(
fromElement
.
type
==
ElementType
.
JELLY_MONSTER
)
{
ele
.
resetMonster
();
}
if
(
fromElement
.
monster
)
{
ele
.
resetToMonsterView
(
fromElement
.
monster
.
res
,
fromElement
.
monster
.
statusNum
);
// ele.monster.resetStatusNum(fromElement.monster.statusNum);
}
if
(
fromElement
.
type
==
ElementType
.
FISH
)
{
ele
.
resetToFishView
(
fromElement
[
'fish'
].
state
);
}
return
ele
;
return
ele
;
}
}
\ 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