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
305b762d
Commit
305b762d
authored
Aug 21, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
46866bd9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
62 deletions
+23
-62
MainScene.ts
egret/src/mainScene/MainScene.ts
+23
-10
soundCtrl.ts
egret/src/something/soundCtrl.ts
+0
-52
No files found.
egret/src/mainScene/MainScene.ts
View file @
305b762d
...
...
@@ -28,7 +28,7 @@ import { PassType } from '../something/enum/PassType';
import
{
ElementTargetData
}
from
'../something/interface/ElementTargetData'
;
import
{
ScoreAni
}
from
'../something/anis/ScoreAni'
;
import
{
ScoreProgress
}
from
'../something/uis/ScoreProgress'
;
import
{
playSound
,
SoundType
}
from
'../soundCtrl'
;
import
{
playSound
,
SoundType
,
toggleSound
,
toggleBg
,
getSoundOn
,
getBgOn
}
from
'../soundCtrl'
;
import
Scene
from
'../../libs/new_wx/components/Scene'
;
import
{
showToast
}
from
'../../libs/new_wx/ctrls/toastCtrl'
;
import
getResPath
from
'../../libs/new_tc/getResPath'
;
...
...
@@ -188,11 +188,8 @@ export default class MainScene extends Scene {
this
.
initSvgas
();
//先禁掉事件
this
.
enableMouseEvt
(
false
);
this
.
initBuired
()
//
this.initBuired()
var
b
=
new
BonusShootAni
();
console
.
log
(
b
)
this
.
addChild
(
b
)
//步数初始化
this
.
steps
=
this
.
chapterData
.
stepCount
;
//分数置0
...
...
@@ -494,11 +491,20 @@ export default class MainScene extends Scene {
this
.
onTap_settingBtn
();
}
onTap_soundBtnn
()
{
toggleSound
()
if
(
getSoundOn
()){
this
.
soundBtn
.
source
=
"mainSoundBtnOn_png"
}
else
{
this
.
soundBtn
.
source
=
"mainSoundBtnOff_png"
}
}
onTap_musicBtn
()
{
toggleBg
();
if
(
getBgOn
()){
this
.
musicBtn
.
source
=
"mainMusicBtnOn_png"
}
else
{
this
.
musicBtn
.
source
=
"mainMusicBtnOff_png"
}
}
onTap_quitBtn
()
{
PanelCtrl
.
instance
.
show
(
"quit"
);
...
...
@@ -1278,6 +1284,11 @@ export default class MainScene extends Scene {
}
else
{
//通关了
//提交分数等
var
json
=
this
.
getSubmitJson
()
console
.
log
(
json
)
playSound
(
SoundType
.
sucess
);
//区分奖品
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
PRIZE_PANEL
);
}
return
}
...
...
@@ -1285,6 +1296,9 @@ export default class MainScene extends Scene {
if
(
this
.
steps
==
0
)
{
//判断是否有加步数的道具,有则提示是否加(加完判断死图),没有则直接结束
//失败弹框
playSound
(
SoundType
.
fail
);
PanelCtrl
.
instance
.
show
(
"failed"
);
}
else
{
//检查死图
this
.
warningCop
=
this
.
dieMapCheck
()
...
...
@@ -1706,9 +1720,7 @@ export default class MainScene extends Scene {
}
})
},
150
*
deltaCount
)
}
}
}
/**
...
...
@@ -1966,6 +1978,7 @@ export default class MainScene extends Scene {
/**
* 禁用与开启事件
* 暂时只禁止道具及元素的
* @param b
*/
enableMouseEvt
(
b
:
boolean
)
{
...
...
egret/src/something/soundCtrl.ts
deleted
100644 → 0
View file @
46866bd9
let
soundOn
=
true
;
let
bgChannel
:
egret
.
SoundChannel
;
let
loading
=
false
;
export
const
getSoundOn
=
()
=>
{
return
soundOn
}
export
const
toggleSound
=
()
=>
{
soundOn
=
!
soundOn
;
if
(
bgChannel
)
{
if
(
!
soundOn
)
{
bgChannel
.
stop
();
bgChannel
=
null
;
}
}
else
{
if
(
soundOn
)
{
playBg
();
}
}
}
export
const
playBg
=
async
()
=>
{
if
(
bgChannel
)
return
;
if
(
loading
)
return
;
loading
=
true
;
const
bg
=
await
RES
.
getResAsync
(
'bgMusic_mp3'
);
bgChannel
=
bg
.
play
();
loading
=
false
;
}
export
enum
SoundType
{
fall
=
'fall'
,
magic
=
'magic'
,
boom
=
'boom'
,
sucess
=
'sucess'
,
mapBg
=
'mapBg'
,
eliminate
=
'eliminate'
,
toast
=
'toast'
,
fail
=
'fail'
,
playBg
=
'playBg'
,
line
=
'line'
,
}
export
const
playSound
=
(
type
:
SoundType
)
=>
{
if
(
!
soundOn
)
return
;
const
sound
:
egret
.
Sound
=
RES
.
getRes
(
type
+
"_mp3"
);
if
(
sound
)
sound
.
play
(
0
,
1
);
else
RES
.
getResAsync
(
type
+
"_mp3"
)
}
\ 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