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
6c914c8b
Commit
6c914c8b
authored
Oct 29, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
e41cc2b9
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
349 additions
and
79 deletions
+349
-79
HairballBrownDivideAni.ts
egret/src/something/anis/HairballBrownDivideAni.ts
+164
-39
Chapter4.ts
egret/src/something/chapters/Chapter4.ts
+36
-3
Chapter6.ts
egret/src/something/chapters/Chapter6.ts
+88
-4
RecoverName.ts
egret/src/something/enum/RecoverName.ts
+2
-2
AiControl.ts
egret/src/something/logic/AiControl.ts
+59
-31
No files found.
egret/src/something/anis/HairballBrownDivideAni.ts
View file @
6c914c8b
import
{
ImageAni
}
from
"../class/ImageAni"
;
import
{
Pool
}
from
"../Pool"
;
import
{
Pool
}
from
"../Pool"
;
import
{
RecoverName
}
from
"../enum/RecoverName"
;
import
{
RecoverName
}
from
"../enum/RecoverName"
;
import
{
playSound
,
SoundType
}
from
"../../soundCtrl"
;
import
{
Tool
}
from
"../Tool"
;
import
{
Tool
}
from
"../Tool"
;
import
{
ElementType
}
from
"../enum/ElementType"
;
import
{
Element
}
from
"../class/Element"
;
import
{
StateType
}
from
"../enum/StateType"
;
const
offsetX
=
71
/
2
;
const
offsetY
=
62
/
2
;
/**
/**
* 分裂的动画,待写
* 分裂的动画,待写
* 71*62
*/
*/
export
class
HairballBrownDivideAni
extends
egret
.
DisplayObjectContainer
{
export
class
HairballBrownDivideAni
extends
egret
.
DisplayObjectContainer
{
startHairball
:
Hairball
;
endHairball
:
Hairball
;
constructor
()
{
constructor
()
{
super
()
super
()
//起点处的
this
.
startHairball
=
new
Hairball
();
this
.
startHairball
.
brownFace
.
visible
=
false
;
this
.
startHairball
.
x
=
-
offsetX
;
this
.
startHairball
.
y
=
-
offsetY
;
this
.
addChild
(
this
.
startHairball
);
//移动的
this
.
endHairball
=
new
Hairball
();
this
.
endHairball
.
x
=
-
offsetX
;
this
.
endHairball
.
y
=
-
offsetY
;
this
.
addChild
(
this
.
endHairball
);
}
}
play
(
type
:
StateType
,
startP
:
number
[],
endP
:
number
[],
callback
:
Function
)
{
reset
()
{
var
source
:
string
;
this
.
startHairball
.
eyesDown
.
scaleY
=
1.5
;
switch
(
type
)
{
this
.
startHairball
.
visible
=
false
;
case
StateType
.
HAIRBALLBLACK
:
this
.
endHairball
.
x
=
-
offsetX
;
source
=
"ele"
+
ElementType
.
HAIRBALLBLACK
+
"_png"
;
this
.
endHairball
.
y
=
-
offsetY
;
break
;
this
.
endHairball
.
brownFace
.
visible
=
true
;
case
StateType
.
HAIRBALLGREY
:
this
.
endHairball
.
greyFace
.
alpha
=
0
;
source
=
"ele"
+
ElementType
.
HAIRBALLGREY
+
"_png"
;
}
break
;
play
(
startP
:
number
[],
endP
:
number
[],
callback
:
Function
)
{
case
StateType
.
HAIRBALLBROWN
:
this
.
reset
();
source
=
"ele"
+
ElementType
.
HAIRBALLBROWN
+
"_png"
;
var
oriEyeX
=
10.99
;
break
;
var
oriEyeY
=
24.66
;
default
:
//判断上下左右,
source
=
"ele"
+
ElementType
.
HAIRBALLGREY
+
"_png"
;
var
obj
=
{
x
:
-
offsetX
,
y
:
-
offsetY
};
//整体的位置跳动
break
var
eyeObj
=
{
x
:
oriEyeX
,
y
:
oriEyeY
};
//眼睛的移动
//一个位置不能移动,都相等
if
(
Math
.
abs
(
endP
[
0
]
-
startP
[
0
])
<=
0.001
&&
Math
.
abs
(
endP
[
1
]
-
startP
[
1
])
<=
0.001
)
{
}
//x相等 上下
else
if
(
Math
.
abs
(
endP
[
0
]
-
startP
[
0
])
<=
0.001
)
{
//下
if
(
endP
[
1
]
-
startP
[
1
]
>
0
)
{
obj
.
y
+=
Tool
.
height
;
eyeObj
.
y
+=
4
;
}
//上
else
{
obj
.
y
-=
Tool
.
height
;
eyeObj
.
y
-=
4
;
}
}
//y相等 左右
else
{
//左
if
(
endP
[
0
]
-
startP
[
0
]
>
0
)
{
obj
.
x
+=
Tool
.
width
;
eyeObj
.
x
+=
4
;
}
//右
else
{
obj
.
x
-=
Tool
.
width
;
eyeObj
.
x
-=
4
;
}
}
}
var
texture
:
egret
.
Texture
=
RES
.
getRes
(
source
)
this
.
anchorOffsetX
=
texture
.
textureWidth
/
2
;
this
.
anchorOffsetY
=
texture
.
textureHeight
;
//自己的
this
.
x
=
startP
[
0
];
this
.
x
=
startP
[
0
];
this
.
y
=
startP
[
1
]
+
texture
.
textureHeight
/
2
;
this
.
y
=
startP
[
1
];
egret
.
Tween
.
get
(
this
)
.
to
({
scaleX
:
1.2
,
scaleY
:
0.8
},
50
)
//整体的移动
.
to
({
scaleX
:
0.8
,
scaleY
:
1.2
},
50
)
let
tweenPosAll
=
egret
.
Tween
.
get
(
this
.
endHairball
);
.
to
({
scaleX
:
1
,
scaleY
:
1
},
50
)
for
(
var
i
=
0
;
i
<
5
;
i
++
)
{
.
to
({
scaleX
:
1.2
,
scaleY
:
0.8
},
50
)
tweenPosAll
.
to
({
x
:
-
offsetX
-
1
},
20
)
.
to
({
scaleX
:
0.8
,
scaleY
:
1.2
},
50
)
.
to
({
x
:
-
offsetX
+
2
},
20
)
.
to
({
scaleX
:
1
,
scaleY
:
1
},
50
)
.
to
({
x
:
-
offsetX
},
20
)
}
tweenPosAll
.
call
(()
=>
{
this
.
startHairball
.
visible
=
true
;
})
tweenPosAll
.
to
(
obj
,
200
)
//褐色变灰色,灰色透明度到1
egret
.
Tween
.
get
(
this
.
endHairball
.
greyFace
)
.
wait
(
100
)
.
to
({
alpha
:
1
},
100
)
.
call
(()
=>
{
this
.
endHairball
.
brownFace
.
visible
=
false
;
})
//endHairball的眼白
egret
.
Tween
.
get
(
this
.
endHairball
.
eyesDown
)
.
wait
(
50
)
.
to
({
scaleY
:
1.5
},
50
)
.
wait
(
420
)
.
to
({
scaleY
:
1
},
30
)
//startHairball的眼白
egret
.
Tween
.
get
(
this
.
startHairball
.
eyesDown
)
.
wait
(
520
)
.
to
({
scaleY
:
1
},
30
)
//endHairball的眼珠的移动
egret
.
Tween
.
get
(
this
.
endHairball
.
eyes
)
.
wait
(
200
)
.
to
(
eyeObj
,
30
)
.
wait
(
290
)
.
to
({
x
:
oriEyeX
,
y
:
oriEyeY
},
30
)
.
call
(()
=>
{
.
call
(()
=>
{
//回收元素
//回收元素
if
(
this
.
parent
)
this
.
parent
.
removeChild
(
this
);
if
(
this
.
parent
)
this
.
parent
.
removeChild
(
this
);
Pool
.
recover
(
RecoverName
.
HAIRBALL
JUMP
_ANI
,
this
)
Pool
.
recover
(
RecoverName
.
HAIRBALL
BROWNDIVIDE
_ANI
,
this
)
//回调
//回调
callback
();
callback
();
})
})
egret
.
Tween
.
get
(
this
)
.
to
({
x
:
endP
[
0
],
y
:
endP
[
1
]
+
texture
.
textureHeight
/
2
},
300
,
egret
.
Ease
.
sineInOut
)
}
}
}
}
/**
* 整个球
*/
class
Hairball
extends
egret
.
DisplayObjectContainer
{
brownFace
:
egret
.
Bitmap
;
greyFace
:
egret
.
Bitmap
;
eyesDown
:
EyesDown
;
eyes
:
Eyes
;
constructor
()
{
super
();
this
.
brownFace
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"brownBallFace_png"
));
this
.
addChild
(
this
.
brownFace
);
this
.
greyFace
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"greyBallFace_png"
));
this
.
addChild
(
this
.
greyFace
);
this
.
eyesDown
=
new
EyesDown
();
this
.
eyesDown
.
x
=
10
;
this
.
eyesDown
.
y
=
32.66
;
this
.
addChild
(
this
.
eyesDown
);
this
.
eyes
=
new
Eyes
();
this
.
eyes
.
x
=
10.99
;
this
.
eyes
.
y
=
24.66
;
this
.
addChild
(
this
.
eyes
);
}
}
/**
* 眼睛的,整体位置10.99,24.66
*/
class
Eyes
extends
egret
.
DisplayObjectContainer
{
left
:
egret
.
Bitmap
;
right
:
egret
.
Bitmap
;
constructor
()
{
super
();
var
texture
:
egret
.
Texture
=
RES
.
getRes
(
"eyeSingle_png"
)
this
.
left
=
new
egret
.
Bitmap
(
texture
);
this
.
addChild
(
this
.
left
);
this
.
right
=
new
egret
.
Bitmap
(
texture
);
this
.
right
.
x
=
27.85
;
this
.
addChild
(
this
.
right
)
}
}
/**
* 整体位置是10,32.66
*/
class
EyesDown
extends
egret
.
DisplayObjectContainer
{
left
:
egret
.
Bitmap
;
right
:
egret
.
Bitmap
;
constructor
()
{
super
();
this
.
left
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"eyeDownLeft_png"
));
this
.
left
.
y
=
-
10
;
this
.
addChild
(
this
.
left
);
this
.
right
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"eyeDownRight_png"
));
this
.
right
.
x
=
27.51
;
this
.
right
.
y
=
-
10
;
this
.
addChild
(
this
.
right
)
}
}
egret/src/something/chapters/Chapter4.ts
View file @
6c914c8b
...
@@ -6,7 +6,7 @@ import { ElementType } from "../enum/ElementType";
...
@@ -6,7 +6,7 @@ import { ElementType } from "../enum/ElementType";
* 61到80关数据
* 61到80关数据
*/
*/
export
const
Chapters4
:
ChapterData
[]
=
[
export
const
Chapters4
:
ChapterData
[]
=
[
//61
测试鸡蛋
//61
鸡蛋引导,待调整
{
{
baseElementTypes
:
[
0
,
4
,
2
,
3
],
baseElementTypes
:
[
0
,
4
,
2
,
3
],
bubbleProbability
:
0
,
bubbleProbability
:
0
,
...
@@ -14,17 +14,50 @@ export const Chapters4: ChapterData[] = [
...
@@ -14,17 +14,50 @@ export const Chapters4: ChapterData[] = [
passTarget
:
{
type
:
1
,
elements
:
[{
type
:
1
,
count
:
30
}]
},
passTarget
:
{
type
:
1
,
elements
:
[{
type
:
1
,
count
:
30
}]
},
starScores
:
[
8000
,
15000
,
22000
],
starScores
:
[
8000
,
15000
,
22000
],
map
:
{
map
:
{
lattices
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
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
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
0
,
0
,
0
],
lattices
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
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
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
0
,
0
,
0
],
connectedLats
:
[],
connectedLats
:
[],
elements
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
6
,
1
,
1
,
1
,
6
,
1
,
1
,
1
,
1
,
6
,
1
,
1
,
1
,
6
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
0
,
0
,
0
],
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
],
elements
:
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
6
,
1
,
1
,
1
,
6
,
1
,
1
,
1
,
1
,
6
,
1
,
1
,
1
,
6
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
0
,
0
,
0
],
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
:
[],
recycles
:
[],
generateLats
:
[
generateLats
:
[
{
index
:
12
,
type
:
null
},
{
index
:
12
,
type
:
null
},
{
index
:
13
,
type
:
null
},
{
index
:
13
,
type
:
null
},
{
index
:
14
,
type
:
null
},
{
index
:
14
,
type
:
null
},
{
index
:
20
,
type
:
null
},
{
index
:
20
,
type
:
null
},
{
index
:
24
,
type
:
null
},
{
index
:
24
,
type
:
null
},
{
index
:
28
,
type
:
null
},
{
index
:
28
,
type
:
null
},
{
index
:
34
,
type
:
null
},
{
index
:
34
,
type
:
null
},
{
index
:
36
,
type
:
null
},
{
index
:
36
,
type
:
null
},
{
index
:
44
,
type
:
null
}
{
index
:
44
,
type
:
null
}
...
...
egret/src/something/chapters/Chapter6.ts
View file @
6c914c8b
This diff is collapsed.
Click to expand it.
egret/src/something/enum/RecoverName.ts
View file @
6c914c8b
...
@@ -57,7 +57,7 @@ export enum RecoverName {
...
@@ -57,7 +57,7 @@ export enum RecoverName {
LOCK_STATE
=
"LockState"
,
LOCK_STATE
=
"LockState"
,
BUBBLE_STATE
=
"BubbleState"
,
BUBBLE_STATE
=
"BubbleState"
,
HAIRBALLGREY_STATE
=
"HairballGreyState"
,
HAIRBALLGREY_STATE
=
"HairballGreyState"
,
HAIRBALLBLACK_STATE
=
"Hairball
Grey
State"
,
HAIRBALLBLACK_STATE
=
"Hairball
Black
State"
,
HAIRBALLBROWN_STATE
=
"Hairball
Grey
State"
,
HAIRBALLBROWN_STATE
=
"Hairball
Brown
State"
,
}
}
\ No newline at end of file
egret/src/something/logic/AiControl.ts
View file @
6c914c8b
...
@@ -13,6 +13,7 @@ import { BubbleAni } from "../anis/BubbleAni";
...
@@ -13,6 +13,7 @@ import { BubbleAni } from "../anis/BubbleAni";
import
{
Element
}
from
"../class/Element"
;
import
{
Element
}
from
"../class/Element"
;
import
{
HairballBrownState
}
from
"../states/HairballBrownState"
;
import
{
HairballBrownState
}
from
"../states/HairballBrownState"
;
import
{
HairballJumpAni
}
from
"../anis/HairballJumpAni"
;
import
{
HairballJumpAni
}
from
"../anis/HairballJumpAni"
;
import
{
HairballBrownDivideAni
}
from
"../anis/HairballBrownDivideAni"
;
//孵鸡的数量
//孵鸡的数量
const
chickenNum
:
number
=
4
const
chickenNum
:
number
=
4
...
@@ -361,10 +362,18 @@ export class AiControl {
...
@@ -361,10 +362,18 @@ export class AiControl {
}
}
//分裂的优先,因为存在多出状态,不需要多次,按顺序就行
//分裂的优先,因为存在多出状态,不需要多次,按顺序就行
let
countDivide
=
0
;
this
.
divideAni
(
thisObj
,
divideBallIndexs
,
callbackOperation
)
let
countDivideAll
=
divideBallIndexs
.
length
;
//跳动的,
for
(
var
a
=
0
;
a
<
countDivideAll
;
a
++
)
{
this
.
jumpAni
(
thisObj
,
jumpBallIndexs
,
callbackOperation
)
let
indexFrom
=
divideBallIndexs
[
a
];
//唤醒的
this
.
awakeAni
(
thisObj
,
awakeBallIndexs
,
callbackOperation
)
}
private
divideAni
(
thisObj
:
MainScene
,
indexs
:
number
[],
callback
:
Function
)
{
let
count
=
0
;
let
countAll
=
indexs
.
length
;
for
(
var
a
=
0
;
a
<
countAll
;
a
++
)
{
let
indexFrom
=
indexs
[
a
];
let
elementFrom
:
Element
=
thisObj
.
lattices
[
indexFrom
].
element
;
let
elementFrom
:
Element
=
thisObj
.
lattices
[
indexFrom
].
element
;
//判断是否能分裂
//判断是否能分裂
let
indexEnd
=
judgeActionIndex
(
indexFrom
,
thisObj
.
lattices
);
let
indexEnd
=
judgeActionIndex
(
indexFrom
,
thisObj
.
lattices
);
...
@@ -377,31 +386,54 @@ export class AiControl {
...
@@ -377,31 +386,54 @@ export class AiControl {
let
elementEnd
=
thisObj
.
lattices
[
indexEnd
].
element
;
let
elementEnd
=
thisObj
.
lattices
[
indexEnd
].
element
;
//变成灰色毛球
//变成灰色毛球
elementEnd
.
setState
(
StateType
.
HAIRBALLGREY
,
true
);
elementEnd
.
setState
(
StateType
.
HAIRBALLGREY
,
true
);
//动画
//两个都隐藏
setTimeout
(()
=>
{
elementFrom
.
getState
(
StateType
.
HAIRBALLGREY
).
visible
=
false
;
elementEnd
.
getState
(
StateType
.
HAIRBALLGREY
).
visible
=
false
;
//分裂动画
let
divideAni
:
HairballBrownDivideAni
=
Pool
.
takeOut
(
RecoverName
.
HAIRBALLBROWNDIVIDE_ANI
)
if
(
!
divideAni
)
divideAni
=
new
HairballBrownDivideAni
()
thisObj
.
addChild
(
divideAni
);
divideAni
.
play
(
Tool
.
getPositionByIndex
(
indexFrom
),
Tool
.
getPositionByIndex
(
indexEnd
),
()
=>
{
//显示
elementFrom
.
getState
(
StateType
.
HAIRBALLGREY
).
visible
=
true
;
elementEnd
.
getState
(
StateType
.
HAIRBALLGREY
).
visible
=
true
;
//都执行了
//都执行了
if
(
++
countDivide
==
countDivideAll
)
callbackOperation
();
if
(
++
count
==
countAll
)
callback
();
},
200
);
})
// setTimeout(()=>{
// if (++count == countAll) callback();
// },200)
}
}
//没有则执行
直接变灰动画
//没有则执行
传自身位置
else
{
else
{
//去掉原先的褐色
//去掉原先的褐色
elementFrom
.
setState
(
StateType
.
HAIRBALLBROWN
,
false
);
elementFrom
.
setState
(
StateType
.
HAIRBALLBROWN
,
false
);
//变成灰色毛球
//变成灰色毛球
elementFrom
.
setState
(
StateType
.
HAIRBALLGREY
,
true
);
elementFrom
.
setState
(
StateType
.
HAIRBALLGREY
,
true
);
//隐藏
elementFrom
.
getState
(
StateType
.
HAIRBALLGREY
).
visible
=
false
;
//动画
//动画
setTimeout
(()
=>
{
let
divideAni
:
HairballBrownDivideAni
=
Pool
.
takeOut
(
RecoverName
.
HAIRBALLBROWNDIVIDE_ANI
)
if
(
!
divideAni
)
divideAni
=
new
HairballBrownDivideAni
()
thisObj
.
addChild
(
divideAni
);
divideAni
.
play
(
Tool
.
getPositionByIndex
(
indexFrom
),
Tool
.
getPositionByIndex
(
indexFrom
),
()
=>
{
//显示
elementFrom
.
getState
(
StateType
.
HAIRBALLGREY
).
visible
=
true
;
//都执行了
//都执行了
if
(
++
countDivide
==
countDivideAll
)
callbackOperation
();
if
(
++
count
==
countAll
)
callback
();
},
200
);
})
// setTimeout(()=>{
// if (++count == countAll) callback();
// },200)
}
}
}
}
//跳动的,
}
let
countJump
=
0
;
private
jumpAni
(
thisObj
:
MainScene
,
indexs
:
{
type
:
StateType
,
index
:
number
}[],
callback
:
Function
)
{
let
countJumpAll
=
jumpBallIndexs
.
length
;
let
count
=
0
;
for
(
var
a
=
0
;
a
<
jumpBallIndexs
.
length
;
a
++
)
{
let
countAll
=
indexs
.
length
;
let
data
:
{
type
:
StateType
,
index
:
number
}
=
jumpBallIndexs
[
a
];
for
(
var
a
=
0
;
a
<
indexs
.
length
;
a
++
)
{
let
data
:
{
type
:
StateType
,
index
:
number
}
=
indexs
[
a
];
let
indexFrom
=
data
.
index
;
let
indexFrom
=
data
.
index
;
let
elementFrom
:
Element
=
thisObj
.
lattices
[
indexFrom
].
element
;
let
elementFrom
:
Element
=
thisObj
.
lattices
[
indexFrom
].
element
;
let
stateType
:
StateType
=
data
.
type
;
let
stateType
:
StateType
=
data
.
type
;
...
@@ -421,33 +453,29 @@ export class AiControl {
...
@@ -421,33 +453,29 @@ export class AiControl {
let
jumpAni
:
HairballJumpAni
=
Pool
.
takeOut
(
RecoverName
.
HAIRBALLJUMP_ANI
)
let
jumpAni
:
HairballJumpAni
=
Pool
.
takeOut
(
RecoverName
.
HAIRBALLJUMP_ANI
)
if
(
!
jumpAni
)
jumpAni
=
new
HairballJumpAni
()
if
(
!
jumpAni
)
jumpAni
=
new
HairballJumpAni
()
thisObj
.
addChild
(
jumpAni
);
thisObj
.
addChild
(
jumpAni
);
jumpAni
.
play
(
stateType
,
Tool
.
getPositionByIndex
(
indexFrom
),
Tool
.
getPositionByIndex
(
indexEnd
),
()
=>
{
jumpAni
.
play
(
stateType
,
Tool
.
getPositionByIndex
(
indexFrom
),
Tool
.
getPositionByIndex
(
indexEnd
),
()
=>
{
//显示
//显示
elementEnd
.
getState
(
stateType
).
visible
=
true
;
elementEnd
.
getState
(
stateType
).
visible
=
true
;
//都执行了
//都执行了
if
(
++
count
Jump
==
countJumpAll
)
callbackOperation
();
if
(
++
count
==
countAll
)
callback
();
})
})
// setTimeout(()=>{
// //都执行了
// if (++countJump == countJumpAll) callbackOperation();
// },200)
}
}
//没有则计数
//没有则计数
else
{
else
{
if
(
++
count
Jump
==
countJumpAll
)
callbackOperation
();
if
(
++
count
==
countAll
)
callback
();
}
}
}
}
//唤醒的
}
let
countAwake
=
0
;
private
awakeAni
(
thisObj
:
MainScene
,
indexs
:
number
[],
callback
:
Function
)
{
let
countAwakeAll
=
awakeBallIndexs
.
length
;
let
count
=
0
;
for
(
var
a
=
0
;
a
<
awakeBallIndexs
.
length
;
a
++
)
{
let
countAll
=
indexs
.
length
;
let
indexFrom
=
awakeBallIndexs
[
a
];
for
(
var
a
=
0
;
a
<
indexs
.
length
;
a
++
)
{
let
indexFrom
=
indexs
[
a
];
let
elementFrom
:
Element
=
thisObj
.
lattices
[
indexFrom
].
element
;
let
elementFrom
:
Element
=
thisObj
.
lattices
[
indexFrom
].
element
;
//唤醒的动画直接写在自己的blackState里吧,然后换图
//唤醒的动画直接写在自己的blackState里吧,然后换图
setTimeout
(()
=>
{
setTimeout
(()
=>
{
//都执行了
//都执行了
if
(
++
count
Awake
==
countAwakeAll
)
callbackOperation
();
if
(
++
count
==
countAll
)
callback
();
},
200
);
},
200
);
}
}
}
}
...
...
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