微信小程序编译
All checks were successful
Plugin Library CI / publish (00.BuildOriginality) (push) Successful in 13s
Plugin Library CI / publish (00.StaryEvo) (push) Successful in 17s
Plugin Library CI / publish (00.StaryEvoTools) (push) Successful in 35s
Plugin Library CI / publish (01.HybridCLR) (push) Successful in 15s
Plugin Library CI / publish (02.InformationSave) (push) Successful in 3s
Plugin Library CI / publish (03.YooAsset) (push) Successful in 33s
Plugin Library CI / publish (04.AudioCore) (push) Successful in 3s
Plugin Library CI / publish (05.TableTextConversion) (push) Successful in 5s
Plugin Library CI / publish (06.UIFarme) (push) Successful in 15s
Plugin Library CI / publish (07.RKTools) (push) Successful in 2s
Plugin Library CI / publish (08.UniTask) (push) Successful in 3s
Plugin Library CI / publish (09.CodeChecker) (push) Successful in 16s
Plugin Library CI / publish (10.StoryEditor) (push) Successful in 3s
Plugin Library CI / publish (10.XNode) (push) Successful in 3s
Plugin Library CI / publish (11.PointCloudTools) (push) Successful in 2s
Plugin Library CI / publish (12.WeixinMinigame) (push) Successful in 2m32s
All checks were successful
Plugin Library CI / publish (00.BuildOriginality) (push) Successful in 13s
Plugin Library CI / publish (00.StaryEvo) (push) Successful in 17s
Plugin Library CI / publish (00.StaryEvoTools) (push) Successful in 35s
Plugin Library CI / publish (01.HybridCLR) (push) Successful in 15s
Plugin Library CI / publish (02.InformationSave) (push) Successful in 3s
Plugin Library CI / publish (03.YooAsset) (push) Successful in 33s
Plugin Library CI / publish (04.AudioCore) (push) Successful in 3s
Plugin Library CI / publish (05.TableTextConversion) (push) Successful in 5s
Plugin Library CI / publish (06.UIFarme) (push) Successful in 15s
Plugin Library CI / publish (07.RKTools) (push) Successful in 2s
Plugin Library CI / publish (08.UniTask) (push) Successful in 3s
Plugin Library CI / publish (09.CodeChecker) (push) Successful in 16s
Plugin Library CI / publish (10.StoryEditor) (push) Successful in 3s
Plugin Library CI / publish (10.XNode) (push) Successful in 3s
Plugin Library CI / publish (11.PointCloudTools) (push) Successful in 2s
Plugin Library CI / publish (12.WeixinMinigame) (push) Successful in 2m32s
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
import { WEBAudio, audios, unityAudioVolume, innerAudioVolume } from './store';
|
||||
import { resumeWebAudio, mkCacheDir } from './utils';
|
||||
|
||||
mkCacheDir();
|
||||
export default {
|
||||
WXGetAudioCount() {
|
||||
return {
|
||||
innerAudio: Object.keys(audios).length,
|
||||
webAudio: WEBAudio.bufferSourceNodeLength,
|
||||
buffer: WEBAudio.audioBufferLength,
|
||||
};
|
||||
},
|
||||
WXSetAudioMute(value) {
|
||||
if (typeof value !== 'boolean') {
|
||||
return;
|
||||
}
|
||||
if (WEBAudio.isMute === value) {
|
||||
return;
|
||||
}
|
||||
WEBAudio.isMute = value;
|
||||
|
||||
for (const channelInstance of Object.keys(WEBAudio.audioInstances)) {
|
||||
const channel = WEBAudio.audioInstances[+channelInstance];
|
||||
if (channel.source) {
|
||||
channel.setVolume?.(value ? 0 : unityAudioVolume.get(channel) ?? 1);
|
||||
}
|
||||
}
|
||||
|
||||
for (const innerAudio of Object.values(audios)) {
|
||||
innerAudio.volume = value ? 0 : innerAudioVolume.get(innerAudio) ?? 1;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const HandleInterruption = {
|
||||
init() {
|
||||
let INTERRUPT_LIST = {};
|
||||
wx.onHide(() => {
|
||||
Object.keys(audios).forEach((key) => {
|
||||
if (!audios[key].paused !== false) {
|
||||
INTERRUPT_LIST[key] = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
wx.onShow(() => {
|
||||
Object.keys(audios).forEach((key) => {
|
||||
if (audios[key].paused !== false && INTERRUPT_LIST[key]) {
|
||||
audios[key].play();
|
||||
}
|
||||
});
|
||||
INTERRUPT_LIST = {};
|
||||
});
|
||||
wx.onAudioInterruptionBegin(() => {
|
||||
Object.keys(audios).forEach((key) => {
|
||||
if (!audios[key].paused !== false) {
|
||||
INTERRUPT_LIST[key] = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
wx.onAudioInterruptionEnd(() => {
|
||||
Object.keys(audios).forEach((key) => {
|
||||
if (audios[key].paused !== false && INTERRUPT_LIST[key]) {
|
||||
audios[key].play();
|
||||
}
|
||||
});
|
||||
INTERRUPT_LIST = {};
|
||||
resumeWebAudio();
|
||||
});
|
||||
},
|
||||
};
|
||||
HandleInterruption.init();
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5bf97124ccca4d4d8594e4fa7cf6e80
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,3 @@
|
||||
export const INNER_AUDIO_UNDEFINED_MSG = 'InnerAudioContext does not exist!';
|
||||
export const IGNORE_ERROR_MSG = 'audio is playing, don\'t play again';
|
||||
export const TEMP_DIR_PATH = `${wx.env.USER_DATA_PATH}/__GAME_FILE_CACHE/audios`;
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0dc51494e781bc54986232005518beb5
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
import innerAudio from './inner-audio';
|
||||
import unityAudio from './unity-audio';
|
||||
import common from './common';
|
||||
export default {
|
||||
...innerAudio,
|
||||
...unityAudio,
|
||||
...common,
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c18b7b9c9f4611a4981b7e7b85a8b9e3
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,382 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
import moduleHelper from '../module-helper';
|
||||
import { isSupportPlayBackRate } from '../../check-version';
|
||||
import { audios, localAudioMap, downloadingAudioMap, innerAudioVolume, WEBAudio } from './store';
|
||||
import { createInnerAudio, destroyInnerAudio, printErrMsg } from './utils';
|
||||
import { IGNORE_ERROR_MSG, INNER_AUDIO_UNDEFINED_MSG } from './const';
|
||||
const funs = {
|
||||
|
||||
getFullUrl(v) {
|
||||
if (!/^https?:\/\//.test(v) && !/^wxfile:\/\//.test(v)) {
|
||||
const cdnPath = GameGlobal.manager.assetPath;
|
||||
v = `${cdnPath.replace(/\/$/, '')}/${v.replace(/^\//, '').replace(/^Assets\//, '')}`;
|
||||
}
|
||||
return v;
|
||||
},
|
||||
|
||||
downloadAudios(paths) {
|
||||
const list = paths.split(',');
|
||||
return Promise.all(list.map((v) => {
|
||||
const src = funs.getFullUrl(v);
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
if (!downloadingAudioMap[src]) {
|
||||
downloadingAudioMap[src] = [
|
||||
{
|
||||
resolve,
|
||||
reject,
|
||||
},
|
||||
];
|
||||
if (funs.checkLocalFile(src)) {
|
||||
funs.handleDownloadEnd(src, true);
|
||||
}
|
||||
else if (!GameGlobal.unityNamespace.isCacheableFile(src)) {
|
||||
|
||||
wx.downloadFile({
|
||||
url: src,
|
||||
success(res) {
|
||||
if (res.statusCode === 200 && res.tempFilePath) {
|
||||
localAudioMap[src] = res.tempFilePath;
|
||||
funs.handleDownloadEnd(src, true);
|
||||
}
|
||||
else {
|
||||
funs.handleDownloadEnd(src, false);
|
||||
}
|
||||
},
|
||||
fail(e) {
|
||||
funs.handleDownloadEnd(src, false);
|
||||
printErrMsg(e);
|
||||
},
|
||||
});
|
||||
}
|
||||
else {
|
||||
const xmlhttp = new GameGlobal.unityNamespace.UnityLoader.UnityCache.XMLHttpRequest();
|
||||
xmlhttp.open('GET', src, true);
|
||||
xmlhttp.responseType = 'arraybuffer';
|
||||
xmlhttp.onsave = () => {
|
||||
localAudioMap[src] = GameGlobal.manager.getCachePath(src);
|
||||
funs.handleDownloadEnd(src, true);
|
||||
};
|
||||
xmlhttp.onsavefail = () => {
|
||||
funs.handleDownloadEnd(src, false);
|
||||
};
|
||||
xmlhttp.onerror = () => {
|
||||
funs.handleDownloadEnd(src, false);
|
||||
};
|
||||
xmlhttp.send();
|
||||
}
|
||||
}
|
||||
else {
|
||||
downloadingAudioMap[src].push({
|
||||
resolve,
|
||||
reject,
|
||||
});
|
||||
}
|
||||
});
|
||||
}));
|
||||
},
|
||||
|
||||
handleDownloadEnd(src, succeeded) {
|
||||
if (!downloadingAudioMap[src]) {
|
||||
return;
|
||||
}
|
||||
while (downloadingAudioMap[src] && downloadingAudioMap[src].length > 0) {
|
||||
const item = downloadingAudioMap[src].shift();
|
||||
if (!succeeded) {
|
||||
item?.reject();
|
||||
}
|
||||
else {
|
||||
item?.resolve('');
|
||||
}
|
||||
}
|
||||
delete downloadingAudioMap[src];
|
||||
},
|
||||
// 是否存在本地文件
|
||||
checkLocalFile(src) {
|
||||
if (localAudioMap[src]) {
|
||||
return true;
|
||||
}
|
||||
const path = GameGlobal.manager.getCachePath(src);
|
||||
if (path) {
|
||||
localAudioMap[src] = path;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
// 设置路径
|
||||
setAudioSrc(audio, getSrc) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const src = funs.getFullUrl(getSrc);
|
||||
// 设置原始路径,后面用此路径作为key值
|
||||
audio.isLoading = src;
|
||||
if (funs.checkLocalFile(src)) {
|
||||
audio.src = localAudioMap[src];
|
||||
delete audio.isLoading;
|
||||
funs.handleDownloadEnd(src, true);
|
||||
resolve(localAudioMap[src]);
|
||||
}
|
||||
else if (audio.needDownload) {
|
||||
funs
|
||||
.downloadAudios(src)
|
||||
.then(() => {
|
||||
if (audio) {
|
||||
audio.src = localAudioMap[src];
|
||||
delete audio.isLoading;
|
||||
resolve(localAudioMap[src]);
|
||||
}
|
||||
else {
|
||||
console.warn('资源已被删除:', src);
|
||||
reject({
|
||||
errCode: -1,
|
||||
errMsg: '资源已被删除',
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
console.warn('资源下载失败:', src);
|
||||
if (audio) {
|
||||
audio.src = src;
|
||||
delete audio.isLoading;
|
||||
}
|
||||
reject({
|
||||
errCode: -1,
|
||||
errMsg: '资源下载失败',
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
// 不推荐这样处理,建议优先下载再使用,除非是需要立即播放的长音频文件或一次性播放音频
|
||||
// console.warn('建议优先下载再使用:', src);
|
||||
audio.src = src;
|
||||
delete audio.isLoading;
|
||||
resolve(src);
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
function checkHasAudio(id) {
|
||||
if (audios[id]) {
|
||||
return true;
|
||||
}
|
||||
console.error(INNER_AUDIO_UNDEFINED_MSG, id);
|
||||
return false;
|
||||
}
|
||||
export default {
|
||||
// 创建audio对象
|
||||
WXCreateInnerAudioContext(src, loop, startTime, autoplay, volume, playbackRate, needDownload) {
|
||||
const { audio: getAudio, id } = createInnerAudio();
|
||||
getAudio.needDownload = needDownload;
|
||||
if (src) {
|
||||
// 设置原始src
|
||||
funs.setAudioSrc(getAudio, src).catch((e) => {
|
||||
moduleHelper.send('OnAudioCallback', JSON.stringify({
|
||||
callbackId: id,
|
||||
errMsg: 'onError',
|
||||
result: JSON.stringify(e),
|
||||
}));
|
||||
});
|
||||
}
|
||||
if (loop) {
|
||||
getAudio.loop = true;
|
||||
}
|
||||
if (autoplay) {
|
||||
getAudio.autoplay = true;
|
||||
}
|
||||
if (typeof startTime === 'undefined') {
|
||||
startTime = 0;
|
||||
}
|
||||
if (startTime > 0) {
|
||||
getAudio.startTime = +startTime.toFixed(2);
|
||||
}
|
||||
|
||||
let volumeValue;
|
||||
if (typeof volume === 'undefined') {
|
||||
volumeValue = 1;
|
||||
}
|
||||
else {
|
||||
volumeValue = +volume.toFixed(2);
|
||||
}
|
||||
innerAudioVolume.set(getAudio, volumeValue);
|
||||
if (WEBAudio.isMute) {
|
||||
volumeValue = 0;
|
||||
}
|
||||
if (volumeValue !== 1) {
|
||||
getAudio.volume = volumeValue;
|
||||
}
|
||||
|
||||
if (!isSupportPlayBackRate) {
|
||||
playbackRate = 1;
|
||||
}
|
||||
if (typeof playbackRate !== 'undefined' && playbackRate !== 1) {
|
||||
getAudio.playbackRate = +playbackRate.toFixed(2);
|
||||
}
|
||||
return id;
|
||||
},
|
||||
|
||||
WXInnerAudioContextSetBool(id, k, v) {
|
||||
if (!checkHasAudio(id)) {
|
||||
return;
|
||||
}
|
||||
audios[id][k] = Boolean(+v);
|
||||
},
|
||||
|
||||
WXInnerAudioContextSetString(id, k, v) {
|
||||
if (!checkHasAudio(id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (k === 'src') {
|
||||
funs.setAudioSrc(audios[id], v);
|
||||
}
|
||||
else if (k === 'needDownload') {
|
||||
audios[id].needDownload = !!v;
|
||||
}
|
||||
else {
|
||||
audios[id][k] = v;
|
||||
}
|
||||
},
|
||||
|
||||
WXInnerAudioContextSetFloat(id, k, v) {
|
||||
if (!checkHasAudio(id)) {
|
||||
return;
|
||||
}
|
||||
let value = +v.toFixed(2);
|
||||
if (k === 'volume') {
|
||||
innerAudioVolume.set(audios[id], value);
|
||||
if (WEBAudio.isMute) {
|
||||
value = 0;
|
||||
}
|
||||
}
|
||||
audios[id][k] = value;
|
||||
},
|
||||
|
||||
WXInnerAudioContextGetFloat(id, k) {
|
||||
if (!checkHasAudio(id)) {
|
||||
return 0;
|
||||
}
|
||||
return audios[id][k];
|
||||
},
|
||||
|
||||
WXInnerAudioContextGetBool(id, k) {
|
||||
if (!checkHasAudio(id)) {
|
||||
return false;
|
||||
}
|
||||
return audios[id][k];
|
||||
},
|
||||
WXInnerAudioContextPlay(id) {
|
||||
if (!checkHasAudio(id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const url = audios[id].isLoading;
|
||||
if (url) {
|
||||
if (downloadingAudioMap[url]) {
|
||||
downloadingAudioMap[url].push({
|
||||
resolve: () => {
|
||||
if (typeof audios[id] !== 'undefined') {
|
||||
audios[id].play();
|
||||
}
|
||||
},
|
||||
reject: () => { },
|
||||
});
|
||||
}
|
||||
else {
|
||||
audios[id].src = url;
|
||||
audios[id].play();
|
||||
}
|
||||
}
|
||||
else {
|
||||
audios[id].play();
|
||||
}
|
||||
},
|
||||
WXInnerAudioContextPause(id) {
|
||||
if (!checkHasAudio(id)) {
|
||||
return;
|
||||
}
|
||||
audios[id].pause();
|
||||
},
|
||||
WXInnerAudioContextStop(id) {
|
||||
if (!checkHasAudio(id)) {
|
||||
return;
|
||||
}
|
||||
audios[id].stop();
|
||||
},
|
||||
WXInnerAudioContextDestroy(id) {
|
||||
if (!checkHasAudio(id)) {
|
||||
return;
|
||||
}
|
||||
destroyInnerAudio(id, false);
|
||||
},
|
||||
WXInnerAudioContextSeek(id, position) {
|
||||
if (!checkHasAudio(id)) {
|
||||
return;
|
||||
}
|
||||
audios[id].seek(+position.toFixed(3));
|
||||
},
|
||||
|
||||
WXInnerAudioContextAddListener(id, key) {
|
||||
if (!checkHasAudio(id)) {
|
||||
return;
|
||||
}
|
||||
if (key === 'onCanplay') {
|
||||
audios[id][key](() => {
|
||||
|
||||
// @ts-ignore
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const { duration, buffered, referrerPolicy, volume } = audios[id];
|
||||
setTimeout(() => {
|
||||
moduleHelper.send('OnAudioCallback', JSON.stringify({
|
||||
callbackId: id,
|
||||
errMsg: key,
|
||||
}));
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
else if (key === 'onError') {
|
||||
audios[id][key]((e) => {
|
||||
if (key === 'onError') {
|
||||
console.error(e);
|
||||
|
||||
if (e.errMsg && e.errMsg.indexOf(IGNORE_ERROR_MSG) > -1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
moduleHelper.send('OnAudioCallback', JSON.stringify({
|
||||
callbackId: id,
|
||||
errMsg: key,
|
||||
result: JSON.stringify(e),
|
||||
}));
|
||||
});
|
||||
}
|
||||
else {
|
||||
audios[id][key](() => {
|
||||
moduleHelper.send('OnAudioCallback', JSON.stringify({
|
||||
callbackId: id,
|
||||
errMsg: key,
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
WXInnerAudioContextRemoveListener(id, key) {
|
||||
if (!checkHasAudio(id)) {
|
||||
return;
|
||||
}
|
||||
audios[id][key]();
|
||||
},
|
||||
WXPreDownloadAudios(paths, id) {
|
||||
funs
|
||||
.downloadAudios(paths)
|
||||
.then(() => {
|
||||
moduleHelper.send('WXPreDownloadAudiosCallback', JSON.stringify({
|
||||
callbackId: id.toString(),
|
||||
errMsg: '0',
|
||||
}));
|
||||
})
|
||||
.catch(() => {
|
||||
moduleHelper.send('WXPreDownloadAudiosCallback', JSON.stringify({
|
||||
callbackId: id.toString(),
|
||||
errMsg: '1',
|
||||
}));
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 033aeb45adbd11f4abba39dd2839a1a6
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
export const WEBAudio = {
|
||||
audioInstanceIdCounter: 0,
|
||||
audioInstances: {},
|
||||
audioContext: null,
|
||||
audioWebEnabled: 0,
|
||||
audioCache: [],
|
||||
lOrientation: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0,
|
||||
xUp: 0,
|
||||
yUp: 0,
|
||||
zUp: 0,
|
||||
},
|
||||
lPosition: { x: 0, y: 0, z: 0 },
|
||||
audio3DSupport: 0,
|
||||
audioWebSupport: 0,
|
||||
bufferSourceNodeLength: 0,
|
||||
audioBufferLength: 0,
|
||||
isMute: false,
|
||||
FAKEMOD_SAMPLERATE: 44100,
|
||||
};
|
||||
|
||||
export const audios = {};
|
||||
|
||||
export const localAudioMap = {};
|
||||
|
||||
export const downloadingAudioMap = {};
|
||||
|
||||
export const unityAudioVolume = new WeakMap();
|
||||
|
||||
export const innerAudioVolume = new WeakMap();
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d0bb4dd4f84ca04188176f74c16fce6
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4d172d7fd90dbd49bf784793ab3c46f
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,77 @@
|
||||
import { uid } from '../utils';
|
||||
import { isSupportCacheAudio } from '../../check-version';
|
||||
import { WEBAudio, audios } from './store';
|
||||
import { TEMP_DIR_PATH } from './const';
|
||||
export const resumeWebAudio = () => {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
WEBAudio.audioContext?.resume();
|
||||
};
|
||||
export const createInnerAudio = () => {
|
||||
const id = uid();
|
||||
const audio = (isSupportCacheAudio && WEBAudio.audioCache.length ? WEBAudio.audioCache.shift() : wx.createInnerAudioContext());
|
||||
if (audio) {
|
||||
audios[id] = audio;
|
||||
}
|
||||
return {
|
||||
id,
|
||||
audio,
|
||||
};
|
||||
};
|
||||
export const destroyInnerAudio = (id, useCache) => {
|
||||
if (!id) {
|
||||
return;
|
||||
}
|
||||
if (!useCache || !isSupportCacheAudio || WEBAudio.audioCache.length > 32) {
|
||||
audios[id].destroy();
|
||||
}
|
||||
else {
|
||||
|
||||
['Play', 'Pause', 'Stop', 'Canplay', 'Error', 'Ended', 'Waiting', 'Seeking', 'Seeked', 'TimeUpdate'].forEach((eventName) => {
|
||||
audios[id][`off${eventName}`]();
|
||||
});
|
||||
const state = {
|
||||
startTime: 0,
|
||||
obeyMuteSwitch: true,
|
||||
volume: 1,
|
||||
autoplay: false,
|
||||
loop: false,
|
||||
referrerPolicy: '',
|
||||
};
|
||||
Object.keys(state).forEach((key) => {
|
||||
try {
|
||||
|
||||
// @ts-ignore
|
||||
audios[id][key] = state[key];
|
||||
}
|
||||
catch (e) { }
|
||||
});
|
||||
audios[id].stop();
|
||||
const cacheAudio = audios[id];
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
WEBAudio.audioCache.push(cacheAudio);
|
||||
}, 1000);
|
||||
}
|
||||
delete audios[id];
|
||||
};
|
||||
export const printErrMsg = (msg) => {
|
||||
GameGlobal.manager.printErr(msg);
|
||||
};
|
||||
export function mkCacheDir() {
|
||||
const fs = wx.getFileSystemManager();
|
||||
fs.rmdir({
|
||||
dirPath: TEMP_DIR_PATH,
|
||||
recursive: true,
|
||||
complete: () => {
|
||||
fs.mkdir({
|
||||
dirPath: TEMP_DIR_PATH,
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97c25a02351801740b75a45a2522115f
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user