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
73a07ec1
Commit
73a07ec1
authored
Feb 18, 2020
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
8ecb8e51
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
28 deletions
+69
-28
MainScene.ts
egret/src/mainScene/MainScene.ts
+22
-3
doHoneyPotAI.ts
egret/src/mainScene/doHoneyPotAI.ts
+18
-0
doMonsterAI.ts
egret/src/mainScene/doMonsterAI.ts
+1
-1
Element.ts
egret/src/something/class/Element.ts
+3
-0
HoneyPot.ts
egret/src/something/class/HoneyPot.ts
+4
-18
HoneyPotElement.ts
egret/src/something/class/HoneyPotElement.ts
+21
-6
No files found.
egret/src/mainScene/MainScene.ts
View file @
73a07ec1
...
@@ -93,10 +93,10 @@ import { createData } from '../startScene/StartScene';
...
@@ -93,10 +93,10 @@ import { createData } from '../startScene/StartScene';
import
Utils
from
'../Utils'
;
import
Utils
from
'../Utils'
;
import
{
DataManager
}
from
'./../../libs/tw/manager/DataManager'
;
import
{
DataManager
}
from
'./../../libs/tw/manager/DataManager'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
doFishAI
from
'./doFishAI'
;
import
doHoneyPotAI
from
'./doHoneyPotAI'
;
import
doMonsterAI
from
'./doMonsterAI'
;
import
doMonsterAI
from
'./doMonsterAI'
;
import
jellyMonsterAI
from
'./jellyMonsterAI'
;
import
jellyMonsterAI
from
'./jellyMonsterAI'
;
import
doFishAI
from
'./doFishAI'
;
import
HoneyPotElement
from
'../something/class/HoneyPotElement'
;
const
aniClass
=
{
const
aniClass
=
{
"BoomAni"
:
BoomAni
,
"BoomAni"
:
BoomAni
,
...
@@ -762,7 +762,7 @@ export default class MainScene extends Scene {
...
@@ -762,7 +762,7 @@ export default class MainScene extends Scene {
monster
.
resetMonster
();
monster
.
resetMonster
();
break
;
break
;
case
ElementConfigType
.
HONEY_POT
:
case
ElementConfigType
.
HONEY_POT
:
let
honeyPot
:
Element
=
Tool
.
getElement
(
ElementType
.
HONEY_POT
);
let
honeyPot
:
Element
=
Tool
.
getElement
(
ElementType
.
HONEY_POT
);
honeyPot
.
x
=
p
[
0
];
honeyPot
.
x
=
p
[
0
];
honeyPot
.
y
=
p
[
1
];
honeyPot
.
y
=
p
[
1
];
this
.
elementContainer
.
addChild
(
honeyPot
);
this
.
elementContainer
.
addChild
(
honeyPot
);
...
@@ -2000,6 +2000,14 @@ export default class MainScene extends Scene {
...
@@ -2000,6 +2000,14 @@ export default class MainScene extends Scene {
this
.
eliminate
();
this
.
eliminate
();
return
return
}
}
const
doHoneyPotAIResult
=
await
doHoneyPotAI
(
this
);
if
(
doHoneyPotAIResult
.
length
>
0
)
{
//如果有激活的罐子被消除,那么表示可以自动消除,则不需要进行下一步
doHoneyPotAIResult
.
forEach
((
index
)
=>
{
this
.
eliminatedElements
.
push
(
index
);
});
this
.
eliminate
();
return
;
};
const
doFishResult
=
await
doFishAI
(
this
);
const
doFishResult
=
await
doFishAI
(
this
);
if
(
doFishResult
.
length
>
0
)
{
if
(
doFishResult
.
length
>
0
)
{
//这里应该先播放动画,播放完了,再执行消除
//这里应该先播放动画,播放完了,再执行消除
...
@@ -2512,6 +2520,14 @@ export default class MainScene extends Scene {
...
@@ -2512,6 +2520,14 @@ export default class MainScene extends Scene {
//鸡蛋动效
//鸡蛋动效
this
.
playAni
(
RecoverName
.
EGGBROKEN_ANI
,
p
)
this
.
playAni
(
RecoverName
.
EGGBROKEN_ANI
,
p
)
}
}
else
if
(
ele
.
type
==
ElementType
.
HONEY_POT
)
{
//蜂蜜罐子
if
(
ele
.
canElimite
)
{
this
.
recoverEle
(
index
);
this
.
playAni
(
RecoverName
.
ELEDIS_ANI
,
p
)
}
else
ele
.
onElimiate
();
}
//大红包
//大红包
else
if
(
ele
.
type
==
ElementType
.
FESTIVALELE_BIG
)
{
else
if
(
ele
.
type
==
ElementType
.
FESTIVALELE_BIG
)
{
//动画也在放这里
//动画也在放这里
...
@@ -3127,6 +3143,9 @@ export default class MainScene extends Scene {
...
@@ -3127,6 +3143,9 @@ export default class MainScene extends Scene {
this
.
checkNebEle
(
latttice
,
(
lat
)
=>
{
this
.
checkNebEle
(
latttice
,
(
lat
)
=>
{
return
lat
&&
lat
.
element
&&
lat
.
element
.
type
==
ElementType
.
ROCK
return
lat
&&
lat
.
element
&&
lat
.
element
.
type
==
ElementType
.
ROCK
});
});
this
.
checkNebEle
(
latttice
,
(
lat
)
=>
{
return
lat
&&
lat
.
element
&&
lat
.
element
.
type
==
ElementType
.
HONEY_POT
});
//如果附近有果冻
//如果附近有果冻
this
.
checkNebEle
(
latttice
,
(
lat
)
=>
{
this
.
checkNebEle
(
latttice
,
(
lat
)
=>
{
return
lat
&&
lat
.
element
&&
lat
.
element
.
type
==
ElementType
.
JELLY
return
lat
&&
lat
.
element
&&
lat
.
element
.
type
==
ElementType
.
JELLY
...
...
egret/src/mainScene/doHoneyPotAI.ts
0 → 100644
View file @
73a07ec1
import
{
ElementType
}
from
"../something/enum/ElementType"
;
import
MainScene
from
"./MainScene"
;
/**
* 罐子爆炸
*/
export
default
async
(
thisObj
:
MainScene
)
=>
{
//先找出所有激活的罐子
const
activeElementIndexs
:
number
[]
=
[];
for
(
var
i
=
0
;
i
<
thisObj
.
lattices
.
length
;
i
++
)
{
const
lattice
=
thisObj
.
lattices
[
i
]
if
(
lattice
&&
lattice
.
element
&&
lattice
.
element
.
type
==
ElementType
.
HONEY_POT
&&
lattice
.
element
.
isActive
)
{
activeElementIndexs
.
push
(
i
);
lattice
.
element
.
canElimite
=
true
;
}
}
console
.
log
(
'激活的罐子'
,
activeElementIndexs
)
return
activeElementIndexs
}
\ No newline at end of file
egret/src/mainScene/doMonsterAI.ts
View file @
73a07ec1
...
@@ -79,7 +79,7 @@ export default async (thisObj: MainScene) => {
...
@@ -79,7 +79,7 @@ export default async (thisObj: MainScene) => {
activeMosterEles
[
index
].
monster
.
resetStatus
();
activeMosterEles
[
index
].
monster
.
resetStatus
();
}
}
console
.
log
(
'激活的怪物数据'
,
foundsResult
);
//
console.log('激活的怪物数据', foundsResult);
//禁用所有的怪物,再开始播放怪物释放技能的动画,完了再播放怪物睡眠、苏醒的动画,再重新启用怪物
//禁用所有的怪物,再开始播放怪物释放技能的动画,完了再播放怪物睡眠、苏醒的动画,再重新启用怪物
return
genarateEffect
;
//如果有苏醒的怪物
return
genarateEffect
;
//如果有苏醒的怪物
}
}
\ No newline at end of file
egret/src/something/class/Element.ts
View file @
73a07ec1
...
@@ -668,4 +668,7 @@ export class Element extends eui.Component {
...
@@ -668,4 +668,7 @@ export class Element extends eui.Component {
}
}
get
candy
()
{
return
this
.
_candy
}
get
candy
()
{
return
this
.
_candy
}
resetView
(){}
resetView
(){}
onElimiate
(){}
get
isActive
()
{
return
false
}
canElimite
:
boolean
;
}
}
\ No newline at end of file
egret/src/something/class/HoneyPot.ts
View file @
73a07ec1
...
@@ -11,32 +11,18 @@ const frames = [
...
@@ -11,32 +11,18 @@ const frames = [
export
class
HoneyPot
extends
eui
.
Component
{
export
class
HoneyPot
extends
eui
.
Component
{
async
nextStatus
()
{
async
nextStatus
()
{
this
.
_statusNum
++
;
this
.
_statusNum
++
;
if
(
this
.
_statusNum
>
4
)
{
if
(
this
.
_statusNum
>=
3
)
{
this
.
_statusNum
=
4
;
this
.
removeEvents
();
this
.
removeEvents
();
}
}
//播放动画,动画时间要短200ms以内
//播放动画,动画时间要短200ms以内
if
(
this
.
_statusNum
<=
3
)
{
if
(
this
.
_statusNum
<=
2
)
{
createMonsterStatusAni
(
this
.
x
,
this
.
y
,
this
.
parent
);
createMonsterStatusAni
(
this
.
x
,
this
.
y
,
this
.
parent
);
this
.
changeSource
();
this
.
changeSource
();
}
}
}
}
hide
()
{
get
isActive
():
boolean
{
this
.
_mv
.
scaleX
=
this
.
_mv
.
scaleY
=
0
;
return
this
.
_statusNum
>=
3
;
}
resetStatus
()
{
this
.
addEvents
();
this
.
_statusNum
=
0
;
this
.
_mv
.
gotoAndPlay
(
1
);
egret
.
Tween
.
get
(
this
.
_mv
).
to
({
scaleY
:
1
,
scaleX
:
1
},
500
,
egret
.
Ease
.
backOut
).
call
(()
=>
{
this
.
changeSource
();
})
}
get
active
():
boolean
{
return
this
.
_statusNum
==
4
;
}
}
/**
/**
...
...
egret/src/something/class/HoneyPotElement.ts
View file @
73a07ec1
import
{
Element
}
from
"./Element"
;
import
{
ElementType
}
from
"../enum/ElementType"
;
import
{
ElementType
}
from
"../enum/ElementType"
;
import
{
Monster
}
from
"./Monster
"
;
import
{
Element
}
from
"./Element
"
;
import
{
HoneyPot
}
from
"./HoneyPot"
;
import
{
HoneyPot
}
from
"./HoneyPot"
;
export
default
class
HoneyPotElement
extends
Element
{
export
default
class
HoneyPotElement
extends
Element
{
honeyPot
:
HoneyPot
;
resetView
(){
honeyPot
:
HoneyPot
;
const
type
=
ElementType
.
HONEY_POT
;
resetView
()
{
this
.
honeyPot
=
new
HoneyPot
();
this
.
honeyPot
=
new
HoneyPot
();
this
.
addChild
(
this
.
honeyPot
);
this
.
addChild
(
this
.
honeyPot
);
this
.
showImage
.
alpha
=
0
;
this
.
showImage
.
alpha
=
0
;
}
}
onElimiate
()
{
this
.
honeyPot
.
nextStatus
();
}
get
isActive
()
{
return
this
.
honeyPot
.
isActive
}
reset
(
type
:
ElementType
)
{
super
.
reset
(
type
);
if
(
this
.
honeyPot
)
{
this
.
removeChild
(
this
.
honeyPot
);
this
.
honeyPot
.
removeEvents
();
this
.
honeyPot
=
null
;
}
}
}
}
\ 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