微信小程序编译
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,77 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { formatJsonStr, formatResponse, convertDataToPointer } from '../utils';
|
||||
let wxStartGyroscopeCallback;
|
||||
let wxStopGyroscopeCallback;
|
||||
let wxOnGyroscopeChangeCallback;
|
||||
const OnGyroscopeChange = (res) => {
|
||||
formatResponse('OnGyroscopeChangeListenerResult', res);
|
||||
const xPtr = convertDataToPointer(res.x);
|
||||
const yPtr = convertDataToPointer(res.y);
|
||||
const zPtr = convertDataToPointer(res.z);
|
||||
GameGlobal.Module.dynCall_viii(wxOnGyroscopeChangeCallback, xPtr, yPtr, zPtr);
|
||||
GameGlobal.Module._free(xPtr);
|
||||
GameGlobal.Module._free(yPtr);
|
||||
GameGlobal.Module._free(zPtr);
|
||||
};
|
||||
function handleCallback(callback, id, callbackType, res) {
|
||||
formatResponse('GeneralCallbackResult', res);
|
||||
const idPtr = convertDataToPointer(id);
|
||||
const msgPtr = convertDataToPointer(res.errMsg);
|
||||
GameGlobal.Module.dynCall_viii(callback, idPtr, callbackType, msgPtr);
|
||||
GameGlobal.Module._free(idPtr);
|
||||
GameGlobal.Module._free(msgPtr);
|
||||
}
|
||||
function WX_StartGyroscope(id, conf) {
|
||||
const config = formatJsonStr(conf);
|
||||
wx.startGyroscope({
|
||||
...config,
|
||||
success(res) {
|
||||
handleCallback(wxStartGyroscopeCallback, id, 2, res);
|
||||
},
|
||||
fail(res) {
|
||||
handleCallback(wxStartGyroscopeCallback, id, 1, res);
|
||||
},
|
||||
complete(res) {
|
||||
handleCallback(wxStartGyroscopeCallback, id, 0, res);
|
||||
},
|
||||
});
|
||||
}
|
||||
function WX_StopGyroscope(id, conf) {
|
||||
const config = formatJsonStr(conf);
|
||||
wx.stopGyroscope({
|
||||
...config,
|
||||
success(res) {
|
||||
handleCallback(wxStopGyroscopeCallback, id, 2, res);
|
||||
},
|
||||
fail(res) {
|
||||
handleCallback(wxStopGyroscopeCallback, id, 1, res);
|
||||
},
|
||||
complete(res) {
|
||||
handleCallback(wxStopGyroscopeCallback, id, 0, res);
|
||||
},
|
||||
});
|
||||
}
|
||||
function WX_OnGyroscopeChange() {
|
||||
wx.onGyroscopeChange(OnGyroscopeChange);
|
||||
}
|
||||
function WX_OffGyroscopeChange() {
|
||||
wx.offGyroscopeChange();
|
||||
}
|
||||
function WX_RegisterStartGyroscopeCallback(callback) {
|
||||
wxStartGyroscopeCallback = callback;
|
||||
}
|
||||
function WX_RegisterStopGyroscopeCallback(callback) {
|
||||
wxStopGyroscopeCallback = callback;
|
||||
}
|
||||
function WX_RegisterOnGyroscopeChangeCallback(callback) {
|
||||
wxOnGyroscopeChangeCallback = callback;
|
||||
}
|
||||
export default {
|
||||
WX_StartGyroscope,
|
||||
WX_StopGyroscope,
|
||||
WX_OnGyroscopeChange,
|
||||
WX_OffGyroscopeChange,
|
||||
WX_RegisterStartGyroscopeCallback,
|
||||
WX_RegisterStopGyroscopeCallback,
|
||||
WX_RegisterOnGyroscopeChangeCallback,
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee51f3d234e4aad4ab47c05df4c10f4b
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user