Commit 12920820 authored by haiyoucuv's avatar haiyoucuv

init

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