import { _decorator, Component, Node, sys, native } from 'cc'; import { GameMng } from './GameMng'; import { UIManager } from './gcommon/UIManager'; import { msgManager } from './socket/msgManager'; const { ccclass, property } = _decorator; @ccclass('native_manager') export class native_manager { public static wxLogin(){ if("ANDROID"==sys.platform){ UIManager.AddPrefab(GameMng.Instance.uiloading) var o = native.reflection.callStaticMethod("com/cocos/game/AppActivity", "wxLogin", "()V"); native.bridge.onNative = (jsonStr:string)=>{ var json_ = JSON.parse(jsonStr); console.log("wxLogin",jsonStr) if(jsonStr!=""){ for (const key in json_) { if (Object.prototype.hasOwnProperty.call(json_, key)) { const element = json_[key]; console.log("wxLogin",element) } } msgManager.wxlogin(json_.nickname,json_.openId,json_.sex,json_.property,json_.city,json_.country,json_.headimgurl) }else{ console.log("wxLogin error",json_) } } }else{ // msgManager.wxlogin(json_.nickname,json_.openId,json_.sex,json_.property,json_.city,json_.country,json_.headimgurl) } } public static share(){ if("ANDROID"==sys.platform){ setTimeout(() => { var o = native.reflection.callStaticMethod("com/cocos/game/AppActivity", "shareWx", "()V"); }, 1000); } } public static hideSplash(){ if("ANDROID"==sys.platform){ setTimeout(() => { var o = native.reflection.callStaticMethod("com/cocos/game/AppActivity", "hideSplash", "()V"); }, 1000); } } }