|
@@ -2,32 +2,18 @@ import { _decorator, Component, Node, sys, native } from 'cc';
|
|
import { GameMng } from './GameMng';
|
|
import { GameMng } from './GameMng';
|
|
import { UIManager } from './gcommon/UIManager';
|
|
import { UIManager } from './gcommon/UIManager';
|
|
import { msgManager } from './socket/msgManager';
|
|
import { msgManager } from './socket/msgManager';
|
|
|
|
+import { Tools } from './Tools';
|
|
const { ccclass, property } = _decorator;
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
@ccclass('native_manager')
|
|
@ccclass('native_manager')
|
|
export class native_manager {
|
|
export class native_manager {
|
|
public static wxLogin(){
|
|
public static wxLogin(){
|
|
|
|
+ UIManager.AddPrefab(GameMng.Instance.uiloading)
|
|
if("ANDROID"==sys.platform){
|
|
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_)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ native.jsbBridgeWrapper.dispatchEventToNative("send_ios_login");
|
|
|
|
+ native.jsbBridgeWrapper.removeNativeEventListener("receive_ios_login",native_manager.ios_login)
|
|
|
|
+ native.jsbBridgeWrapper.addNativeEventListener("receive_ios_login",native_manager.ios_login);
|
|
}else if("IOS"==sys.platform){
|
|
}else if("IOS"==sys.platform){
|
|
-
|
|
|
|
native.jsbBridgeWrapper.dispatchEventToNative("send_ios_login");
|
|
native.jsbBridgeWrapper.dispatchEventToNative("send_ios_login");
|
|
native.jsbBridgeWrapper.removeNativeEventListener("receive_ios_login",native_manager.ios_login)
|
|
native.jsbBridgeWrapper.removeNativeEventListener("receive_ios_login",native_manager.ios_login)
|
|
native.jsbBridgeWrapper.addNativeEventListener("receive_ios_login",native_manager.ios_login);
|
|
native.jsbBridgeWrapper.addNativeEventListener("receive_ios_login",native_manager.ios_login);
|
|
@@ -55,10 +41,35 @@ export class native_manager {
|
|
public static share(){
|
|
public static share(){
|
|
if("ANDROID"==sys.platform){
|
|
if("ANDROID"==sys.platform){
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
- var o = native.reflection.callStaticMethod("com/cocos/game/AppActivity", "shareWx", "()V");
|
|
|
|
|
|
+ var o = native.reflection.callStaticMethod("com/cocos/game/AppActivity", "shareWx", "(Ljava/lang/String;)V",Tools.getShareObj());
|
|
}, 1000);
|
|
}, 1000);
|
|
}else if("IOS"==sys.platform){
|
|
}else if("IOS"==sys.platform){
|
|
- native.jsbBridgeWrapper.dispatchEventToNative("shareWx");
|
|
|
|
|
|
+ native.jsbBridgeWrapper.dispatchEventToNative("shareWx",Tools.getShareObj());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static check_jump_info(){
|
|
|
|
+ native_manager.recv_jump_info();
|
|
|
|
+ if("ANDROID"==sys.platform){
|
|
|
|
+ native.jsbBridgeWrapper.dispatchEventToNative("check_jump_info");
|
|
|
|
+ }else if("IOS"==sys.platform){
|
|
|
|
+ native.jsbBridgeWrapper.dispatchEventToNative("check_jump_info");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ public static recv_jump_info_call(jsonStr: string): void {
|
|
|
|
+ var json_ = JSON.parse(jsonStr);
|
|
|
|
+ console.log("recv_jump_info_call",jsonStr)
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ public static recv_jump_info(){
|
|
|
|
+ native.jsbBridgeWrapper.removeAllListeners()
|
|
|
|
+ if("ANDROID"==sys.platform){
|
|
|
|
+ native.jsbBridgeWrapper.removeNativeEventListener("recv_jump_info",native_manager.recv_jump_info_call);
|
|
|
|
+ native.jsbBridgeWrapper.addNativeEventListener("recv_jump_info",native_manager.recv_jump_info_call);
|
|
|
|
+ }else if("IOS"==sys.platform){
|
|
|
|
+ native.jsbBridgeWrapper.removeNativeEventListener("recv_jump_info",native_manager.recv_jump_info_call);
|
|
|
|
+ native.jsbBridgeWrapper.addNativeEventListener("recv_jump_info",native_manager.recv_jump_info_call);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public static hideSplash(){
|
|
public static hideSplash(){
|