微信小程序编译
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,103 @@
|
||||
import moduleHelper from './module-helper';
|
||||
import { formatJsonStr, getListObject, uid } from './utils';
|
||||
const gameClubButtonList = {};
|
||||
const typeEnum = {
|
||||
0: 'text',
|
||||
1: 'image',
|
||||
};
|
||||
const iconEnum = {
|
||||
0: 'green',
|
||||
1: 'white',
|
||||
2: 'dark',
|
||||
3: 'light',
|
||||
};
|
||||
const getObject = getListObject(gameClubButtonList, 'gameClubButton');
|
||||
export default {
|
||||
WXCreateGameClubButton(conf) {
|
||||
const config = formatJsonStr(conf);
|
||||
// @ts-ignore
|
||||
config.style = JSON.parse(config.styleRaw);
|
||||
if (config.style.fontSize === 0) {
|
||||
// @ts-ignore
|
||||
config.style.fontSize = undefined;
|
||||
}
|
||||
// @ts-ignore
|
||||
config.type = typeEnum[config.type];
|
||||
// @ts-ignore
|
||||
config.icon = iconEnum[config.icon];
|
||||
|
||||
if (!config.text) {
|
||||
config.text = '';
|
||||
}
|
||||
const id = uid();
|
||||
gameClubButtonList[id] = wx.createGameClubButton(config);
|
||||
return id;
|
||||
},
|
||||
WXGameClubButtonDestroy(id) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
obj.destroy();
|
||||
if (gameClubButtonList) {
|
||||
delete gameClubButtonList[id];
|
||||
}
|
||||
},
|
||||
WXGameClubButtonHide(id) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
obj.hide();
|
||||
},
|
||||
WXGameClubButtonShow(id) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
obj.show();
|
||||
},
|
||||
WXGameClubButtonAddListener(id, key) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
obj[key](() => {
|
||||
moduleHelper.send('OnGameClubButtonCallback', JSON.stringify({
|
||||
callbackId: id,
|
||||
errMsg: key,
|
||||
}));
|
||||
});
|
||||
},
|
||||
WXGameClubButtonRemoveListener(id, key) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
obj[key]();
|
||||
},
|
||||
|
||||
WXGameClubButtonSetProperty(id, key, value) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
obj[key] = value;
|
||||
},
|
||||
|
||||
WXGameClubStyleChangeInt(id, key, value) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
obj.style[key] = value;
|
||||
},
|
||||
|
||||
WXGameClubStyleChangeStr(id, key, value) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
obj.style[key] = value;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user