Browse Source

微信登录接口提取

lvjincheng 2 years ago
parent
commit
85ed0053fb

+ 1 - 3
Assets/BowArrow/Scripts/Manager/LoginMgr/LoginView.cs

@@ -203,9 +203,7 @@ public class LoginView : MonoBehaviour
             PopupMgr.ins.ShowTip(TextAutoLanguage2.GetTextByCNKey("操作过于频繁"));
             return;
         }
-        #if UNITY_ANDROID
-        using (var sdk = new AndroidJavaClass("com.xmjssvr.BowArrow.mi.WeChatSDK")) sdk.CallStatic("WeChatLogin");
-        #endif
+        WeChatLoginHelper.Login();
     }
 
     private string _loginToken = null;

+ 18 - 0
Assets/BowArrow/Scripts/Manager/LoginMgr/WeChatLoginHelper.cs

@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class WeChatLoginHelper
+{
+    public static void Login()
+    {
+        #if UNITY_ANDROID
+        using (var sdk = new AndroidJavaClass("com.xmjssvr.BowArrow.mi.WeChatSDK")) sdk.CallStatic("WeChatLogin");
+        #endif
+    }
+
+    public static void OnLoginResp(string code)
+    {
+        LoginView.ins?.OnWxLoginResp(code);
+    }
+}

+ 11 - 0
Assets/BowArrow/Scripts/Manager/LoginMgr/WeChatLoginHelper.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: e6768fcf8ccb6134890e110fac4faac0
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: