暂存
This commit is contained in:
1 parent
723c881790
commit
f21b83697b
18 files changed
+1912
-1386
No files matched your search
@@ -11,6 +11,9 @@ public class LoginControllerMobile : MonoBehaviour
|
||||
// Start is called before the first frame update
|
||||
ScrollRect loginScrollView;
|
||||
Transform thirdLoginPage;
|
||||
|
||||
public WeChatController weChat { get; private set; }
|
||||
|
||||
void Awake()
|
||||
{
|
||||
loginScrollView = transform.Find("Panel/LoginContainer/LoginScrollView").GetComponent<ScrollRect>();
|
||||
@@ -26,8 +29,19 @@ public class LoginControllerMobile : MonoBehaviour
|
||||
(b) => goWxLogin());
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
transform.Find("MobileInfo/BatteryText").GetComponent<Text>().text =
|
||||
$"{Math.Round(SystemInfo.batteryLevel * 100, 0)}%";
|
||||
transform.Find("MobileInfo/TimeText").GetComponent<Text>().text =
|
||||
DateTime.Now.ToString("HH:mm");
|
||||
weChat = App.weChatController;
|
||||
weChat.Init(App.WxAppId);
|
||||
//App.weChatController.Init(App.WxAppId);
|
||||
//var s = App.weChatController.isApplicationAvilible("com.gugoumainapp","powerfun").ToString();
|
||||
//Utils.showToast(null, SystemInfo.batteryLevel.ToString());
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
@@ -44,8 +58,6 @@ public class LoginControllerMobile : MonoBehaviour
|
||||
private void goWxLogin()
|
||||
{
|
||||
#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
|
||||
var weChat = App.weChatController;
|
||||
weChat.Init(App.WxAppId);
|
||||
if (weChat.IsWeChatAppInstalled())
|
||||
{
|
||||
weChat.WxLogin("snsapi_userinfo", "");
|
||||
|
||||
@@ -22,6 +22,8 @@ public class WeChatController
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void WechatLogin(string scope,string state);
|
||||
[DllImport("__Internal")]
|
||||
private static extern bool checkAPPIsExist(string URLScheme);
|
||||
#endif
|
||||
#endregion
|
||||
/// <summary>
|
||||
@@ -52,13 +54,12 @@ public class WeChatController
|
||||
public void Init(string APPID)
|
||||
{
|
||||
_APP_ID = APPID;
|
||||
#if !UNITY_EDITOR && UNITY_ANDROID
|
||||
#if UNITY_ANDROID
|
||||
mainActivityClass = new AndroidJavaClass(_className);
|
||||
// 第一个参数: MainActivity中的方法名
|
||||
// 第二、三个参数: 分别是SendMessageToUnity需要接收的第一和第二个参数,对比上面Java的代码
|
||||
mainActivityClass.CallStatic("InitWeChat", Application.identifier, _APP_ID);
|
||||
#endif
|
||||
#if !UNITY_EDITOR && UNITY_IOS
|
||||
#elif UNITY_IOS
|
||||
RegisterApp(_APP_ID);
|
||||
#endif
|
||||
}
|
||||
@@ -77,12 +78,25 @@ public class WeChatController
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分享链接至微信,缩略图用的是APP Icon
|
||||
/// </summary>
|
||||
/// <param name="scene">分享至什么场景, 0-对话、1-朋友圈、2-收藏</param>
|
||||
/// <param name="url">网页链接</param>
|
||||
/// <param name="title">标题</param>
|
||||
/// <param name="description">描述</param>
|
||||
/// 判断应用是否存在
|
||||
/// </summary>
|
||||
/// <param name="pkgName"></param>
|
||||
/// <returns></returns>
|
||||
public bool isApplicationAvilible(string pkgName,string URLScheme)
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
return mainActivityClass.CallStatic<bool>("isApplicationAvilible",pkgName);
|
||||
#elif UNITY_IOS
|
||||
return checkAPPIsExist(URLScheme);
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// 分享链接至微信,缩略图用的是APP Icon
|
||||
/// </summary>
|
||||
/// <param name="scene">分享至什么场景, 0-对话、1-朋友圈、2-收藏</param>
|
||||
/// <param name="url">网页链接</param>
|
||||
/// <param name="title">标题</param>
|
||||
/// <param name="description">描述</param>
|
||||
public void ShareWebpageToWX(int scene, string url, string title, string description)
|
||||
{
|
||||
mainActivityClass.CallStatic("ShareWebpageToWX", scene, url, title, description);
|
||||
|
||||
Reference in new issue
Block a user