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
7d469bcf
Commit
7d469bcf
authored
Feb 07, 2020
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
1fb8bca2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
86 additions
and
6 deletions
+86
-6
ChocolateDivideAni.ts
egret/src/something/anis/ChocolateDivideAni.ts
+76
-0
RecoverName.ts
egret/src/something/enum/RecoverName.ts
+1
-0
AiControl.ts
egret/src/something/logic/AiControl.ts
+9
-6
No files found.
egret/src/something/anis/ChocolateDivideAni.ts
0 → 100644
View file @
7d469bcf
import
{
Pool
}
from
"../Pool"
;
import
{
RecoverName
}
from
"../enum/RecoverName"
;
//70是chocolateFour的尺寸,偷懒,固定了
var
x1
=
70
/
4
-
70
/
2
;
var
x2
=
70
/
4
*
3
-
70
/
2
;
var
y1
=
70
/
4
-
70
/
2
;
var
y2
=
70
/
4
*
3
-
70
/
2
;
var
dis1
=
20
;
var
dis2
=
40
;
const
fourPositions
:
number
[][]
=
[
[
x1
,
y1
],
[
x2
,
y1
],
[
x1
,
y2
],
[
x2
,
y2
]
]
const
f1
:
number
[][]
=
[
[
x1
-
dis1
,
y1
-
dis1
],
[
x2
+
dis1
,
y1
-
dis1
],
[
x1
-
dis1
,
y2
+
dis1
],
[
x2
+
dis1
,
y2
+
dis1
]
]
const
f2
:
number
[][]
=
[
[
x1
-
dis2
,
y1
-
dis2
],
[
x2
+
dis2
,
y1
-
dis2
],
[
x1
-
dis2
,
y2
+
dis2
],
[
x2
+
dis2
,
y2
+
dis2
]
]
/**
* 巧克力分裂动效
*/
export
class
ChocolateDivideAni
extends
egret
.
DisplayObjectContainer
{
constructor
()
{
super
()
for
(
var
i
=
0
;
i
<
4
;
i
++
)
{
var
t
:
egret
.
Texture
=
RES
.
getRes
(
"chocolate"
+
i
+
"_png"
);
var
b
=
new
egret
.
Bitmap
(
t
);
b
.
anchorOffsetX
=
t
.
textureWidth
/
2
;
b
.
anchorOffsetY
=
t
.
textureHeight
/
2
;
b
.
scaleX
=
32
/
t
.
textureWidth
;
//32是缩小的尺寸
b
.
scaleY
=
32
/
t
.
textureHeight
;
b
.
x
=
fourPositions
[
i
][
0
];
b
.
y
=
fourPositions
[
i
][
1
];
this
.
addChild
(
b
);
this
[
"chocolate"
+
i
]
=
b
;
}
}
play
(
p
:
number
[])
{
this
.
x
=
p
[
0
];
this
.
y
=
p
[
1
];
//重置位置和透明度
for
(
var
i
=
0
;
i
<
4
;
i
++
)
{
let
ii
=
i
;
let
chocolate
:
egret
.
Bitmap
=
this
[
"chocolate"
+
i
];
chocolate
.
x
=
fourPositions
[
i
][
0
];
chocolate
.
y
=
fourPositions
[
i
][
1
];
chocolate
.
scaleX
=
chocolate
.
scaleY
=
32
/
70
chocolate
.
alpha
=
1
;
egret
.
Tween
.
get
(
chocolate
)
.
wait
(
100
)
.
to
({
x
:
f1
[
ii
][
0
],
y
:
f1
[
ii
][
1
],
scaleX
:
40
/
70
,
scaleY
:
40
/
70
},
300
)
.
wait
(
100
)
.
to
({
x
:
f2
[
ii
][
0
],
y
:
f2
[
ii
][
1
],
alpha
:
0
},
300
)
.
call
(()
=>
{
if
(
ii
==
3
)
{
//回收元素
if
(
this
.
parent
)
this
.
parent
.
removeChild
(
this
);
Pool
.
recover
(
RecoverName
.
CHOCOLATEDIVIDE_ANI
,
this
)
}
})
}
}
}
\ No newline at end of file
egret/src/something/enum/RecoverName.ts
View file @
7d469bcf
...
...
@@ -57,6 +57,7 @@ export enum RecoverName {
EGGBROKEN_ANI
=
"EggBrokenAni"
,
HAIRBALLGREYDIS_ANI
=
"HairballGreyDisAni"
,
HAIRBALLBLACKDIS_ANI
=
"HairballBlackDisAni"
,
CHOCOLATEDIVIDE_ANI
=
"ChocolateDivideAni"
,
//方形遮罩
RECT_MASK
=
"RectMask"
,
...
...
egret/src/something/logic/AiControl.ts
View file @
7d469bcf
...
...
@@ -21,6 +21,7 @@ import { FesRedShootAni2 } from "../anisCall/FesRedShootAni2";
import
{
loadSvga
}
from
"../../loadSvga"
;
import
getResPath
from
"../../../libs/new_tc/getResPath"
;
import
SceneCtrl
from
"../../../libs/new_wx/ctrls/sceneCtrl"
;
import
{
ChocolateDivideAni
}
from
"../anis/ChocolateDivideAni"
;
//孵鸡的数量
const
chickenNum
:
number
=
4
;
...
...
@@ -141,7 +142,7 @@ export class AiControl {
}
//变成对象
for
(
var
i
=
0
;
i
<
six
.
length
;
i
++
)
six
[
i
]
=
{
index
:
six
[
i
]
};
//暂时只有一个大红包,
//暂时只有一个大红包,
如出现多个,需改逻辑
let
index
=
indexs
[
0
];
var
p
=
Tool
.
getPositionByIndex
(
index
);
var
vec0
=
[
1
,
0
];
...
...
@@ -161,10 +162,12 @@ export class AiControl {
six
.
sort
(
function
(
a
,
b
)
{
return
b
.
rotation
-
a
.
rotation
});
//还原为索引
for
(
var
i
=
0
;
i
<
six
.
length
;
i
++
)
six
[
i
]
=
six
[
i
].
index
;
//动画
//先去掉元素,再加分裂动画
thisObj
.
removeOperation
(
index
);
//巧克力分裂效果,
thisObj
.
addChild
(
Pool
.
takeOut
(
RecoverName
.
CHOCOLATEDIVIDE_ANI
)
||
new
ChocolateDivideAni
())[
"play"
](
p
);
//光效动画
thisObj
.
redBombLightAni
(
index
,
()
=>
{
//巧克力分裂效果,先去掉元素,再加动画
let
count
=
0
;
let
countAll
=
six
.
length
;
for
(
let
a
=
0
;
a
<
six
.
length
;
a
++
)
{
...
...
@@ -179,8 +182,8 @@ export class AiControl {
thisObj
.
addChild
(
fesRedShootAni
);
fesRedShootAni
.
play
(
p
,
ele
,
()
=>
{
if
(
++
count
==
countAll
)
{
//去掉大红包
thisObj
.
removeOperation
(
index
);
//去掉大红包
,改成上面去掉了
//
thisObj.removeOperation(index);
//进行掉落
thisObj
.
fall
(()
=>
{
thisObj
.
fallCallback
();
...
...
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