Commit 375e6467 authored by liujiaxin's avatar liujiaxin

111

parent af47150b
......@@ -62,10 +62,34 @@ export default class SceneComponent extends MyCocosSceneComponent {
_mapScaleMin: number = 1;
_mapScaleMax: number = 1;
_cocosScale: number = 1;
BASE_URL: string = null;
MACHINE_INITED: boolean = false;
onLoad(){
this.tws = [];
this.LoadingCount = 0;
this.initSize();
}
initialized() {
if(this.BASE_URL && this.gameMachineService) {
this.gameMachineService.start();
this.restore();
}
}
callOcMethod(method, param) {
const paramStr = JSON.stringify(param);
if (cc.sys.isNative && cc.sys.os == cc.sys.OS_IOS) {
return jsb.reflection.callStaticMethod('CocosMng', `${method}:`, paramStr);
} else if (cc.sys.isNative && cc.sys.os == cc.sys.OS_ANDROID) {
return jsb.reflection.callStaticMethod('com/iplayabc/cocos/AppActivity', method, '(Ljava/lang/String;)Ljava/lang/String;', paramStr);
} else if (cc.sys.isNative && cc.sys.os == cc.sys.OS_WINDOWS) {
console.log('汪汪汪')
} else {
throw ('非源生环境');
}
}
initSize() {
// 注意cc.winSize只有在适配后(修改fitHeight/fitWidth后)才能获取到正确的值,因此使用cc.getFrameSize()来获取初始的屏幕大小
......@@ -137,7 +161,27 @@ export default class SceneComponent extends MyCocosSceneComponent {
}, this, true);
});
}
globalThis.aaa = this;
const that = this;
// @ts-ignores
window.air.getEngineInfoCallback = function({isDev} ) {
console.log(isDev);
if (isDev) {
this.BASE_URL = 'https://staging-teach.ireadabc.com';
} else {
this.BASE_URL = 'https://iteachabc.com';
}
console.log(111111);
that.initialized();
}
// @ts-ignores
const success = this.callOcMethod('getEngineInfo');
if (success) {
console.log("callOcMethod('getEngineInfo') success" + success);
} else {
console.log("callOcMethod('getEngineInfo') error" + success);
}
}
initBg() {
// const bgNode = cc.find('Canvas/MainScene/SpaceView/bg');
......@@ -500,8 +544,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.gameMachineService = interpret(operationMachine).onTransition((state) => {
// console.log(1, state);
});
this.gameMachineService.start();
this.restore();
}
restore() {
if (globalThis.PREV_STATE) {
......
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