2021-08-23 09:28:14 +08:00
|
|
|
|
using Assets.Scripts;
|
2021-08-24 17:50:14 +08:00
|
|
|
|
using DG.Tweening;
|
|
|
|
|
|
using System;
|
2021-08-23 09:28:14 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
2021-08-24 17:50:14 +08:00
|
|
|
|
using UnityEngine.UI;
|
2021-08-23 09:28:14 +08:00
|
|
|
|
|
|
|
|
|
|
public class LoginControllerMobile : MonoBehaviour
|
|
|
|
|
|
{
|
|
|
|
|
|
// Start is called before the first frame update
|
2021-08-24 17:50:14 +08:00
|
|
|
|
ScrollRect loginScrollView;
|
|
|
|
|
|
Transform thirdLoginPage;
|
|
|
|
|
|
void Awake()
|
2021-08-23 09:28:14 +08:00
|
|
|
|
{
|
2021-08-24 17:50:14 +08:00
|
|
|
|
loginScrollView = transform.Find("Panel/LoginContainer/LoginScrollView").GetComponent<ScrollRect>();
|
|
|
|
|
|
thirdLoginPage = loginScrollView.content.Find("FormContainer-Login/Mask/FormContainer-third");
|
|
|
|
|
|
UIManager.AddEvent(loginScrollView.content.Find("FormContainer-Login/Mask/FormContainer/BtnThirdLogin").gameObject,
|
|
|
|
|
|
UnityEngine.EventSystems.EventTriggerType.PointerClick,
|
|
|
|
|
|
(b)=> ShowThirdLoginPage());
|
|
|
|
|
|
UIManager.AddEvent(loginScrollView.content.Find("FormContainer-Login/Mask/FormContainer-third/BtnReturn").gameObject,
|
|
|
|
|
|
UnityEngine.EventSystems.EventTriggerType.PointerClick,
|
|
|
|
|
|
(b) => HideThirdLoginPage());
|
|
|
|
|
|
UIManager.AddEvent(loginScrollView.content.Find("FormContainer-Login/Mask/FormContainer-third/otherContainer/Wechat").gameObject,
|
|
|
|
|
|
UnityEngine.EventSystems.EventTriggerType.PointerClick,
|
|
|
|
|
|
(b) => goWxLogin());
|
2021-08-23 09:28:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-08-24 17:50:14 +08:00
|
|
|
|
|
|
|
|
|
|
|
2021-08-23 09:28:14 +08:00
|
|
|
|
// Update is called once per frame
|
|
|
|
|
|
void Update()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
private void ShowThirdLoginPage()
|
|
|
|
|
|
{
|
2021-08-24 17:50:14 +08:00
|
|
|
|
thirdLoginPage.DOLocalMoveY(0, 0.3f);
|
2021-08-23 09:28:14 +08:00
|
|
|
|
}
|
2021-08-24 17:50:14 +08:00
|
|
|
|
public void HideThirdLoginPage()
|
2021-08-23 09:28:14 +08:00
|
|
|
|
{
|
2021-08-24 17:50:14 +08:00
|
|
|
|
thirdLoginPage.DOLocalMoveY(-301, 0.3f);
|
|
|
|
|
|
}
|
|
|
|
|
|
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", "");
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
2021-08-23 09:28:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 从ios或者安卓接收code,在c#里不建议调用
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="res"></param>
|
|
|
|
|
|
public void OnMobileWxLoginResp(string res)
|
|
|
|
|
|
{
|
|
|
|
|
|
Utils.showToast(gameObject, res, type: 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|