Commit 86328455 authored by 李帅's avatar 李帅

+1

parent cc0ef51b
......@@ -2,12 +2,13 @@
* @Author: ls
* @Date: 2022-04-14 19:58:47
* @LastEditors: ls
* @LastEditTime: 2022-04-18 20:38:19
* @LastEditTime: 2022-04-18 20:47:24
* @Description: file content
* @FilePath: \ls_activity_after\assets\ls_activity_after\scene\ls_activity_after.ts
*/
import { MyCocosSceneComponent } from '../script/MyCocosSceneComponent';
import { callMiddleLayerFunction } from '../script/util';
const { ccclass, property } = cc._decorator;
......@@ -107,7 +108,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.playLocalAudio('btn');
// TODO
let info = this.data.gameInfo[Number(str)];
callMiddleLayerFunction('NS_select_game', { gameId: info.id }, (result) => {
console.log(JSON.stringify(result));
});
// callFunc('NS_select_game', { gameId: info.id });
}
}
......@@ -421,4 +421,14 @@ export function onHomeworkFinish() {
} else {
console.log('onHomeworkFinish');
}
}
export function callMiddleLayerFunction(apiName: string, data: any, callback: Function) {
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
middleLayerComponent.callMiddleLayerFunction(apiName, data, callback);
} else {
console.log('callMiddleLayerFunction: ' + apiName);
}
}
\ No newline at end of file
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