Commit 12920820 authored by haiyoucuv's avatar haiyoucuv

init

parent ac7a34bb
......@@ -199,7 +199,7 @@
"_priority": 40000,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 687.0769230769231,
"_orthoHeight": 923.2951048951049,
"_near": 0,
"_far": 2000,
"_color": {
......@@ -2096,10 +2096,7 @@
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "ca623fc8-3952-4b60-a30b-72aeee26b413@9296f",
"__expectedType__": "cc.SpriteFrame"
},
"_spriteFrame": null,
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
......@@ -2447,7 +2444,7 @@
"_priority": 50000,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 687.0769230769231,
"_orthoHeight": 923.2951048951049,
"_near": 1,
"_far": 2000,
"_color": {
......
import { _decorator, Animation, Component, Node } from "cc";
import { AudioMgr } from "../../../../core_tgx/base/AudioMgr";
const { ccclass, property } = _decorator;
......@@ -31,6 +32,7 @@ export class PreCd extends Component {
async startCd() {
this.node.active = true;
return new Promise<void>((resolve) => {
AudioMgr.ins.playOneShot("audio/倒计时");
this.animation.play();
const callBack = () => {
this.animation.off(Animation.EventType.FINISHED, callBack);
......
......@@ -58,9 +58,16 @@ export class AudioMgr {
this._audioSource.volume = this._musicVolume * this._musicVolumeScale;
}
public get musicVolume() {
return this._musicVolume;
}
public set soundVolume(v: number) {
this._soundVolume = v;
}
public get soundVolume() {
return this._soundVolume;
}
/**
* @en
......@@ -74,21 +81,19 @@ export class AudioMgr {
options = {
bundleName: "resources",
volume: this._soundVolume,
volume: this.soundVolume,
...options
};
if (sound instanceof AudioClip) {
this._audioSource.volume = 1.0;
this._audioSource.playOneShot(sound, options.volume * this._soundVolume);
this.audioSource.playOneShot(sound, options.volume);
} else {
let bundle = assetManager.getBundle(options.bundleName);
bundle.load(sound, (err, clip: AudioClip) => {
if (err) {
console.log(err);
} else {
this._audioSource.volume = 1.0;
this._audioSource.playOneShot(clip, options.volume * this._soundVolume);
this.audioSource.playOneShot(clip, options.volume);
}
});
}
......@@ -113,9 +118,9 @@ export class AudioMgr {
this._musicVolumeScale = options.volume;
if (sound instanceof AudioClip) {
this._audioSource.clip = sound;
this._audioSource.loop = options.loop;
this._audioSource.play();
this.audioSource.clip = sound;
this.audioSource.loop = options.loop;
this.audioSource.play();
this.audioSource.volume = this._musicVolume * this._musicVolumeScale;
} else {
let bundle = assetManager.getBundle(options.bundleName);
......@@ -123,9 +128,9 @@ export class AudioMgr {
if (err) {
console.log(err);
} else {
this._audioSource.clip = clip;
this._audioSource.loop = options.loop;
this._audioSource.play();
this.audioSource.clip = clip;
this.audioSource.loop = options.loop;
this.audioSource.play();
this.audioSource.volume = this._musicVolume * this._musicVolumeScale;
}
});
......
......@@ -2,7 +2,7 @@
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "43ec5cb6-cc53-49b3-9ede-e3052108c0fa",
"uuid": "0d2c3637-30b8-47c3-bba5-290984784603",
"files": [
".json",
".mp3"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment