Commit 86328455 authored by 李帅's avatar 李帅

+1

parent cc0ef51b
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
* @Author: ls * @Author: ls
* @Date: 2022-04-14 19:58:47 * @Date: 2022-04-14 19:58:47
* @LastEditors: ls * @LastEditors: ls
* @LastEditTime: 2022-04-18 20:38:19 * @LastEditTime: 2022-04-18 20:47:24
* @Description: file content * @Description: file content
* @FilePath: \ls_activity_after\assets\ls_activity_after\scene\ls_activity_after.ts * @FilePath: \ls_activity_after\assets\ls_activity_after\scene\ls_activity_after.ts
*/ */
import { MyCocosSceneComponent } from '../script/MyCocosSceneComponent'; import { MyCocosSceneComponent } from '../script/MyCocosSceneComponent';
import { callMiddleLayerFunction } from '../script/util';
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
...@@ -108,6 +109,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -108,6 +109,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
// TODO // TODO
let info = this.data.gameInfo[Number(str)]; 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 }); // callFunc('NS_select_game', { gameId: info.id });
} }
} }
...@@ -422,3 +422,13 @@ export function onHomeworkFinish() { ...@@ -422,3 +422,13 @@ export function onHomeworkFinish() {
console.log('onHomeworkFinish'); 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