添加微信云开发环境
This commit is contained in:
@@ -12,6 +12,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { LoadingViewComp } from "./view/LoadingViewComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { WxCloudApi } from "../wx_clound_client_api/WxCloudApi";
|
||||
|
||||
|
||||
// import {data} from "../data/data";
|
||||
@@ -50,6 +51,10 @@ export class Initialize extends ecs.Entity {
|
||||
oops.res.load("language/font/" + oops.language.current, () => {
|
||||
// 加载本地英雄数据
|
||||
this.loadHeroDataFromLocal();
|
||||
// 判断是否为微信客户端,是的话才加载云端数据
|
||||
if (this.isWxClient()) {
|
||||
this.loadWxDataFromCloud();
|
||||
}
|
||||
next();
|
||||
});
|
||||
//加载精灵配置表
|
||||
@@ -83,7 +88,19 @@ export class Initialize extends ecs.Entity {
|
||||
oops.res.loadDir("common", next);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 判断是否为微信客户端
|
||||
*/
|
||||
private isWxClient(): boolean {
|
||||
// 检查是否存在微信API
|
||||
return typeof wx !== 'undefined' && typeof (wx as any).getSystemInfoSync === 'function';
|
||||
}
|
||||
|
||||
private loadWxDataFromCloud() {
|
||||
WxCloudApi.login().then(loginRes=>{
|
||||
console.log("login res", loginRes);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 从本地存储加载游戏数据
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user