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
91a00c20
Commit
91a00c20
authored
Mar 02, 2020
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
8c2c1061
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
15 deletions
+72
-15
doSandAI.ts
egret/src/mainScene/doSandAI.ts
+5
-5
Sand.ts
egret/src/something/Sand.ts
+2
-0
SandMoveAni.ts
egret/src/something/anis/SandMoveAni.ts
+64
-10
ElementType.ts
egret/src/something/enum/ElementType.ts
+1
-0
No files found.
egret/src/mainScene/doSandAI.ts
View file @
91a00c20
...
@@ -20,7 +20,7 @@ export default async (thisObj: MainScene) => {
...
@@ -20,7 +20,7 @@ export default async (thisObj: MainScene) => {
//map promise
//map promise
//先判断是否能跳动,目前都能跳
//先判断是否能跳动,目前都能跳
const
promiseList
:
Promise
<
any
>
[]
=
[];
const
promiseList
:
Promise
<
any
>
[]
=
[];
const
sands
=
[];
//
const sands = [];
for
(
let
i
=
0
;
i
<
sandLattices
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
sandLattices
.
length
;
i
++
)
{
const
sandLattice
=
sandLattices
[
i
];
const
sandLattice
=
sandLattices
[
i
];
const
indexEnd
=
judgeActionIndex
(
sandLattice
.
index
,
thisObj
.
lattices
)
const
indexEnd
=
judgeActionIndex
(
sandLattice
.
index
,
thisObj
.
lattices
)
...
@@ -41,13 +41,13 @@ export default async (thisObj: MainScene) => {
...
@@ -41,13 +41,13 @@ export default async (thisObj: MainScene) => {
if
(
!
sandMoveAni
)
{
if
(
!
sandMoveAni
)
{
sandMoveAni
=
new
SandMoveAni
();
sandMoveAni
=
new
SandMoveAni
();
}
}
thisObj
.
addChild
(
sandMoveAni
);
thisObj
.
map
.
addChild
(
sandMoveAni
);
promiseList
.
push
(
sandMoveAni
.
play
(
[
sand
.
x
,
sand
.
y
],
p
));
promiseList
.
push
(
sandMoveAni
.
play
(
from
,
p
,
sand
));
sands
.
push
(
sand
);
//
sands.push(sand);
}
}
}
}
await
Promise
.
all
(
promiseList
);
await
Promise
.
all
(
promiseList
);
sands
.
forEach
(
e
=>
e
.
visible
=
true
);
//
sands.forEach(e => e.visible = true);
}
}
//找到毛球移动的目标位置
//找到毛球移动的目标位置
...
...
egret/src/something/Sand.ts
View file @
91a00c20
...
@@ -3,6 +3,7 @@ import { loadSvga } from "../loadSvga";
...
@@ -3,6 +3,7 @@ import { loadSvga } from "../loadSvga";
export
default
class
Sand
extends
egret
.
Sprite
{
export
default
class
Sand
extends
egret
.
Sprite
{
mc
;
constructor
()
{
constructor
()
{
super
();
super
();
this
.
initSvga
();
this
.
initSvga
();
...
@@ -13,6 +14,7 @@ export default class Sand extends egret.Sprite {
...
@@ -13,6 +14,7 @@ export default class Sand extends egret.Sprite {
movieclip
.
anchorOffsetX
=
78
/
2
;
movieclip
.
anchorOffsetX
=
78
/
2
;
movieclip
.
anchorOffsetY
=
78
/
2
;
movieclip
.
anchorOffsetY
=
78
/
2
;
this
.
addChild
(
movieclip
);
this
.
addChild
(
movieclip
);
this
.
mc
=
movieclip
;
}
}
}
}
...
...
egret/src/something/anis/SandMoveAni.ts
View file @
91a00c20
...
@@ -13,13 +13,20 @@ export const monstShootAniDur: number = 400;
...
@@ -13,13 +13,20 @@ export const monstShootAniDur: number = 400;
export
class
SandMoveAni
extends
egret
.
DisplayObjectContainer
{
export
class
SandMoveAni
extends
egret
.
DisplayObjectContainer
{
fromContainer
;
fromContainer
;
toContainer
;
toContainer
;
moveMc
:
any
;
constructor
()
{
constructor
()
{
super
()
super
()
}
}
async
initMc
(
from
:
number
[],
to
:
number
[])
{
async
initMc
(
from
:
number
[],
to
:
number
[])
{
const
fromContainer
=
await
this
.
createContainer
();
this
.
moveMc
=
await
loadSvga
(
getResPath
()
+
'resource/assets/svgas/sand_move.svga'
);
this
.
moveMc
.
anchorOffsetX
=
200
/
2
;
this
.
moveMc
.
anchorOffsetY
=
100
/
2
;
this
.
moveMc
.
x
=
(
from
[
0
]
+
to
[
0
])
/
2
;
this
.
moveMc
.
y
=
(
from
[
1
]
+
to
[
1
])
/
2
;
this
.
addChild
(
this
.
moveMc
);
const
fromContainer
=
await
this
.
createContainer
(
1
);
fromContainer
.
x
=
from
[
0
];
fromContainer
.
x
=
from
[
0
];
fromContainer
.
y
=
from
[
1
];
fromContainer
.
y
=
from
[
1
];
this
.
fromContainer
=
fromContainer
;
this
.
fromContainer
=
fromContainer
;
...
@@ -31,39 +38,86 @@ export class SandMoveAni extends egret.DisplayObjectContainer {
...
@@ -31,39 +38,86 @@ export class SandMoveAni extends egret.DisplayObjectContainer {
this
.
addChild
(
this
.
fromContainer
);
this
.
addChild
(
this
.
fromContainer
);
this
.
addChild
(
this
.
toContainer
);
this
.
addChild
(
this
.
toContainer
);
this
.
fromMask
.
anchorOffsetY
=
78
;
this
.
fromMask
.
y
=
78
;
this
.
toMask
.
anchorOffsetY
=
78
;
this
.
toMask
.
y
=
78
;
this
.
fromMask
.
scaleY
=
1
;
this
.
toMask
.
scaleY
=
0
;
this
.
setMove
(
from
,
to
);
}
private
setMove
(
from
,
to
)
{
const
[
fromX
,
fromY
]
=
from
;
const
[
toX
,
toY
]
=
to
;
if
(
fromX
-
toX
==
0
)
{
//竖向
if
(
toY
<
fromY
)
this
.
moveMc
.
rotation
=
90
;
//上
else
this
.
moveMc
.
rotation
=
-
90
;
//下
}
else
{
//横向
if
(
toX
<
fromX
)
this
.
moveMc
.
rotation
=
0
else
this
.
moveMc
.
rotation
=
180
;
}
//向上
//向下
//向左
//向右
}
}
private
reset
(
from
:
number
[],
to
:
number
[])
{
private
reset
(
from
:
number
[],
to
:
number
[])
{
this
.
moveMc
.
x
=
(
from
[
0
]
+
to
[
0
])
/
2
;
this
.
moveMc
.
y
=
(
from
[
1
]
+
to
[
1
])
/
2
;
this
.
fromContainer
.
x
=
from
[
0
];
this
.
fromContainer
.
x
=
from
[
0
];
this
.
fromContainer
.
y
=
from
[
1
];
this
.
fromContainer
.
y
=
from
[
1
];
this
.
toContainer
.
x
=
to
[
0
];
this
.
toContainer
.
x
=
to
[
0
];
this
.
toContainer
.
y
=
to
[
1
];
this
.
toContainer
.
y
=
to
[
1
];
this
.
fromMask
.
scaleY
=
1
;
this
.
toMask
.
scaleY
=
0
;
this
.
setMove
(
from
,
to
);
}
}
async
play
(
from
:
number
[],
to
:
number
[])
{
async
play
(
from
:
number
[],
to
:
number
[]
,
sand
)
{
if
(
!
this
.
fromContainer
)
{
if
(
!
this
.
fromContainer
)
{
await
this
.
initMc
(
from
,
to
);
await
this
.
initMc
(
from
,
to
);
}
else
{
}
else
{
this
.
reset
(
from
,
to
);
this
.
reset
(
from
,
to
);
}
}
this
.
moveMc
.
gotoAndPlay
(
1
);
await
wait
(
5000
);
await
(
new
Promise
((
r
)
=>
{
const
dur
=
1000
;
egret
.
Tween
.
get
(
this
.
fromMask
).
to
({
scaleY
:
0
},
dur
);
egret
.
Tween
.
get
(
this
.
toMask
).
to
({
scaleY
:
1
},
dur
).
call
(
r
);
}));
sand
.
visible
=
true
;
this
.
parent
&&
this
.
parent
.
removeChild
(
this
);
this
.
parent
&&
this
.
parent
.
removeChild
(
this
);
Pool
.
recover
(
RecoverName
.
SAND_MOVE_ANI
,
this
);
Pool
.
recover
(
RecoverName
.
SAND_MOVE_ANI
,
this
);
return
null
;
return
null
;
}
}
fromMask
:
egret
.
Shape
;
private
async
createContainer
()
{
toMask
:
egret
.
Shape
;
private
async
createContainer
(
isfrom
=
0
)
{
const
container
=
new
egret
.
Sprite
();
const
container
=
new
egret
.
Sprite
();
const
rect
=
this
.
createRect
();
const
rect
=
this
.
createRect
(
isfrom
);
const
mc
=
await
this
.
createMc
();
const
mc
=
await
this
.
createMc
();
container
.
addChild
(
mc
);
container
.
addChild
(
mc
);
container
.
addChild
(
rect
);
container
.
addChild
(
rect
);
mc
.
mask
=
rect
;
mc
.
mask
=
rect
;
return
mc
;
if
(
isfrom
)
this
.
fromMask
=
rect
;
else
this
.
toMask
=
rect
;
return
container
;
}
}
private
createRect
()
{
private
createRect
(
isfrom
)
{
const
rect
=
new
egret
.
Shape
();
const
rect
=
new
egret
.
Shape
();
rect
.
graphics
.
beginFill
(
0
,
1
);
rect
.
graphics
.
beginFill
(
0
,
1
);
const
r
=
80
;
const
r
=
80
;
...
...
egret/src/something/enum/ElementType.ts
View file @
91a00c20
...
@@ -236,6 +236,7 @@ export const submitTran = {
...
@@ -236,6 +236,7 @@ export const submitTran = {
25
:
14
,
25
:
14
,
26
:
15
,
26
:
15
,
34
:
16
,
34
:
16
,
36
:
17
,
}
}
// SCORE(1, "分数"),
// SCORE(1, "分数"),
...
...
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