Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-libs
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
劳工
zeroing-libs
Commits
b4bbd46e
Commit
b4bbd46e
authored
Dec 24, 2019
by
XieChuanJin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加音效
parent
6c541e0f
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
50 additions
and
112 deletions
+50
-112
index2.html
custom-emulator/index2.html
+1
-1
ShootPlanet.json
dist/customs/ShootPlanet.json
+11
-6
Ball.ts
src/custom/ShootPlanet/Game/Ball.ts
+2
-2
Car.ts
src/custom/ShootPlanet/Game/Car.ts
+1
-1
Drop.ts
src/custom/ShootPlanet/Game/Drop.ts
+1
-1
Game.ts
src/custom/ShootPlanet/Game/Game.ts
+3
-2
SoundMgr.ts
src/custom/ShootPlanet/Mgr/SoundMgr.ts
+11
-91
BallPool.ts
src/custom/ShootPlanet/Pools/BallPool.ts
+0
-1
ShootPlanet.ts
src/custom/ShootPlanet/ShootPlanet.ts
+5
-0
meta.json
src/custom/ShootPlanet/meta.json
+11
-7
test.js
src/custom/ShootPlanet/test.js
+4
-0
No files found.
custom-emulator/index2.html
View file @
b4bbd46e
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
<div
id=
"game-container"
style=
"line-height:0;font-size:0"
></div>
<div
id=
"game-container"
style=
"line-height:0;font-size:0"
></div>
<script
src=
"//res.wx.qq.com/open/js/jweixin-1.4.0.js"
></script>
<script
src=
"//res.wx.qq.com/open/js/jweixin-1.4.0.js"
></script>
<!--script src="http://localhost:4002/debug/engine.js"></script-->
<!--script src="http://localhost:4002/debug/engine.js"></script-->
<script
src=
"//yun.duiba.com.cn/editor/zeroing/libs/engine.
a55406676ddead0c1728d886fa14378bbf82d873
.js"
></script>
<script
src=
"//yun.duiba.com.cn/editor/zeroing/libs/engine.
d208e8f972669861e966f1cfe979ad7700cb1f8d
.js"
></script>
<script
src=
"app.js"
></script>
<script
src=
"app.js"
></script>
<script>
<script>
...
...
dist/customs/ShootPlanet.json
View file @
b4bbd46e
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/custom/ShootPlanet/Game/Ball.ts
View file @
b4bbd46e
...
@@ -80,7 +80,7 @@ export default class Ball extends MoveObjcet implements PoolElement {
...
@@ -80,7 +80,7 @@ export default class Ball extends MoveObjcet implements PoolElement {
}
}
EffectMgr
.
playBoomEffect
(
this
.
position
,
this
.
scaleRatio
);
EffectMgr
.
playBoomEffect
(
this
.
position
,
this
.
scaleRatio
);
SoundMgr
.
instance
.
playEffect
(
"boom
_mp3
"
);
SoundMgr
.
instance
.
playEffect
(
"boom"
);
ballPool
.
recycle
(
this
.
poolKey
,
this
);
ballPool
.
recycle
(
this
.
poolKey
,
this
);
}
}
...
@@ -196,7 +196,7 @@ export default class Ball extends MoveObjcet implements PoolElement {
...
@@ -196,7 +196,7 @@ export default class Ball extends MoveObjcet implements PoolElement {
//判断是否会震动地面
//判断是否会震动地面
if
(
this
.
sizeIndex
>=
MConfigs
.
size
.
length
-
2
)
{
if
(
this
.
sizeIndex
>=
MConfigs
.
size
.
length
-
2
)
{
DataMgr
.
game
.
_shake
();
DataMgr
.
game
.
_shake
();
SoundMgr
.
instance
.
playEffect
(
"dong
_mp3
"
);
SoundMgr
.
instance
.
playEffect
(
"dong"
);
}
}
}
}
...
...
src/custom/ShootPlanet/Game/Car.ts
View file @
b4bbd46e
...
@@ -61,7 +61,7 @@ export default class Car extends GameObject {
...
@@ -61,7 +61,7 @@ export default class Car extends GameObject {
private
fire
()
{
private
fire
()
{
// return;
// return;
SoundMgr
.
instance
.
playEffect
(
"shoot
_mp3
"
);
SoundMgr
.
instance
.
playEffect
(
"shoot"
);
new
BulletGroup
(
new
engine
.
Point
(
this
.
x
+
this
.
width
/
2
,
this
.
y
),
this
.
rowBulletNum
);
new
BulletGroup
(
new
engine
.
Point
(
this
.
x
+
this
.
width
/
2
,
this
.
y
),
this
.
rowBulletNum
);
}
}
...
...
src/custom/ShootPlanet/Game/Drop.ts
View file @
b4bbd46e
...
@@ -63,7 +63,7 @@ export default class Drop extends MoveObjcet implements PoolElement {
...
@@ -63,7 +63,7 @@ export default class Drop extends MoveObjcet implements PoolElement {
}
}
private
eated
()
{
private
eated
()
{
SoundMgr
.
instance
.
playEffect
(
"collect
_mp3
"
);
SoundMgr
.
instance
.
playEffect
(
"collect"
);
this
.
physics
.
rotateVelocity
=
0
;
this
.
physics
.
rotateVelocity
=
0
;
DropBlinkMgr
.
instance
.
remove
(
this
);
DropBlinkMgr
.
instance
.
remove
(
this
);
this
.
visible
=
true
;
this
.
visible
=
true
;
...
...
src/custom/ShootPlanet/Game/Game.ts
View file @
b4bbd46e
...
@@ -165,8 +165,8 @@ export default class Game {
...
@@ -165,8 +165,8 @@ export default class Game {
//开始倒计时
//开始倒计时
this
.
timing
=
true
;
this
.
timing
=
true
;
//
this._BulletScore = 140;
this
.
_BulletScore
=
140
;
//
this._PowerScore = 2000;
this
.
_PowerScore
=
2000
;
}
}
public
addGameObject
(
gameObject
:
GameObject
,
layer
:
LayerName
)
{
public
addGameObject
(
gameObject
:
GameObject
,
layer
:
LayerName
)
{
...
@@ -225,6 +225,7 @@ export default class Game {
...
@@ -225,6 +225,7 @@ export default class Game {
private
createBall
()
{
private
createBall
()
{
return
;
let
size
=
MUtils
.
randomInt
(
0
,
MConfigs
.
size
.
length
);
let
size
=
MUtils
.
randomInt
(
0
,
MConfigs
.
size
.
length
);
if
(
GuideMgr
.
instance
.
guideFlag
==
true
)
{
if
(
GuideMgr
.
instance
.
guideFlag
==
true
)
{
size
=
3
;
size
=
3
;
...
...
src/custom/ShootPlanet/Mgr/SoundMgr.ts
View file @
b4bbd46e
...
@@ -9,11 +9,10 @@ export default class SoundMgr {
...
@@ -9,11 +9,10 @@ export default class SoundMgr {
return
this
.
_instance
;
return
this
.
_instance
;
}
}
public
effectEnabled
=
false
;
private
effectEnabled
=
false
;
private
_enabled
:
boolean
=
false
;
private
_enabled
:
boolean
=
false
;
public
set
enabled
(
v
:
boolean
)
{
public
set
enabled
(
v
:
boolean
)
{
this
.
musicEnabled
=
v
;
//
this.musicEnabled = v;
this
.
effectEnabled
=
v
;
this
.
effectEnabled
=
v
;
this
.
_enabled
=
v
;
this
.
_enabled
=
v
;
}
}
...
@@ -21,99 +20,20 @@ export default class SoundMgr {
...
@@ -21,99 +20,20 @@ export default class SoundMgr {
return
this
.
_enabled
;
return
this
.
_enabled
;
}
}
private
_musicEnabled
:
boolean
=
false
;
public
get
musicEnabled
()
{
return
this
.
_musicEnabled
;
}
public
set
musicEnabled
(
v
:
boolean
)
{
if
(
v
==
true
)
{
this
.
playMusic
();
}
else
{
this
.
stopMusic
();
}
this
.
_musicEnabled
=
v
;
}
// private music: engine. = null;
// private musicChannel: engine.SoundChannel = null;
// private loopChannelMap: { [name: string]: engine.SoundChannel } = {}
private
effectPool
:
{
[
name
:
string
]:
PoolSound
[]
}
=
{}
public
firstSeted
=
false
;
public
setMusic
(
url
:
string
)
{
// this.music = RES.getRes(url);
}
public
playMusic
()
{
/* if (this.music == null) {
console.warn("music do not set");
return;
}
this.musicChannel && this.musicChannel.stop();
this.musicChannel = this.music.play(0, 0); */
}
public
stopMusic
()
{
// this.musicChannel && (this.musicChannel.stop());
}
public
playEffect
(
name
:
string
,
loop
:
boolean
=
false
)
{
public
playEffect
(
name
:
string
,
loop
:
boolean
=
false
)
{
/* if (!this.effectEnabled) return;
if
(
!
this
.
effectEnabled
)
return
;
let poolSound = this.createSound(name, loop);
let channel = poolSound.sound.play(0, loop ? 0 : 1);
if (loop) {
if (this.loopChannelMap[name]) {
this.loopChannelMap[name].stop();
}
this.loopChannelMap[name] = channel;
} else {
return new Promise<void>(resolve => {
channel.addEventListener(engine.Event.SOUND_COMPLETE, () => {
this.recycleSound(poolSound);
resolve();
}, this);
});
} */
}
public
stopLoopEffect
(
name
:
string
)
{
engine
.
playSound
(
nameToUuid
[
name
],
{
/* if (this.loopChannelMap[name]) {
loop
:
false
this.loopChannelMap[name].stop();
},
name
);
} */
}
}
private
t
:
number
=
0
;
private
createSound
(
name
:
string
,
loop
:
boolean
):
PoolSound
{
/* let soundList = this.effectPool[name];
if (!soundList || soundList.length <= 0) {
let poolSound = new PoolSound(name, RES.getRes(name), loop);
if (poolSound.name == "shoot_mp3") {
this.t++;
}
return poolSound;
} else {
return soundList.pop();
} */
return
null
;
}
private
recycleSound
(
poolSound
:
PoolSound
)
{
/* delete this.loopChannelMap[poolSound.name];
this.effectPool[poolSound.name] = this.effectPool[poolSound.name] || [];
this.effectPool[poolSound.name].push(poolSound); */
}
}
}
class
PoolSound
{
const
nameToUuid
=
{
/* private loop = false;
shoot
:
"b01dc39a-2886-4887-b3bb-0f8c801003a9"
,
public onRecycle = (sound: PoolSound) => { }
collect
:
"7004616a-0aba-4826-9245-895e7fdf8d31"
,
public sound: engine.Sound = null;
dong
:
"7fc04e43-1465-4336-92a3-d6039ee88cb3"
,
public name: string = null;
boom
:
"ca6b799f-be85-4e94-99df-812f31801490"
constructor(name: string, sound: engine.Sound, loop: boolean) {
this.name = name;
this.sound = sound;
this.loop = loop;
} */
}
}
\ No newline at end of file
src/custom/ShootPlanet/Pools/BallPool.ts
View file @
b4bbd46e
import
{
Pool
,
PoolGroup
}
from
"../Component/Pool"
;
import
{
Pool
,
PoolGroup
}
from
"../Component/Pool"
;
import
Ball
from
"../Game/Ball"
;
import
Ball
from
"../Game/Ball"
;
import
Game
from
"../Game/Game"
;
import
{
DataMgr
}
from
"../Mgr/DataMgr"
;
import
{
DataMgr
}
from
"../Mgr/DataMgr"
;
class
BallPool
extends
Pool
<
Ball
>
{
class
BallPool
extends
Pool
<
Ball
>
{
...
...
src/custom/ShootPlanet/ShootPlanet.ts
View file @
b4bbd46e
...
@@ -17,6 +17,7 @@ import { NetUtils } from "./Global/NetUtils";
...
@@ -17,6 +17,7 @@ import { NetUtils } from "./Global/NetUtils";
import
Net
from
"./Global/Net"
;
import
Net
from
"./Global/Net"
;
import
Loading
from
"./Global/Loading"
;
import
Loading
from
"./Global/Loading"
;
import
{
initNECaptcha
}
from
"./Component/InitNECaptcha"
;
import
{
initNECaptcha
}
from
"./Component/InitNECaptcha"
;
import
SoundMgr
from
"./Mgr/SoundMgr"
;
/**
/**
* Created by rockyl on 2019-11-22.
* Created by rockyl on 2019-11-22.
...
@@ -50,6 +51,8 @@ export class ShootPlanet extends engine.Container {
...
@@ -50,6 +51,8 @@ export class ShootPlanet extends engine.Container {
constructor
()
{
constructor
()
{
super
();
super
();
return
;
this
.
customProperty
();
this
.
customProperty
();
this
.
game
=
new
Game
(
this
);
this
.
game
=
new
Game
(
this
);
this
.
width
=
750
;
this
.
width
=
750
;
...
@@ -57,6 +60,8 @@ export class ShootPlanet extends engine.Container {
...
@@ -57,6 +60,8 @@ export class ShootPlanet extends engine.Container {
this
.
addEventListener
(
engine
.
Event
.
REMOVED_FROM_STAGE
,
this
.
onDestroy
,
this
);
this
.
addEventListener
(
engine
.
Event
.
REMOVED_FROM_STAGE
,
this
.
onDestroy
,
this
);
this
.
init
();
this
.
init
();
SoundMgr
.
instance
.
enabled
=
false
;
if
(
GuideMgr
.
instance
.
guideFlag
==
true
)
{
if
(
GuideMgr
.
instance
.
guideFlag
==
true
)
{
const
car
=
this
.
game
.
_car
;
const
car
=
this
.
game
.
_car
;
GuideMgr
.
instance
.
runGuide
(
0
,
car
.
x
+
car
.
width
/
2
,
car
.
y
+
car
.
height
/
2
/* - 130 */
);
GuideMgr
.
instance
.
runGuide
(
0
,
car
.
x
+
car
.
width
/
2
,
car
.
y
+
car
.
height
/
2
/* - 130 */
);
...
...
src/custom/ShootPlanet/meta.json
View file @
b4bbd46e
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
"ext"
:
".png"
"ext"
:
".png"
},
},
{
{
"url"
:
"//yun.duiba.com.cn/aurora/assets/
b95848ec6c510347c040f0c11f0d5685fcc110aa
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
692cd00552482f0a89602701a84bde870019a763
.png"
,
"uuid"
:
"09bdff41-2fe3-4298-ad3a-1d2eaf6af778"
,
"uuid"
:
"09bdff41-2fe3-4298-ad3a-1d2eaf6af778"
,
"ext"
:
".png"
"ext"
:
".png"
},
},
...
@@ -216,11 +216,6 @@
...
@@ -216,11 +216,6 @@
"uuid"
:
""
,
"uuid"
:
""
,
"ext"
:
".png"
"ext"
:
".png"
},
},
{
"url"
:
"//yun.duiba.com.cn/aurora/assets/d4ac501c938e2b7cd4beaf737ff07c53afe18c44.png"
,
"uuid"
:
"3cc0aa86-0581-4caa-b662-266e58fd39b7"
,
"ext"
:
".png"
},
{
{
"url"
:
"//yun.duiba.com.cn/aurora/assets/905239e8db76682f47339668e7d9279b2ec4f0e2.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/905239e8db76682f47339668e7d9279b2ec4f0e2.png"
,
"uuid"
:
"93992a62-e3c4-46d5-99f4-f7ba35fe4f4f"
,
"uuid"
:
"93992a62-e3c4-46d5-99f4-f7ba35fe4f4f"
,
...
@@ -260,7 +255,16 @@
...
@@ -260,7 +255,16 @@
"url"
:
"//yun.duiba.com.cn/aurora/assets/ed6f41a38d28e03acf791dd3672c0364e6754821.mp3"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/ed6f41a38d28e03acf791dd3672c0364e6754821.mp3"
,
"uuid"
:
"ca6b799f-be85-4e94-99df-812f31801490"
,
"uuid"
:
"ca6b799f-be85-4e94-99df-812f31801490"
,
"ext"
:
".mp3"
"ext"
:
".mp3"
},
{
"url"
:
"//yun.duiba.com.cn/aurora/assets/d4ac501c938e2b7cd4beaf737ff07c53afe18c44.png"
,
"uuid"
:
"3cc0aa86-0581-4caa-b662-266e58fd39b7"
,
"ext"
:
".png"
},
{
"url"
:
"//yun.duiba.com.cn/aurora/assets/d4ac501c938e2b7cd4beaf737ff07c53afe18c44.png"
,
"uuid"
:
"3cc0aa86-0581-4caa-b662-266e58fd39b7"
,
"ext"
:
".png"
}
}
]
]
}
}
\ No newline at end of file
src/custom/ShootPlanet/test.js
0 → 100644
View file @
b4bbd46e
let
payload
=
Object
.
assign
({},
args
);
let
sign
=
engine
.
env
.
shareUrl
.
indexOf
(
"?"
)
>
0
?
"&"
:
"?"
;
payload
.
url
=
engine
.
env
.
shareUrl
+
sign
+
"shareCode="
+
args
.
shareCode
;
next
(
'success'
,
payload
);
\ 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