Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
elephant
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
elephant
Commits
58c59310
Commit
58c59310
authored
Dec 13, 2021
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加适配和音效
parent
f0243074
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
3492 additions
and
2109 deletions
+3492
-2109
eating.mp3
assets/elephant/audios/eating.mp3
+0
-0
eating.mp3.meta
assets/elephant/audios/eating.mp3.meta
+7
-0
hungry.mp3
assets/elephant/audios/hungry.mp3
+0
-0
hungry.mp3.meta
assets/elephant/audios/hungry.mp3.meta
+7
-0
elephant.fire
assets/elephant/scene/elephant.fire
+3442
-2100
elephant.ts
assets/elephant/scene/elephant.ts
+35
-8
pg.ts
assets/elephant/scene/pg.ts
+1
-1
No files found.
assets/elephant/audios/eating.mp3
0 → 100644
View file @
58c59310
File added
assets/elephant/audios/eating.mp3.meta
0 → 100644
View file @
58c59310
{
"ver": "2.0.1",
"uuid": "30a70929-6e5d-4275-8fb9-004ab4b891b7",
"downloadMode": 0,
"duration": 2.56,
"subMetas": {}
}
\ No newline at end of file
assets/elephant/audios/hungry.mp3
0 → 100644
View file @
58c59310
File added
assets/elephant/audios/hungry.mp3.meta
0 → 100644
View file @
58c59310
{
"ver": "2.0.1",
"uuid": "85d9b4ae-4b48-4a38-a4a5-d8e9aca2acee",
"downloadMode": 0,
"duration": 1.123265,
"subMetas": {}
}
\ No newline at end of file
assets/elephant/scene/elephant.fire
View file @
58c59310
This diff is collapsed.
Click to expand it.
assets/elephant/scene/elephant.ts
View file @
58c59310
...
@@ -343,20 +343,32 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -343,20 +343,32 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
eatAni
=
pg
.
view
.
find
(
this
.
elephant
,
"
eat
"
);
let
eatAni
=
pg
.
view
.
find
(
this
.
elephant
,
"
eat
"
);
walkAni
.
active
=
true
;
walkAni
.
active
=
true
;
eatAni
.
active
=
false
;
eatAni
.
active
=
false
;
pg
.
view
.
playDBAnimation
(
walkAni
,
"
walking
"
,
0
);
let
db
=
pg
.
view
.
playDBAnimation
(
walkAni
,
"
walking
"
,
0
);
this
.
removeHungryAudio
(
db
);
cc
.
Tween
.
stopAllByTarget
(
this
.
elephant
);
cc
.
Tween
.
stopAllByTarget
(
this
.
elephant
);
walkAni
.
scaleX
=
1
;
walkAni
.
scaleX
=
1
;
let
moveX
=
400
;
let
moveY
=
0
;
let
winSize
=
cc
.
winSize
;
if
(
winSize
.
width
/
winSize
.
height
<
16
/
9
)
{
moveY
=
-
(
16
/
9
-
winSize
.
width
/
winSize
.
height
)
*
750
/
2
;
}
if
(
!
this
.
elephant
.
active
)
{
this
.
elephant
.
active
=
true
;
this
.
elephant
.
x
=
0
;
this
.
elephant
.
y
=
moveY
+
Math
.
random
()
*
100
;
}
cc
.
tween
(
this
.
elephant
)
cc
.
tween
(
this
.
elephant
)
.
to
(
4
,
{
x
:
400
,
y
:
Math
.
random
()
*
100
})
.
to
(
4
,
{
x
:
moveX
,
y
:
moveY
+
Math
.
random
()
*
100
})
.
call
(()
=>
{
.
call
(()
=>
{
walkAni
.
scaleX
=
-
1
;
walkAni
.
scaleX
=
-
1
;
})
})
.
to
(
4
,
{
x
:
0
,
y
:
Math
.
random
()
*
100
})
.
to
(
4
,
{
x
:
0
,
y
:
moveY
+
Math
.
random
()
*
100
})
.
to
(
4
,
{
x
:
-
400
,
y
:
Math
.
random
()
*
100
})
.
to
(
4
,
{
x
:
-
moveX
,
y
:
moveY
+
Math
.
random
()
*
100
})
.
call
(()
=>
{
.
call
(()
=>
{
walkAni
.
scaleX
=
1
;
walkAni
.
scaleX
=
1
;
})
})
.
to
(
4
,
{
x
:
0
,
y
:
Math
.
random
()
*
100
})
.
to
(
4
,
{
x
:
0
,
y
:
moveY
+
Math
.
random
()
*
100
})
.
call
(()
=>
{
.
call
(()
=>
{
this
.
elephentState
(
0
);
this
.
elephentState
(
0
);
})
})
...
@@ -367,7 +379,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -367,7 +379,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
eatAni
=
pg
.
view
.
find
(
this
.
elephant
,
"
eat
"
);
let
eatAni
=
pg
.
view
.
find
(
this
.
elephant
,
"
eat
"
);
walkAni
.
active
=
true
;
walkAni
.
active
=
true
;
eatAni
.
active
=
false
;
eatAni
.
active
=
false
;
pg
.
view
.
playDBAnimation
(
walkAni
,
"
happy
"
,
0
);
let
db
=
pg
.
view
.
playDBAnimation
(
walkAni
,
"
happy
"
,
0
);
this
.
removeHungryAudio
(
db
);
cc
.
Tween
.
stopAllByTarget
(
this
.
elephant
);
cc
.
Tween
.
stopAllByTarget
(
this
.
elephant
);
walkAni
.
scaleX
=
1
;
walkAni
.
scaleX
=
1
;
}
}
...
@@ -376,7 +389,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -376,7 +389,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
eatAni
=
pg
.
view
.
find
(
this
.
elephant
,
"
eat
"
);
let
eatAni
=
pg
.
view
.
find
(
this
.
elephant
,
"
eat
"
);
walkAni
.
active
=
true
;
walkAni
.
active
=
true
;
eatAni
.
active
=
false
;
eatAni
.
active
=
false
;
pg
.
view
.
playDBAnimation
(
walkAni
,
"
hungry
"
,
0
);
this
.
playLocalAudio
(
"
hungry
"
);
let
db
:
dragonBones
.
ArmatureDisplay
=
pg
.
view
.
playDBAnimation
(
walkAni
,
"
hungry
"
,
0
);
this
.
removeHungryAudio
(
db
);
this
.
addHungryAudio
(
db
);
cc
.
Tween
.
stopAllByTarget
(
this
.
elephant
);
cc
.
Tween
.
stopAllByTarget
(
this
.
elephant
);
walkAni
.
scaleX
=
1
;
walkAni
.
scaleX
=
1
;
}
}
...
@@ -387,9 +403,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -387,9 +403,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
eatAni
.
active
=
true
;
eatAni
.
active
=
true
;
pg
.
view
.
playDBAnimation
(
eatAni
,
"
eating
"
,
0
);
pg
.
view
.
playDBAnimation
(
eatAni
,
"
eating
"
,
0
);
cc
.
Tween
.
stopAllByTarget
(
this
.
elephant
);
cc
.
Tween
.
stopAllByTarget
(
this
.
elephant
);
this
.
playLocalAudio
(
"
eating
"
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
elephentState
(
0
);
this
.
elephentState
(
0
);
},
4000
);
},
3500
);
}
addHungryAudio
(
db
:
dragonBones
.
ArmatureDisplay
)
{
db
.
addEventListener
(
dragonBones
.
EventObject
.
LOOP_COMPLETE
,
this
.
playHungryAudio
,
this
)
}
removeHungryAudio
(
db
:
dragonBones
.
ArmatureDisplay
)
{
db
.
removeEventListener
(
dragonBones
.
EventObject
.
LOOP_COMPLETE
,
this
.
playHungryAudio
,
this
)
}
playHungryAudio
()
{
this
.
playLocalAudio
(
"
hungry
"
);
}
}
...
...
assets/elephant/scene/pg.ts
View file @
58c59310
...
@@ -320,7 +320,7 @@ let pg = {
...
@@ -320,7 +320,7 @@ let pg = {
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
((
resolve
)
=>
{
return
setTimeout
(()
=>
{
return
setTimeout
(()
=>
{
return
resolve
({
status
:
200
});
return
resolve
({
status
:
200
});
},
100
+
Math
.
random
()
*
30
0
);
},
6
0
);
let
xhr
=
cc
.
loader
.
getXMLHttpRequest
();
let
xhr
=
cc
.
loader
.
getXMLHttpRequest
();
xhr
.
timeout
=
5000
;
xhr
.
timeout
=
5000
;
xhr
.
responseType
=
"
text
"
;
xhr
.
responseType
=
"
text
"
;
...
...
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