Commit 8f86d3b7 authored by 李帅's avatar 李帅

+1

parent 1108a048
......@@ -2,12 +2,13 @@
* @Author: ls
* @Date: 2022-04-14 19:58:47
* @LastEditors: ls
* @LastEditTime: 2022-04-18 20:36:31
* @LastEditTime: 2022-04-18 20:49:19
* @Description: file content
* @FilePath: \ls_activity_before\assets\ls_activity_before\scene\ls_activity_before.ts
*/
import { MyCocosSceneComponent } from '../script/MyCocosSceneComponent';
import { callMiddleLayerFunction } from '../script/util';
const { ccclass, property } = cc._decorator;
......@@ -91,6 +92,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 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